#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 /*<<< orphan*/ fname;

/* Variables and functions */
int /*<<< orphan*/ I2C_SLAVE;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ ioctl(int, int /*<<< orphan*/, int);
unsigned char *malloc(unsigned int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int strlen(char const *);
void *strtol(char const *, int /*<<< orphan*/ *, int);
unsigned int write(int, unsigned char *, unsigned int);
int main(int argc, const char *argv[]) {
  int fd;
  if (argc != 4) {
    fprintf(stderr, "Usage: i2cwrite I2CBUS CHIP-ADDRESS DATA\n");
    return 1;
  }
  char fname[20];
  snprintf(fname, sizeof(fname), "/dev/i2c-%s", argv[1]);
  fname[sizeof(fname) - 1] = '\0';
  fd = open(fname, O_RDWR);
  if (fd < 0) {
    fprintf(stderr, "Cannot open I2C device (%s)\n", strerror(errno));
    return 2;
  }
  int addr = strtol(argv[2], NULL, 0);
  if (ioctl(fd, I2C_SLAVE, addr) < 0) {
    fprintf(stderr, "Cannot set I2C slave address to 0x%x (%s)\n", addr,
            strerror(errno));
    return 3;
  }
  unsigned int buflen = strlen(argv[3]) / 2;
  unsigned char *buf = malloc(buflen);
  if (NULL == buf) {
    fprintf(stderr, "Cannot allocate scratch memory\n");
    return 4;
  }
  char hex[3] = "00";
  for (int i = 0; i < buflen; i++) {
    hex[0] = argv[3][i * 2];
    hex[1] = argv[3][i * 2 + 1];
    buf[i] = strtol(hex, NULL, 16);
  }
  if (write(fd, buf, buflen) != buflen) {
    fprintf(stderr, "Cannot write I2C data (%s)\n", strerror(errno));
    return 5;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11d3 <main+0x43>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13f5 <main+0x265>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    $0x14,%esi
lea    0xe3f(%rip),%rdx
call   1050 <snprintf@plt>
movb   $0x0,-0x1d(%rbp)
lea    -0x30(%rbp),%rdi
mov    0x2de9(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    124d <main+0xbd>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rdx
lea    0xdfc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    13f5 <main+0x265>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2d73(%rip),%rax
mov    (%rax),%esi
mov    -0x34(%rbp),%edx
call   1060 <ioctl@plt>
cmp    $0x0,%rax
jge    12c4 <main+0x134>
mov    0x2d48(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%edx
mov    %rax,%rcx
lea    0xda2(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x3,-0x4(%rbp)
jmp    13f5 <main+0x265>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
xor    %eax,%eax
cmp    -0x40(%rbp),%rax
jne    1317 <main+0x187>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x4(%rbp)
jmp    13f5 <main+0x265>
mov    0xd80(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xd78(%rip),%al
mov    %al,-0x41(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x38(%rbp),%eax
jae    139c <main+0x20c>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x48(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x43(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    -0x48(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x42(%rbp)
lea    -0x43(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1332 <main+0x1a2>
mov    -0x14(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   1030 <write@plt>
cmp    -0x38(%rbp),%eax
je     13ee <main+0x25e>
mov    0x2c15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x58(%rbp),%edi
mov    %rax,%rdx
lea    0xcc6(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x5,-0x4(%rbp)
jmp    13f5 <main+0x265>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x4,%edi
jne    12f4 <main+0x164>
mov    %rsi,%r13
mov    0x8(%rsi),%rcx
lea    0xe75(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x14,%esi
call   1050 <snprintf@plt>
movb   $0x0,0x23(%rsp)
mov    0x2e15(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1315 <main+0x185>
mov    %eax,%ebx
mov    0x10(%r13),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,%rbp
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %ebp,%edx
call   1060 <ioctl@plt>
test   %rax,%rax
js     1346 <main+0x1b6>
mov    0x18(%r13),%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    %eax,%r15d
shr    $0x1f,%r15d
add    %eax,%r15d
sar    %r15d
mov    %r15d,%edi
call   1090 <malloc@plt>
test   %rax,%rax
je     1379 <main+0x1e9>
mov    %rax,%rbp
mov    %ebx,0xc(%rsp)
movb   $0x0,0xa(%rsp)
movw   $0x3030,0x8(%rsp)
add    $0x1,%r12d
cmp    $0x3,%r12d
jb     12a4 <main+0x114>
cmp    $0x2,%r15d
mov    $0x1,%ebx
cmovae %r15d,%ebx
xor    %r14d,%r14d
lea    0x8(%rsp),%r12
xchg   %ax,%ax
mov    0x18(%r13),%rax
movzbl (%rax,%r14,2),%ecx
mov    %cl,0x8(%rsp)
movzbl 0x1(%rax,%r14,2),%eax
mov    %al,0x9(%rsp)
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
mov    %al,0x0(%rbp,%r14,1)
add    $0x1,%r14
cmp    %r14,%rbx
jne    1270 <main+0xe0>
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %r15d,%ecx
je     1395 <main+0x205>
mov    0x2d09(%rip),%rax
mov    (%rax),%ebx
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xdc3(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x5,%eax
jmp    1395 <main+0x205>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xcfc(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
jmp    1395 <main+0x205>
mov    0x2cb4(%rip),%rax
mov    (%rax),%ebx
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd03(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x2,%eax
jmp    1395 <main+0x205>
mov    0x2c83(%rip),%rax
mov    (%rax),%ebx
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcef(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x3,%eax
jmp    1395 <main+0x205>
mov    0x2c50(%rip),%rax
mov    (%rax),%edi
lea    0xcf5(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x4,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: i2cwrite I2CBUS CHIP-ADDRESS DATA\0A\00"
@.str.1 = [12 x i8] c"/dev/i2c-%s\00"
@O_RDWR = global i32 0
@.str.2 = [29 x i8] c"Cannot open I2C device (%s)\0A\00"
@errno = global i32 0
@I2C_SLAVE = global i32 0
@.str.3 = [43 x i8] c"Cannot set I2C slave address to 0x%x (%s)\0A\00"
@.str.4 = [32 x i8] c"Cannot allocate scratch memory\0A\00"
@__const.main.hex = [3 x i8] c"00\00"
@.str.5 = [28 x i8] c"Cannot write I2C data (%s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [20 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [3 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %114
18: ; preds = %2
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @snprintf(i8* %19, i32 20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 19
store i8 0, i8* %24
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* @O_RDWR
%27 = call i32 @open(i8* %25, i32 %26)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %18
%31 = load i32, i32* @stderr
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %33)
store i32 2, i32* %3
br label %114
35: ; preds = %18
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i8* @strtol(i8* %38, i32* null, i32 0)
%40 = ptrtoint i8* %39 to i32
store i32 %40, i32* %8
%41 = load i32, i32* %6
%42 = load i32, i32* @I2C_SLAVE
%43 = load i32, i32* %8
%44 = call i64 @ioctl(i32 %41, i32 %42, i32 %43)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %35
%47 = load i32, i32* @stderr
%48 = load i32, i32* %8
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %48, i8* %50)
store i32 3, i32* %3
br label %114
52: ; preds = %35
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
%56 = call i32 @strlen(i8* %55)
%57 = sdiv i32 %56, 2
store i32 %57, i32* %9
%58 = load i32, i32* %9
%59 = call i8* @malloc(i32 %58)
store i8* %59, i8** %10
%60 = load i8*, i8** %10
%61 = icmp eq i8* null, %60
br i1 %61, label %62, label %65
62: ; preds = %52
%63 = load i32, i32* @stderr
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 4, i32* %3
br label %114
65: ; preds = %52
%66 = bitcast [3 x i8]* %11 to i8*
store i32 0, i32* %12
br label %67
67: ; preds = %98, %65
%68 = load i32, i32* %12
%69 = load i32, i32* %9
%70 = icmp ult i32 %68, %69
br i1 %70, label %71, label %101
71: ; preds = %67
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 3
%74 = load i8*, i8** %73
%75 = load i32, i32* %12
%76 = mul nsw i32 %75, 2
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %74, i64 %77
%79 = load i8, i8* %78
%80 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
store i8 %79, i8* %80
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 3
%83 = load i8*, i8** %82
%84 = load i32, i32* %12
%85 = mul nsw i32 %84, 2
%86 = add nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %83, i64 %87
%89 = load i8, i8* %88
%90 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 1
store i8 %89, i8* %90
%91 = getelementptr inbounds [3 x i8], [3 x i8]* %11, i64 0, i64 0
%92 = call i8* @strtol(i8* %91, i32* null, i32 16)
%93 = ptrtoint i8* %92 to i8
%94 = load i8*, i8** %10
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
store i8 %93, i8* %97
br label %98
98: ; preds = %71
%99 = load i32, i32* %12
%100 = add nsw i32 %99, 1
store i32 %100, i32* %12
br label %67
101: ; preds = %67
%102 = load i32, i32* %6
%103 = load i8*, i8** %10
%104 = load i32, i32* %9
%105 = call i32 @write(i32 %102, i8* %103, i32 %104)
%106 = load i32, i32* %9
%107 = icmp ne i32 %105, %106
br i1 %107, label %108, label %113
108: ; preds = %101
%109 = load i32, i32* @stderr
%110 = load i32, i32* @errno
%111 = call i8* @strerror(i32 %110)
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %111)
store i32 5, i32* %3
br label %114
113: ; preds = %101
store i32 0, i32* %3
br label %114
114: ; preds = %113, %108, %62, %46, %30, %15
%115 = load i32, i32* %3
ret i32 %115
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: i2cwrite I2CBUS CHIP-ADDRESS DATA\0A\00"
@.str.1 = [12 x i8] c"/dev/i2c-%s\00"
@O_RDWR = global i32 0
@.str.2 = [29 x i8] c"Cannot open I2C device (%s)\0A\00"
@errno = global i32 0
@I2C_SLAVE = global i32 0
@.str.3 = [43 x i8] c"Cannot set I2C slave address to 0x%x (%s)\0A\00"
@.str.4 = [32 x i8] c"Cannot allocate scratch memory\0A\00"
@__const.main.hex = [3 x i8] c"00\00"
@.str.5 = [28 x i8] c"Cannot write I2C data (%s)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [20 x i8]
%4 = alloca [3 x i8]
%5 = icmp eq i32 %0, 4
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %82
9: ; preds = %2
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @snprintf(i8* %10, i32 20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 19
store i8 0, i8* %14
%15 = load i32, i32* @O_RDWR
%16 = call i32 @open(i8* %10, i32 %15)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %9
%19 = load i32, i32* @stderr
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %80
23: ; preds = %9
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = call i8* @strtol(i8* nocapture %25, i32* null, i32 0)
%27 = ptrtoint i8* %26 to i64
%28 = trunc i64 %27 to i32
%29 = load i32, i32* @I2C_SLAVE
%30 = call i64 @ioctl(i32 %16, i32 %29, i32 %28)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %23
%33 = load i32, i32* @stderr
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %28, i8* %35)
br label %80
37: ; preds = %23
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = call i32 @strlen(i8* %39)
%41 = sdiv i32 %40, 2
%42 = call i8* @malloc(i32 %41)
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %80
47: ; preds = %37
%48 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%49 = add i32 %40, 1
%50 = icmp ult i32 %49, 3
br i1 %50, label %55, label %51
51: ; preds = %47
%52 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 1
%53 = call i32 @llvm.umax.i32(i32 %41, i32 1)
%54 = zext i32 %53 to i64
br label %58
55: ; preds = %58, %47
%56 = call i32 @write(i32 %16, i8* %42, i32 %41)
%57 = icmp eq i32 %56, %41
br i1 %57, label %78, label %73
58: ; preds = %51, %58
%59 = phi i64 [ 0, %51 ], [ %71, %58 ]
%60 = load i8*, i8** %38
%61 = shl nuw nsw i64 %59, 1
%62 = getelementptr inbounds i8, i8* %60, i64 %61
%63 = load i8, i8* %62
store i8 %63, i8* %48
%64 = or i64 %61, 1
%65 = getelementptr inbounds i8, i8* %60, i64 %64
%66 = load i8, i8* %65
store i8 %66, i8* %52
%67 = call i8* @strtol(i8* nocapture %48, i32* null, i32 16)
%68 = ptrtoint i8* %67 to i64
%69 = trunc i64 %68 to i8
%70 = getelementptr inbounds i8, i8* %42, i64 %59
store i8 %69, i8* %70
%71 = add nuw nsw i64 %59, 1
%72 = icmp eq i64 %71, %54
br i1 %72, label %55, label %58
73: ; preds = %55
%74 = load i32, i32* @stderr
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %55, %73
%79 = phi i32 [ 5, %73 ], [ 0, %55 ]
br label %80
80: ; preds = %32, %78, %44, %18
%81 = phi i32 [ 2, %18 ], [ 3, %32 ], [ 4, %44 ], [ %79, %78 ]
br label %82
82: ; preds = %80, %6
%83 = phi i32 [ 1, %6 ], [ %81, %80 ]
ret i32 %83
}