#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 scalar_t__ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int aes_file(int /*<<< orphan*/ *, int /*<<< orphan*/ *, char const *, int);
int /*<<< orphan*/ errno;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, scalar_t__, int /*<<< orphan*/ *);
int /*<<< orphan*/ *open_memstream(char **, size_t *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int aes_inplace(const char *filename, const char *password, int operation) {
  ;
  FILE *fid = fopen(filename, "r");
  if (fid == NULL) {
    fprintf(stderr, "ERROR: %s", strerror(errno));
    return -1;
  };
  char *streambuffer;
  size_t streamsize;
  FILE *memstream = open_memstream(&streambuffer, &streamsize);
  if (memstream == NULL) {
    fprintf(stderr, "ERROR: %s", strerror(errno));
    fclose(fid);
    return -1;
  }
  ssize_t bytes;
  char buffer[1024 + 1];
  do {
    bytes = fread(buffer, 1, 1024, fid);
    if (bytes <= 0) {
      break;
    }
    fwrite(buffer, 1, bytes, memstream);
  } while (bytes > 0);
  rewind(memstream);
  if (fclose(fid) < 0) {
    fprintf(stderr, "ERROR: %s", strerror(errno));
    fclose(memstream);
    free(streambuffer);
    return -1;
  };
  fid = fopen(filename, "w");
  if (fid == NULL) {
    fclose(memstream);
    free(streambuffer);
    fprintf(stderr, "ERROR: %s", strerror(errno));
    return -1;
  }
  int err = aes_file(memstream, fid, password, operation);
  if (err < 0) {
    fprintf(stderr, "ERROR: failed to encrypt/decyrpt file");
    return -1;
  }
  if (fclose(fid) < 0) {
    fprintf(stderr, "ERROR: %s", strerror(errno));
    fclose(memstream);
    free(streambuffer);
    return -1;
  }
  if (fclose(memstream) < 0) {
    free(streambuffer);
    return -1;
  }
  free(streambuffer);
  return 0;
}


x86 assembly (clang, -O0):
<aes_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1215 <aes_inplace+0x75>
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x458(%rbp)
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x458(%rbp),%edi
mov    %rax,%rdx
lea    0xe00(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1040 <open_memstream@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    127a <aes_inplace+0xda>
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x45c(%rbp)
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x45c(%rbp),%edi
mov    %rax,%rdx
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
jmp    127f <aes_inplace+0xdf>
lea    -0x450(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1050 <fread@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jg     12ad <aes_inplace+0x10d>
jmp    12d1 <aes_inplace+0x131>
lea    -0x450(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    $0x1,%esi
call   10b0 <fwrite@plt>
cmpq   $0x0,-0x48(%rbp)
jg     127f <aes_inplace+0xdf>
mov    -0x40(%rbp),%rdi
call   1080 <rewind@plt>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
jge    133f <aes_inplace+0x19f>
mov    0x2cec(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x460(%rbp)
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x460(%rbp),%edi
mov    %rax,%rdx
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
mov    -0x10(%rbp),%rdi
lea    0xcc2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    13b0 <aes_inplace+0x210>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    0x2c69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x464(%rbp)
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x464(%rbp),%edi
mov    %rax,%rdx
lea    0xc65(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1070 <aes_file@plt>
mov    %eax,-0x454(%rbp)
cmpl   $0x0,-0x454(%rbp)
jge    13fa <aes_inplace+0x25a>
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
lea    0xc27(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
jge    145f <aes_inplace+0x2bf>
mov    0x2bcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x468(%rbp)
mov    0x2bb5(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x468(%rbp),%edi
mov    %rax,%rdx
lea    0xbc8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
mov    -0x40(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
jge    1487 <aes_inplace+0x2e7>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1497 <aes_inplace+0x2f7>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_inplace>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xe3f(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1336 <aes_inplace+0x196>
mov    %rax,%rbp
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1040 <open_memstream@plt>
test   %rax,%rax
je     12b4 <aes_inplace+0x114>
mov    %rax,%r13
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
test   %rax,%rax
jle    123d <aes_inplace+0x9d>
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r13,%rcx
call   10b0 <fwrite@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %rbp,%rcx
call   1050 <fread@plt>
test   %rax,%rax
jg     1210 <aes_inplace+0x70>
mov    %r13,%rdi
call   1080 <rewind@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
test   %rax,%rax
js     12e8 <aes_inplace+0x148>
lea    0xdaf(%rip),%rsi
mov    %r12,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1325 <aes_inplace+0x185>
mov    %rax,%rbx
mov    %r13,%rdi
mov    %rax,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1070 <aes_file@plt>
test   %eax,%eax
js     1379 <aes_inplace+0x1d9>
mov    %rbx,%rdi
call   1060 <fclose@plt>
test   %rax,%rax
js     12e8 <aes_inplace+0x148>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %rax,%rbx
mov    (%rsp),%rdi
call   1030 <free@plt>
sar    $0x3f,%rbx
jmp    1365 <aes_inplace+0x1c5>
mov    0x2d25(%rip),%rax
mov    (%rax),%ebx
mov    0x2d14(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xd30(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
jmp    1360 <aes_inplace+0x1c0>
mov    0x2cf1(%rip),%rax
mov    (%rax),%ebx
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcfc(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
jmp    1360 <aes_inplace+0x1c0>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x2ca3(%rip),%rax
mov    (%rax),%ebx
mov    0x2c92(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
lea    0xcae(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1360 <aes_inplace+0x1c0>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [10 x i8] c"ERROR: %s\00"
@errno = global i32 0
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [38 x i8] c"ERROR: failed to encrypt/decyrpt file\00"
define i32 @aes_inplace(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i64
%13 = alloca [1025 x i8]
%14 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%15 = load i8*, i8** %5
%16 = call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %16, i32** %8
%17 = load i32*, i32** %8
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %3
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = call i8* @strerror(i32 %21)
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 -1, i32* %4
br label %114
24: ; preds = %3
%25 = call i32* @open_memstream(i8** %9, i64* %10)
store i32* %25, i32** %11
%26 = load i32*, i32** %11
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %35
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32*, i32** %8
%34 = call i64 @fclose(i32* %33)
store i32 -1, i32* %4
br label %114
35: ; preds = %24
br label %36
36: ; preds = %48, %35
%37 = getelementptr inbounds [1025 x i8], [1025 x i8]* %13, i64 0, i64 0
%38 = load i32*, i32** %8
%39 = call i64 @fread(i8* %37, i32 1, i32 1024, i32* %38)
store i64 %39, i64* %12
%40 = load i64, i64* %12
%41 = icmp sle i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %36
br label %51
43: ; preds = %36
%44 = getelementptr inbounds [1025 x i8], [1025 x i8]* %13, i64 0, i64 0
%45 = load i64, i64* %12
%46 = load i32*, i32** %11
%47 = call i32 @fwrite(i8* %44, i32 1, i64 %45, i32* %46)
br label %48
48: ; preds = %43
%49 = load i64, i64* %12
%50 = icmp sgt i64 %49, 0
br i1 %50, label %36, label %51
51: ; preds = %48, %42
%52 = load i32*, i32** %11
%53 = call i32 @rewind(i32* %52)
%54 = load i32*, i32** %8
%55 = call i64 @fclose(i32* %54)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %66
57: ; preds = %51
%58 = load i32, i32* @stderr
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %60)
%62 = load i32*, i32** %11
%63 = call i64 @fclose(i32* %62)
%64 = load i8*, i8** %9
%65 = call i32 @free(i8* %64)
store i32 -1, i32* %4
br label %114
66: ; preds = %51
%67 = load i8*, i8** %5
%68 = call i32* @fopen(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %68, i32** %8
%69 = load i32*, i32** %8
%70 = icmp eq i32* %69, null
br i1 %70, label %71, label %80
71: ; preds = %66
%72 = load i32*, i32** %11
%73 = call i64 @fclose(i32* %72)
%74 = load i8*, i8** %9
%75 = call i32 @free(i8* %74)
%76 = load i32, i32* @stderr
%77 = load i32, i32* @errno
%78 = call i8* @strerror(i32 %77)
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %78)
store i32 -1, i32* %4
br label %114
80: ; preds = %66
%81 = load i32*, i32** %11
%82 = load i32*, i32** %8
%83 = load i8*, i8** %6
%84 = load i32, i32* %7
%85 = call i32 @aes_file(i32* %81, i32* %82, i8* %83, i32 %84)
store i32 %85, i32* %14
%86 = load i32, i32* %14
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %80
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %4
br label %114
91: ; preds = %80
%92 = load i32*, i32** %8
%93 = call i64 @fclose(i32* %92)
%94 = icmp slt i64 %93, 0
br i1 %94, label %95, label %104
95: ; preds = %91
%96 = load i32, i32* @stderr
%97 = load i32, i32* @errno
%98 = call i8* @strerror(i32 %97)
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %98)
%100 = load i32*, i32** %11
%101 = call i64 @fclose(i32* %100)
%102 = load i8*, i8** %9
%103 = call i32 @free(i8* %102)
store i32 -1, i32* %4
br label %114
104: ; preds = %91
%105 = load i32*, i32** %11
%106 = call i64 @fclose(i32* %105)
%107 = icmp slt i64 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %104
%109 = load i8*, i8** %9
%110 = call i32 @free(i8* %109)
store i32 -1, i32* %4
br label %114
111: ; preds = %104
%112 = load i8*, i8** %9
%113 = call i32 @free(i8* %112)
store i32 0, i32* %4
br label %114
114: ; preds = %111, %108, %95, %88, %71, %57, %28, %19
%115 = load i32, i32* %4
ret i32 %115
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.1 = [10 x i8] c"ERROR: %s\00"
@errno = global i32 0
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [38 x i8] c"ERROR: failed to encrypt/decyrpt file\00"
define i32 @aes_inplace(i8* nocapture %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca [1025 x i8]
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i32, i32* @errno
%12 = tail call i8* @strerror(i32 %11)
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %84
14: ; preds = %3
%15 = bitcast i8** %4 to i8*
%16 = bitcast i64* %5 to i8*
%17 = call i32* @open_memstream(i8** %4, i64* %5)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i32, i32* @stderr
%21 = load i32, i32* @errno
%22 = call i8* @strerror(i32 %21)
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = call i64 @fclose(i32* %7)
br label %82
25: ; preds = %14
%26 = getelementptr inbounds [1025 x i8], [1025 x i8]* %6, i64 0, i64 0
%27 = call i64 @fread(i8* %26, i32 1, i32 1024, i32* %7)
%28 = icmp slt i64 %27, 1
br i1 %28, label %34, label %29
29: ; preds = %25, %29
%30 = phi i64 [ %32, %29 ], [ %27, %25 ]
%31 = call i32 @fwrite(i8* %26, i32 1, i64 %30, i32* %17)
%32 = call i64 @fread(i8* %26, i32 1, i32 1024, i32* %7)
%33 = icmp slt i64 %32, 1
br i1 %33, label %34, label %29
34: ; preds = %29, %25
%35 = call i32 @rewind(i32* %17)
%36 = call i64 @fclose(i32* %7)
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i32, i32* @stderr
%40 = load i32, i32* @errno
%41 = call i8* @strerror(i32 %40)
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = call i64 @fclose(i32* %17)
%44 = load i8*, i8** %4
%45 = call i32 @free(i8* %44)
br label %80
46: ; preds = %34
%47 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = call i64 @fclose(i32* %17)
%51 = load i8*, i8** %4
%52 = call i32 @free(i8* %51)
%53 = load i32, i32* @stderr
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %55)
br label %80
57: ; preds = %46
%58 = call i32 @aes_file(i32* %17, i32* %47, i8* %1, i32 %2)
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
br label %80
63: ; preds = %57
%64 = call i64 @fclose(i32* %47)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %74
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %69)
%71 = call i64 @fclose(i32* %17)
%72 = load i8*, i8** %4
%73 = call i32 @free(i8* %72)
br label %80
74: ; preds = %63
%75 = call i64 @fclose(i32* %17)
%76 = load i8*, i8** %4
%77 = call i32 @free(i8* %76)
%78 = ashr i64 %75, 63
%79 = trunc i64 %78 to i32
br label %80
80: ; preds = %74, %60, %66, %49, %38
%81 = phi i32 [ -1, %38 ], [ -1, %49 ], [ -1, %60 ], [ -1, %66 ], [ %79, %74 ]
br label %82
82: ; preds = %80, %19
%83 = phi i32 [ -1, %19 ], [ %81, %80 ]
br label %84
84: ; preds = %82, %9
%85 = phi i32 [ -1, %9 ], [ %83, %82 ]
ret i32 %85
}