#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ i2c_deinit();
int /*<<< orphan*/ i2c_getopt(int, char **);
int i2c_hw_rx_byte(int);
int /*<<< orphan*/ i2c_hw_start();
int /*<<< orphan*/ i2c_hw_stop();
int /*<<< orphan*/ i2c_hw_tx_byte(int);
int /*<<< orphan*/ i2c_init();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int strtol(char *, char **, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i, address, cmdbuf;
  int num_bytes = 1;
  unsigned int ret;
  char *conv_err;
  i2c_getopt(argc, argv);
  if (argc < 3) {
    fputs("Usage: vusb-i2cget <address> <num_bytes> [register ...] ", stderr);
    return 1;
  }
  address = strtol(argv[1], &conv_err, 0);
  if (conv_err && *conv_err) {
    fprintf(stderr, "address: Conversion error at '%s'\n", conv_err);
    return 2;
  }
  num_bytes = strtol(argv[2], &conv_err, 0);
  if (conv_err && *conv_err) {
    fprintf(stderr, "num_bytes: Conversion error at '%s'\n", conv_err);
    return 2;
  }
  i2c_init();
  if (argc >= 3) {
    i2c_hw_start();
    if (!i2c_hw_tx_byte((address << 1) | 0)) {
      fprintf(stderr, "Received NAK from slave 0x%02x, aborting\n", address);
      i2c_hw_stop();
      i2c_deinit();
      return 3;
    }
  }
  for (i = 3; i < argc; i++) {
    cmdbuf = strtol(argv[i], &conv_err, 0);
    if (conv_err && *conv_err) {
      fprintf(stderr, "read command: Conversion error at '%s'\n", conv_err);
      i2c_hw_stop();
      i2c_deinit();
      return 2;
    }
    if (!i2c_hw_tx_byte(cmdbuf)) {
      fprintf(stderr, "Received NAK after byte %d (0x%02x)\n", i - 1, cmdbuf);
      i2c_hw_stop();
      i2c_deinit();
      return 4;
    }
  }
  i2c_hw_start();
  if (!i2c_hw_tx_byte((address << 1) | 1)) {
    fprintf(stderr, "Received NAK after reSTART from slave 0x%02x, aborting\n",
            address);
    i2c_hw_stop();
    i2c_deinit();
    return 3;
  }
  for (i = 1; i <= num_bytes; i++) {
    printf("%i ", i2c_hw_rx_byte((i < num_bytes) * 1));
  }
  putc('\n', stdout);
  i2c_hw_stop();
  i2c_deinit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <i2c_getopt@plt>
cmpl   $0x3,-0x8(%rbp)
jge    1214 <main+0x54>
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
lea    0xdfd(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,-0x18(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     126c <main+0xac>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     126c <main+0xac>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,-0x20(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     12c4 <main+0x104>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12c4 <main+0x104>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    $0x0,%al
call   1030 <i2c_init@plt>
cmpl   $0x3,-0x8(%rbp)
jl     132c <main+0x16c>
mov    $0x0,%al
call   10c0 <i2c_hw_start@plt>
mov    -0x18(%rbp),%edi
shl    $0x1,%edi
or     $0x0,%edi
call   10b0 <i2c_hw_tx_byte@plt>
cmp    $0x0,%eax
jne    1327 <main+0x167>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1060 <i2c_hw_stop@plt>
mov    $0x0,%al
call   10e0 <i2c_deinit@plt>
movl   $0x3,-0x4(%rbp)
jmp    14c6 <main+0x306>
jmp    132c <main+0x16c>
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1407 <main+0x247>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,-0x1c(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     13a9 <main+0x1e9>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13a9 <main+0x1e9>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1060 <i2c_hw_stop@plt>
mov    $0x0,%al
call   10e0 <i2c_deinit@plt>
movl   $0x2,-0x4(%rbp)
jmp    14c6 <main+0x306>
mov    -0x1c(%rbp),%edi
call   10b0 <i2c_hw_tx_byte@plt>
cmp    $0x0,%eax
jne    13f4 <main+0x234>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x1c(%rbp),%ecx
lea    0xd00(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1060 <i2c_hw_stop@plt>
mov    $0x0,%al
call   10e0 <i2c_deinit@plt>
movl   $0x4,-0x4(%rbp)
jmp    14c6 <main+0x306>
jmp    13f9 <main+0x239>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1333 <main+0x173>
mov    $0x0,%al
call   10c0 <i2c_hw_start@plt>
mov    -0x18(%rbp),%edi
shl    $0x1,%edi
or     $0x1,%edi
call   10b0 <i2c_hw_tx_byte@plt>
cmp    $0x0,%eax
jne    1459 <main+0x299>
mov    0x2bb4(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
lea    0xcc0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   1060 <i2c_hw_stop@plt>
mov    $0x0,%al
call   10e0 <i2c_deinit@plt>
movl   $0x3,-0x4(%rbp)
jmp    14c6 <main+0x306>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     149e <main+0x2de>
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
shl    $0x0,%edi
call   10d0 <i2c_hw_rx_byte@plt>
mov    %eax,%esi
lea    0xca5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1460 <main+0x2a0>
mov    0x2b33(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1070 <putc@plt>
mov    $0x0,%al
call   1060 <i2c_hw_stop@plt>
mov    $0x0,%al
call   10e0 <i2c_deinit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
call   10a0 <i2c_getopt@plt>
cmp    $0x2,%ebp
jg     11fc <main+0x3c>
mov    0x2dfc(%rip),%rax
mov    (%rax),%esi
lea    0xe13(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x1,%ebx
jmp    13b2 <main+0x1f2>
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     1230 <main+0x70>
cmpb   $0x0,(%rdx)
je     1230 <main+0x70>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
lea    0xe0b(%rip),%rsi
jmp    1262 <main+0xa2>
mov    0x10(%rbx),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     1273 <main+0xb3>
cmpb   $0x0,(%rdx)
je     1273 <main+0xb3>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%ebx
jmp    13b2 <main+0x1f2>
xor    %eax,%eax
call   1030 <i2c_init@plt>
xor    %eax,%eax
call   10c0 <i2c_hw_start@plt>
mov    %r14d,%r12d
add    %r14d,%r12d
mov    %r12d,%edi
call   10b0 <i2c_hw_tx_byte@plt>
test   %eax,%eax
je     136f <main+0x1af>
mov    %r14d,0x14(%rsp)
cmp    $0x4,%ebp
jb     12ef <main+0x12f>
mov    %ebp,%r13d
mov    $0x3,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%rdx
test   %rdx,%rdx
je     12d6 <main+0x116>
cmpb   $0x0,(%rdx)
jne    13f7 <main+0x237>
mov    %r14d,%edi
call   10b0 <i2c_hw_tx_byte@plt>
test   %eax,%eax
je     13c3 <main+0x203>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    12b0 <main+0xf0>
xor    %eax,%eax
call   10c0 <i2c_hw_start@plt>
or     $0x1,%r12d
mov    %r12d,%edi
call   10b0 <i2c_hw_tx_byte@plt>
test   %eax,%eax
je     1384 <main+0x1c4>
test   %r15d,%r15d
jle    134a <main+0x18a>
mov    %r15d,%ebp
neg    %ebp
mov    $0x1,%ebx
lea    0xe10(%rip),%r14
xor    %edi,%edi
cmp    %r15d,%ebx
setl   %dil
call   10d0 <i2c_hw_rx_byte@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1320 <main+0x160>
mov    0x2c87(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1070 <putc@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <i2c_hw_stop@plt>
xor    %eax,%eax
call   10e0 <i2c_deinit@plt>
jmp    13b2 <main+0x1f2>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
mov    %r14d,%edx
jmp    1398 <main+0x1d8>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xd64(%rip),%rsi
mov    0x14(%rsp),%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1060 <i2c_hw_stop@plt>
xor    %eax,%eax
call   10e0 <i2c_deinit@plt>
mov    $0x3,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c16(%rip),%rax
mov    (%rax),%edi
add    $0xffffffff,%ebp
lea    0xcfd(%rip),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1060 <i2c_hw_stop@plt>
xor    %eax,%eax
call   10e0 <i2c_deinit@plt>
mov    $0x4,%ebx
jmp    13b2 <main+0x1f2>
mov    0x2be2(%rip),%rax
mov    (%rax),%edi
lea    0xca4(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   1060 <i2c_hw_stop@plt>
xor    %eax,%eax
call   10e0 <i2c_deinit@plt>
mov    $0x2,%ebx
jmp    13b2 <main+0x1f2>

LLVM IR (-O0):
@.str = [57 x i8] c"Usage: vusb-i2cget <address> <num_bytes> [register ...] \00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"address: Conversion error at '%s'\0A\00"
@.str.2 = [37 x i8] c"num_bytes: Conversion error at '%s'\0A\00"
@.str.3 = [42 x i8] c"Received NAK from slave 0x%02x, aborting\0A\00"
@.str.4 = [40 x i8] c"read command: Conversion error at '%s'\0A\00"
@.str.5 = [37 x i8] c"Received NAK after byte %d (0x%02x)\0A\00"
@.str.6 = [56 x i8] c"Received NAK after reSTART from slave 0x%02x, aborting\0A\00"
@.str.7 = [4 x i8] c"%i \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %9
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @i2c_getopt(i32 %12, i8** %13)
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 @fputs(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 1, i32* %3
br label %145
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strtol(i8* %23, i8** %11, i32 0)
store i32 %24, i32* %7
%25 = load i8*, i8** %11
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i8*, i8** %11
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %11
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %34)
store i32 2, i32* %3
br label %145
36: ; preds = %27, %20
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @strtol(i8* %39, i8** %11, i32 0)
store i32 %40, i32* %9
%41 = load i8*, i8** %11
%42 = icmp ne i8* %41, null
br i1 %42, label %43, label %52
43: ; preds = %36
%44 = load i8*, i8** %11
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = load i8*, i8** %11
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %50)
store i32 2, i32* %3
br label %145
52: ; preds = %43, %36
%53 = call i32 (...) @i2c_init()
%54 = load i32, i32* %4
%55 = icmp sge i32 %54, 3
br i1 %55, label %56, label %70
56: ; preds = %52
%57 = call i32 (...) @i2c_hw_start()
%58 = load i32, i32* %7
%59 = shl i32 %58, 1
%60 = or i32 %59, 0
%61 = call i32 @i2c_hw_tx_byte(i32 %60)
%62 = icmp ne i32 %61, 0
br i1 %62, label %69, label %63
63: ; preds = %56
%64 = load i32, i32* @stderr
%65 = load i32, i32* %7
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = call i32 (...) @i2c_hw_stop()
%68 = call i32 (...) @i2c_deinit()
store i32 3, i32* %3
br label %145
69: ; preds = %56
br label %70
70: ; preds = %69, %52
store i32 3, i32* %6
br label %71
71: ; preds = %108, %70
%72 = load i32, i32* %6
%73 = load i32, i32* %4
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %111
75: ; preds = %71
%76 = load i8**, i8*** %5
%77 = load i32, i32* %6
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = call i32 @strtol(i8* %80, i8** %11, i32 0)
store i32 %81, i32* %8
%82 = load i8*, i8** %11
%83 = icmp ne i8* %82, null
br i1 %83, label %84, label %95
84: ; preds = %75
%85 = load i8*, i8** %11
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %95
89: ; preds = %84
%90 = load i32, i32* @stderr
%91 = load i8*, i8** %11
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %91)
%93 = call i32 (...) @i2c_hw_stop()
%94 = call i32 (...) @i2c_deinit()
store i32 2, i32* %3
br label %145
95: ; preds = %84, %75
%96 = load i32, i32* %8
%97 = call i32 @i2c_hw_tx_byte(i32 %96)
%98 = icmp ne i32 %97, 0
br i1 %98, label %107, label %99
99: ; preds = %95
%100 = load i32, i32* @stderr
%101 = load i32, i32* %6
%102 = sub nsw i32 %101, 1
%103 = load i32, i32* %8
%104 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %102, i32 %103)
%105 = call i32 (...) @i2c_hw_stop()
%106 = call i32 (...) @i2c_deinit()
store i32 4, i32* %3
br label %145
107: ; preds = %95
br label %108
108: ; preds = %107
%109 = load i32, i32* %6
%110 = add nsw i32 %109, 1
store i32 %110, i32* %6
br label %71
111: ; preds = %71
%112 = call i32 (...) @i2c_hw_start()
%113 = load i32, i32* %7
%114 = shl i32 %113, 1
%115 = or i32 %114, 1
%116 = call i32 @i2c_hw_tx_byte(i32 %115)
%117 = icmp ne i32 %116, 0
br i1 %117, label %124, label %118
118: ; preds = %111
%119 = load i32, i32* @stderr
%120 = load i32, i32* %7
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0), i32 %120)
%122 = call i32 (...) @i2c_hw_stop()
%123 = call i32 (...) @i2c_deinit()
store i32 3, i32* %3
br label %145
124: ; preds = %111
store i32 1, i32* %6
br label %125
125: ; preds = %137, %124
%126 = load i32, i32* %6
%127 = load i32, i32* %9
%128 = icmp sle i32 %126, %127
br i1 %128, label %129, label %140
129: ; preds = %125
%130 = load i32, i32* %6
%131 = load i32, i32* %9
%132 = icmp slt i32 %130, %131
%133 = zext i1 %132 to i32
%134 = mul nsw i32 %133, 1
%135 = call i32 @i2c_hw_rx_byte(i32 %134)
%136 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %135)
br label %137
137: ; preds = %129
%138 = load i32, i32* %6
%139 = add nsw i32 %138, 1
store i32 %139, i32* %6
br label %125
140: ; preds = %125
%141 = load i32, i32* @stdout
%142 = call i32 @putc(i8 signext 10, i32 %141)
%143 = call i32 (...) @i2c_hw_stop()
%144 = call i32 (...) @i2c_deinit()
store i32 0, i32* %3
br label %145
145: ; preds = %140, %118, %99, %89, %63, %48, %32, %17
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
@.str = [57 x i8] c"Usage: vusb-i2cget <address> <num_bytes> [register ...] \00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"address: Conversion error at '%s'\0A\00"
@.str.2 = [37 x i8] c"num_bytes: Conversion error at '%s'\0A\00"
@.str.3 = [42 x i8] c"Received NAK from slave 0x%02x, aborting\0A\00"
@.str.4 = [40 x i8] c"read command: Conversion error at '%s'\0A\00"
@.str.5 = [37 x i8] c"Received NAK after byte %d (0x%02x)\0A\00"
@.str.6 = [56 x i8] c"Received NAK after reSTART from slave 0x%02x, aborting\0A\00"
@.str.7 = [4 x i8] c"%i \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i32 @i2c_getopt(i32 %0, i8** %1)
%6 = icmp slt i32 %0, 3
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @fputs(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %102
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strtol(i8* %12, i8** %3, i32 0)
%14 = load i8*, i8** %3
%15 = icmp eq i8* %14, null
br i1 %15, label %22, label %16
16: ; preds = %10
%17 = load i8, i8* %14
%18 = icmp eq i8 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %102
22: ; preds = %16, %10
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @strtol(i8* %24, i8** %3, i32 0)
%26 = load i8*, i8** %3
%27 = icmp eq i8* %26, null
br i1 %27, label %34, label %28
28: ; preds = %22
%29 = load i8, i8* %26
%30 = icmp eq i8 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %102
34: ; preds = %28, %22
%35 = tail call i32 (...) @i2c_init()
%36 = tail call i32 (...) @i2c_hw_start()
%37 = shl i32 %13, 1
%38 = tail call i32 @i2c_hw_tx_byte(i32 %37)
%39 = icmp eq i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %34
%41 = icmp ugt i32 %0, 3
br i1 %41, label %42, label %77
42: ; preds = %40
%43 = zext i32 %0 to i64
br label %49
44: ; preds = %34
%45 = load i32, i32* @stderr
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%47 = tail call i32 (...) @i2c_hw_stop()
%48 = tail call i32 (...) @i2c_deinit()
br label %102
49: ; preds = %42, %74
%50 = phi i64 [ 3, %42 ], [ %75, %74 ]
%51 = getelementptr inbounds i8*, i8** %1, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @strtol(i8* %52, i8** %3, i32 0)
%54 = load i8*, i8** %3
%55 = icmp eq i8* %54, null
br i1 %55, label %64, label %56
56: ; preds = %49
%57 = load i8, i8* %54
%58 = icmp eq i8 %57, 0
br i1 %58, label %64, label %59
59: ; preds = %56
%60 = load i32, i32* @stderr
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %54)
%62 = tail call i32 (...) @i2c_hw_stop()
%63 = tail call i32 (...) @i2c_deinit()
br label %102
64: ; preds = %56, %49
%65 = tail call i32 @i2c_hw_tx_byte(i32 %53)
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %74
67: ; preds = %64
%68 = trunc i64 %50 to i32
%69 = load i32, i32* @stderr
%70 = add nsw i32 %68, -1
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i32 %70, i32 %53)
%72 = tail call i32 (...) @i2c_hw_stop()
%73 = tail call i32 (...) @i2c_deinit()
br label %102
74: ; preds = %64
%75 = add nuw nsw i64 %50, 1
%76 = icmp eq i64 %75, %43
br i1 %76, label %77, label %49
77: ; preds = %74, %40
%78 = tail call i32 (...) @i2c_hw_start()
%79 = or i32 %37, 1
%80 = tail call i32 @i2c_hw_tx_byte(i32 %79)
%81 = icmp eq i32 %80, 0
br i1 %81, label %84, label %82
82: ; preds = %77
%83 = icmp slt i32 %25, 1
br i1 %83, label %97, label %89
84: ; preds = %77
%85 = load i32, i32* @stderr
%86 = tail call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%87 = tail call i32 (...) @i2c_hw_stop()
%88 = tail call i32 (...) @i2c_deinit()
br label %102
89: ; preds = %82, %89
%90 = phi i32 [ %95, %89 ], [ 1, %82 ]
%91 = icmp slt i32 %90, %25
%92 = zext i1 %91 to i32
%93 = tail call i32 @i2c_hw_rx_byte(i32 %92)
%94 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %93)
%95 = add nuw i32 %90, 1
%96 = icmp eq i32 %90, %25
br i1 %96, label %97, label %89
97: ; preds = %89, %82
%98 = load i32, i32* @stdout
%99 = tail call i32 @putc(i8 signext 10, i32 %98)
%100 = tail call i32 (...) @i2c_hw_stop()
%101 = tail call i32 (...) @i2c_deinit()
br label %102
102: ; preds = %97, %84, %67, %59, %44, %31, %19, %7
%103 = phi i32 [ 1, %7 ], [ 2, %19 ], [ 2, %31 ], [ 2, %59 ], [ 4, %67 ], [ 0, %97 ], [ 3, %84 ], [ 3, %44 ]
ret i32 %103
}