Working code:
3e70: 98 81 ld r25, Y
3e72: 98 23 and r25, r24
3e74: e9 f3 breq .-6 ; 0x3e70 <com_channel_buffer_forward_one+0x58>
"Optimised" code from the standard library, not working:
3e72: 21 e0 ldi r18, 0x01 ; 1
3e74: 30 e0 ldi r19, 0x00 ; 0
3e76: 02 c0 rjmp .+4 ; 0x3e7c <com_channel_buffer_forward_one+0x64>
3e78: 22 0f add r18, r18
3e7a: 33 1f adc r19, r19
3e7c: 8a 95 dec r24
3e7e: e2 f7 brpl .-8 ; 0x3e78 <com_channel_buffer_forward_one+0x60>
3e80: 88 81 ld r24, Y
3e82: 90 e0 ldi r25, 0x00 ; 0
3e84: 82 23 and r24, r18
3e86: 93 23 and r25, r19
3e88: 89 2b or r24, r25
3e8a: d1 f3 breq .-12 ; 0x3e80 <com_channel_buffer_forward_one+0x68>