#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*/ i2c_set_slave(int);
scalar_t__ i2c_setup(int);
int /*<<< orphan*/ i2c_write8(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  if (i2c_setup(0x23) < 0) {
    printf("err");
  }
  i2c_set_slave(0x27);
  i2c_write8(0x27, 0x00, 0x00);
  sleep(1);
  i2c_write8(0x27, 0x06, 0x00);
  sleep(1);
  i2c_write8(0x27, 0x0A, 0xff);
  sleep(1);
  i2c_write8(0x27, 0x09, 0xf0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x23,%edi
call   1050 <i2c_setup@plt>
cmp    $0x0,%rax
jge    117f <main+0x2f>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    $0x27,%edi
call   1060 <i2c_set_slave@plt>
mov    $0x27,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0x6,%esi
xor    %edx,%edx
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0xa,%esi
mov    $0xff,%edx
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0x9,%esi
mov    $0xf0,%edx
call   1040 <i2c_write8@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x23,%edi
call   1050 <i2c_setup@plt>
test   %rax,%rax
jns    116c <main+0x1c>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0x27,%edi
call   1060 <i2c_set_slave@plt>
mov    $0x27,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0x6,%esi
xor    %edx,%edx
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0xa,%esi
mov    $0xff,%edx
call   1040 <i2c_write8@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    $0x27,%edi
mov    $0x9,%esi
mov    $0xf0,%edx
call   1040 <i2c_write8@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"err\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @i2c_setup(i32 35)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = call i32 @i2c_set_slave(i32 39)
%8 = call i32 @i2c_write8(i32 39, i32 0, i32 0)
%9 = call i32 @sleep(i32 1)
%10 = call i32 @i2c_write8(i32 39, i32 6, i32 0)
%11 = call i32 @sleep(i32 1)
%12 = call i32 @i2c_write8(i32 39, i32 10, i32 255)
%13 = call i32 @sleep(i32 1)
%14 = call i32 @i2c_write8(i32 39, i32 9, i32 240)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"err\00"
define i32 @main() {
%1 = tail call i64 @i2c_setup(i32 35)
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @i2c_set_slave(i32 39)
%7 = tail call i32 @i2c_write8(i32 39, i32 0, i32 0)
%8 = tail call i32 @sleep(i32 1)
%9 = tail call i32 @i2c_write8(i32 39, i32 6, i32 0)
%10 = tail call i32 @sleep(i32 1)
%11 = tail call i32 @i2c_write8(i32 39, i32 10, i32 255)
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @i2c_write8(i32 39, i32 9, i32 240)
ret i32 0
}