#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ onewire_send_bit(int, int);
void onewire_send_byte(int pin, int b) {
  for (int p = 8; p; p--) {
    onewire_send_bit(pin, b & 1);
    b >>= 1;
  }
}


x86 assembly (clang, -O0):
<onewire_send_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1154 <onewire_send_byte+0x44>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
and    $0x1,%esi
call   1030 <onewire_send_bit@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <onewire_send_byte+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onewire_send_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
and    $0x1,%esi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    %esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    $0x2,%esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    $0x3,%esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    $0x4,%esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    $0x5,%esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x1,%esi
mov    %ebp,%edi
call   1030 <onewire_send_bit@plt>
shr    $0x7,%ebx
and    $0x1,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <onewire_send_bit@plt>

LLVM IR (-O0):
define void @onewire_send_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 8, i32* %5
br label %6
6: ; preds = %16, %2
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = and i32 %11, 1
%13 = call i32 @onewire_send_bit(i32 %10, i32 %12)
%14 = load i32, i32* %4
%15 = ashr i32 %14, 1
store i32 %15, i32* %4
br label %16
16: ; preds = %9
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @onewire_send_byte(i32 %0, i32 %1) {
%3 = and i32 %1, 1
%4 = tail call i32 @onewire_send_bit(i32 %0, i32 %3)
%5 = lshr i32 %1, 1
%6 = and i32 %5, 1
%7 = tail call i32 @onewire_send_bit(i32 %0, i32 %6)
%8 = lshr i32 %1, 2
%9 = and i32 %8, 1
%10 = tail call i32 @onewire_send_bit(i32 %0, i32 %9)
%11 = lshr i32 %1, 3
%12 = and i32 %11, 1
%13 = tail call i32 @onewire_send_bit(i32 %0, i32 %12)
%14 = lshr i32 %1, 4
%15 = and i32 %14, 1
%16 = tail call i32 @onewire_send_bit(i32 %0, i32 %15)
%17 = lshr i32 %1, 5
%18 = and i32 %17, 1
%19 = tail call i32 @onewire_send_bit(i32 %0, i32 %18)
%20 = lshr i32 %1, 6
%21 = and i32 %20, 1
%22 = tail call i32 @onewire_send_bit(i32 %0, i32 %21)
%23 = lshr i32 %1, 7
%24 = and i32 %23, 1
%25 = tail call i32 @onewire_send_bit(i32 %0, i32 %24)
ret void
}