#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*/ AdjustOscillator(int);
int BUS;
int /*<<< orphan*/ DisplayVersion(int);
int I2CWrapperOpen(int, int);
int /*<<< orphan*/ TestSingleShot(int);
int /*<<< orphan*/ TestSingleShotPack(int);
int /*<<< orphan*/ TestTimerMode(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned char);
int /*<<< orphan*/ stdout;
int main(void) {
  int i2c_handle;
  unsigned char AD_address = 0x20;
  const BUS = 1;
  int I2C_Current_Slave_Adress = 0x20;
  i2c_handle = I2CWrapperOpen(BUS, I2C_Current_Slave_Adress);
  if (i2c_handle < 0)
    return -1;
  printf("I2C Address= 0x%02X\n", AD_address);
  fflush(stdout);
  DisplayVersion(i2c_handle);
  TestSingleShot(i2c_handle);
  TestSingleShotPack(i2c_handle);
  AdjustOscillator(i2c_handle);
  TestTimerMode(i2c_handle);
  close(i2c_handle);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x9(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x20,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1080 <I2CWrapperOpen@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11d7 <main+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    122c <main+0x9c>
lea    0xe22(%rip),%rdi
movzbl -0x9(%rbp),%esi
call   1050 <printf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    -0x8(%rbp),%edi
call   10a0 <DisplayVersion@plt>
mov    -0x8(%rbp),%edi
call   10b0 <TestSingleShot@plt>
mov    -0x8(%rbp),%edi
call   1030 <TestSingleShotPack@plt>
mov    -0x8(%rbp),%edi
call   1040 <AdjustOscillator@plt>
mov    -0x8(%rbp),%edi
call   1070 <TestTimerMode@plt>
mov    -0x8(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x20,%esi
call   1080 <I2CWrapperOpen@plt>
test   %eax,%eax
js     11f3 <main+0x63>
mov    %eax,%ebx
lea    0xe53(%rip),%rdi
mov    $0x20,%esi
call   1050 <printf@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    %ebx,%edi
call   10a0 <DisplayVersion@plt>
mov    %ebx,%edi
call   10b0 <TestSingleShot@plt>
mov    %ebx,%edi
call   1030 <TestSingleShotPack@plt>
mov    %ebx,%edi
call   1040 <AdjustOscillator@plt>
mov    %ebx,%edi
call   1070 <TestTimerMode@plt>
mov    %ebx,%edi
call   1060 <close@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"I2C Address= 0x%02X\0A\00"
@stdout = global i32 0
@BUS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i8 32, i8* %3
store i32 1, i32* %4
store i32 32, i32* %5
%6 = load i32, i32* %5
%7 = call i32 @I2CWrapperOpen(i32 1, i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
store i32 -1, i32* %1
br label %28
11: ; preds = %0
%12 = load i8, i8* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
%14 = load i32, i32* @stdout
%15 = call i32 @fflush(i32 %14)
%16 = load i32, i32* %2
%17 = call i32 @DisplayVersion(i32 %16)
%18 = load i32, i32* %2
%19 = call i32 @TestSingleShot(i32 %18)
%20 = load i32, i32* %2
%21 = call i32 @TestSingleShotPack(i32 %20)
%22 = load i32, i32* %2
%23 = call i32 @AdjustOscillator(i32 %22)
%24 = load i32, i32* %2
%25 = call i32 @TestTimerMode(i32 %24)
%26 = load i32, i32* %2
%27 = call i32 @close(i32 %26)
store i32 0, i32* %1
br label %28
28: ; preds = %11, %10
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [21 x i8] c"I2C Address= 0x%02X\0A\00"
@stdout = global i32 0
@BUS = global i32 0
define i32 @main() {
%1 = tail call i32 @I2CWrapperOpen(i32 1, i32 32)
%2 = icmp slt i32 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 zeroext 32)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
%7 = tail call i32 @DisplayVersion(i32 %1)
%8 = tail call i32 @TestSingleShot(i32 %1)
%9 = tail call i32 @TestSingleShotPack(i32 %1)
%10 = tail call i32 @AdjustOscillator(i32 %1)
%11 = tail call i32 @TestTimerMode(i32 %1)
%12 = tail call i32 @close(i32 %1)
br label %13
13: ; preds = %0, %3
%14 = phi i32 [ 0, %3 ], [ -1, %0 ]
ret i32 %14
}