#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 */
struct i2c_rdwr_ioctl_data {
  int nmsgs;
  struct i2c_msg *msgs;
};
struct i2c_msg {
  int addr;
  int len;
  unsigned char *buf;
  scalar_t__ flags;
};

/* Variables and functions */
scalar_t__ I2C_M_RD;
int /*<<< orphan*/ I2C_RDWR;
int errno;
int ioctl(int, int /*<<< orphan*/, struct i2c_rdwr_ioctl_data *);
int /*<<< orphan*/ printf(char *, ...);
int local_cam_setget_register(int filehandle, int iDataWidth, int oDataWidth,
                              int reg_addr, int *val, int newval) {
  unsigned char buf[10], out[10];
  struct i2c_rdwr_ioctl_data i2c_data;
  struct i2c_msg msgs[2];
  out[0] = out[1] = 0;
  if (iDataWidth == 1) {
    buf[0] = newval & 0xFF;
  } else {
    buf[0] = (newval >> 8) & 0xFF;
    buf[1] = newval & 0xFF;
  }
  msgs[0].addr = reg_addr;
  msgs[0].flags = 0;
  msgs[0].len = iDataWidth;
  msgs[0].buf = buf;
  msgs[1].addr = reg_addr;
  msgs[1].flags = I2C_M_RD;
  msgs[1].len = oDataWidth;
  msgs[1].buf = out;
  i2c_data.nmsgs = 2;
  i2c_data.msgs = msgs;
  if (ioctl(filehandle, I2C_RDWR, &i2c_data) != -1) {
    printf("setget done\n");
    if (iDataWidth == 1) {
      printf("local_cam_setget_register: 0x%x 0x%x written\r\n", buf[0],
             buf[1]);
    } else {
      printf("local_cam_setget_register: 0x%x 0x%x 0x%x written\r\n", buf[0],
             buf[1], buf[2]);
    }
    if (oDataWidth == 1) {
      *val = out[0];
    } else {
      *val = out[0] << 8;
      *val |= out[1];
    }
    return 0;
  }
  if (iDataWidth == 1) {
    printf("local_cam_setget_register: Error sending 0x%02x at 0x%02x, errno = "
           "%d\r\n",
           newval, reg_addr, errno);
  } else {
    printf("local_cam_setget_register: Error sending 0x%04x at 0x%02x, errno = "
           "%d\r\n",
           newval, reg_addr, errno);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<local_cam_setget_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movb   $0x0,-0x37(%rbp)
movb   $0x0,-0x38(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1161 <local_cam_setget_register+0x41>
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x2e(%rbp)
jmp    117a <local_cam_setget_register+0x5a>
mov    -0x24(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x2e(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x2d(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x80(%rbp)
movq   $0x0,-0x70(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x2e(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    0x2e35(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x64(%rbp)
lea    -0x38(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x2,-0x48(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
call   1040 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1270 <local_cam_setget_register+0x150>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    1218 <local_cam_setget_register+0xf8>
movzbl -0x2e(%rbp),%esi
movzbl -0x2d(%rbp),%edx
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1232 <local_cam_setget_register+0x112>
movzbl -0x2e(%rbp),%esi
movzbl -0x2d(%rbp),%edx
movzbl -0x2c(%rbp),%ecx
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x10(%rbp)
jne    124b <local_cam_setget_register+0x12b>
movzbl -0x38(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1264 <local_cam_setget_register+0x144>
movzbl -0x38(%rbp),%ecx
shl    $0x8,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movzbl -0x37(%rbp),%ecx
mov    -0x20(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    12c0 <local_cam_setget_register+0x1a0>
cmpl   $0x1,-0xc(%rbp)
jne    129c <local_cam_setget_register+0x17c>
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2d59(%rip),%rax
mov    (%rax),%ecx
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12b9 <local_cam_setget_register+0x199>
mov    -0x24(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2d37(%rip),%rax
mov    (%rax),%ecx
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<local_cam_setget_register>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %r9d,%r12d
mov    %r8,%r14
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%ebp
movw   $0x0,0x16(%rsp)
cmp    $0x1,%esi
jne    115c <local_cam_setget_register+0x2c>
mov    %r12b,0xc(%rsp)
jmp    1168 <local_cam_setget_register+0x38>
mov    %r12d,%eax
rol    $0x8,%ax
mov    %ax,0xc(%rsp)
mov    %ebx,0x20(%rsp)
movq   $0x0,0x30(%rsp)
mov    %ebp,0x24(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    %ebx,0x38(%rsp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x48(%rsp)
mov    %r15d,0x3c(%rsp)
lea    0x16(%rsp),%rax
mov    %rax,0x40(%rsp)
movl   $0x2,0x50(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,0x58(%rsp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
lea    0x50(%rsp),%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     11fa <local_cam_setget_register+0xca>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
movzbl 0xc(%rsp),%esi
movzbl 0xd(%rsp),%edx
cmp    $0x1,%ebp
jne    1211 <local_cam_setget_register+0xe1>
lea    0xe0f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1224 <local_cam_setget_register+0xf4>
mov    0x2ddf(%rip),%rax
mov    (%rax),%ecx
cmp    $0x1,%ebp
jne    1243 <local_cam_setget_register+0x113>
lea    0xe54(%rip),%rdi
jmp    124a <local_cam_setget_register+0x11a>
movzbl 0xe(%rsp),%ecx
lea    0xe12(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl 0x16(%rsp),%eax
mov    %eax,%ecx
shl    $0x8,%ecx
movzbl 0x17(%rsp),%edx
or     %ecx,%edx
cmp    $0x1,%r15d
cmove  %eax,%edx
mov    %edx,(%r14)
xor    %eax,%eax
jmp    125b <local_cam_setget_register+0x12b>
lea    0xe61(%rip),%rdi
mov    %r12d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.i2c_rdwr_ioctl_data = type { i32, %struct.i2c_msg* }
%struct.i2c_msg = type { i32, i32, i8*, i64 }
@I2C_M_RD = global i64 0
@I2C_RDWR = global i32 0
@.str = [13 x i8] c"setget done\0A\00"
@.str.1 = [47 x i8] c"local_cam_setget_register: 0x%x 0x%x written\0D\0A\00"
@.str.2 = [52 x i8] c"local_cam_setget_register: 0x%x 0x%x 0x%x written\0D\0A\00"
@.str.3 = [72 x i8] c"local_cam_setget_register: Error sending 0x%02x at 0x%02x, errno = %d\0D\0A\00"
@errno = global i32 0
@.str.4 = [72 x i8] c"local_cam_setget_register: Error sending 0x%04x at 0x%02x, errno = %d\0D\0A\00"
define i32 @local_cam_setget_register(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca [10 x i8]
%15 = alloca [10 x i8]
%16 = alloca %struct.i2c_rdwr_ioctl_data
%17 = alloca [2 x %struct.i2c_msg]
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32 %5, i32* %13
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 1
store i8 0, i8* %18
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
store i8 0, i8* %19
%20 = load i32, i32* %9
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %27
22: ; preds = %6
%23 = load i32, i32* %13
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
store i8 %25, i8* %26
br label %37
27: ; preds = %6
%28 = load i32, i32* %13
%29 = ashr i32 %28, 8
%30 = and i32 %29, 255
%31 = trunc i32 %30 to i8
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
store i8 %31, i8* %32
%33 = load i32, i32* %13
%34 = and i32 %33, 255
%35 = trunc i32 %34 to i8
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 1
store i8 %35, i8* %36
br label %37
37: ; preds = %27, %22
%38 = load i32, i32* %11
%39 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 0
%40 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %39, i32 0, i32 0
store i32 %38, i32* %40
%41 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 0
%42 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %41, i32 0, i32 3
store i64 0, i64* %42
%43 = load i32, i32* %9
%44 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 0
%45 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %44, i32 0, i32 1
store i32 %43, i32* %45
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%47 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 0
%48 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %47, i32 0, i32 2
store i8* %46, i8** %48
%49 = load i32, i32* %11
%50 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 1
%51 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %50, i32 0, i32 0
store i32 %49, i32* %51
%52 = load i64, i64* @I2C_M_RD
%53 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 1
%54 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %53, i32 0, i32 3
store i64 %52, i64* %54
%55 = load i32, i32* %10
%56 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 1
%57 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %56, i32 0, i32 1
store i32 %55, i32* %57
%58 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%59 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 1
%60 = getelementptr inbounds %struct.i2c_msg, %struct.i2c_msg* %59, i32 0, i32 2
store i8* %58, i8** %60
%61 = getelementptr inbounds %struct.i2c_rdwr_ioctl_data, %struct.i2c_rdwr_ioctl_data* %16, i32 0, i32 0
store i32 2, i32* %61
%62 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %17, i64 0, i64 0
%63 = getelementptr inbounds %struct.i2c_rdwr_ioctl_data, %struct.i2c_rdwr_ioctl_data* %16, i32 0, i32 1
store %struct.i2c_msg* %62, %struct.i2c_msg** %63
%64 = load i32, i32* %8
%65 = load i32, i32* @I2C_RDWR
%66 = call i32 @ioctl(i32 %64, i32 %65, %struct.i2c_rdwr_ioctl_data* %16)
%67 = icmp ne i32 %66, -1
br i1 %67, label %68, label %112
68: ; preds = %37
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%70 = load i32, i32* %9
%71 = icmp eq i32 %70, 1
br i1 %71, label %72, label %80
72: ; preds = %68
%73 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
%76 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 1
%77 = load i8, i8* %76
%78 = zext i8 %77 to i32
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %75, i32 %78)
br label %91
80: ; preds = %68
%81 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 0
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 1
%85 = load i8, i8* %84
%86 = zext i8 %85 to i32
%87 = getelementptr inbounds [10 x i8], [10 x i8]* %14, i64 0, i64 2
%88 = load i8, i8* %87
%89 = zext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %83, i32 %86, i32 %89)
br label %91
91: ; preds = %80, %72
%92 = load i32, i32* %10
%93 = icmp eq i32 %92, 1
br i1 %93, label %94, label %99
94: ; preds = %91
%95 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%96 = load i8, i8* %95
%97 = zext i8 %96 to i32
%98 = load i32*, i32** %12
store i32 %97, i32* %98
br label %111
99: ; preds = %91
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%101 = load i8, i8* %100
%102 = zext i8 %101 to i32
%103 = shl i32 %102, 8
%104 = load i32*, i32** %12
store i32 %103, i32* %104
%105 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 1
%106 = load i8, i8* %105
%107 = zext i8 %106 to i32
%108 = load i32*, i32** %12
%109 = load i32, i32* %108
%110 = or i32 %109, %107
store i32 %110, i32* %108
br label %111
111: ; preds = %99, %94
store i32 0, i32* %7
br label %126
112: ; preds = %37
%113 = load i32, i32* %9
%114 = icmp eq i32 %113, 1
br i1 %114, label %115, label %120
115: ; preds = %112
%116 = load i32, i32* %13
%117 = load i32, i32* %11
%118 = load i32, i32* @errno
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %116, i32 %117, i32 %118)
br label %125
120: ; preds = %112
%121 = load i32, i32* %13
%122 = load i32, i32* %11
%123 = load i32, i32* @errno
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0), i32 %121, i32 %122, i32 %123)
br label %125
125: ; preds = %120, %115
store i32 -1, i32* %7
br label %126
126: ; preds = %125, %111
%127 = load i32, i32* %7
ret i32 %127
}

LLVM IR (-O2):
%struct.i2c_rdwr_ioctl_data = type { i32, %struct.i2c_msg* }
%struct.i2c_msg = type { i32, i32, i8*, i64 }
@I2C_M_RD = global i64 0
@I2C_RDWR = global i32 0
@.str.1 = [47 x i8] c"local_cam_setget_register: 0x%x 0x%x written\0D\0A\00"
@.str.2 = [52 x i8] c"local_cam_setget_register: 0x%x 0x%x 0x%x written\0D\0A\00"
@.str.3 = [72 x i8] c"local_cam_setget_register: Error sending 0x%02x at 0x%02x, errno = %d\0D\0A\00"
@errno = global i32 0
@.str.4 = [72 x i8] c"local_cam_setget_register: Error sending 0x%04x at 0x%02x, errno = %d\0D\0A\00"
@str = [12 x i8] c"setget done\00"
define i32 @local_cam_setget_register(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32 %5) {
%7 = alloca [10 x i8]
%8 = alloca [10 x i8]
%9 = alloca %struct.i2c_rdwr_ioctl_data
%10 = alloca [2 x %struct.i2c_msg]
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%13 = bitcast %struct.i2c_rdwr_ioctl_data* %9 to i8*
%14 = bitcast [2 x %struct.i2c_msg]* %10 to i8*
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 1
store i8 0, i8* %15
store i8 0, i8* %12
%16 = icmp eq i32 %1, 1
br i1 %16, label %17, label %19
17: ; preds = %6
%18 = trunc i32 %5 to i8
store i8 %18, i8* %11
br label %24
19: ; preds = %6
%20 = lshr i32 %5, 8
%21 = trunc i32 %20 to i8
store i8 %21, i8* %11
%22 = trunc i32 %5 to i8
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 1
store i8 %22, i8* %23
br label %24
24: ; preds = %19, %17
%25 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 0
%26 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 0, i32 0
store i32 %3, i32* %26
%27 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 0, i32 3
store i64 0, i64* %27
%28 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 0, i32 1
store i32 %1, i32* %28
%29 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 0, i32 2
store i8* %11, i8** %29
%30 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 1, i32 0
store i32 %3, i32* %30
%31 = load i64, i64* @I2C_M_RD
%32 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 1, i32 3
store i64 %31, i64* %32
%33 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 1, i32 1
store i32 %2, i32* %33
%34 = getelementptr inbounds [2 x %struct.i2c_msg], [2 x %struct.i2c_msg]* %10, i64 0, i64 1, i32 2
store i8* %12, i8** %34
%35 = getelementptr inbounds %struct.i2c_rdwr_ioctl_data, %struct.i2c_rdwr_ioctl_data* %9, i64 0, i32 0
store i32 2, i32* %35
%36 = getelementptr inbounds %struct.i2c_rdwr_ioctl_data, %struct.i2c_rdwr_ioctl_data* %9, i64 0, i32 1
store %struct.i2c_msg* %25, %struct.i2c_msg** %36
%37 = load i32, i32* @I2C_RDWR
%38 = call i32 @ioctl(i32 %0, i32 %37, %struct.i2c_rdwr_ioctl_data* %9)
%39 = icmp eq i32 %38, -1
br i1 %39, label %63, label %40
40: ; preds = %24
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%42 = load i8, i8* %11
%43 = zext i8 %42 to i32
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 1
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
br i1 %16, label %47, label %49
47: ; preds = %40
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %43, i32 %46)
br label %54
49: ; preds = %40
%50 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 2
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %43, i32 %46, i32 %52)
br label %54
54: ; preds = %49, %47
%55 = icmp eq i32 %2, 1
%56 = load i8, i8* %12
%57 = zext i8 %56 to i32
%58 = shl nuw nsw i32 %57, 8
%59 = load i8, i8* %15
%60 = zext i8 %59 to i32
%61 = or i32 %58, %60
%62 = select i1 %55, i32 %57, i32 %61
store i32 %62, i32* %4
br label %69
63: ; preds = %24
%64 = load i32, i32* @errno
br i1 %16, label %65, label %67
65: ; preds = %63
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.3, i64 0, i64 0), i32 %5, i32 %3, i32 %64)
br label %69
67: ; preds = %63
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0), i32 %5, i32 %3, i32 %64)
br label %69
69: ; preds = %65, %67, %54
%70 = phi i32 [ 0, %54 ], [ -1, %67 ], [ -1, %65 ]
ret i32 %70
}