#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*/ I2Cstart();
int /*<<< orphan*/ I2Cstop();
scalar_t__ I2Cwrite(unsigned char);
int /*<<< orphan*/ delay(int);
unsigned char LCDcmd(unsigned char cmd) {
  I2Cstart();
  if (I2Cwrite(0x7c))
    goto err;
  if (I2Cwrite(0b10000000))
    goto err;
  if (I2Cwrite(cmd))
    goto err;
  I2Cstop();
  delay(30);
  return 0;
err:
  I2Cstop();
  return 1;
}


x86 assembly (clang, -O0):
<LCDcmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    $0x0,%al
call   1030 <I2Cstart@plt>
mov    $0x7c,%edi
call   1050 <I2Cwrite@plt>
cmp    $0x0,%rax
je     116e <LCDcmd+0x2e>
jmp    11b9 <LCDcmd+0x79>
mov    $0x80,%edi
call   1050 <I2Cwrite@plt>
cmp    $0x0,%rax
je     1187 <LCDcmd+0x47>
jmp    11b9 <LCDcmd+0x79>
movzbl -0x2(%rbp),%edi
call   1050 <I2Cwrite@plt>
cmp    $0x0,%rax
je     119f <LCDcmd+0x5f>
jmp    11b9 <LCDcmd+0x79>
mov    $0x0,%al
call   1060 <I2Cstop@plt>
mov    $0x1e,%edi
call   1040 <delay@plt>
movb   $0x0,-0x1(%rbp)
jmp    11c4 <LCDcmd+0x84>
mov    $0x0,%al
call   1060 <I2Cstop@plt>
movb   $0x1,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDcmd>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <I2Cstart@plt>
mov    $0x7c,%edi
call   1050 <I2Cwrite@plt>
test   %rax,%rax
jne    1175 <LCDcmd+0x35>
mov    $0x80,%edi
call   1050 <I2Cwrite@plt>
test   %rax,%rax
jne    1175 <LCDcmd+0x35>
movzbl %bl,%edi
call   1050 <I2Cwrite@plt>
test   %rax,%rax
je     1182 <LCDcmd+0x42>
xor    %eax,%eax
call   1060 <I2Cstop@plt>
mov    $0x1,%bl
mov    %ebx,%eax
pop    %rbx
ret
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <I2Cstop@plt>
mov    $0x1e,%edi
call   1040 <delay@plt>
jmp    117e <LCDcmd+0x3e>

LLVM IR (-O0):
define zeroext i8 @LCDcmd(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i32 (...) @I2Cstart()
%5 = call i64 @I2Cwrite(i8 zeroext 124)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
br label %20
8: ; preds = %1
%9 = call i64 @I2Cwrite(i8 zeroext -128)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
br label %20
12: ; preds = %8
%13 = load i8, i8* %3
%14 = call i64 @I2Cwrite(i8 zeroext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
br label %20
17: ; preds = %12
%18 = call i32 (...) @I2Cstop()
%19 = call i32 @delay(i32 30)
store i8 0, i8* %2
br label %22
20: ; preds = %16, %11, %7
%21 = call i32 (...) @I2Cstop()
store i8 1, i8* %2
br label %22
22: ; preds = %20, %17
%23 = load i8, i8* %2
ret i8 %23
}

LLVM IR (-O2):
define zeroext i8 @LCDcmd(i8 zeroext %0) {
%2 = tail call i32 (...) @I2Cstart()
%3 = tail call i64 @I2Cwrite(i8 zeroext 124)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = tail call i64 @I2Cwrite(i8 zeroext -128)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = tail call i64 @I2Cwrite(i8 zeroext %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = tail call i32 (...) @I2Cstop()
%13 = tail call i32 @delay(i32 30)
br label %16
14: ; preds = %8, %5, %1
%15 = tail call i32 (...) @I2Cstop()
br label %16
16: ; preds = %14, %11
%17 = phi i8 [ 1, %14 ], [ 0, %11 ]
ret i8 %17
}