#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ I2C_SLAVE;
int /*<<< orphan*/ exit(int);
scalar_t__ ioctl(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, int);
int write(int, int *, int);
uint8_t FindMotors(int file, uint8_t addr) {
  uint8_t i = 1;
  uint8_t buf[5];
  printf("Looking for preassigned motors on the bus...\n");
  while (1) {
    if (ioctl(file, I2C_SLAVE, addr + i) < 0) {
      printf("Failed to acquire bus access and/or talk to slave.\n");
      exit(1);
    }
    buf[0] = 0x09;
    buf[1] = 0x00;
    buf[2] = 0x00;
    buf[3] = 0x00;
    buf[4] = 0x00;
    if (write(file, buf, 5) != 5) {
      printf("No motor found at addr: 0x%00x, stopping search\n", addr + i);
      break;
    }
    if (read(file, buf, 4) != 4) {
      printf("Failed to read from the i2c bus.\n");
      printf("\n\n");
    }
    printf("Found Motor[%d] at addr: 0x%00x\n", i, addr + i);
    i++;
  }
  printf("Looking for any new motors on the bus...\n");
  while (1) {
    if (ioctl(file, I2C_SLAVE, addr) < 0) {
      printf("Failed to acquire bus access and/or talk to slave.\n");
      exit(1);
    }
    buf[0] = 0x00;
    buf[1] = (addr + i) << 1;
    buf[2] = 0x00;
    buf[3] = 0x00;
    buf[4] = 0x00;
    if (write(file, buf, 5) != 5) {
      printf("Failed to find any more motors\n");
      break;
    }
    if (ioctl(file, I2C_SLAVE, addr + i) < 0) {
      printf("Failed to acquire bus access and/or talk to slave.\n");
      exit(1);
    }
    if (read(file, buf, 4) != 4) {
      printf("Failed to read from the i2c bus.\n");
      printf("\n\n");
    } else {
      printf("Motor[%d] found, assigned addr 0x%00x\n", i, addr + i);
    }
    i++;
  }
  return i - 1;
}


