#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 /*<<< orphan*/ free(char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
char *malloc(scalar_t__);
int /*<<< orphan*/ perror(char *);
int sprintf(char *, char *, char const *, char const *);
int /*<<< orphan*/ stderr;
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) {
    return -ENOMEM;
  }
  ret = sprintf(temp, "%s/%s", basedir, filename);
  if (ret < 0) {
    goto error_free;
  }
  sysfsfp = fopen(temp, "w");
  if (!sysfsfp) {
    ret = -errno;
    fprintf(stderr, "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) {
      ret = -errno;
      fprintf(stderr, "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) {
      fprintf(stderr, "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   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11f5 <_write_sysfs_int+0x65>
xor    %eax,%eax
mov    0x2ded(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    141d <_write_sysfs_int+0x28d>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xdf8(%rip),%rsi
call   10b0 <sprintf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    121f <_write_sysfs_int+0x8f>
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x40(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    126c <_write_sysfs_int+0xdc>
xor    %eax,%eax
mov    0x2d81(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x30(%rbp),%rax
mov    %eax,%edi
mov    -0x1c(%rbp),%edx
lea    0xd9f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12b4 <_write_sysfs_int+0x124>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     12af <_write_sysfs_int+0x11f>
lea    0xd74(%rip),%rdi
call   10a0 <perror@plt>
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     12da <_write_sysfs_int+0x14a>
xor    %eax,%eax
mov    0x2cf8(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
jmp    140e <_write_sysfs_int+0x27e>
cmpl   $0x0,-0x20(%rbp)
je     1409 <_write_sysfs_int+0x279>
mov    -0x40(%rbp),%rdi
lea    0xd55(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1331 <_write_sysfs_int+0x1a1>
xor    %eax,%eax
mov    0x2cbc(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xce3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x30(%rbp),%rdi
lea    0xcdf(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1060 <fscanf@plt>
cmp    $0x1,%eax
je     13a9 <_write_sysfs_int+0x219>
mov    0x2c73(%rip),%rax
cmpl   $0x0,(%rax)
je     1371 <_write_sysfs_int+0x1e1>
xor    %eax,%eax
mov    0x2c61(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4c(%rbp)
jmp    137f <_write_sysfs_int+0x1ef>
xor    %eax,%eax
mov    0x2c6e(%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     13a4 <_write_sysfs_int+0x214>
lea    0xc7f(%rip),%rdi
call   10a0 <perror@plt>
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     13cf <_write_sysfs_int+0x23f>
xor    %eax,%eax
mov    0x2c03(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x24(%rbp)
jmp    140e <_write_sysfs_int+0x27e>
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     1404 <_write_sysfs_int+0x274>
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xc50(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    1409 <_write_sysfs_int+0x279>
jmp    140e <_write_sysfs_int+0x27e>
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   1080 <malloc@plt>
test   %rax,%rax
je     124a <_write_sysfs_int+0xba>
mov    %rax,%r14
lea    0xe28(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r13,%rcx
call   10b0 <sprintf@plt>
test   %eax,%eax
js     125a <_write_sysfs_int+0xca>
mov    %r12d,0x10(%rsp)
mov    %ebx,0xc(%rsp)
lea    0xe0c(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     12d7 <_write_sysfs_int+0x147>
mov    %rax,%r12
lea    0xe06(%rip),%rsi
mov    %r12d,%edi
mov    0xc(%rsp),%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <fclose@plt>
test   %ebp,%ebp
js     131e <_write_sysfs_int+0x18e>
test   %rax,%rax
je     1261 <_write_sysfs_int+0xd1>
mov    0x2d87(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
jmp    1323 <_write_sysfs_int+0x193>
mov    0x2d87(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
jmp    132b <_write_sysfs_int+0x19b>
mov    %eax,%ebp
jmp    1323 <_write_sysfs_int+0x193>
cmpl   $0x0,0x10(%rsp)
je     1323 <_write_sysfs_int+0x193>
lea    0xdd1(%rip),%rsi
mov    %r14,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     12d7 <_write_sysfs_int+0x147>
mov    %rax,%rbx
lea    0xd91(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %rax,%rdi
call   1060 <fscanf@plt>
cmp    $0x1,%eax
jne    12fe <_write_sysfs_int+0x16e>
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    123a <_write_sysfs_int+0xaa>
mov    0xc(%rsp),%edx
cmp    %edx,0x14(%rsp)
je     1323 <_write_sysfs_int+0x193>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
lea    0xd83(%rip),%rsi
mov    %r15,%rcx
mov    %r13,%r8
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0xffffffff,%ebp
jmp    1323 <_write_sysfs_int+0x193>
mov    0x2cea(%rip),%rax
xor    %ebp,%ebp
sub    (%rax),%ebp
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
lea    0xd16(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1323 <_write_sysfs_int+0x193>
mov    0x2cc3(%rip),%rax
mov    (%rax),%ebp
test   %ebp,%ebp
jne    1314 <_write_sysfs_int+0x184>
mov    0x2cd6(%rip),%rax
mov    (%rax),%ebp
neg    %ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    133c <_write_sysfs_int+0x1ac>
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    0xcdb(%rip),%rdi
call   10a0 <perror@plt>
jmp    1323 <_write_sysfs_int+0x193>

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
@stderr = 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 ne i8* %21, null
br i1 %22, label %26, label %23
23: ; preds = %4
%24 = load i32, i32* @ENOMEM
%25 = sub nsw i32 0, %24
store i32 %25, i32* %5
br label %124
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 %120
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 ne i32* %37, null
br i1 %38, label %45, label %39
39: ; preds = %34
%40 = load i32, i32* @errno
%41 = sub nsw i32 0, %40
store i32 %41, i32* %10
%42 = load i32, i32* @stderr
%43 = load i8*, i8** %13
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %43)
br label %120
45: ; preds = %34
%46 = load i32*, i32** %11
%47 = ptrtoint i32* %46 to i32
%48 = load i32, i32* %8
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %48)
store i32 %49, i32* %10
%50 = load i32, i32* %10
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %59
52: ; preds = %45
%53 = load i32*, i32** %11
%54 = call i64 @fclose(i32* %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %58
58: ; preds = %56, %52
br label %120
59: ; preds = %45
%60 = load i32*, i32** %11
%61 = call i64 @fclose(i32* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load i32, i32* @errno
%65 = sub nsw i32 0, %64
store i32 %65, i32* %10
br label %120
66: ; preds = %59
%67 = load i32, i32* %9
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %119
69: ; preds = %66
%70 = load i8*, i8** %13
%71 = call i32* @fopen(i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %71, i32** %11
%72 = load i32*, i32** %11
%73 = icmp ne i32* %72, null
br i1 %73, label %80, label %74
74: ; preds = %69
%75 = load i32, i32* @errno
%76 = sub nsw i32 0, %75
store i32 %76, i32* %10
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %13
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %78)
br label %120
80: ; preds = %69
%81 = load i32*, i32** %11
%82 = call i32 @fscanf(i32* %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%83 = icmp ne i32 %82, 1
br i1 %83, label %84, label %101
84: ; preds = %80
%85 = load i32, i32* @errno
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %84
%88 = load i32, i32* @errno
%89 = sub nsw i32 0, %88
br label %93
90: ; preds = %84
%91 = load i32, i32* @ENODATA
%92 = sub nsw i32 0, %91
br label %93
93: ; preds = %90, %87
%94 = phi i32 [ %89, %87 ], [ %92, %90 ]
store i32 %94, i32* %10
%95 = load i32*, i32** %11
%96 = call i64 @fclose(i32* %95)
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %93
%99 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %100
100: ; preds = %98, %93
br label %120
101: ; preds = %80
%102 = load i32*, i32** %11
%103 = call i64 @fclose(i32* %102)
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = load i32, i32* @errno
%107 = sub nsw i32 0, %106
store i32 %107, i32* %10
br label %120
108: ; preds = %101
%109 = load i32, i32* %12
%110 = load i32, i32* %8
%111 = icmp ne i32 %109, %110
br i1 %111, label %112, label %118
112: ; preds = %108
%113 = load i32, i32* @stderr
%114 = load i32, i32* %8
%115 = load i8*, i8** %7
%116 = load i8*, i8** %6
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %114, i8* %115, i8* %116)
store i32 -1, i32* %10
br label %118
118: ; preds = %112, %108
br label %119
119: ; preds = %118, %66
br label %120
120: ; preds = %119, %105, %100, %74, %63, %58, %39, %33
%121 = load i8*, i8** %13
%122 = call i32 @free(i8* %121)
%123 = load i32, i32* %10
store i32 %123, i32* %5
br label %124
124: ; preds = %120, %23
%125 = load i32, i32* %5
ret i32 %125
}

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
@stderr = 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 %79
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 %76, 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 %27
22: ; preds = %19
%23 = load i32, i32* @errno
%24 = sub nsw i32 0, %23
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %76
27: ; preds = %19
%28 = ptrtoint i32* %20 to i64
%29 = trunc i64 %28 to i32
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%31 = icmp slt i32 %30, 0
%32 = tail call i64 @fclose(i32* %20)
%33 = icmp eq i64 %32, 0
br i1 %31, label %34, label %37
34: ; preds = %27
br i1 %33, label %76, label %35
35: ; preds = %34
%36 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %76
37: ; preds = %27
br i1 %33, label %41, label %38
38: ; preds = %37
%39 = load i32, i32* @errno
%40 = sub nsw i32 0, %39
br label %76
41: ; preds = %37
%42 = icmp eq i32 %3, 0
br i1 %42, label %76, label %43
43: ; preds = %41
%44 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* @errno
%48 = sub nsw i32 0, %47
%49 = load i32, i32* @stderr
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %76
51: ; preds = %43
%52 = call i32 @fscanf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%53 = icmp eq i32 %52, 1
br i1 %53, label %64, label %54
54: ; preds = %51
%55 = load i32, i32* @errno
%56 = icmp eq i32 %55, 0
%57 = load i32, i32* @ENODATA
%58 = select i1 %56, i32 %57, i32 %55
%59 = sub nsw i32 0, %58
%60 = call i64 @fclose(i32* %44)
%61 = icmp eq i64 %60, 0
br i1 %61, label %76, label %62
62: ; preds = %54
%63 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %76
64: ; preds = %51
%65 = call i64 @fclose(i32* %44)
%66 = icmp eq i64 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %64
%68 = load i32, i32* @errno
%69 = sub nsw i32 0, %68
br label %76
70: ; preds = %64
%71 = load i32, i32* %5
%72 = icmp eq i32 %71, %2
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = load i32, i32* @stderr
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i32 %2, i8* %1, i8* %0)
br label %76
76: ; preds = %41, %73, %70, %54, %62, %34, %35, %16, %67, %46, %38, %22
%77 = phi i32 [ %17, %16 ], [ %30, %35 ], [ %30, %34 ], [ %40, %38 ], [ %59, %62 ], [ %59, %54 ], [ %69, %67 ], [ -1, %73 ], [ %30, %70 ], [ %48, %46 ], [ %30, %41 ], [ %24, %22 ]
%78 = call i32 @free(i8* %11)
br label %79
79: ; preds = %76, %13
%80 = phi i32 [ %77, %76 ], [ %15, %13 ]
ret i32 %80
}