#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 BUFSIZ;
int cmp_cache(char *, char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetl(int /*<<< orphan*/ *, int, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *fd1;
  FILE *fd2;
  if (argc != 3) {
    fprintf(stderr, "usage: %s infile mergefile\n", argv[0]);
    return (-1);
  }
  char *infile = argv[1];
  char *mergefile = argv[2];
  if ((fd1 = fopen(infile, "rb")) == NULL) {
    fprintf(stderr, "%s: %s\n", infile, strerror(errno));
    return (-1);
  }
  if ((fd2 = fopen(mergefile, "rb")) == NULL) {
    fprintf(stderr, "%s: %s\n", mergefile, strerror(errno));
    fclose(fd1);
    return (-1);
  }
  char line_buf1[BUFSIZ];
  char line_buf2[BUFSIZ];
  if (fgetl(fd1, BUFSIZ, line_buf1) == -1)
    memset(line_buf1, 0, BUFSIZ);
  if (fgetl(fd2, BUFSIZ, line_buf2) == -1)
    memset(line_buf2, 0, BUFSIZ);
  int comp = 1;
  while (!feof(fd1) && !feof(fd2)) {
    comp = cmp_cache(line_buf1, line_buf2);
    if (comp == 0) {
      puts(line_buf1);
      if (fgetl(fd1, BUFSIZ, line_buf1) == -1)
        memset(line_buf1, 0, BUFSIZ);
      if (fgetl(fd2, BUFSIZ, line_buf2) == -1)
        memset(line_buf2, 0, BUFSIZ);
    } else if (comp > 0) {
      puts(line_buf2);
      if (fgetl(fd2, BUFSIZ, line_buf2) == -1)
        memset(line_buf2, 0, BUFSIZ);
    } else if (comp < 0) {
      puts(line_buf1);
      if (fgetl(fd1, BUFSIZ, line_buf1) == -1)
        memset(line_buf1, 0, BUFSIZ);
    }
  }
  if (!feof(fd1) && comp == 0)
    puts(line_buf1);
  if (!feof(fd2) && comp == 0)
    puts(line_buf2);
  if (comp > 0)
    puts(line_buf1);
  while (!feof(fd1)) {
    if (fgetl(fd1, BUFSIZ, line_buf1) == -1) {
      memset(line_buf1, 0, BUFSIZ);
      continue;
    }
    puts(line_buf1);
  }
  while (!feof(fd2)) {
    if (fgetl(fd2, BUFSIZ, line_buf2) == -1) {
      memset(line_buf2, 0, BUFSIZ);
      continue;
    }
    puts(line_buf2);
  }
  fclose(fd1);
  fclose(fd2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11dd <main+0x4d>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1641 <main+0x4b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1259 <main+0xc9>
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rdx
mov    %rax,%rcx
lea    0xdd9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1641 <main+0x4b1>
mov    -0x30(%rbp),%rdi
lea    0xdb8(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    12c6 <main+0x136>
mov    0x2d62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    %rax,%rcx
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1641 <main+0x4b1>
mov    0x2d0b(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x80(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x40(%rbp)
mov    (%rax),%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2cbd(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    133f <main+0x1af>
mov    -0x80(%rbp),%rdi
mov    0x2ca2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x78(%rbp),%rdx
mov    -0x20(%rbp),%rdi
mov    0x2c8a(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1372 <main+0x1e2>
mov    -0x78(%rbp),%rdi
mov    0x2c6f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0x1,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x81(%rbp)
jne    13ac <main+0x21c>
mov    -0x20(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    13bf <main+0x22f>
jmp    14f2 <main+0x362>
mov    -0x78(%rbp),%rsi
mov    -0x80(%rbp),%rdi
call   1090 <cmp_cache@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    144d <main+0x2bd>
mov    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x80(%rbp),%rdx
mov    -0x18(%rbp),%rdi
mov    0x2be7(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1415 <main+0x285>
mov    -0x80(%rbp),%rdi
mov    0x2bcc(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x78(%rbp),%rdx
mov    -0x20(%rbp),%rdi
mov    0x2bb4(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1448 <main+0x2b8>
mov    -0x78(%rbp),%rdi
mov    0x2b99(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    14ed <main+0x35d>
cmpl   $0x0,-0x4c(%rbp)
jle    1498 <main+0x308>
mov    -0x78(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x78(%rbp),%rdx
mov    -0x20(%rbp),%rdi
mov    0x2b69(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1493 <main+0x303>
mov    -0x78(%rbp),%rdi
mov    0x2b4e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    14e8 <main+0x358>
cmpl   $0x0,-0x4c(%rbp)
jge    14e3 <main+0x353>
mov    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x80(%rbp),%rdx
mov    -0x18(%rbp),%rdi
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    14de <main+0x34e>
mov    -0x80(%rbp),%rdi
mov    0x2b03(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    14e3 <main+0x353>
jmp    14e8 <main+0x358>
jmp    14ed <main+0x35d>
jmp    1379 <main+0x1e9>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    1517 <main+0x387>
cmpl   $0x0,-0x4c(%rbp)
jne    1517 <main+0x387>
mov    -0x80(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x20(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    153c <main+0x3ac>
cmpl   $0x0,-0x4c(%rbp)
jne    153c <main+0x3ac>
mov    -0x78(%rbp),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x4c(%rbp)
jle    154f <main+0x3bf>
mov    -0x80(%rbp),%rdi
call   1030 <puts@plt>
jmp    1554 <main+0x3c4>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1572 <main+0x3e2>
jmp    15b8 <main+0x428>
mov    -0x80(%rbp),%rdx
mov    -0x18(%rbp),%rdi
mov    0x2a57(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    15aa <main+0x41a>
mov    -0x80(%rbp),%rdi
mov    0x2a3c(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    1554 <main+0x3c4>
mov    -0x80(%rbp),%rdi
call   1030 <puts@plt>
jmp    1554 <main+0x3c4>
jmp    15bd <main+0x42d>
mov    -0x20(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    15db <main+0x44b>
jmp    1621 <main+0x491>
mov    -0x78(%rbp),%rdx
mov    -0x20(%rbp),%rdi
mov    0x29ee(%rip),%rax
mov    (%rax),%esi
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1613 <main+0x483>
mov    -0x78(%rbp),%rdi
mov    0x29d3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    15bd <main+0x42d>
mov    -0x78(%rbp),%rdi
call   1030 <puts@plt>
jmp    15bd <main+0x42d>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x3,%edi
jne    1271 <main+0xe1>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r12
lea    0xe63(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1394 <main+0x204>
mov    %rax,%r14
lea    0xe48(%rip),%rsi
mov    %r12,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13cd <main+0x23d>
mov    %rax,%r15
mov    %rsp,-0x38(%rbp)
mov    0x2de5(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    0x0(%r13),%esi
mov    %rsp,%r12
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    123e <main+0xae>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x0(%r13),%esi
mov    %r15,%rdi
mov    %r12,%rdx
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1260 <main+0xd0>
mov    0x0(%r13),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,%rdi
call   1070 <feof@plt>
movl   $0x1,-0x2c(%rbp)
jmp    12a8 <main+0x118>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xd7c(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    14a6 <main+0x316>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1360 <main+0x1d0>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1360 <main+0x1d0>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <cmp_cache@plt>
test   %eax,%eax
mov    %eax,-0x2c(%rbp)
je     12de <main+0x14e>
jle    132d <main+0x19d>
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    1310 <main+0x180>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1310 <main+0x180>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%esi
mov    %r15,%rdi
mov    %r12,%rdx
call   1080 <fgetl@plt>
mov    %r12,%rdi
cmp    $0xffffffff,%eax
jne    12a0 <main+0x110>
jmp    1350 <main+0x1c0>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <fgetl@plt>
mov    %rbx,%rdi
cmp    $0xffffffff,%eax
jne    12a0 <main+0x110>
mov    0x0(%r13),%edx
xor    %esi,%esi
call   1050 <memset@plt>
jmp    12a0 <main+0x110>
mov    %r14,%rdi
call   1070 <feof@plt>
or     -0x2c(%rbp),%eax
jne    1375 <main+0x1e5>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
mov    -0x2c(%rbp),%ecx
or     %ecx,%eax
mov    %r12,%rdi
je     140c <main+0x27c>
mov    %rbx,%rdi
test   %ecx,%ecx
jg     140c <main+0x27c>
jmp    1411 <main+0x281>
mov    0x2c45(%rip),%rax
mov    (%rax),%r14d
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xc6c(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    14a6 <main+0x316>
mov    0x2c0c(%rip),%rax
mov    (%rax),%ebx
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xc34(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    $0xffffffff,%eax
jmp    14a6 <main+0x316>
call   1030 <puts@plt>
mov    %r14,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1458 <main+0x2c8>
mov    0x0(%r13),%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1488 <main+0x2f8>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
jmp    1411 <main+0x281>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1490 <main+0x300>
mov    0x0(%r13),%esi
mov    %r15,%rdi
mov    %r12,%rdx
call   1080 <fgetl@plt>
cmp    $0xffffffff,%eax
jne    1450 <main+0x2c0>
mov    0x0(%r13),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
jmp    1458 <main+0x2c8>
mov    %rbx,%rdi
jmp    140c <main+0x27c>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
mov    -0x38(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"usage: %s infile mergefile\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@BUFSIZ = 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 i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 -1, i32* %3
br label %197
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
store i8* %25, i8** %8
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
store i8* %28, i8** %9
%29 = load i8*, i8** %8
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %6
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %38
32: ; preds = %22
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %8
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %34, i8* %36)
store i32 -1, i32* %3
br label %197
38: ; preds = %22
%39 = load i8*, i8** %9
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %7
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %50
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %9
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %44, i8* %46)
%48 = load i32*, i32** %6
%49 = call i32 @fclose(i32* %48)
store i32 -1, i32* %3
br label %197
50: ; preds = %38
%51 = load i32, i32* @BUFSIZ
%52 = zext i32 %51 to i64
%53 = call i8* @llvm.stacksave()
store i8* %53, i8** %10
%54 = alloca i8, i64 %52
store i64 %52, i64* %11
%55 = load i32, i32* @BUFSIZ
%56 = zext i32 %55 to i64
%57 = alloca i8, i64 %56
store i64 %56, i64* %12
%58 = load i32*, i32** %6
%59 = load i32, i32* @BUFSIZ
%60 = call i32 @fgetl(i32* %58, i32 %59, i8* %54)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %65
62: ; preds = %50
%63 = load i32, i32* @BUFSIZ
%64 = call i32 @memset(i8* %54, i32 0, i32 %63)
br label %65
65: ; preds = %62, %50
%66 = load i32*, i32** %7
%67 = load i32, i32* @BUFSIZ
%68 = call i32 @fgetl(i32* %66, i32 %67, i8* %57)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %73
70: ; preds = %65
%71 = load i32, i32* @BUFSIZ
%72 = call i32 @memset(i8* %57, i32 0, i32 %71)
br label %73
73: ; preds = %70, %65
store i32 1, i32* %13
br label %74
74: ; preds = %135, %73
%75 = load i32*, i32** %6
%76 = call i32 @feof(i32* %75)
%77 = icmp ne i32 %76, 0
br i1 %77, label %83, label %78
78: ; preds = %74
%79 = load i32*, i32** %7
%80 = call i32 @feof(i32* %79)
%81 = icmp ne i32 %80, 0
%82 = xor i1 %81, true
br label %83
83: ; preds = %78, %74
%84 = phi i1 [ false, %74 ], [ %82, %78 ]
br i1 %84, label %85, label %136
85: ; preds = %83
%86 = call i32 @cmp_cache(i8* %54, i8* %57)
store i32 %86, i32* %13
%87 = load i32, i32* %13
%88 = icmp eq i32 %87, 0
br i1 %88, label %89, label %107
89: ; preds = %85
%90 = call i32 @puts(i8* %54)
%91 = load i32*, i32** %6
%92 = load i32, i32* @BUFSIZ
%93 = call i32 @fgetl(i32* %91, i32 %92, i8* %54)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %98
95: ; preds = %89
%96 = load i32, i32* @BUFSIZ
%97 = call i32 @memset(i8* %54, i32 0, i32 %96)
br label %98
98: ; preds = %95, %89
%99 = load i32*, i32** %7
%100 = load i32, i32* @BUFSIZ
%101 = call i32 @fgetl(i32* %99, i32 %100, i8* %57)
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %106
103: ; preds = %98
%104 = load i32, i32* @BUFSIZ
%105 = call i32 @memset(i8* %57, i32 0, i32 %104)
br label %106
106: ; preds = %103, %98
br label %135
107: ; preds = %85
%108 = load i32, i32* %13
%109 = icmp sgt i32 %108, 0
br i1 %109, label %110, label %120
110: ; preds = %107
%111 = call i32 @puts(i8* %57)
%112 = load i32*, i32** %7
%113 = load i32, i32* @BUFSIZ
%114 = call i32 @fgetl(i32* %112, i32 %113, i8* %57)
%115 = icmp eq i32 %114, -1
br i1 %115, label %116, label %119
116: ; preds = %110
%117 = load i32, i32* @BUFSIZ
%118 = call i32 @memset(i8* %57, i32 0, i32 %117)
br label %119
119: ; preds = %116, %110
br label %134
120: ; preds = %107
%121 = load i32, i32* %13
%122 = icmp slt i32 %121, 0
br i1 %122, label %123, label %133
123: ; preds = %120
%124 = call i32 @puts(i8* %54)
%125 = load i32*, i32** %6
%126 = load i32, i32* @BUFSIZ
%127 = call i32 @fgetl(i32* %125, i32 %126, i8* %54)
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %132
129: ; preds = %123
%130 = load i32, i32* @BUFSIZ
%131 = call i32 @memset(i8* %54, i32 0, i32 %130)
br label %132
132: ; preds = %129, %123
br label %133
133: ; preds = %132, %120
br label %134
134: ; preds = %133, %119
br label %135
135: ; preds = %134, %106
br label %74
136: ; preds = %83
%137 = load i32*, i32** %6
%138 = call i32 @feof(i32* %137)
%139 = icmp ne i32 %138, 0
br i1 %139, label %145, label %140
140: ; preds = %136
%141 = load i32, i32* %13
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %145
143: ; preds = %140
%144 = call i32 @puts(i8* %54)
br label %145
145: ; preds = %143, %140, %136
%146 = load i32*, i32** %7
%147 = call i32 @feof(i32* %146)
%148 = icmp ne i32 %147, 0
br i1 %148, label %154, label %149
149: ; preds = %145
%150 = load i32, i32* %13
%151 = icmp eq i32 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %149
%153 = call i32 @puts(i8* %57)
br label %154
154: ; preds = %152, %149, %145
%155 = load i32, i32* %13
%156 = icmp sgt i32 %155, 0
br i1 %156, label %157, label %159
157: ; preds = %154
%158 = call i32 @puts(i8* %54)
br label %159
159: ; preds = %157, %154
br label %160
160: ; preds = %173, %170, %159
%161 = load i32*, i32** %6
%162 = call i32 @feof(i32* %161)
%163 = icmp ne i32 %162, 0
%164 = xor i1 %163, true
br i1 %164, label %165, label %175
165: ; preds = %160
%166 = load i32*, i32** %6
%167 = load i32, i32* @BUFSIZ
%168 = call i32 @fgetl(i32* %166, i32 %167, i8* %54)
%169 = icmp eq i32 %168, -1
br i1 %169, label %170, label %173
170: ; preds = %165
%171 = load i32, i32* @BUFSIZ
%172 = call i32 @memset(i8* %54, i32 0, i32 %171)
br label %160
173: ; preds = %165
%174 = call i32 @puts(i8* %54)
br label %160
175: ; preds = %160
br label %176
176: ; preds = %189, %186, %175
%177 = load i32*, i32** %7
%178 = call i32 @feof(i32* %177)
%179 = icmp ne i32 %178, 0
%180 = xor i1 %179, true
br i1 %180, label %181, label %191
181: ; preds = %176
%182 = load i32*, i32** %7
%183 = load i32, i32* @BUFSIZ
%184 = call i32 @fgetl(i32* %182, i32 %183, i8* %57)
%185 = icmp eq i32 %184, -1
br i1 %185, label %186, label %189
186: ; preds = %181
%187 = load i32, i32* @BUFSIZ
%188 = call i32 @memset(i8* %57, i32 0, i32 %187)
br label %176
189: ; preds = %181
%190 = call i32 @puts(i8* %57)
br label %176
191: ; preds = %176
%192 = load i32*, i32** %6
%193 = call i32 @fclose(i32* %192)
%194 = load i32*, i32** %7
%195 = call i32 @fclose(i32* %194)
store i32 0, i32* %3
%196 = load i8*, i8** %10
br label %197
197: ; preds = %191, %42, %32, %16
%198 = load i32, i32* %3
ret i32 %198
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"usage: %s infile mergefile\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@BUFSIZ = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %142
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = load i32, i32* @stderr
%17 = load i32, i32* @errno
%18 = tail call i8* @strerror(i32 %17)
%19 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* %18)
br label %142
20: ; preds = %8
%21 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %26)
%28 = tail call i32 @fclose(i32* %13)
br label %142
29: ; preds = %20
%30 = load i32, i32* @BUFSIZ
%31 = zext i32 %30 to i64
%32 = tail call i8* @llvm.stacksave()
%33 = alloca i8, i64 %31
%34 = load i32, i32* @BUFSIZ
%35 = zext i32 %34 to i64
%36 = alloca i8, i64 %35
%37 = call i32 @fgetl(i32* %13, i32 %34, i8* %33)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %42
39: ; preds = %29
%40 = load i32, i32* @BUFSIZ
%41 = call i32 @memset(i8* %33, i32 0, i32 %40)
br label %42
42: ; preds = %39, %29
%43 = load i32, i32* @BUFSIZ
%44 = call i32 @fgetl(i32* %21, i32 %43, i8* %36)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = load i32, i32* @BUFSIZ
%48 = call i32 @memset(i8* %36, i32 0, i32 %47)
br label %49
49: ; preds = %46, %42
%50 = call i32 @feof(i32* %13)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %92
52: ; preds = %49
%53 = call i32 @feof(i32* %21)
%54 = icmp eq i32 %53, 0
br i1 %54, label %58, label %92
55: ; preds = %89
%56 = call i32 @feof(i32* %21)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %92
58: ; preds = %52, %55
%59 = call i32 @cmp_cache(i8* %33, i8* %36)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %73
61: ; preds = %58
%62 = call i32 @puts(i8* %33)
%63 = load i32, i32* @BUFSIZ
%64 = call i32 @fgetl(i32* %13, i32 %63, i8* %33)
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load i32, i32* @BUFSIZ
%68 = call i32 @memset(i8* %33, i32 0, i32 %67)
br label %69
69: ; preds = %66, %61
%70 = load i32, i32* @BUFSIZ
%71 = call i32 @fgetl(i32* %21, i32 %70, i8* %36)
%72 = icmp eq i32 %71, -1
br i1 %72, label %85, label %89
73: ; preds = %58
%74 = icmp sgt i32 %59, 0
br i1 %74, label %75, label %80
75: ; preds = %73
%76 = call i32 @puts(i8* %36)
%77 = load i32, i32* @BUFSIZ
%78 = call i32 @fgetl(i32* %21, i32 %77, i8* %36)
%79 = icmp eq i32 %78, -1
br i1 %79, label %85, label %89
80: ; preds = %73
%81 = call i32 @puts(i8* %33)
%82 = load i32, i32* @BUFSIZ
%83 = call i32 @fgetl(i32* %13, i32 %82, i8* %33)
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %89
85: ; preds = %80, %75, %69
%86 = phi i8* [ %36, %69 ], [ %36, %75 ], [ %33, %80 ]
%87 = load i32, i32* @BUFSIZ
%88 = call i32 @memset(i8* %86, i32 0, i32 %87)
br label %89
89: ; preds = %85, %75, %80, %69
%90 = call i32 @feof(i32* %13)
%91 = icmp eq i32 %90, 0
br i1 %91, label %55, label %92
92: ; preds = %89, %55, %52, %49
%93 = phi i32 [ 1, %49 ], [ 1, %52 ], [ %59, %55 ], [ %59, %89 ]
%94 = call i32 @feof(i32* %13)
%95 = icmp eq i32 %94, 0
%96 = icmp eq i32 %93, 0
%97 = select i1 %95, i1 %96, i1 false
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = call i32 @puts(i8* %33)
br label %100
100: ; preds = %98, %92
%101 = call i32 @feof(i32* %21)
%102 = icmp eq i32 %101, 0
%103 = select i1 %102, i1 %96, i1 false
br i1 %103, label %106, label %104
104: ; preds = %100
%105 = icmp sgt i32 %93, 0
br i1 %105, label %106, label %109
106: ; preds = %104, %100
%107 = phi i8* [ %36, %100 ], [ %33, %104 ]
%108 = call i32 @puts(i8* %107)
br label %109
109: ; preds = %106, %104
%110 = call i32 @feof(i32* %13)
%111 = icmp eq i32 %110, 0
br i1 %111, label %115, label %112
112: ; preds = %122, %109
%113 = call i32 @feof(i32* %21)
%114 = icmp eq i32 %113, 0
br i1 %114, label %127, label %139
115: ; preds = %109, %122
%116 = load i32, i32* @BUFSIZ
%117 = call i32 @fgetl(i32* %13, i32 %116, i8* %33)
%118 = icmp eq i32 %117, -1
br i1 %118, label %119, label %125
119: ; preds = %115
%120 = load i32, i32* @BUFSIZ
%121 = call i32 @memset(i8* %33, i32 0, i32 %120)
br label %122
122: ; preds = %119, %125
%123 = call i32 @feof(i32* %13)
%124 = icmp eq i32 %123, 0
br i1 %124, label %115, label %112
125: ; preds = %115
%126 = call i32 @puts(i8* %33)
br label %122
127: ; preds = %112, %134
%128 = load i32, i32* @BUFSIZ
%129 = call i32 @fgetl(i32* %21, i32 %128, i8* %36)
%130 = icmp eq i32 %129, -1
br i1 %130, label %131, label %137
131: ; preds = %127
%132 = load i32, i32* @BUFSIZ
%133 = call i32 @memset(i8* %36, i32 0, i32 %132)
br label %134
134: ; preds = %131, %137
%135 = call i32 @feof(i32* %21)
%136 = icmp eq i32 %135, 0
br i1 %136, label %127, label %139
137: ; preds = %127
%138 = call i32 @puts(i8* %36)
br label %134
139: ; preds = %134, %112
%140 = call i32 @fclose(i32* %13)
%141 = call i32 @fclose(i32* %21)
br label %142
142: ; preds = %15, %23, %139, %4
%143 = phi i32 [ -1, %4 ], [ -1, %15 ], [ -1, %23 ], [ 0, %139 ]
ret i32 %143
}