#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*/ atoi(char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ i2c_deinit();
int /*<<< orphan*/ i2c_init();
int /*<<< orphan*/ i2c_start();
int /*<<< orphan*/ i2c_stop();
int /*<<< orphan*/ i2c_tx_byte(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i;
  i2c_init();
  i2c_start();
  if (argc < 3) {
    fputs("Usage: si2cset <address> <data ...>", stderr);
    return 1;
  }
  for (i = 1; i < argc; i++) {
    i2c_tx_byte(atoi(argv[i]));
  }
  i2c_stop();
  i2c_deinit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <i2c_init@plt>
mov    $0x0,%al
call   1070 <i2c_start@plt>
cmpl   $0x3,-0x8(%rbp)
jge    11bf <main+0x4f>
mov    0x2e3b(%rip),%rax
mov    (%rax),%esi
lea    0xe52(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    120d <main+0x9d>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f8 <main+0x88>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1040 <i2c_tx_byte@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0x56>
mov    $0x0,%al
call   1060 <i2c_stop@plt>
mov    $0x0,%al
call   1090 <i2c_deinit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <i2c_init@plt>
xor    %eax,%eax
call   1070 <i2c_start@plt>
cmp    $0x3,%ebp
jge    11a8 <main+0x38>
mov    0x2e4d(%rip),%rax
mov    (%rax),%esi
lea    0xe64(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x1,%ebx
jmp    11d9 <main+0x69>
mov    %ebp,%ebp
mov    $0x1,%ebx
nop
mov    (%r14,%rbx,8),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   1040 <i2c_tx_byte@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <main+0x40>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <i2c_stop@plt>
xor    %eax,%eax
call   1090 <i2c_deinit@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Usage: si2cset <address> <data ...>\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @i2c_init()
%8 = call i32 (...) @i2c_start()
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 1, i32* %3
br label %33
14: ; preds = %2
store i32 1, i32* %6
br label %15
15: ; preds = %27, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = call i32 @i2c_tx_byte(i32 %25)
br label %27
27: ; preds = %19
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %15
30: ; preds = %15
%31 = call i32 (...) @i2c_stop()
%32 = call i32 (...) @i2c_deinit()
store i32 0, i32* %3
br label %33
33: ; preds = %30, %11
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [36 x i8] c"Usage: si2cset <address> <data ...>\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @i2c_init()
%4 = tail call i32 (...) @i2c_start()
%5 = icmp slt i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputs(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %22
11: ; preds = %6, %11
%12 = phi i64 [ 1, %6 ], [ %17, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i32 @i2c_tx_byte(i32 %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %7
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = tail call i32 (...) @i2c_stop()
%21 = tail call i32 (...) @i2c_deinit()
br label %22
22: ; preds = %19, %8
%23 = phi i32 [ 1, %8 ], [ 0, %19 ]
ret i32 %23
}