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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_RDWR;
int barebox_overlay_mbr(int, int, long);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strdup(int /*<<< orphan*/);
long strtol(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int rc = 0, c;
  char *barebox_image_filename = NULL, *hd_image_filename = NULL;
  int fd_barebox_image = 0, fd_hd_image = 0;
  long barebox_pers_size = -1;
  if (argc == 1) {
    print_usage(argv[0]);
    exit(0);
  }
  while (1) {
    c = getopt(argc, argv, "m:d:s:hv");
    if (c == -1)
      break;
    switch (c) {
    case 's':
      barebox_pers_size = strtol(optarg, NULL, 0);
      break;
    case 'm':
      barebox_image_filename = strdup(optarg);
      break;
    case 'd':
      hd_image_filename = strdup(optarg);
      break;
    case 'h':
      print_usage(argv[0]);
      rc = 0;
      goto on_error;
    case 'v':
      printf("setupmbr for u-boot-v%s\n",
             "2.6.35.14-BLACKOUT-ACE-ICS-v1.0-g657f3ee-dirty");
      printf("Send bug reports to 'barebox@lists.infradead.org'\n");
      rc = 0;
      goto on_error;
    }
  }
  if (barebox_image_filename == NULL) {
    print_usage(argv[0]);
    rc = -1;
    goto on_error;
  }
  fd_barebox_image = open(barebox_image_filename, O_RDONLY);
  if (fd_barebox_image == -1) {
    fprintf(stderr, "Cannot open '%s' for reading\n", barebox_image_filename);
    rc = -1;
    goto on_error;
  }
  fd_hd_image = open(hd_image_filename, O_RDWR);
  if (fd_hd_image == -1) {
    fprintf(stderr, "Cannot open '%s'\n", hd_image_filename);
    rc = -1;
    goto on_error;
  }
  if (barebox_pers_size < 0)
    barebox_pers_size = 0;
  rc = barebox_overlay_mbr(fd_barebox_image, fd_hd_image, barebox_pers_size);
on_error:
  if (fd_barebox_image != -1)
    close(fd_barebox_image);
  if (fd_hd_image != -1)
    close(fd_hd_image);
  if (barebox_image_filename != NULL)
    free(barebox_image_filename);
  if (hd_image_filename != NULL)
    free(hd_image_filename);
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movq   $0xffffffffffffffff,-0x38(%rbp)
ff
cmpl   $0x1,-0x8(%rbp)
jne    1210 <main+0x60>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_usage@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
jmp    1215 <main+0x65>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe29(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    123a <main+0x8a>
jmp    12fa <main+0x14a>
mov    -0x18(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x12,%eax
ja     12f5 <main+0x145>
mov    -0x40(%rbp),%rax
lea    0xda6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1080 <strtol@plt>
mov    %rax,-0x38(%rbp)
jmp    12f5 <main+0x145>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
call   10d0 <strdup@plt>
mov    %rax,-0x20(%rbp)
jmp    12f5 <main+0x145>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strdup@plt>
mov    %rax,-0x28(%rbp)
jmp    12f5 <main+0x145>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_usage@plt>
movl   $0x0,-0x14(%rbp)
jmp    13ca <main+0x21a>
lea    0xd88(%rip),%rdi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdbb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    13ca <main+0x21a>
jmp    1215 <main+0x65>
cmpq   $0x0,-0x20(%rbp)
jne    131d <main+0x16d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <print_usage@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    13ca <main+0x21a>
mov    -0x20(%rbp),%rdi
mov    0x2cb0(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1361 <main+0x1b1>
mov    0x2c85(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xd80(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    13ca <main+0x21a>
mov    -0x28(%rbp),%rdi
mov    0x2c74(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    13a5 <main+0x1f5>
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xd5a(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    13ca <main+0x21a>
cmpq   $0x0,-0x38(%rbp)
jge    13b8 <main+0x208>
movq   $0x0,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x38(%rbp),%rdx
call   1040 <barebox_overlay_mbr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
je     13dc <main+0x22c>
mov    -0x2c(%rbp),%edi
call   1060 <close@plt>
cmpl   $0xffffffff,-0x30(%rbp)
je     13ee <main+0x23e>
mov    -0x30(%rbp),%edi
call   1060 <close@plt>
cmpq   $0x0,-0x20(%rbp)
je     1402 <main+0x252>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x28(%rbp)
je     1416 <main+0x266>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
je     1383 <main+0x1c3>
mov    %edi,%ebp
movq   $0xffffffffffffffff,(%rsp)
ff
xor    %r12d,%r12d
lea    0xe61(%rip),%r13
lea    0xe0e(%rip),%r15
xor    %r14d,%r14d
jmp    1209 <main+0x49>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     12d4 <main+0x114>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10b0 <getopt@plt>
lea    -0x64(%rax),%ecx
cmp    $0x12,%ecx
ja     1200 <main+0x40>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
call   10e0 <strdup@plt>
mov    %rax,%r14
jmp    1209 <main+0x49>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
call   10e0 <strdup@plt>
mov    %rax,%r12
jmp    1209 <main+0x49>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <strtol@plt>
mov    %rax,(%rsp)
jmp    1209 <main+0x49>
mov    (%rbx),%rdi
call   10d0 <print_usage@plt>
xor    %r15d,%r15d
jmp    1296 <main+0xd6>
lea    0xddc(%rip),%rdi
lea    0xdee(%rip),%rsi
xor    %r15d,%r15d
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe3c(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
xor    %ebx,%ebx
mov    %ebp,%edi
call   1070 <close@plt>
mov    %ebx,%edi
call   1070 <close@plt>
test   %r12,%r12
je     12b5 <main+0xf5>
mov    %r12,%rdi
call   1030 <free@plt>
test   %r14,%r14
je     12c2 <main+0x102>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r12,%r12
je     1327 <main+0x167>
mov    0x2cf8(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     133d <main+0x17d>
mov    %eax,%ebp
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
je     1359 <main+0x199>
mov    %eax,%ebx
xor    %edx,%edx
mov    (%rsp),%rax
test   %rax,%rax
cmovns %rax,%rdx
mov    %ebp,%edi
mov    %ebx,%esi
call   1050 <barebox_overlay_mbr@plt>
mov    %eax,%r15d
jmp    129a <main+0xda>
mov    (%rbx),%rdi
call   10d0 <print_usage@plt>
xor    %r12d,%r12d
mov    $0xffffffff,%r15d
jmp    1296 <main+0xd6>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
lea    0xd50(%rip),%rsi
mov    %r12,%rdx
call   1080 <fprintf@plt>
xor    %ebp,%ebp
jmp    1371 <main+0x1b1>
mov    0x2c68(%rip),%rax
mov    (%rax),%edi
lea    0xd52(%rip),%rsi
mov    %r14,%rdx
call   1080 <fprintf@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    $0xffffffff,%r15d
jmp    12ad <main+0xed>
mov    (%rbx),%rdi
call   10d0 <print_usage@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"m:d:s:hv\00"
@optarg = global i32 0
@.str.1 = [25 x i8] c"setupmbr for u-boot-v%s\0A\00"
@.str.2 = [47 x i8] c"2.6.35.14-BLACKOUT-ACE-ICS-v1.0-g657f3ee-dirty\00"
@.str.3 = [51 x i8] c"Send bug reports to 'barebox@lists.infradead.org'\0A\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.4 = [30 x i8] c"Cannot open '%s' for reading\0A\00"
@O_RDWR = global i32 0
@.str.5 = [18 x i8] c"Cannot open '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
store i32 0, i32* %11
store i64 -1, i64* %12
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @print_usage(i8* %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
br label %22
22: ; preds = %21, %48
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @getopt(i32 %23, i8** %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %29
28: ; preds = %22
br label %49
29: ; preds = %22
%30 = load i32, i32* %7
switch i32 %30, label %48 [
i32 115, label %31
i32 109, label %34
i32 100, label %37
i32 104, label %40
i32 118, label %45
]
31: ; preds = %29
%32 = load i32, i32* @optarg
%33 = call i64 @strtol(i32 %32, i32* null, i32 0)
store i64 %33, i64* %12
br label %48
34: ; preds = %29
%35 = load i32, i32* @optarg
%36 = call i8* @strdup(i32 %35)
store i8* %36, i8** %8
br label %48
37: ; preds = %29
%38 = load i32, i32* @optarg
%39 = call i8* @strdup(i32 %38)
store i8* %39, i8** %9
br label %48
40: ; preds = %29
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 @print_usage(i8* %43)
store i32 0, i32* %6
br label %86
45: ; preds = %29
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %86
48: ; preds = %29, %37, %34, %31
br label %22
49: ; preds = %28
%50 = load i8*, i8** %8
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 0
%55 = load i8*, i8** %54
%56 = call i32 @print_usage(i8* %55)
store i32 -1, i32* %6
br label %86
57: ; preds = %49
%58 = load i8*, i8** %8
%59 = load i32, i32* @O_RDONLY
%60 = call i32 @open(i8* %58, i32 %59)
store i32 %60, i32* %10
%61 = load i32, i32* %10
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %67
63: ; preds = %57
%64 = load i32, i32* @stderr
%65 = load i8*, i8** %8
%66 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %65)
store i32 -1, i32* %6
br label %86
67: ; preds = %57
%68 = load i8*, i8** %9
%69 = load i32, i32* @O_RDWR
%70 = call i32 @open(i8* %68, i32 %69)
store i32 %70, i32* %11
%71 = load i32, i32* %11
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %77
73: ; preds = %67
%74 = load i32, i32* @stderr
%75 = load i8*, i8** %9
%76 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %75)
store i32 -1, i32* %6
br label %86
77: ; preds = %67
%78 = load i64, i64* %12
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %77
store i64 0, i64* %12
br label %81
81: ; preds = %80, %77
%82 = load i32, i32* %10
%83 = load i32, i32* %11
%84 = load i64, i64* %12
%85 = call i32 @barebox_overlay_mbr(i32 %82, i32 %83, i64 %84)
store i32 %85, i32* %6
br label %86
86: ; preds = %81, %73, %63, %52, %45, %40
%87 = load i32, i32* %10
%88 = icmp ne i32 %87, -1
br i1 %88, label %89, label %92
89: ; preds = %86
%90 = load i32, i32* %10
%91 = call i32 @close(i32 %90)
br label %92
92: ; preds = %89, %86
%93 = load i32, i32* %11
%94 = icmp ne i32 %93, -1
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = load i32, i32* %11
%97 = call i32 @close(i32 %96)
br label %98
98: ; preds = %95, %92
%99 = load i8*, i8** %8
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %104
101: ; preds = %98
%102 = load i8*, i8** %8
%103 = call i32 @free(i8* %102)
br label %104
104: ; preds = %101, %98
%105 = load i8*, i8** %9
%106 = icmp ne i8* %105, null
br i1 %106, label %107, label %110
107: ; preds = %104
%108 = load i8*, i8** %9
%109 = call i32 @free(i8* %108)
br label %110
110: ; preds = %107, %104
%111 = load i32, i32* %6
ret i32 %111
}

LLVM IR (-O2):
@.str = [9 x i8] c"m:d:s:hv\00"
@optarg = global i32 0
@.str.1 = [25 x i8] c"setupmbr for u-boot-v%s\0A\00"
@.str.2 = [47 x i8] c"2.6.35.14-BLACKOUT-ACE-ICS-v1.0-g657f3ee-dirty\00"
@O_RDONLY = global i32 0
@stderr = global i32 0
@.str.4 = [30 x i8] c"Cannot open '%s' for reading\0A\00"
@O_RDWR = global i32 0
@.str.5 = [18 x i8] c"Cannot open '%s'\0A\00"
@str = [50 x i8] c"Send bug reports to 'barebox@lists.infradead.org'\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @print_usage(i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %13, %8
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %8 [
i32 -1, label %34
i32 115, label %10
i32 109, label %15
i32 100, label %25
i32 104, label %28
i32 118, label %31
]
10: ; preds = %8
%11 = load i32, i32* @optarg
%12 = tail call i64 @strtol(i32 %11, i32* null, i32 0)
br label %13
13: ; preds = %22, %10
%14 = phi i64 [ %24, %22 ], [ %12, %10 ]
br label %8
15: ; preds = %8
%16 = load i32, i32* @optarg
%17 = tail call i8* @strdup(i32 %16)
br label %18
18: ; preds = %2, %15
%19 = phi i8* [ %17, %15 ], [ null, %2 ]
%20 = phi i8* [ %23, %15 ], [ null, %2 ]
%21 = phi i64 [ %14, %15 ], [ -1, %2 ]
br label %22
22: ; preds = %18, %25
%23 = phi i8* [ %20, %18 ], [ %27, %25 ]
%24 = phi i64 [ %21, %18 ], [ %14, %25 ]
br label %13
25: ; preds = %8
%26 = load i32, i32* @optarg
%27 = tail call i8* @strdup(i32 %26)
br label %22
28: ; preds = %8
%29 = load i8*, i8** %1
%30 = tail call i32 @print_usage(i8* %29)
br label %57
31: ; preds = %8
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %57
34: ; preds = %8
%35 = icmp eq i8* %19, null
br i1 %35, label %36, label %39
36: ; preds = %34
%37 = load i8*, i8** %1
%38 = tail call i32 @print_usage(i8* %37)
br label %57
39: ; preds = %34
%40 = load i32, i32* @O_RDONLY
%41 = tail call i32 @open(i8* %19, i32 %40)
%42 = icmp eq i32 %41, -1
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = load i32, i32* @O_RDWR
%45 = tail call i32 @open(i8* %23, i32 %44)
%46 = icmp eq i32 %45, -1
br i1 %46, label %54, label %47
47: ; preds = %43
%48 = icmp sgt i64 %14, 0
%49 = select i1 %48, i64 %14, i64 0
%50 = tail call i32 @barebox_overlay_mbr(i32 %41, i32 %45, i64 %49)
br label %57
51: ; preds = %39
%52 = load i32, i32* @stderr
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %19)
br label %65
54: ; preds = %43
%55 = load i32, i32* @stderr
%56 = tail call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %23)
br label %65
57: ; preds = %28, %31, %47, %36
%58 = phi i8* [ null, %36 ], [ %19, %47 ], [ %19, %31 ], [ %19, %28 ]
%59 = phi i32 [ -1, %36 ], [ %50, %47 ], [ 0, %31 ], [ 0, %28 ]
%60 = phi i32 [ 0, %36 ], [ %41, %47 ], [ 0, %31 ], [ 0, %28 ]
%61 = phi i32 [ 0, %36 ], [ %45, %47 ], [ 0, %31 ], [ 0, %28 ]
%62 = tail call i32 @close(i32 %60)
%63 = tail call i32 @close(i32 %61)
%64 = icmp eq i8* %58, null
br i1 %64, label %72, label %68
65: ; preds = %54, %51
%66 = phi i32 [ 0, %51 ], [ %41, %54 ]
%67 = tail call i32 @close(i32 %66)
br label %68
68: ; preds = %65, %57
%69 = phi i8* [ %58, %57 ], [ %19, %65 ]
%70 = phi i32 [ %59, %57 ], [ -1, %65 ]
%71 = tail call i32 @free(i8* %69)
br label %72
72: ; preds = %68, %57
%73 = phi i32 [ %70, %68 ], [ %59, %57 ]
%74 = icmp eq i8* %23, null
br i1 %74, label %77, label %75
75: ; preds = %72
%76 = tail call i32 @free(i8* %23)
br label %77
77: ; preds = %75, %72
ret i32 %73
}