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

/* Variables and functions */
int ENODATA;
int ENOMEM;
int errno;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ free(char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
char *malloc(scalar_t__);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sprintf(char *, char *, char const *, char const *);
scalar_t__ strlen(char const *);
int _write_sysfs_int(const char *filename, const char *basedir, int val,
                     int verify) {
  int ret = 0;
  FILE *sysfsfp;
  int test;
  char *temp = malloc(strlen(basedir) + strlen(filename) + 2);
  if (temp == NULL)
    return -ENOMEM;
  ret = sprintf(temp, "%s/%s", basedir, filename);
  if (ret < 0)
    goto error_free;
  sysfsfp = fopen(temp, "w");
  if (sysfsfp == NULL) {
    ret = -errno;
    printf("failed to open %s\n", temp);
    goto error_free;
  }
  ret = fprintf(sysfsfp, "%d", val);
  if (ret < 0) {
    if (fclose(sysfsfp))
      perror("_write_sysfs_int(): Failed to close dir");
    goto error_free;
  }
  if (fclose(sysfsfp)) {
    ret = -errno;
    goto error_free;
  }
  if (verify) {
    sysfsfp = fopen(temp, "r");
    if (sysfsfp == NULL) {
      ret = -errno;
      printf("failed to open %s\n", temp);
      goto error_free;
    }
    if (fscanf(sysfsfp, "%d", &test) != 1) {
      ret = errno ? -errno : -ENODATA;
      if (fclose(sysfsfp))
        perror("_write_sysfs_int(): Failed to close dir");
      goto error_free;
    }
    if (fclose(sysfsfp)) {
      ret = -errno;
      goto error_free;
    }
    if (test != val) {
      printf("Possible failure in int write %d to %s/%s\n", val, basedir,
             filename);
      ret = -1;
    }
  }
error_free:
  free(temp);
  return ret;
}


x86 assembly (clang, -O0):
<_write_sysfs_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x48(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1205 <_write_sysfs_int+0x65>
xor    %eax,%eax
mov    0x2ddd(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    140e <_write_sysfs_int+0x26e>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xde8(%rip),%rsi
call   10c0 <sprintf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    122f <_write_sysfs_int+0x8f>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x40(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1273 <_write_sysfs_int+0xd3>
xor    %eax,%eax
mov    0x2d79(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd9a(%rip),%rsi
call   1080 <fprintf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12b7 <_write_sysfs_int+0x117>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     12b2 <_write_sysfs_int+0x112>
lea    0xd71(%rip),%rdi
call   10b0 <perror@plt>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     12dd <_write_sysfs_int+0x13d>
xor    %eax,%eax
mov    0x2cfd(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
jmp    13ff <_write_sysfs_int+0x25f>
cmpl   $0x0,-0x20(%rbp)
je     13fa <_write_sysfs_int+0x25a>
mov    -0x40(%rbp),%rdi
lea    0xd52(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    132b <_write_sysfs_int+0x18b>
xor    %eax,%eax
mov    0x2cc1(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xce9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x30(%rbp),%rdi
lea    0xce5(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1070 <fscanf@plt>
cmp    $0x1,%eax
je     13a3 <_write_sysfs_int+0x203>
mov    0x2c81(%rip),%rax
cmpl   $0x0,(%rax)
je     136b <_write_sysfs_int+0x1cb>
xor    %eax,%eax
mov    0x2c6f(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4c(%rbp)
jmp    1379 <_write_sysfs_int+0x1d9>
xor    %eax,%eax
mov    0x2c74(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     139e <_write_sysfs_int+0x1fe>
lea    0xc85(%rip),%rdi
call   10b0 <perror@plt>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     13c9 <_write_sysfs_int+0x229>
xor    %eax,%eax
mov    0x2c11(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     13f5 <_write_sysfs_int+0x255>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xc5f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13fa <_write_sysfs_int+0x25a>
jmp    13ff <_write_sysfs_int+0x25f>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write_sysfs_int>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r12d
mov    %edx,%ebx
mov    %rsi,%r15
mov    %rdi,%r13
mov    %rsi,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbp
mov    %r13,%rdi
call   1050 <strlen@plt>
lea    (%rax,%rbp,1),%rdi
add    $0x2,%rdi
call   1090 <malloc@plt>
test   %rax,%rax
je     1258 <_write_sysfs_int+0xb8>
mov    %rax,%r14
lea    0xe18(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r13,%rcx
call   10c0 <sprintf@plt>
test   %eax,%eax
js     1268 <_write_sysfs_int+0xc8>
mov    %r12d,0x10(%rsp)
mov    %ebx,0xc(%rsp)
lea    0xdfc(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12dc <_write_sysfs_int+0x13c>
mov    %rax,%r12
lea    0xdf6(%rip),%rsi
mov    %rax,%rdi
mov    0xc(%rsp),%edx
call   1080 <fprintf@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %ebp,%ebp
js     131a <_write_sysfs_int+0x17a>
test   %rax,%rax
je     126f <_write_sysfs_int+0xcf>
mov    0x2d81(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
jmp    131f <_write_sysfs_int+0x17f>
mov    0x2d79(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
jmp    1327 <_write_sysfs_int+0x187>
mov    %eax,%ebp
jmp    131f <_write_sysfs_int+0x17f>
cmpl   $0x0,0x10(%rsp)
je     131f <_write_sysfs_int+0x17f>
lea    0xdc3(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12dc <_write_sysfs_int+0x13c>
mov    %rax,%rbx
lea    0xd83(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %rax,%rdi
call   1070 <fscanf@plt>
cmp    $0x1,%eax
jne    12fa <_write_sysfs_int+0x15a>
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    1248 <_write_sysfs_int+0xa8>
mov    0xc(%rsp),%esi
cmp    %esi,0x14(%rsp)
je     131f <_write_sysfs_int+0x17f>
lea    0xd7e(%rip),%rdi
mov    %r15,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebp
jmp    131f <_write_sysfs_int+0x17f>
mov    0x2ced(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
lea    0xd1a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    131f <_write_sysfs_int+0x17f>
mov    0x2ccf(%rip),%rax
mov    (%rax),%ebp
test   %ebp,%ebp
jne    1310 <_write_sysfs_int+0x170>
mov    0x2cda(%rip),%rax
mov    (%rax),%ebp
neg    %ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    1338 <_write_sysfs_int+0x198>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcdf(%rip),%rdi
call   10b0 <perror@plt>
jmp    131f <_write_sysfs_int+0x17f>

LLVM IR (-O0):
@ENOMEM = global i32 0
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [2 x i8] c"w\00"
@errno = global i32 0
@.str.2 = [19 x i8] c"failed to open %s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [40 x i8] c"_write_sysfs_int(): Failed to close dir\00"
@.str.5 = [2 x i8] c"r\00"
@ENODATA = global i32 0
@.str.6 = [43 x i8] c"Possible failure in int write %d to %s/%s\0A\00"
define i32 @_write_sysfs_int(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %10
%14 = load i8*, i8** %7
%15 = call i64 @strlen(i8* %14)
%16 = load i8*, i8** %6
%17 = call i64 @strlen(i8* %16)
%18 = add nsw i64 %15, %17
%19 = add nsw i64 %18, 2
%20 = call i8* @malloc(i64 %19)
store i8* %20, i8** %13
%21 = load i8*, i8** %13
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %26
23: ; preds = %4
%24 = load i32, i32* @ENOMEM
%25 = sub nsw i32 0, %24
store i32 %25, i32* %5
br label %120
26: ; preds = %4
%27 = load i8*, i8** %13
%28 = load i8*, i8** %7
%29 = load i8*, i8** %6
%30 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %28, i8* %29)
store i32 %30, i32* %10
%31 = load i32, i32* %10
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %26
br label %116
34: ; preds = %26
%35 = load i8*, i8** %13
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %36, i32** %11
%37 = load i32*, i32** %11
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %44
39: ; preds = %34
%40 = load i32, i32* @errno
%41 = sub nsw i32 0, %40
store i32 %41, i32* %10
%42 = load i8*, i8** %13
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %116
44: ; preds = %34
%45 = load i32*, i32** %11
%46 = load i32, i32* %8
%47 = call i32 @fprintf(i32* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %46)
store i32 %47, i32* %10
%48 = load i32, i32* %10
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %44
%51 = load i32*, i32** %11
%52 = call i64 @fclose(i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
br label %116
57: ; preds = %44
%58 = load i32*, i32** %11
%59 = call i64 @fclose(i32* %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load i32, i32* @errno
%63 = sub nsw i32 0, %62
store i32 %63, i32* %10
br label %116
64: ; preds = %57
%65 = load i32, i32* %9
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %115
67: ; preds = %64
%68 = load i8*, i8** %13
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %69, i32** %11
%70 = load i32*, i32** %11
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %77
72: ; preds = %67
%73 = load i32, i32* @errno
%74 = sub nsw i32 0, %73
store i32 %74, i32* %10
%75 = load i8*, i8** %13
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %75)
br label %116
77: ; preds = %67
%78 = load i32*, i32** %11
%79 = call i32 @fscanf(i32* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%80 = icmp ne i32 %79, 1
br i1 %80, label %81, label %98
81: ; preds = %77
%82 = load i32, i32* @errno
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i32, i32* @errno
%86 = sub nsw i32 0, %85
br label %90
87: ; preds = %81
%88 = load i32, i32* @ENODATA
%89 = sub nsw i32 0, %88
br label %90
90: ; preds = %87, %84
%91 = phi i32 [ %86, %84 ], [ %89, %87 ]
store i32 %91, i32* %10
%92 = load i32*, i32** %11
%93 = call i64 @fclose(i32* %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %90
%96 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %97
97: ; preds = %95, %90
br label %116
98: ; preds = %77
%99 = load i32*, i32** %11
%100 = call i64 @fclose(i32* %99)
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %98
%103 = load i32, i32* @errno
%104 = sub nsw i32 0, %103
store i32 %104, i32* %10
br label %116
105: ; preds = %98
%106 = load i32, i32* %12
%107 = load i32, i32* %8
%108 = icmp ne i32 %106, %107
br i1 %108, label %109, label %114
109: ; preds = %105
%110 = load i32, i32* %8
%111 = load i8*, i8** %7
%112 = load i8*, i8** %6
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %110, i8* %111, i8* %112)
store i32 -1, i32* %10
br label %114
114: ; preds = %109, %105
br label %115
115: ; preds = %114, %64
br label %116
116: ; preds = %115, %102, %97, %72, %61, %56, %39, %33
%117 = load i8*, i8** %13
%118 = call i32 @free(i8* %117)
%119 = load i32, i32* %10
store i32 %119, i32* %5
br label %120
120: ; preds = %116, %23
%121 = load i32, i32* %5
ret i32 %121
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@.str = [6 x i8] c"%s/%s\00"
@.str.1 = [2 x i8] c"w\00"
@errno = global i32 0
@.str.2 = [19 x i8] c"failed to open %s\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [40 x i8] c"_write_sysfs_int(): Failed to close dir\00"
@.str.5 = [2 x i8] c"r\00"
@ENODATA = global i32 0
@.str.6 = [43 x i8] c"Possible failure in int write %d to %s/%s\0A\00"
define i32 @_write_sysfs_int(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%9 = add i64 %7, 2
%10 = add i64 %9, %8
%11 = tail call i8* @malloc(i64 %10)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i32, i32* @ENOMEM
%15 = sub nsw i32 0, %14
br label %74
16: ; preds = %4
%17 = tail call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%18 = icmp slt i32 %17, 0
br i1 %18, label %71, label %19
19: ; preds = %16
%20 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* @errno
%24 = sub nsw i32 0, %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %71
26: ; preds = %19
%27 = tail call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%28 = icmp slt i32 %27, 0
%29 = tail call i64 @fclose(i32* %20)
%30 = icmp eq i64 %29, 0
br i1 %28, label %31, label %34
31: ; preds = %26
br i1 %30, label %71, label %32
32: ; preds = %31
%33 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %71
34: ; preds = %26
br i1 %30, label %38, label %35
35: ; preds = %34
%36 = load i32, i32* @errno
%37 = sub nsw i32 0, %36
br label %71
38: ; preds = %34
%39 = icmp eq i32 %3, 0
br i1 %39, label %71, label %40
40: ; preds = %38
%41 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* @errno
%45 = sub nsw i32 0, %44
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %71
47: ; preds = %40
%48 = call i32 @fscanf(i32* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%49 = icmp eq i32 %48, 1
br i1 %49, label %60, label %50
50: ; preds = %47
%51 = load i32, i32* @errno
%52 = icmp eq i32 %51, 0
%53 = load i32, i32* @ENODATA
%54 = select i1 %52, i32 %53, i32 %51
%55 = sub nsw i32 0, %54
%56 = call i64 @fclose(i32* %41)
%57 = icmp eq i64 %56, 0
br i1 %57, label %71, label %58
58: ; preds = %50
%59 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %71
60: ; preds = %47
%61 = call i64 @fclose(i32* %41)
%62 = icmp eq i64 %61, 0
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = load i32, i32* @errno
%65 = sub nsw i32 0, %64
br label %71
66: ; preds = %60
%67 = load i32, i32* %5
%68 = icmp eq i32 %67, %2
br i1 %68, label %71, label %69
69: ; preds = %66
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %2, i8* %1, i8* %0)
br label %71
71: ; preds = %38, %69, %66, %50, %58, %31, %32, %16, %63, %43, %35, %22
%72 = phi i32 [ %17, %16 ], [ %24, %22 ], [ %27, %32 ], [ %27, %31 ], [ %37, %35 ], [ %45, %43 ], [ %55, %58 ], [ %55, %50 ], [ %65, %63 ], [ -1, %69 ], [ %27, %66 ], [ %27, %38 ]
%73 = call i32 @free(i8* %11)
br label %74
74: ; preds = %71, %13
%75 = phi i32 [ %15, %13 ], [ %72, %71 ]
ret i32 %75
}