#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 /*<<< orphan*/ add(char *, char *, size_t, char *, size_t);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fwrite(char *, int, size_t, int /*<<< orphan*/);
size_t get_line_len(char *, char *);
scalar_t__ malloc(size_t);
size_t read_segment(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s file1 file2\nfile1 can be \"-\" for stdin.",
            argv[0]);
    return (-1);
  }
  size_t sz_buf = (32 * 1024 * 1024) + (8 * 1024);
  char *buf_in1 = (char *)malloc(sz_buf);
  char *buf_in2 = (char *)malloc(sz_buf);
  char *buf_out = (char *)malloc(sz_buf);
  char *ptr_out = buf_out;
  FILE *fd1;
  FILE *fd2;
  if (!strcmp(argv[1], "-")) {
    fd1 = stdin;
  } else {
    if ((fd1 = fopen(argv[1], "rb")) == NULL) {
      fprintf(stderr, "%s: %s\n", argv[1], strerror(errno));
      free(buf_in1);
      free(buf_in2);
      free(buf_out);
      return (-1);
    }
  }
  if ((fd2 = fopen(argv[2], "rb")) == NULL) {
    fprintf(stderr, "%s: %s\n", argv[2], strerror(errno));
    free(buf_in1);
    free(buf_in2);
    free(buf_out);
    fclose(fd1);
    return (-1);
  }
  while (!feof(fd1)) {
    size_t real_sz1 = read_segment(buf_in1, fd1);
    char *max_in1 = buf_in1 + real_sz1;
    char *ptr_in1;
    size_t len_in1;
    for (ptr_in1 = buf_in1; ptr_in1 < max_in1; ptr_in1 += len_in1 + 1) {
      len_in1 = get_line_len(ptr_in1, max_in1);
      size_t vir_in1 = len_in1;
      while (vir_in1) {
        if (ptr_in1[vir_in1 - 1] != '\r')
          break;
        vir_in1--;
      }
      if (vir_in1 > 32)
        continue;
      while (!feof(fd2)) {
        size_t real_sz2 = read_segment(buf_in2, fd2);
        char *max_in2 = buf_in2 + real_sz2;
        char *ptr_in2;
        size_t len_in2;
        for (ptr_in2 = buf_in2; ptr_in2 < max_in2; ptr_in2 += len_in2 + 1) {
          len_in2 = get_line_len(ptr_in2, max_in2);
          size_t vir_in2 = len_in2;
          while (vir_in2) {
            if (ptr_in2[vir_in2 - 1] != '\r')
              break;
            vir_in2--;
          }
          if (vir_in2 > 32)
            continue;
          size_t len_out = ptr_out - buf_out;
          size_t len_add = vir_in1 + vir_in2 + 1;
          if ((len_out + len_add) < (32 * 1024 * 1024)) {
            add(ptr_out, ptr_in1, vir_in1, ptr_in2, vir_in2);
            ptr_out += len_add;
          } else {
            size_t len_out = ptr_out - buf_out;
            fwrite(buf_out, 1, len_out, stdout);
            ptr_out = buf_out;
            add(ptr_out, ptr_in1, vir_in1, ptr_in2, vir_in2);
            ptr_out += len_add;
          }
        }
      }
      rewind(fd2);
    }
  }
  size_t len_out = ptr_out - buf_out;
  fwrite(buf_out, 1, len_out, stdout);
  fclose(fd2);
  fclose(fd1);
  free(buf_out);
  free(buf_in2);
  free(buf_in1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     121d <main+0x4d>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d8 <main+0x508>
movq   $0x2002000,-0x18(%rbp)
02
mov    -0x18(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdcf(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1284 <main+0xb4>
mov    0x2d70(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    131c <main+0x14c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xda1(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1317 <main+0x147>
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0xc0(%rbp)
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xc4(%rbp),%edi
mov    -0xc0(%rbp),%rdx
mov    %rax,%rcx
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d8 <main+0x508>
jmp    131c <main+0x14c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd09(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    13b8 <main+0x1e8>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xd0(%rbp)
mov    0x2c6d(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0xd4(%rbp),%edi
mov    -0xd0(%rbp),%rdx
mov    %rax,%rcx
lea    0xcb6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d8 <main+0x508>
jmp    13bd <main+0x1ed>
mov    -0x40(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13db <main+0x20b>
jmp    1674 <main+0x4a4>
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   10a0 <read_segment@plt>
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
add    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
cmp    -0x58(%rbp),%rax
jae    166f <main+0x49f>
mov    -0x60(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   10c0 <get_line_len@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     1461 <main+0x291>
mov    -0x60(%rbp),%rax
mov    -0x70(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1450 <main+0x280>
jmp    1461 <main+0x291>
mov    -0x70(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x70(%rbp)
jmp    1427 <main+0x257>
cmpq   $0x20,-0x70(%rbp)
jbe    1471 <main+0x2a1>
jmp    165a <main+0x48a>
jmp    1476 <main+0x2a6>
mov    -0x48(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1494 <main+0x2c4>
jmp    1651 <main+0x481>
mov    -0x28(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <read_segment@plt>
mov    %rax,-0x78(%rbp)
mov    -0x28(%rbp),%rax
add    -0x78(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0x80(%rbp),%rax
jae    164c <main+0x47c>
mov    -0x88(%rbp),%rdi
mov    -0x80(%rbp),%rsi
call   10c0 <get_line_len@plt>
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
je     153b <main+0x36b>
mov    -0x88(%rbp),%rax
mov    -0x98(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     1524 <main+0x354>
jmp    153b <main+0x36b>
mov    -0x98(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x98(%rbp)
jmp    14f2 <main+0x322>
cmpq   $0x20,-0x98(%rbp)
20
jbe    154e <main+0x37e>
jmp    162e <main+0x45e>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x70(%rbp),%rax
add    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa0(%rbp),%rax
add    -0xa8(%rbp),%rax
cmp    $0x2000000,%rax
jae    15c3 <main+0x3f3>
mov    -0x38(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    -0x98(%rbp),%r8
call   1040 <add@plt>
mov    -0xa8(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1629 <main+0x459>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xb0(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0xb0(%rbp),%rdx
mov    0x29e1(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x88(%rbp),%rcx
mov    -0x98(%rbp),%r8
call   1040 <add@plt>
mov    -0xa8(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    162e <main+0x45e>
mov    -0x90(%rbp),%rax
add    $0x1,%rax
add    -0x88(%rbp),%rax
mov    %rax,-0x88(%rbp)
jmp    14bc <main+0x2ec>
jmp    1476 <main+0x2a6>
mov    -0x48(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x68(%rbp),%rax
add    $0x1,%rax
add    -0x60(%rbp),%rax
mov    %rax,-0x60(%rbp)
jmp    1400 <main+0x230>
jmp    13bd <main+0x1ed>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0xb8(%rbp),%rdx
mov    0x2930(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
mov    -0x48(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x40(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    1297 <main+0xc7>
mov    $0x2002000,%edi
call   10b0 <malloc@plt>
mov    %rax,%r12
mov    $0x2002000,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    $0x2002000,%edi
call   10b0 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    0x8(%r14),%r15
lea    0xe14(%rip),%rsi
mov    %r15,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12b6 <main+0xe6>
lea    0xdff(%rip),%rsi
mov    %r15,%rdi
call   10d0 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12c0 <main+0xf0>
mov    0x2d8c(%rip),%rax
mov    (%rax),%r15d
mov    0x8(%r14),%r14
mov    0x2d76(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xdcf(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
jmp    138f <main+0x1bf>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xd56(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    138f <main+0x1bf>
mov    0x2d2b(%rip),%rax
mov    (%rax),%r13
mov    0x10(%r14),%rdi
lea    0xd69(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     133a <main+0x16a>
mov    %rax,%rbp
mov    %r13,%rdi
call   1090 <feof@plt>
mov    0x8(%rsp),%r15
test   %eax,%eax
je     13a3 <main+0x1d3>
mov    0x8(%rsp),%r14
sub    %r14,%r15
mov    0x2ccc(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   10e0 <fwrite@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    1394 <main+0x1c4>
mov    0x2c97(%rip),%rax
mov    (%rax),%r15d
mov    0x10(%r14),%r14
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xcda(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    $0xffffffff,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%r15
mov    %r15,%rax
neg    %rax
mov    %rax,0x28(%rsp)
mov    %r12,0x30(%rsp)
mov    %rbx,0x50(%rsp)
mov    %r13,0x20(%rsp)
mov    %rbp,0x48(%rsp)
jmp    13e5 <main+0x215>
nopl   0x0(%rax)
mov    0x20(%rsp),%r13
mov    %r13,%rdi
call   1090 <feof@plt>
test   %eax,%eax
jne    12ed <main+0x11d>
mov    %r12,%rdi
mov    %r13,%rsi
call   10a0 <read_segment@plt>
test   %rax,%rax
jle    13d0 <main+0x200>
mov    %rax,%r14
add    %r12,%r14
mov    %r12,%rdi
mov    %r14,0x38(%rsp)
jmp    1438 <main+0x268>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,%rdi
call   1060 <rewind@plt>
mov    0x30(%rsp),%r12
mov    0x38(%rsp),%r14
mov    0x40(%rsp),%r13
mov    0x10(%rsp),%rdi
add    %r13,%rdi
add    $0x1,%rdi
cmp    %r14,%rdi
jae    13d0 <main+0x200>
mov    %rdi,0x10(%rsp)
mov    %r14,%rsi
call   10c0 <get_line_len@plt>
mov    %rax,%r13
add    $0x1,%rax
nopl   0x0(%rax)
cmp    $0x1,%rax
je     1480 <main+0x2b0>
lea    -0x1(%rax),%rdx
mov    0x10(%rsp),%rcx
cmpb   $0xd,-0x2(%rcx,%rax,1)
mov    %rdx,%rax
je     1450 <main+0x280>
mov    %rdx,%rax
mov    %rdx,0x18(%rsp)
cmp    $0x20,%rdx
ja     1427 <main+0x257>
jmp    1487 <main+0x2b7>
nopl   0x0(%rax)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
mov    %rbp,%rdi
call   1090 <feof@plt>
test   %eax,%eax
mov    %r13,0x40(%rsp)
jne    1410 <main+0x240>
mov    0x28(%rsp),%rax
mov    0x18(%rsp),%rcx
add    %rcx,%rax
mov    %rax,0x58(%rsp)
jmp    14ca <main+0x2fa>
mov    0x48(%rsp),%rbp
mov    %rbp,%rdi
call   1090 <feof@plt>
test   %eax,%eax
mov    0x50(%rsp),%rbx
jne    1410 <main+0x240>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <read_segment@plt>
test   %rax,%rax
jle    14b0 <main+0x2e0>
mov    %rax,%rbp
add    %rbx,%rbp
mov    %rbx,%r13
mov    %rbp,0x60(%rsp)
jmp    1522 <main+0x352>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rsi
mov    %r15,%rdi
mov    0x18(%rsp),%rdx
mov    %r13,%rcx
mov    %r12,%r8
mov    %rdx,%rbp
call   1040 <add@plt>
add    %rbp,%r15
add    %r14,%r15
mov    0x60(%rsp),%rbp
add    %rbx,%r13
add    $0x1,%r13
cmp    %rbp,%r13
jae    14b0 <main+0x2e0>
mov    %r13,%rdi
mov    %rbp,%rsi
call   10c0 <get_line_len@plt>
mov    %rax,%rbx
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%r14
cmp    $0x1,%rax
je     155b <main+0x38b>
lea    -0x1(%r14),%rax
cmpb   $0xd,-0x2(%r13,%r14,1)
je     1540 <main+0x370>
cmp    $0x20,%rax
ja     1516 <main+0x346>
mov    0x58(%rsp),%rax
add    %r15,%rax
add    %r14,%rax
lea    -0x1(%r14),%r12
cmp    $0x2000000,%rax
jb     14f0 <main+0x320>
mov    0x8(%rsp),%rbp
sub    %rbp,%r15
mov    0x2a43(%rip),%rax
mov    (%rax),%ecx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   10e0 <fwrite@plt>
mov    %rbp,%r15
jmp    14f0 <main+0x320>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"usage: %s file1 file2\0Afile1 can be \22-\22 for stdin.\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i64
%26 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 3
br i1 %28, label %29, label %35
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %33)
store i32 -1, i32* %3
br label %260
35: ; preds = %2
store i64 33562624, i64* %6
%36 = load i64, i64* %6
%37 = call i64 @malloc(i64 %36)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %7
%39 = load i64, i64* %6
%40 = call i64 @malloc(i64 %39)
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %8
%42 = load i64, i64* %6
%43 = call i64 @malloc(i64 %42)
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %9
%45 = load i8*, i8** %9
store i8* %45, i8** %10
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = load i8*, i8** %47
%49 = call i32 @strcmp(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%50 = icmp ne i32 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %35
%52 = load i32*, i32** @stdin
store i32* %52, i32** %11
br label %74
53: ; preds = %35
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = call i32* @fopen(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %57, i32** %11
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %73
59: ; preds = %53
%60 = load i32, i32* @stderr
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 1
%63 = load i8*, i8** %62
%64 = load i32, i32* @errno
%65 = call i8* @strerror(i32 %64)
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %63, i8* %65)
%67 = load i8*, i8** %7
%68 = call i32 @free(i8* %67)
%69 = load i8*, i8** %8
%70 = call i32 @free(i8* %69)
%71 = load i8*, i8** %9
%72 = call i32 @free(i8* %71)
store i32 -1, i32* %3
br label %260
73: ; preds = %53
br label %74
74: ; preds = %73, %51
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 2
%77 = load i8*, i8** %76
%78 = call i32* @fopen(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %78, i32** %12
%79 = icmp eq i32* %78, null
br i1 %79, label %80, label %96
80: ; preds = %74
%81 = load i32, i32* @stderr
%82 = load i8**, i8*** %5
%83 = getelementptr inbounds i8*, i8** %82, i64 2
%84 = load i8*, i8** %83
%85 = load i32, i32* @errno
%86 = call i8* @strerror(i32 %85)
%87 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %84, i8* %86)
%88 = load i8*, i8** %7
%89 = call i32 @free(i8* %88)
%90 = load i8*, i8** %8
%91 = call i32 @free(i8* %90)
%92 = load i8*, i8** %9
%93 = call i32 @free(i8* %92)
%94 = load i32*, i32** %11
%95 = call i32 @fclose(i32* %94)
store i32 -1, i32* %3
br label %260
96: ; preds = %74
br label %97
97: ; preds = %239, %96
%98 = load i32*, i32** %11
%99 = call i32 @feof(i32* %98)
%100 = icmp ne i32 %99, 0
%101 = xor i1 %100, true
br i1 %101, label %102, label %240
102: ; preds = %97
%103 = load i8*, i8** %7
%104 = load i32*, i32** %11
%105 = call i64 @read_segment(i8* %103, i32* %104)
store i64 %105, i64* %13
%106 = load i8*, i8** %7
%107 = load i64, i64* %13
%108 = getelementptr inbounds i8, i8* %106, i64 %107
store i8* %108, i8** %14
%109 = load i8*, i8** %7
store i8* %109, i8** %15
br label %110
110: ; preds = %234, %102
%111 = load i8*, i8** %15
%112 = load i8*, i8** %14
%113 = icmp ult i8* %111, %112
br i1 %113, label %114, label %239
114: ; preds = %110
%115 = load i8*, i8** %15
%116 = load i8*, i8** %14
%117 = call i64 @get_line_len(i8* %115, i8* %116)
store i64 %117, i64* %16
%118 = load i64, i64* %16
store i64 %118, i64* %17
br label %119
119: ; preds = %131, %114
%120 = load i64, i64* %17
%121 = icmp ne i64 %120, 0
br i1 %121, label %122, label %134
122: ; preds = %119
%123 = load i8*, i8** %15
%124 = load i64, i64* %17
%125 = sub i64 %124, 1
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp ne i32 %128, 13
br i1 %129, label %130, label %131
130: ; preds = %122
br label %134
131: ; preds = %122
%132 = load i64, i64* %17
%133 = add i64 %132, -1
store i64 %133, i64* %17
br label %119
134: ; preds = %130, %119
%135 = load i64, i64* %17
%136 = icmp ugt i64 %135, 32
br i1 %136, label %137, label %138
137: ; preds = %134
br label %234
138: ; preds = %134
br label %139
139: ; preds = %230, %138
%140 = load i32*, i32** %12
%141 = call i32 @feof(i32* %140)
%142 = icmp ne i32 %141, 0
%143 = xor i1 %142, true
br i1 %143, label %144, label %231
144: ; preds = %139
%145 = load i8*, i8** %8
%146 = load i32*, i32** %12
%147 = call i64 @read_segment(i8* %145, i32* %146)
store i64 %147, i64* %18
%148 = load i8*, i8** %8
%149 = load i64, i64* %18
%150 = getelementptr inbounds i8, i8* %148, i64 %149
store i8* %150, i8** %19
%151 = load i8*, i8** %8
store i8* %151, i8** %20
br label %152
152: ; preds = %225, %144
%153 = load i8*, i8** %20
%154 = load i8*, i8** %19
%155 = icmp ult i8* %153, %154
br i1 %155, label %156, label %230
156: ; preds = %152
%157 = load i8*, i8** %20
%158 = load i8*, i8** %19
%159 = call i64 @get_line_len(i8* %157, i8* %158)
store i64 %159, i64* %21
%160 = load i64, i64* %21
store i64 %160, i64* %22
br label %161
161: ; preds = %173, %156
%162 = load i64, i64* %22
%163 = icmp ne i64 %162, 0
br i1 %163, label %164, label %176
164: ; preds = %161
%165 = load i8*, i8** %20
%166 = load i64, i64* %22
%167 = sub i64 %166, 1
%168 = getelementptr inbounds i8, i8* %165, i64 %167
%169 = load i8, i8* %168
%170 = sext i8 %169 to i32
%171 = icmp ne i32 %170, 13
br i1 %171, label %172, label %173
172: ; preds = %164
br label %176
173: ; preds = %164
%174 = load i64, i64* %22
%175 = add i64 %174, -1
store i64 %175, i64* %22
br label %161
176: ; preds = %172, %161
%177 = load i64, i64* %22
%178 = icmp ugt i64 %177, 32
br i1 %178, label %179, label %180
179: ; preds = %176
br label %225
180: ; preds = %176
%181 = load i8*, i8** %10
%182 = load i8*, i8** %9
%183 = ptrtoint i8* %181 to i64
%184 = ptrtoint i8* %182 to i64
%185 = sub i64 %183, %184
store i64 %185, i64* %23
%186 = load i64, i64* %17
%187 = load i64, i64* %22
%188 = add i64 %186, %187
%189 = add i64 %188, 1
store i64 %189, i64* %24
%190 = load i64, i64* %23
%191 = load i64, i64* %24
%192 = add i64 %190, %191
%193 = icmp ult i64 %192, 33554432
br i1 %193, label %194, label %204
194: ; preds = %180
%195 = load i8*, i8** %10
%196 = load i8*, i8** %15
%197 = load i64, i64* %17
%198 = load i8*, i8** %20
%199 = load i64, i64* %22
%200 = call i32 @add(i8* %195, i8* %196, i64 %197, i8* %198, i64 %199)
%201 = load i64, i64* %24
%202 = load i8*, i8** %10
%203 = getelementptr inbounds i8, i8* %202, i64 %201
store i8* %203, i8** %10
br label %224
204: ; preds = %180
%205 = load i8*, i8** %10
%206 = load i8*, i8** %9
%207 = ptrtoint i8* %205 to i64
%208 = ptrtoint i8* %206 to i64
%209 = sub i64 %207, %208
store i64 %209, i64* %25
%210 = load i8*, i8** %9
%211 = load i64, i64* %25
%212 = load i32, i32* @stdout
%213 = call i32 @fwrite(i8* %210, i32 1, i64 %211, i32 %212)
%214 = load i8*, i8** %9
store i8* %214, i8** %10
%215 = load i8*, i8** %10
%216 = load i8*, i8** %15
%217 = load i64, i64* %17
%218 = load i8*, i8** %20
%219 = load i64, i64* %22
%220 = call i32 @add(i8* %215, i8* %216, i64 %217, i8* %218, i64 %219)
%221 = load i64, i64* %24
%222 = load i8*, i8** %10
%223 = getelementptr inbounds i8, i8* %222, i64 %221
store i8* %223, i8** %10
br label %224
224: ; preds = %204, %194
br label %225
225: ; preds = %224, %179
%226 = load i64, i64* %21
%227 = add i64 %226, 1
%228 = load i8*, i8** %20
%229 = getelementptr inbounds i8, i8* %228, i64 %227
store i8* %229, i8** %20
br label %152
230: ; preds = %152
br label %139
231: ; preds = %139
%232 = load i32*, i32** %12
%233 = call i32 @rewind(i32* %232)
br label %234
234: ; preds = %231, %137
%235 = load i64, i64* %16
%236 = add i64 %235, 1
%237 = load i8*, i8** %15
%238 = getelementptr inbounds i8, i8* %237, i64 %236
store i8* %238, i8** %15
br label %110
239: ; preds = %110
br label %97
240: ; preds = %97
%241 = load i8*, i8** %10
%242 = load i8*, i8** %9
%243 = ptrtoint i8* %241 to i64
%244 = ptrtoint i8* %242 to i64
%245 = sub i64 %243, %244
store i64 %245, i64* %26
%246 = load i8*, i8** %9
%247 = load i64, i64* %26
%248 = load i32, i32* @stdout
%249 = call i32 @fwrite(i8* %246, i32 1, i64 %247, i32 %248)
%250 = load i32*, i32** %12
%251 = call i32 @fclose(i32* %250)
%252 = load i32*, i32** %11
%253 = call i32 @fclose(i32* %252)
%254 = load i8*, i8** %9
%255 = call i32 @free(i8* %254)
%256 = load i8*, i8** %8
%257 = call i32 @free(i8* %256)
%258 = load i8*, i8** %7
%259 = call i32 @free(i8* %258)
store i32 0, i32* %3
br label %260
260: ; preds = %240, %80, %59, %29
%261 = load i32, i32* %3
ret i32 %261
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"usage: %s file1 file2\0Afile1 can be \22-\22 for stdin.\00"
@.str.1 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
@stdout = 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 ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %141
8: ; preds = %2
%9 = tail call i64 @malloc(i64 33562624)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i64 @malloc(i64 33562624)
%12 = inttoptr i64 %11 to i8*
%13 = tail call i64 @malloc(i64 33562624)
%14 = inttoptr i64 %13 to i8*
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @strcmp(i8* dereferenceable(1) %16, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %8
%20 = load i32*, i32** @stdin
br label %33
21: ; preds = %8
%22 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %15
%27 = load i32, i32* @errno
%28 = tail call i8* @strerror(i32 %27)
%29 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %26, i8* %28)
%30 = tail call i32 @free(i8* %10)
%31 = tail call i32 @free(i8* %12)
%32 = tail call i32 @free(i8* %14)
br label %141
33: ; preds = %21, %19
%34 = phi i32* [ %22, %21 ], [ %20, %19 ]
%35 = getelementptr inbounds i8*, i8** %1, i64 2
%36 = load i8*, i8** %35
%37 = tail call i32* @fopen(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp eq i32* %37, null
br i1 %38, label %42, label %39
39: ; preds = %33
%40 = tail call i32 @feof(i32* %34)
%41 = icmp eq i32 %40, 0
br i1 %41, label %56, label %130
42: ; preds = %33
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %35
%45 = load i32, i32* @errno
%46 = tail call i8* @strerror(i32 %45)
%47 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %44, i8* %46)
%48 = tail call i32 @free(i8* %10)
%49 = tail call i32 @free(i8* %12)
%50 = tail call i32 @free(i8* %14)
%51 = tail call i32 @fclose(i32* %34)
br label %141
52: ; preds = %125, %56
%53 = phi i8* [ %57, %56 ], [ %126, %125 ]
%54 = tail call i32 @feof(i32* %34)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %130
56: ; preds = %39, %52
%57 = phi i8* [ %53, %52 ], [ %14, %39 ]
%58 = tail call i64 @read_segment(i8* %10, i32* %34)
%59 = getelementptr inbounds i8, i8* %10, i64 %58
%60 = icmp sgt i64 %58, 0
br i1 %60, label %61, label %52
61: ; preds = %56, %125
%62 = phi i8* [ %126, %125 ], [ %57, %56 ]
%63 = phi i8* [ %128, %125 ], [ %10, %56 ]
%64 = tail call i64 @get_line_len(i8* %63, i8* %59)
br label %65
65: ; preds = %68, %61
%66 = phi i64 [ %64, %61 ], [ %69, %68 ]
%67 = icmp eq i64 %66, 0
br i1 %67, label %75, label %68
68: ; preds = %65
%69 = add i64 %66, -1
%70 = getelementptr inbounds i8, i8* %63, i64 %69
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 13
br i1 %72, label %65, label %73
73: ; preds = %68
%74 = icmp ugt i64 %66, 32
br i1 %74, label %125, label %75
75: ; preds = %65, %73
%76 = phi i64 [ %66, %73 ], [ 0, %65 ]
%77 = tail call i32 @feof(i32* %37)
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %122
79: ; preds = %75
%80 = add nuw nsw i64 %76, 1
br label %85
81: ; preds = %117, %85
%82 = phi i8* [ %86, %85 ], [ %118, %117 ]
%83 = tail call i32 @feof(i32* %37)
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %122
85: ; preds = %79, %81
%86 = phi i8* [ %62, %79 ], [ %82, %81 ]
%87 = tail call i64 @read_segment(i8* %12, i32* %37)
%88 = getelementptr inbounds i8, i8* %12, i64 %87
%89 = icmp sgt i64 %87, 0
br i1 %89, label %90, label %81
90: ; preds = %85, %117
%91 = phi i8* [ %118, %117 ], [ %86, %85 ]
%92 = phi i8* [ %120, %117 ], [ %12, %85 ]
%93 = tail call i64 @get_line_len(i8* %92, i8* %88)
br label %94
94: ; preds = %97, %90
%95 = phi i64 [ %93, %90 ], [ %98, %97 ]
%96 = icmp eq i64 %95, 0
br i1 %96, label %104, label %97
97: ; preds = %94
%98 = add i64 %95, -1
%99 = getelementptr inbounds i8, i8* %92, i64 %98
%100 = load i8, i8* %99
%101 = icmp eq i8 %100, 13
br i1 %101, label %94, label %102
102: ; preds = %97
%103 = icmp ugt i64 %95, 32
br i1 %103, label %117, label %104
104: ; preds = %94, %102
%105 = ptrtoint i8* %91 to i64
%106 = sub i64 %105, %13
%107 = add i64 %80, %95
%108 = add i64 %107, %106
%109 = icmp ult i64 %108, 33554432
br i1 %109, label %113, label %110
110: ; preds = %104
%111 = load i32, i32* @stdout
%112 = tail call i32 @fwrite(i8* %14, i32 1, i64 %106, i32 %111)
br label %113
113: ; preds = %104, %110
%114 = phi i8* [ %14, %110 ], [ %91, %104 ]
%115 = tail call i32 @add(i8* %114, i8* %63, i64 %76, i8* %92, i64 %95)
%116 = getelementptr inbounds i8, i8* %114, i64 %107
br label %117
117: ; preds = %102, %113
%118 = phi i8* [ %116, %113 ], [ %91, %102 ]
%119 = add i64 %93, 1
%120 = getelementptr inbounds i8, i8* %92, i64 %119
%121 = icmp ult i8* %120, %88
br i1 %121, label %90, label %81
122: ; preds = %81, %75
%123 = phi i8* [ %62, %75 ], [ %82, %81 ]
%124 = tail call i32 @rewind(i32* %37)
br label %125
125: ; preds = %73, %122
%126 = phi i8* [ %123, %122 ], [ %62, %73 ]
%127 = add i64 %64, 1
%128 = getelementptr inbounds i8, i8* %63, i64 %127
%129 = icmp ult i8* %128, %59
br i1 %129, label %61, label %52
130: ; preds = %52, %39
%131 = phi i8* [ %14, %39 ], [ %53, %52 ]
%132 = ptrtoint i8* %131 to i64
%133 = sub i64 %132, %13
%134 = load i32, i32* @stdout
%135 = tail call i32 @fwrite(i8* %14, i32 1, i64 %133, i32 %134)
%136 = tail call i32 @fclose(i32* %37)
%137 = tail call i32 @fclose(i32* %34)
%138 = tail call i32 @free(i8* %14)
%139 = tail call i32 @free(i8* %12)
%140 = tail call i32 @free(i8* %10)
br label %141
141: ; preds = %24, %42, %130, %4
%142 = phi i32 [ -1, %4 ], [ -1, %24 ], [ -1, %42 ], [ 0, %130 ]
ret i32 %142
}