#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 */
scalar_t__ StrToNumber(char *, unsigned int *);
int ioctl(int, int, unsigned int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strstr(char *, char *);
int main(int argc, char *argv[]) {
  int fd = -1;
  int ret;
  unsigned int device_addr, reg_addr, reg_addr_end, reg_value, value;
  if ((argc != 3) && (argc != 4)) {
    printf("usage: %s <device_addr> <reg_addr>. sample: %s 0x56 0x0\n", argv[0],
           argv[0]);
    return -1;
  }
  fd = open("/dev/gpioi2c", 0);
  if (fd < 0) {
    printf("Open gpioi2c dev error!\n");
    return -1;
  }
  if (StrToNumber(argv[1], &device_addr)) {
    return 0;
  }
  if (StrToNumber(argv[2], &reg_addr)) {
    return 0;
  }
  if (3 == argc) {
    printf("device_addr:0x%2x; reg_addr:0x%2x.\n", device_addr, reg_addr);
    value = ((device_addr & 0xff) << 24) | ((reg_addr & 0xff) << 16);
    if (strstr(argv[0], "sccb_read")) {
      printf("sccb read.\n");
      ret = ioctl(fd, 0x05, &value);
    } else {
      printf("i2c read\n");
      ret = ioctl(fd, 0x01, &value);
    }
    reg_value = value & 0xff;
    printf("0x%2x\n", reg_value);
  } else if (4 == argc) {
    int cur_addr;
    if (StrToNumber(argv[3], &reg_addr_end)) {
      return 0;
    }
    if (reg_addr_end < reg_addr) {
      printf("end addr(0x%2x) should bigger than start addr(0x%2x)\n",
             reg_addr_end, reg_addr);
      return 0;
    }
    printf("device_addr:0x%2x; reg_addr_start:0x%2x; reg_addr_end:0x%2x.\n",
           device_addr, reg_addr, reg_addr_end);
    for (cur_addr = reg_addr; cur_addr < reg_addr_end + 1; cur_addr++) {
      value = ((device_addr & 0xff) << 24) | ((cur_addr & 0xff) << 16);
      if (strstr(argv[0], "sccb_read")) {
        printf("sccb read.\n");
        ret = ioctl(fd, 0x05, &value);
      } else {
        printf("i2c read\n");
        ret = ioctl(fd, 0x01, &value);
      }
      reg_value = value & 0xff;
      printf("0x%x 0x%x\n", cur_addr, reg_value);
    }
  }
  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   $0xffffffff,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11a9 <main+0x59>
cmpl   $0x4,-0x8(%rbp)
je     11a9 <main+0x59>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1440 <main+0x2f0>
lea    0xe89(%rip),%rdi
xor    %esi,%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11de <main+0x8e>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1440 <main+0x2f0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <StrToNumber@plt>
cmp    $0x0,%rax
je     1205 <main+0xb5>
movl   $0x0,-0x4(%rbp)
jmp    1440 <main+0x2f0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <StrToNumber@plt>
cmp    $0x0,%rax
je     122c <main+0xdc>
movl   $0x0,-0x4(%rbp)
jmp    1440 <main+0x2f0>
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jne    12f1 <main+0x1a1>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x20(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe0b(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     12ae <main+0x15e>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
lea    -0x2c(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
jmp    12d0 <main+0x180>
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
lea    -0x2c(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1439 <main+0x2e9>
mov    $0x4,%eax
cmp    -0x8(%rbp),%eax
jne    1434 <main+0x2e4>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <StrToNumber@plt>
cmp    $0x0,%rax
je     1326 <main+0x1d6>
movl   $0x0,-0x4(%rbp)
jmp    1440 <main+0x2f0>
mov    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
jae    1352 <main+0x202>
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1440 <main+0x2f0>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    142f <main+0x2df>
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x30(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xcd9(%rip),%rsi
call   1070 <strstr@plt>
cmp    $0x0,%rax
je     13e0 <main+0x290>
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
lea    -0x2c(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
jmp    1402 <main+0x2b2>
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
lea    -0x2c(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x18(%rbp)
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    136f <main+0x21f>
jmp    1434 <main+0x2e4>
jmp    1439 <main+0x2e9>
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,%r13
mov    %edi,%ebx
lea    -0x5(%rbx),%eax
cmp    $0xfffffffd,%eax
ja     1195 <main+0x35>
mov    0x0(%r13),%rdx
lea    0xe7a(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1285 <main+0x125>
lea    0xe9d(%rip),%rdi
xor    %ebp,%ebp
xor    %esi,%esi
call   1060 <open@plt>
test   %eax,%eax
js     1279 <main+0x119>
mov    %eax,%r14d
mov    0x8(%r13),%rdi
lea    0x10(%rsp),%rsi
call   1070 <StrToNumber@plt>
test   %rax,%rax
jne    128a <main+0x12a>
mov    0x10(%r13),%rdi
lea    0xc(%rsp),%rsi
call   1070 <StrToNumber@plt>
test   %rax,%rax
jne    128a <main+0x12a>
cmp    $0x4,%ebx
je     129b <main+0x13b>
cmp    $0x3,%ebx
jne    128a <main+0x12a>
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xe47(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%eax
shl    $0x18,%eax
mov    0xc(%rsp),%ecx
movzbl %cl,%ecx
shl    $0x10,%ecx
or     %eax,%ecx
mov    %ecx,0x8(%rsp)
mov    0x0(%r13),%rdi
lea    0xe40(%rip),%rsi
call   1080 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xebc(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
lea    0x1(,%rcx,4),%ebx
call   1030 <puts@plt>
lea    0x8(%rsp),%rdx
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <ioctl@plt>
movzbl 0x8(%rsp),%esi
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    128a <main+0x12a>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x18(%r13),%rdi
lea    0x14(%rsp),%rsi
call   1070 <StrToNumber@plt>
test   %rax,%rax
jne    128a <main+0x12a>
mov    0x14(%rsp),%ecx
mov    0xc(%rsp),%edx
cmp    %edx,%ecx
jae    12ce <main+0x16e>
lea    0xdba(%rip),%rdi
xor    %ebp,%ebp
mov    %ecx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    128a <main+0x12a>
mov    0x10(%rsp),%esi
lea    0xdd8(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%r15d
mov    0x14(%rsp),%eax
add    $0x1,%eax
cmp    %eax,%r15d
jae    128a <main+0x12a>
mov    %r15d,%ebx
shl    $0x10,%ebx
lea    0xdef(%rip),%r12
mov    0x10(%rsp),%eax
shl    $0x18,%eax
mov    %ebx,%ecx
and    $0xff0000,%ecx
or     %eax,%ecx
mov    %ecx,0x8(%rsp)
mov    0x0(%r13),%rdi
lea    0xd4a(%rip),%rsi
call   1080 <strstr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xdcf(%rip),%rdi
lea    0xdbf(%rip),%rax
cmove  %rax,%rdi
lea    0x1(,%rcx,4),%ebp
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %ebp,%esi
lea    0x8(%rsp),%rdx
call   1050 <ioctl@plt>
movzbl 0x8(%rsp),%edx
xor    %ebp,%ebp
mov    %r12,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
mov    0x14(%rsp),%eax
add    $0x1,%eax
add    $0x10000,%ebx
cmp    %eax,%r15d
jb     1300 <main+0x1a0>
jmp    128a <main+0x12a>

LLVM IR (-O0):
@.str = [57 x i8] c"usage: %s <device_addr> <reg_addr>. sample: %s 0x56 0x0\0A\00"
@.str.1 = [13 x i8] c"/dev/gpioi2c\00"
@.str.2 = [25 x i8] c"Open gpioi2c dev error!\0A\00"
@.str.3 = [36 x i8] c"device_addr:0x%2x; reg_addr:0x%2x.\0A\00"
@.str.4 = [10 x i8] c"sccb_read\00"
@.str.5 = [12 x i8] c"sccb read.\0A\00"
@.str.6 = [10 x i8] c"i2c read\0A\00"
@.str.7 = [7 x i8] c"0x%2x\0A\00"
@.str.8 = [54 x i8] c"end addr(0x%2x) should bigger than start addr(0x%2x)\0A\00"
@.str.9 = [62 x i8] c"device_addr:0x%2x; reg_addr_start:0x%2x; reg_addr_end:0x%2x.\0A\00"
@.str.10 = [11 x i8] c"0x%x 0x%x\0A\00"
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 i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %27
16: ; preds = %2
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 4
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %25)
store i32 -1, i32* %3
br label %141
27: ; preds = %16, %2
%28 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 0)
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %141
33: ; preds = %27
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @StrToNumber(i8* %36, i32* %8)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %33
store i32 0, i32* %3
br label %141
40: ; preds = %33
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i64 @StrToNumber(i8* %43, i32* %9)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %40
store i32 0, i32* %3
br label %141
47: ; preds = %40
%48 = load i32, i32* %4
%49 = icmp eq i32 3, %48
br i1 %49, label %50, label %79
50: ; preds = %47
%51 = load i32, i32* %8
%52 = load i32, i32* %9
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %51, i32 %52)
%54 = load i32, i32* %8
%55 = and i32 %54, 255
%56 = shl i32 %55, 24
%57 = load i32, i32* %9
%58 = and i32 %57, 255
%59 = shl i32 %58, 16
%60 = or i32 %56, %59
store i32 %60, i32* %12
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = call i64 @strstr(i8* %63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %50
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%68 = load i32, i32* %6
%69 = call i32 @ioctl(i32 %68, i32 5, i32* %12)
store i32 %69, i32* %7
br label %74
70: ; preds = %50
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%72 = load i32, i32* %6
%73 = call i32 @ioctl(i32 %72, i32 1, i32* %12)
store i32 %73, i32* %7
br label %74
74: ; preds = %70, %66
%75 = load i32, i32* %12
%76 = and i32 %75, 255
store i32 %76, i32* %11
%77 = load i32, i32* %11
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %77)
br label %140
79: ; preds = %47
%80 = load i32, i32* %4
%81 = icmp eq i32 4, %80
br i1 %81, label %82, label %139
82: ; preds = %79
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 3
%85 = load i8*, i8** %84
%86 = call i64 @StrToNumber(i8* %85, i32* %10)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %82
store i32 0, i32* %3
br label %141
89: ; preds = %82
%90 = load i32, i32* %10
%91 = load i32, i32* %9
%92 = icmp ult i32 %90, %91
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i32, i32* %10
%95 = load i32, i32* %9
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i32 %94, i32 %95)
store i32 0, i32* %3
br label %141
97: ; preds = %89
%98 = load i32, i32* %8
%99 = load i32, i32* %9
%100 = load i32, i32* %10
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0), i32 %98, i32 %99, i32 %100)
%102 = load i32, i32* %9
store i32 %102, i32* %13
br label %103
103: ; preds = %135, %97
%104 = load i32, i32* %13
%105 = load i32, i32* %10
%106 = add i32 %105, 1
%107 = icmp ult i32 %104, %106
br i1 %107, label %108, label %138
108: ; preds = %103
%109 = load i32, i32* %8
%110 = and i32 %109, 255
%111 = shl i32 %110, 24
%112 = load i32, i32* %13
%113 = and i32 %112, 255
%114 = shl i32 %113, 16
%115 = or i32 %111, %114
store i32 %115, i32* %12
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 0
%118 = load i8*, i8** %117
%119 = call i64 @strstr(i8* %118, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%120 = icmp ne i64 %119, 0
br i1 %120, label %121, label %125
121: ; preds = %108
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%123 = load i32, i32* %6
%124 = call i32 @ioctl(i32 %123, i32 5, i32* %12)
store i32 %124, i32* %7
br label %129
125: ; preds = %108
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%127 = load i32, i32* %6
%128 = call i32 @ioctl(i32 %127, i32 1, i32* %12)
store i32 %128, i32* %7
br label %129
129: ; preds = %125, %121
%130 = load i32, i32* %12
%131 = and i32 %130, 255
store i32 %131, i32* %11
%132 = load i32, i32* %13
%133 = load i32, i32* %11
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %132, i32 %133)
br label %135
135: ; preds = %129
%136 = load i32, i32* %13
%137 = add nsw i32 %136, 1
store i32 %137, i32* %13
br label %103
138: ; preds = %103
br label %139
139: ; preds = %138, %79
br label %140
140: ; preds = %139, %74
store i32 0, i32* %3
br label %141
141: ; preds = %140, %93, %88, %46, %39, %31, %19
%142 = load i32, i32* %3
ret i32 %142
}

LLVM IR (-O2):
@.str = [57 x i8] c"usage: %s <device_addr> <reg_addr>. sample: %s 0x56 0x0\0A\00"
@.str.1 = [13 x i8] c"/dev/gpioi2c\00"
@.str.3 = [36 x i8] c"device_addr:0x%2x; reg_addr:0x%2x.\0A\00"
@.str.4 = [10 x i8] c"sccb_read\00"
@.str.7 = [7 x i8] c"0x%2x\0A\00"
@.str.8 = [54 x i8] c"end addr(0x%2x) should bigger than start addr(0x%2x)\0A\00"
@.str.9 = [62 x i8] c"device_addr:0x%2x; reg_addr_start:0x%2x; reg_addr_end:0x%2x.\0A\00"
@.str.10 = [11 x i8] c"0x%x 0x%x\0A\00"
@str.12 = [9 x i8] c"i2c read\00"
@str.13 = [11 x i8] c"sccb read.\00"
@str.14 = [24 x i8] c"Open gpioi2c dev error!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = add i32 %0, -5
%12 = icmp ult i32 %11, -2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %14)
br label %91
16: ; preds = %2
%17 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 0)
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.14, i64 0, i64 0))
br label %91
21: ; preds = %16
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @StrToNumber(i8* %23, i32* %3)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %91
26: ; preds = %21
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = call i64 @StrToNumber(i8* %28, i32* %4)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %91
31: ; preds = %26
switch i32 %0, label %91 [
i32 3, label %32
i32 4, label %52
]
32: ; preds = %31
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %34)
%36 = load i32, i32* %3
%37 = shl i32 %36, 24
%38 = load i32, i32* %4
%39 = shl i32 %38, 16
%40 = and i32 %39, 16711680
%41 = or i32 %40, %37
store i32 %41, i32* %6
%42 = load i8*, i8** %1
%43 = call i64 @strstr(i8* %42, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
%45 = select i1 %44, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0)
%46 = select i1 %44, i32 1, i32 5
%47 = call i32 @puts(i8* dereferenceable(1) %45)
%48 = call i32 @ioctl(i32 %17, i32 %46, i32* %6)
%49 = load i32, i32* %6
%50 = and i32 %49, 255
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i32 %50)
br label %91
52: ; preds = %31
%53 = getelementptr inbounds i8*, i8** %1, i64 3
%54 = load i8*, i8** %53
%55 = call i64 @StrToNumber(i8* %54, i32* %5)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %91
57: ; preds = %52
%58 = load i32, i32* %5
%59 = load i32, i32* %4
%60 = icmp ult i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i32 %58, i32 %59)
br label %91
63: ; preds = %57
%64 = load i32, i32* %3
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0), i32 %64, i32 %59, i32 %58)
%66 = load i32, i32* %4
%67 = load i32, i32* %5
%68 = add i32 %67, 1
%69 = icmp ult i32 %66, %68
br i1 %69, label %70, label %91
70: ; preds = %63, %70
%71 = phi i32 [ %87, %70 ], [ %66, %63 ]
%72 = load i32, i32* %3
%73 = shl i32 %72, 24
%74 = shl i32 %71, 16
%75 = and i32 %74, 16711680
%76 = or i32 %73, %75
store i32 %76, i32* %6
%77 = load i8*, i8** %1
%78 = call i64 @strstr(i8* %77, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
%80 = select i1 %79, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0)
%81 = select i1 %79, i32 1, i32 5
%82 = call i32 @puts(i8* dereferenceable(1) %80)
%83 = call i32 @ioctl(i32 %17, i32 %81, i32* %6)
%84 = load i32, i32* %6
%85 = and i32 %84, 255
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %71, i32 %85)
%87 = add nuw nsw i32 %71, 1
%88 = load i32, i32* %5
%89 = add i32 %88, 1
%90 = icmp ult i32 %87, %89
br i1 %90, label %70, label %91
91: ; preds = %70, %63, %52, %32, %31, %61, %26, %21, %19, %13
%92 = phi i32 [ -1, %13 ], [ -1, %19 ], [ 0, %21 ], [ 0, %26 ], [ 0, %61 ], [ 0, %31 ], [ 0, %32 ], [ 0, %52 ], [ 0, %63 ], [ 0, %70 ]
ret i32 %92
}