#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*/ gpio_pulse(char *);
int /*<<< orphan*/ gpio_value(char *, char *);
int send_bits(char data) {
  int bits = 8;
  while (bits) {
    if (data & 1) {
      gpio_value("9", "1");
    } else
      gpio_value("9", "0");
    gpio_pulse("11");
    data = data >> 1;
    bits--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<send_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x8,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     119e <send_bits+0x7e>
movsbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1167 <send_bits+0x47>
lea    0xeaa(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1040 <gpio_value@plt>
jmp    117a <send_bits+0x5a>
lea    0xe92(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <gpio_value@plt>
lea    0xe83(%rip),%rdi
call   1030 <gpio_pulse@plt>
movsbl -0x1(%rbp),%eax
sar    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <send_bits+0x15>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_bits>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebp
test   $0x1,%bpl
lea    0xecd(%rip),%r12
lea    0xec9(%rip),%rbx
mov    %rbx,%rsi
cmove  %r12,%rsi
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
call   1040 <gpio_value@plt>
lea    0xeab(%rip),%r15
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x2,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x4,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x8,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x10,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x20,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   $0x40,%bpl
mov    %rbx,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
test   %bpl,%bpl
cmovns %r12,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <gpio_value@plt>
mov    %r15,%rdi
call   1030 <gpio_pulse@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"9\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [3 x i8] c"11\00"
define i32 @send_bits(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 8, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = and i32 %9, 1
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %7
%15 = call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
%20 = ashr i32 %19, 1
%21 = trunc i32 %20 to i8
store i8 %21, i8* %2
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"9\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [3 x i8] c"11\00"
define i32 @send_bits(i8 signext %0) {
%2 = and i8 %0, 1
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%7 = and i8 %0, 2
%8 = icmp eq i8 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = and i8 %0, 4
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = and i8 %0, 8
%18 = icmp eq i8 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%20 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = and i8 %0, 16
%23 = icmp eq i8 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%25 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%27 = and i8 %0, 32
%28 = icmp eq i8 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%30 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %29)
%31 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = and i8 %0, 64
%33 = icmp eq i8 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%35 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp sgt i8 %0, -1
%38 = select i1 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%39 = tail call i32 @gpio_value(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %38)
%40 = tail call i32 @gpio_pulse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}