x86 assembly (clang, -O0):
<FindMotors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2e6b(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    11ac <FindMotors+0x5c>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x9,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
cmp    $0x5,%eax
je     1202 <FindMotors+0xb2>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    125d <FindMotors+0x10d>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
je     1238 <FindMotors+0xe8>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1173 <FindMotors+0x23>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    12a1 <FindMotors+0x151>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
cmp    $0x5,%eax
je     12f6 <FindMotors+0x1a6>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    138f <FindMotors+0x23f>
mov    -0x4(%rbp),%edi
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    132f <FindMotors+0x1df>
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1060 <read@plt>
cmp    $0x4,%eax
je     136a <FindMotors+0x21a>
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1381 <FindMotors+0x231>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    126b <FindMotors+0x11b>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindMotors>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebx
mov    %edi,%r15d
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
mov    %rbx,0x8(%rsp)
lea    0x1(%rbx),%ebp
mov    %r15d,%edi
mov    %ebp,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
js     1390 <FindMotors+0x230>
mov    0x8(%rsp),%rax
lea    (%rax,%rax,1),%r14d
add    $0x2,%r14d
mov    $0x1,%ebx
lea    0x10(%rsp),%r12
lea    0xe80(%rip),%r13
jmp    1204 <FindMotors+0xa4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
add    $0x1,%ebp
mov    %r15d,%edi
mov    %ebp,%edx
call   1060 <ioctl@plt>
add    $0x2,%r14d
test   %rax,%rax
js     1390 <FindMotors+0x230>
movl   $0x9,0x10(%rsp)
lea    0x14(%rsp),%rax
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0x5,%edx
call   1040 <write@plt>
cmp    $0x5,%eax
jne    125e <FindMotors+0xfe>
mov    %r15d,%edi
mov    %r12,%rsi
mov    $0x4,%edx
call   1070 <read@plt>
cmp    $0x4,%eax
je     11d0 <FindMotors+0x70>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
lea    0xdeb(%rip),%rdi
call   1030 <puts@plt>
jmp    11d0 <FindMotors+0x70>
lea    0xdab(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe41(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d67(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    0x8(%rsp),%rdx
call   1060 <ioctl@plt>
test   %rax,%rax
js     1390 <FindMotors+0x230>
lea    0x10(%rsp),%rbp
lea    0xd9a(%rip),%r12
jmp    12e9 <FindMotors+0x189>
nopw   0x0(%rax,%rax,1)
lea    0xdab(%rip),%rdi
mov    %ebx,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
mov    0x2d1b(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    0x8(%rsp),%rdx
call   1060 <ioctl@plt>
add    $0x2,%r14d
test   %rax,%rax
js     1390 <FindMotors+0x230>
movl   $0x0,0x10(%rsp)
mov    %r14d,0x14(%rsp)
movq   $0x0,0x18(%rsp)
movl   $0x0,0x20(%rsp)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x5,%edx
call   1040 <write@plt>
cmp    $0x5,%eax
jne    1370 <FindMotors+0x210>
mov    0x8(%rsp),%rax
lea    (%rax,%rbx,1),%r13d
mov    0x2cbc(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %r13d,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
js     1390 <FindMotors+0x230>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x4,%edx
call   1070 <read@plt>
cmp    $0x4,%eax
je     12b0 <FindMotors+0x150>
lea    0xd81(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    12c3 <FindMotors+0x163>
lea    0xd89(%rip),%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd88(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Looking for preassigned motors on the bus...\0A\00"
@I2C_SLAVE = global i32 0
@.str.1 = [52 x i8] c"Failed to acquire bus access and/or talk to slave.\0A\00"
@.str.2 = [49 x i8] c"No motor found at addr: 0x%00x, stopping search\0A\00"
@.str.3 = [34 x i8] c"Failed to read from the i2c bus.\0A\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [33 x i8] c"Found Motor[%d] at addr: 0x%00x\0A\00"
@.str.6 = [42 x i8] c"Looking for any new motors on the bus...\0A\00"
@.str.7 = [32 x i8] c"Failed to find any more motors\0A\00"
@.str.8 = [39 x i8] c"Motor[%d] found, assigned addr 0x%00x\0A\00"
define i32 @FindMotors(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %42
%9 = load i32, i32* %3
%10 = load i32, i32* @I2C_SLAVE
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = call i64 @ioctl(i32 %9, i32 %10, i32 %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %8
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
store i32 9, i32* %20
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 1
store i32 0, i32* %21
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 2
store i32 0, i32* %22
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 3
store i32 0, i32* %23
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 4
store i32 0, i32* %24
%25 = load i32, i32* %3
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%27 = call i32 @write(i32 %25, i32* %26, i32 5)
%28 = icmp ne i32 %27, 5
br i1 %28, label %29, label %34
29: ; preds = %19
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %30, %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %50
34: ; preds = %19
%35 = load i32, i32* %3
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%37 = call i32 @read(i32 %35, i32* %36, i32 4)
%38 = icmp ne i32 %37, 4
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %39, %34
%43 = load i32, i32* %5
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = add nsw i32 %44, %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %43, i32 %46)
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %8
50: ; preds = %29
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
br label %52
52: ; preds = %50, %102
%53 = load i32, i32* %3
%54 = load i32, i32* @I2C_SLAVE
%55 = load i32, i32* %4
%56 = call i64 @ioctl(i32 %53, i32 %54, i32 %55)
%57 = icmp slt i64 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %52
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %52
%62 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
store i32 0, i32* %62
%63 = load i32, i32* %4
%64 = load i32, i32* %5
%65 = add nsw i32 %63, %64
%66 = shl i32 %65, 1
%67 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 1
store i32 %66, i32* %67
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 2
store i32 0, i32* %68
%69 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 3
store i32 0, i32* %69
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 4
store i32 0, i32* %70
%71 = load i32, i32* %3
%72 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%73 = call i32 @write(i32 %71, i32* %72, i32 5)
%74 = icmp ne i32 %73, 5
br i1 %74, label %75, label %77
75: ; preds = %61
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %105
77: ; preds = %61
%78 = load i32, i32* %3
%79 = load i32, i32* @I2C_SLAVE
%80 = load i32, i32* %4
%81 = load i32, i32* %5
%82 = add nsw i32 %80, %81
%83 = call i64 @ioctl(i32 %78, i32 %79, i32 %82)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %77
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %77
%89 = load i32, i32* %3
%90 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%91 = call i32 @read(i32 %89, i32* %90, i32 4)
%92 = icmp ne i32 %91, 4
br i1 %92, label %93, label %96
93: ; preds = %88
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %102
96: ; preds = %88
%97 = load i32, i32* %5
%98 = load i32, i32* %4
%99 = load i32, i32* %5
%100 = add nsw i32 %98, %99
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %97, i32 %100)
br label %102
102: ; preds = %96, %93
%103 = load i32, i32* %5
%104 = add nsw i32 %103, 1
store i32 %104, i32* %5
br label %52
105: ; preds = %75
%106 = load i32, i32* %5
%107 = sub nsw i32 %106, 1
ret i32 %107
}

LLVM IR (-O2):
@I2C_SLAVE = global i32 0
@.str.2 = [49 x i8] c"No motor found at addr: 0x%00x, stopping search\0A\00"
@.str.5 = [33 x i8] c"Found Motor[%d] at addr: 0x%00x\0A\00"
@.str.8 = [39 x i8] c"Motor[%d] found, assigned addr 0x%00x\0A\00"
@str = [45 x i8] c"Looking for preassigned motors on the bus...\00"
@str.11 = [41 x i8] c"Looking for any new motors on the bus...\00"
@str.12 = [33 x i8] c"Failed to read from the i2c bus.\00"
@str.13 = [2 x i8] c"\0A\00"
@str.15 = [31 x i8] c"Failed to find any more motors\00"
@str.17 = [51 x i8] c"Failed to acquire bus access and/or talk to slave.\00"
define i32 @FindMotors(i32 %0, i32 %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @I2C_SLAVE
%7 = add nsw i32 %1, 1
%8 = tail call i64 @ioctl(i32 %0, i32 %6, i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %2
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%16 = bitcast i32* %12 to i8*
br label %20
17: ; preds = %37, %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.17, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %10, %37
%21 = phi i32 [ %7, %10 ], [ %41, %37 ]
%22 = phi i32 [ 1, %10 ], [ %39, %37 ]
store i32 9, i32* %11
%23 = call i32 @write(i32 %0, i32* %11, i32 5)
%24 = icmp eq i32 %23, 5
br i1 %24, label %31, label %25
25: ; preds = %20
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.11, i64 0, i64 0))
%28 = load i32, i32* @I2C_SLAVE
%29 = tail call i64 @ioctl(i32 %0, i32 %28, i32 %1)
%30 = icmp slt i64 %29, 0
br i1 %30, label %44, label %47
31: ; preds = %20
%32 = call i32 @read(i32 %0, i32* %11, i32 4)
%33 = icmp eq i32 %32, 4
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
br label %37
37: ; preds = %34, %31
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %22, i32 %21)
%39 = add nuw nsw i32 %22, 1
%40 = load i32, i32* @I2C_SLAVE
%41 = add nsw i32 %39, %1
%42 = tail call i64 @ioctl(i32 %0, i32 %40, i32 %41)
%43 = icmp slt i64 %42, 0
br i1 %43, label %17, label %20
44: ; preds = %71, %25
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.17, i64 0, i64 0))
%46 = tail call i32 @exit(i32 1)
unreachable
47: ; preds = %25, %71
%48 = phi i32 [ %72, %71 ], [ %22, %25 ]
store i32 0, i32* %11
%49 = add nsw i32 %48, %1
%50 = shl i32 %49, 1
store i32 %50, i32* %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
%51 = call i32 @write(i32 %0, i32* %11, i32 5)
%52 = icmp eq i32 %51, 5
br i1 %52, label %56, label %53
53: ; preds = %47
%54 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.15, i64 0, i64 0))
%55 = add nsw i32 %48, -1
ret i32 %55
56: ; preds = %47
%57 = load i32, i32* @I2C_SLAVE
%58 = tail call i64 @ioctl(i32 %0, i32 %57, i32 %49)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.17, i64 0, i64 0))
%62 = tail call i32 @exit(i32 1)
unreachable
63: ; preds = %56
%64 = call i32 @read(i32 %0, i32* %11, i32 4)
%65 = icmp eq i32 %64, 4
br i1 %65, label %69, label %66
66: ; preds = %63
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
%68 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
br label %71
69: ; preds = %63
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i32 %48, i32 %49)
br label %71
71: ; preds = %69, %66
%72 = add nuw nsw i32 %48, 1
%73 = load i32, i32* @I2C_SLAVE
%74 = tail call i64 @ioctl(i32 %0, i32 %73, i32 %1)
%75 = icmp slt i64 %74, 0
br i1 %75, label %44, label %47
}