#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 EOF;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
scalar_t__ ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ header(int /*<<< orphan*/ *, int /*<<< orphan*/);
int record(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int main(int argc, char *argv[]) {
  FILE *infile, *outfile;
  int rectype = 0, addrrecs = 0, datarecs = 0;
  if (argc != 3) {
    fprintf(stderr,
            "FLEX binary to Motorola S-record converter\nUsage: %s infile "
            "outfile\nIt is recommended that the output be put through "
            "srec_cat(1)\nor similar before further use, as this program "
            "generates records\nas long as those in the input file.\n",
            argv[0]);
    return EXIT_FAILURE;
  }
  infile = fopen(argv[1], "rb");
  outfile = fopen(argv[2], "wt");
  if (infile == NULL) {
    fprintf(stderr, "Error opening file %s for input.\n", argv[1]);
  } else if (outfile == NULL) {
    fprintf(stderr, "Error opening file %s for output.\n", argv[2]);
  } else {
    header(outfile, basename(argv[1]));
    do {
      rectype = record(infile, outfile);
      if (rectype == 0x02)
        datarecs++;
      if (rectype == 0x16)
        addrrecs++;
    } while (rectype == 0x02 || rectype == 0x16);
    if (rectype == EOF) {
      fprintf(outfile, "S503%04X%02X\n", datarecs,
              ~(0x03 + ((datarecs >> 8) & 0xFF) + (datarecs & 0xFF)) & 0xFF);
      if (addrrecs == 0)
        fprintf(outfile, "S9030000FC\n");
    } else {
      fprintf(stderr,
              "Unrecognised record type %02X at offset %04X in input file.\n",
              rectype, (int)ftell(infile) - 1);
    }
  }
  if (infile != NULL)
    fclose(infile);
  if (outfile != NULL)
    fclose(outfile);
  return (rectype == EOF) ? EXIT_SUCCESS : EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11d5 <main+0x65>
mov    0x2e2c(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ec <main+0x27c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xf03(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xeee(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1235 <main+0xc5>
mov    0x2dc1(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    138f <main+0x21f>
cmpq   $0x0,-0x20(%rbp)
jne    1265 <main+0xf5>
mov    0x2d91(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    138a <main+0x21a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <basename@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%esi
call   1030 <header@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <record@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jne    12a8 <main+0x138>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x16,-0x24(%rbp)
jne    12bb <main+0x14b>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12c0 <main+0x150>
mov    $0x1,%al
cmpl   $0x2,-0x24(%rbp)
mov    %al,-0x39(%rbp)
je     12d9 <main+0x169>
cmpl   $0x16,-0x24(%rbp)
sete   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    1285 <main+0x115>
mov    -0x24(%rbp),%eax
mov    0x2cfa(%rip),%rcx
cmp    (%rcx),%eax
jne    134e <main+0x1de>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
mov    -0x2c(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
add    $0x3,%ecx
mov    -0x2c(%rbp),%eax
and    $0xff,%eax
add    %eax,%ecx
xor    $0xffffffff,%ecx
and    $0xff,%ecx
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
cmpl   $0x0,-0x28(%rbp)
jne    1349 <main+0x1d9>
mov    -0x20(%rbp),%rdi
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1385 <main+0x215>
mov    0x2c83(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ftell@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%edx
mov    %eax,%ecx
sub    $0x1,%ecx
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    138a <main+0x21a>
jmp    138f <main+0x21f>
cmpq   $0x0,-0x18(%rbp)
je     13a3 <main+0x233>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x20(%rbp)
je     13b7 <main+0x247>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x24(%rbp),%eax
mov    0x2c27(%rip),%rcx
cmp    (%rcx),%eax
jne    13da <main+0x26a>
mov    0x2bf8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
jmp    13e6 <main+0x276>
mov    0x2bef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1274 <main+0xf4>
mov    0x8(%rbx),%rdi
lea    0xf48(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r15
mov    0x10(%rbx),%rdi
lea    0xf38(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
test   %r15,%r15
je     1294 <main+0x114>
test   %r14,%r14
je     12b9 <main+0x139>
mov    0x8(%rbx),%rdi
call   1080 <basename@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <header@plt>
xor    %r12d,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <record@plt>
mov    %eax,%ebp
xor    %eax,%eax
cmp    $0x2,%ebp
sete   %al
add    %eax,%ebx
xor    %eax,%eax
cmp    $0x16,%ebp
sete   %al
add    %eax,%r12d
cmp    $0x2,%ebp
je     11f0 <main+0x70>
cmp    $0x16,%ebp
je     11f0 <main+0x70>
mov    0x2dc5(%rip),%rax
cmp    (%rax),%ebp
jne    12d9 <main+0x159>
mov    %ebx,%eax
shr    $0x8,%eax
add    %ebx,%eax
add    $0x3,%eax
not    %eax
movzbl %al,%ecx
lea    0xef1(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r12d,%r12d
jne    1301 <main+0x181>
lea    0xee3(%rip),%rdi
mov    $0xb,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   10a0 <fwrite@plt>
jmp    1301 <main+0x181>
mov    0x2d5d(%rip),%rax
mov    (%rax),%rdi
mov    (%rbx),%rdx
lea    0xd78(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    132a <main+0x1aa>
mov    0x2d3d(%rip),%rax
mov    (%rax),%rdi
mov    0x8(%rbx),%rdx
lea    0xe44(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <fprintf@plt>
test   %r14,%r14
jne    130e <main+0x18e>
jmp    1316 <main+0x196>
mov    0x2d18(%rip),%rax
mov    (%rax),%rdi
mov    0x10(%rbx),%rdx
lea    0xe41(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1301 <main+0x181>
mov    0x2cf8(%rip),%rax
mov    (%rax),%rbx
mov    %r15,%rdi
call   1070 <ftell@plt>
lea    -0x1(%rax),%ecx
lea    0xe57(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
test   %r14,%r14
je     1316 <main+0x196>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x2ccb(%rip),%rax
cmp    (%rax),%ebp
jne    132a <main+0x1aa>
mov    0x2ca0(%rip),%rax
jmp    1331 <main+0x1b1>
mov    0x2c9f(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32* null
@.str = [231 x i8] c"FLEX binary to Motorola S-record converter\0AUsage: %s infile outfile\0AIt is recommended that the output be put through srec_cat(1)\0Aor similar before further use, as this program generates records\0Aas long as those in the input file.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [34 x i8] c"Error opening file %s for input.\0A\00"
@.str.4 = [35 x i8] c"Error opening file %s for output.\0A\00"
@EOF = global i32 0
@.str.5 = [14 x i8] c"S503%04X%02X\0A\00"
@.str.6 = [12 x i8] c"S9030000FC\0A\00"
@.str.7 = [61 x i8] c"Unrecognised record type %02X at offset %04X in input file.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32*, i32** @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
store i32 %19, i32* %3
br label %132
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %7
%29 = load i32*, i32** %6
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %37
31: ; preds = %20
%32 = load i32*, i32** @stderr
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %35)
br label %110
37: ; preds = %20
%38 = load i32*, i32** %7
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i32*, i32** @stderr
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 2
%44 = load i8*, i8** %43
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %41, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %109
46: ; preds = %37
%47 = load i32*, i32** %7
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @basename(i8* %50)
%52 = call i32 @header(i32* %47, i32 %51)
br label %53
53: ; preds = %75, %46
%54 = load i32*, i32** %6
%55 = load i32*, i32** %7
%56 = call i32 @record(i32* %54, i32* %55)
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = icmp eq i32 %57, 2
br i1 %58, label %59, label %62
59: ; preds = %53
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %62
62: ; preds = %59, %53
%63 = load i32, i32* %8
%64 = icmp eq i32 %63, 22
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = load i32, i32* %9
%67 = add nsw i32 %66, 1
store i32 %67, i32* %9
br label %68
68: ; preds = %65, %62
br label %69
69: ; preds = %68
%70 = load i32, i32* %8
%71 = icmp eq i32 %70, 2
br i1 %71, label %75, label %72
72: ; preds = %69
%73 = load i32, i32* %8
%74 = icmp eq i32 %73, 22
br label %75
75: ; preds = %72, %69
%76 = phi i1 [ true, %69 ], [ %74, %72 ]
br i1 %76, label %53, label %77
77: ; preds = %75
%78 = load i32, i32* %8
%79 = load i32, i32* @EOF
%80 = icmp eq i32 %78, %79
br i1 %80, label %81, label %100
81: ; preds = %77
%82 = load i32*, i32** %7
%83 = load i32, i32* %10
%84 = load i32, i32* %10
%85 = ashr i32 %84, 8
%86 = and i32 %85, 255
%87 = add nsw i32 3, %86
%88 = load i32, i32* %10
%89 = and i32 %88, 255
%90 = add nsw i32 %87, %89
%91 = xor i32 %90, -1
%92 = and i32 %91, 255
%93 = call i32 (i32*, i8*, ...) @fprintf(i32* %82, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %83, i32 %92)
%94 = load i32, i32* %9
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %81
%97 = load i32*, i32** %7
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %97, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %99
99: ; preds = %96, %81
br label %108
100: ; preds = %77
%101 = load i32*, i32** @stderr
%102 = load i32, i32* %8
%103 = load i32*, i32** %6
%104 = call i64 @ftell(i32* %103)
%105 = trunc i64 %104 to i32
%106 = sub nsw i32 %105, 1
%107 = call i32 (i32*, i8*, ...) @fprintf(i32* %101, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 %102, i32 %106)
br label %108
108: ; preds = %100, %99
br label %109
109: ; preds = %108, %40
br label %110
110: ; preds = %109, %31
%111 = load i32*, i32** %6
%112 = icmp ne i32* %111, null
br i1 %112, label %113, label %116
113: ; preds = %110
%114 = load i32*, i32** %6
%115 = call i32 @fclose(i32* %114)
br label %116
116: ; preds = %113, %110
%117 = load i32*, i32** %7
%118 = icmp ne i32* %117, null
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = load i32*, i32** %7
%121 = call i32 @fclose(i32* %120)
br label %122
122: ; preds = %119, %116
%123 = load i32, i32* %8
%124 = load i32, i32* @EOF
%125 = icmp eq i32 %123, %124
br i1 %125, label %126, label %128
126: ; preds = %122
%127 = load i32, i32* @EXIT_SUCCESS
br label %130
128: ; preds = %122
%129 = load i32, i32* @EXIT_FAILURE
br label %130
130: ; preds = %128, %126
%131 = phi i32 [ %127, %126 ], [ %129, %128 ]
store i32 %131, i32* %3
br label %132
132: ; preds = %130, %13
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@stderr = global i32* null
@.str = [231 x i8] c"FLEX binary to Motorola S-record converter\0AUsage: %s infile outfile\0AIt is recommended that the output be put through srec_cat(1)\0Aor similar before further use, as this program generates records\0Aas long as those in the input file.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [3 x i8] c"wt\00"
@.str.3 = [34 x i8] c"Error opening file %s for input.\0A\00"
@.str.4 = [35 x i8] c"Error opening file %s for output.\0A\00"
@EOF = global i32 0
@.str.5 = [14 x i8] c"S503%04X%02X\0A\00"
@.str.6 = [12 x i8] c"S9030000FC\0A\00"
@.str.7 = [61 x i8] c"Unrecognised record type %02X at offset %04X in input file.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32*, i32** @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
br label %75
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32* %12, null
br i1 %16, label %17, label %21
17: ; preds = %9
%18 = load i32*, i32** @stderr
%19 = load i8*, i8** %10
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %64
21: ; preds = %9
%22 = icmp eq i32* %15, null
br i1 %22, label %23, label %27
23: ; preds = %21
%24 = load i32*, i32** @stderr
%25 = load i8*, i8** %13
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i8* %25)
br label %61
27: ; preds = %21
%28 = load i8*, i8** %10
%29 = tail call i32 @basename(i8* %28)
%30 = tail call i32 @header(i32* %15, i32 %29)
br label %31
31: ; preds = %41, %27
%32 = phi i32 [ 0, %27 ], [ %40, %41 ]
%33 = phi i32 [ 0, %27 ], [ %37, %41 ]
%34 = tail call i32 @record(i32* %12, i32* %15)
%35 = icmp eq i32 %34, 2
%36 = zext i1 %35 to i32
%37 = add nuw nsw i32 %33, %36
%38 = icmp eq i32 %34, 22
%39 = zext i1 %38 to i32
%40 = add nuw nsw i32 %32, %39
switch i32 %34, label %42 [
i32 22, label %41
i32 2, label %41
]
41: ; preds = %31, %31
br label %31
42: ; preds = %31
%43 = load i32, i32* @EOF
%44 = icmp eq i32 %34, %43
br i1 %44, label %45, label %55
45: ; preds = %42
%46 = lshr i32 %37, 8
%47 = add nuw i32 %37, 3
%48 = add i32 %47, %46
%49 = and i32 %48, 255
%50 = xor i32 %49, 255
%51 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %37, i32 %50)
%52 = icmp eq i32 %40, 0
br i1 %52, label %53, label %61
53: ; preds = %45
%54 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i64 11, i64 1, i32* %15)
br label %61
55: ; preds = %42
%56 = load i32*, i32** @stderr
%57 = tail call i64 @ftell(i32* %12)
%58 = trunc i64 %57 to i32
%59 = add nsw i32 %58, -1
%60 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %56, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.7, i64 0, i64 0), i32 %34, i32 %59)
br label %61
61: ; preds = %55, %53, %45, %23
%62 = phi i32 [ 0, %23 ], [ %34, %45 ], [ %34, %53 ], [ %34, %55 ]
%63 = tail call i32 @fclose(i32* %12)
br label %64
64: ; preds = %17, %61
%65 = phi i32 [ 0, %17 ], [ %62, %61 ]
%66 = icmp eq i32* %15, null
br i1 %66, label %69, label %67
67: ; preds = %64
%68 = tail call i32 @fclose(i32* %15)
br label %69
69: ; preds = %67, %64
%70 = load i32, i32* @EOF
%71 = icmp eq i32 %65, %70
%72 = load i32, i32* @EXIT_SUCCESS
%73 = load i32, i32* @EXIT_FAILURE
%74 = select i1 %71, i32 %72, i32 %73
br label %75
75: ; preds = %69, %4
%76 = phi i32 [ %8, %4 ], [ %74, %69 ]
ret i32 %76
}