#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*/ GPIOWrite(int, int);
int /*<<< orphan*/ usleep(int);
void lcd_byte(int bits, int mode) {
  GPIOWrite(7, mode);
  if (mode == 0)
    usleep(2000);
  if ((bits & 0x10) == 0x10)
    GPIOWrite(25, 1);
  else
    GPIOWrite(25, 0);
  if ((bits & 0x20) == 0x20)
    GPIOWrite(24, 1);
  else
    GPIOWrite(24, 0);
  if ((bits & 0x40) == 0x40)
    GPIOWrite(23, 1);
  else
    GPIOWrite(23, 0);
  if ((bits & 0x80) == 0x80)
    GPIOWrite(18, 1);
  else
    GPIOWrite(18, 0);
  usleep(50);
  GPIOWrite(8, 1);
  usleep(50);
  GPIOWrite(8, 0);
  usleep(50);
  if ((bits & 0x01) == 0x01)
    GPIOWrite(25, 1);
  else
    GPIOWrite(25, 0);
  if ((bits & 0x02) == 0x02)
    GPIOWrite(24, 1);
  else
    GPIOWrite(24, 0);
  if ((bits & 0x04) == 0x04)
    GPIOWrite(23, 1);
  else
    GPIOWrite(23, 0);
  if ((bits & 0x08) == 0x08)
    GPIOWrite(18, 1);
  else
    GPIOWrite(18, 0);
  usleep(50);
  GPIOWrite(8, 1);
  usleep(50);
  GPIOWrite(8, 0);
  usleep(50);
}


x86 assembly (clang, -O0):
<lcd_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x7,%edi
call   1030 <GPIOWrite@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114f <lcd_byte+0x2f>
mov    $0x7d0,%edi
call   1040 <usleep@plt>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x10,%eax
jne    1172 <lcd_byte+0x52>
mov    $0x19,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    117e <lcd_byte+0x5e>
mov    $0x19,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x20,%eax
jne    11a1 <lcd_byte+0x81>
mov    $0x18,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    11ad <lcd_byte+0x8d>
mov    $0x18,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x40,%eax
jne    11d0 <lcd_byte+0xb0>
mov    $0x17,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    11dc <lcd_byte+0xbc>
mov    $0x17,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x80,%eax
jne    1203 <lcd_byte+0xe3>
mov    $0x12,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    120f <lcd_byte+0xef>
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    126b <lcd_byte+0x14b>
mov    $0x19,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    1277 <lcd_byte+0x157>
mov    $0x19,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x2,%eax
jne    129a <lcd_byte+0x17a>
mov    $0x18,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    12a6 <lcd_byte+0x186>
mov    $0x18,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x4,%eax
cmp    $0x4,%eax
jne    12c9 <lcd_byte+0x1a9>
mov    $0x17,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    12d5 <lcd_byte+0x1b5>
mov    $0x17,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x8,%eax
jne    12f8 <lcd_byte+0x1d8>
mov    $0x12,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
jmp    1304 <lcd_byte+0x1e4>
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x7,%edi
call   1030 <GPIOWrite@plt>
test   %ebp,%ebp
jne    113f <lcd_byte+0x1f>
mov    $0x7d0,%edi
call   1040 <usleep@plt>
mov    %ebx,%esi
shr    $0x4,%esi
and    $0x1,%esi
mov    $0x19,%edi
call   1030 <GPIOWrite@plt>
mov    %ebx,%esi
shr    $0x5,%esi
and    $0x1,%esi
mov    $0x18,%edi
call   1030 <GPIOWrite@plt>
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x1,%esi
mov    $0x17,%edi
call   1030 <GPIOWrite@plt>
mov    %ebx,%esi
shr    $0x7,%esi
and    $0x1,%esi
mov    $0x12,%edi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    %ebx,%esi
and    $0x1,%esi
mov    $0x19,%edi
call   1030 <GPIOWrite@plt>
mov    %ebx,%esi
shr    %esi
and    $0x1,%esi
mov    $0x18,%edi
call   1030 <GPIOWrite@plt>
mov    %ebx,%esi
shr    $0x2,%esi
and    $0x1,%esi
mov    $0x17,%edi
call   1030 <GPIOWrite@plt>
shr    $0x3,%ebx
and    $0x1,%ebx
mov    $0x12,%edi
mov    %ebx,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
mov    $0x1,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
call   1040 <usleep@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1030 <GPIOWrite@plt>
mov    $0x32,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <usleep@plt>

LLVM IR (-O0):
define void @lcd_byte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @GPIOWrite(i32 7, i32 %5)
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @usleep(i32 2000)
br label %11
11: ; preds = %9, %2
%12 = load i32, i32* %3
%13 = and i32 %12, 16
%14 = icmp eq i32 %13, 16
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @GPIOWrite(i32 25, i32 1)
br label %19
17: ; preds = %11
%18 = call i32 @GPIOWrite(i32 25, i32 0)
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* %3
%21 = and i32 %20, 32
%22 = icmp eq i32 %21, 32
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @GPIOWrite(i32 24, i32 1)
br label %27
25: ; preds = %19
%26 = call i32 @GPIOWrite(i32 24, i32 0)
br label %27
27: ; preds = %25, %23
%28 = load i32, i32* %3
%29 = and i32 %28, 64
%30 = icmp eq i32 %29, 64
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @GPIOWrite(i32 23, i32 1)
br label %35
33: ; preds = %27
%34 = call i32 @GPIOWrite(i32 23, i32 0)
br label %35
35: ; preds = %33, %31
%36 = load i32, i32* %3
%37 = and i32 %36, 128
%38 = icmp eq i32 %37, 128
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 @GPIOWrite(i32 18, i32 1)
br label %43
41: ; preds = %35
%42 = call i32 @GPIOWrite(i32 18, i32 0)
br label %43
43: ; preds = %41, %39
%44 = call i32 @usleep(i32 50)
%45 = call i32 @GPIOWrite(i32 8, i32 1)
%46 = call i32 @usleep(i32 50)
%47 = call i32 @GPIOWrite(i32 8, i32 0)
%48 = call i32 @usleep(i32 50)
%49 = load i32, i32* %3
%50 = and i32 %49, 1
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %43
%53 = call i32 @GPIOWrite(i32 25, i32 1)
br label %56
54: ; preds = %43
%55 = call i32 @GPIOWrite(i32 25, i32 0)
br label %56
56: ; preds = %54, %52
%57 = load i32, i32* %3
%58 = and i32 %57, 2
%59 = icmp eq i32 %58, 2
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @GPIOWrite(i32 24, i32 1)
br label %64
62: ; preds = %56
%63 = call i32 @GPIOWrite(i32 24, i32 0)
br label %64
64: ; preds = %62, %60
%65 = load i32, i32* %3
%66 = and i32 %65, 4
%67 = icmp eq i32 %66, 4
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 @GPIOWrite(i32 23, i32 1)
br label %72
70: ; preds = %64
%71 = call i32 @GPIOWrite(i32 23, i32 0)
br label %72
72: ; preds = %70, %68
%73 = load i32, i32* %3
%74 = and i32 %73, 8
%75 = icmp eq i32 %74, 8
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @GPIOWrite(i32 18, i32 1)
br label %80
78: ; preds = %72
%79 = call i32 @GPIOWrite(i32 18, i32 0)
br label %80
80: ; preds = %78, %76
%81 = call i32 @usleep(i32 50)
%82 = call i32 @GPIOWrite(i32 8, i32 1)
%83 = call i32 @usleep(i32 50)
%84 = call i32 @GPIOWrite(i32 8, i32 0)
%85 = call i32 @usleep(i32 50)
ret void
}

LLVM IR (-O2):
define void @lcd_byte(i32 %0, i32 %1) {
%3 = tail call i32 @GPIOWrite(i32 7, i32 %1)
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @usleep(i32 2000)
br label %7
7: ; preds = %5, %2
%8 = lshr i32 %0, 4
%9 = and i32 %8, 1
%10 = tail call i32 @GPIOWrite(i32 25, i32 %9)
%11 = lshr i32 %0, 5
%12 = and i32 %11, 1
%13 = tail call i32 @GPIOWrite(i32 24, i32 %12)
%14 = lshr i32 %0, 6
%15 = and i32 %14, 1
%16 = tail call i32 @GPIOWrite(i32 23, i32 %15)
%17 = lshr i32 %0, 7
%18 = and i32 %17, 1
%19 = tail call i32 @GPIOWrite(i32 18, i32 %18)
%20 = tail call i32 @usleep(i32 50)
%21 = tail call i32 @GPIOWrite(i32 8, i32 1)
%22 = tail call i32 @usleep(i32 50)
%23 = tail call i32 @GPIOWrite(i32 8, i32 0)
%24 = tail call i32 @usleep(i32 50)
%25 = and i32 %0, 1
%26 = tail call i32 @GPIOWrite(i32 25, i32 %25)
%27 = lshr i32 %0, 1
%28 = and i32 %27, 1
%29 = tail call i32 @GPIOWrite(i32 24, i32 %28)
%30 = lshr i32 %0, 2
%31 = and i32 %30, 1
%32 = tail call i32 @GPIOWrite(i32 23, i32 %31)
%33 = lshr i32 %0, 3
%34 = and i32 %33, 1
%35 = tail call i32 @GPIOWrite(i32 18, i32 %34)
%36 = tail call i32 @usleep(i32 50)
%37 = tail call i32 @GPIOWrite(i32 8, i32 1)
%38 = tail call i32 @usleep(i32 50)
%39 = tail call i32 @GPIOWrite(i32 8, i32 0)
%40 = tail call i32 @usleep(i32 50)
ret void
}