#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ u_char;
typedef int ssize_t;
typedef int off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int O_CREAT;
int O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int close(int);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ errx(int, char *, ...);
scalar_t__ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(scalar_t__ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(scalar_t__ *);
scalar_t__ fseeko(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ *malloc(int);
scalar_t__ memcmp(scalar_t__ *, char *, int);
int offtin(scalar_t__ *);
int open(char *, int, int);
int read(int, scalar_t__ *, int);
int write(int, scalar_t__ *, int);
int main(int argc, char *argv[]) {
  FILE *f, *cpf, *dpf, *epf;
  int fd;
  ssize_t oldsize, newsize;
  ssize_t bzctrllen, bzdatalen;
  u_char header[32], buf[8];
  u_char *old, *new;
  off_t oldpos, newpos;
  off_t ctrl[3];
  off_t lenread;
  off_t i;
  if (argc != 4)
    errx(1, "usage: %s oldfile newfile patchfile\n", argv[0]);
  if ((f = fopen(argv[3], "r")) == NULL)
    err(1, "fopen(%s)", argv[3]);
  if (fread(header, 1, 32, f) < 32) {
    if (feof(f))
      errx(1, "Corrupt patch\n");
    err(1, "fread(%s)", argv[3]);
  }
  if (memcmp(header, "BSDIFF40", 8) != 0)
    errx(1, "Corrupt patch\n");
  bzctrllen = offtin(header + 8);
  bzdatalen = offtin(header + 16);
  newsize = offtin(header + 24);
  if ((bzctrllen < 0) || (bzdatalen < 0) || (newsize < 0))
    errx(1, "Corrupt patch\n");
  if (fclose(f))
    err(1, "fclose(%s)", argv[3]);
  if ((cpf = fopen(argv[3], "r")) == NULL)
    err(1, "fopen(%s)", argv[3]);
  if (fseeko(cpf, 32, SEEK_SET))
    err(1, "fseeko(%s, %lld)", argv[3], (long long)32);
  if ((dpf = fopen(argv[3], "r")) == NULL)
    err(1, "fopen(%s)", argv[3]);
  if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
    err(1, "fseeko(%s, %lld)", argv[3], (long long)(32 + bzctrllen));
  if ((epf = fopen(argv[3], "r")) == NULL)
    err(1, "fopen(%s)", argv[3]);
  if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
    err(1, "fseeko(%s, %lld)", argv[3],
        (long long)(32 + bzctrllen + bzdatalen));
  if (((fd = open(argv[1], O_RDONLY, 0)) < 0) ||
      ((oldsize = lseek(fd, 0, SEEK_END)) == -1) ||
      ((old = malloc(oldsize + 1)) == NULL) || (lseek(fd, 0, SEEK_SET) != 0) ||
      (read(fd, old, oldsize) != oldsize) || (close(fd) == -1))
    err(1, "%s", argv[1]);
  if ((new = malloc(newsize + 1)) == NULL)
    err(1, NULL);
  oldpos = 0;
  newpos = 0;
  while (newpos < newsize) {
    for (i = 0; i <= 2; i++) {
      lenread = fread(buf, 1, 8, cpf);
      if (lenread < 8)
        errx(1, "Corrupt patch\n");
      ctrl[i] = offtin(buf);
    };
    if (newpos + ctrl[0] > newsize)
      errx(1, "Corrupt patch\n");
    lenread = fread(new + newpos, 1, ctrl[0], dpf);
    if (lenread < ctrl[0])
      errx(1, "Corrupt patch\n");
    for (i = 0; i < ctrl[0]; i++)
      if ((oldpos + i >= 0) && (oldpos + i < oldsize))
        new[newpos + i] += old[oldpos + i];
    newpos += ctrl[0];
    oldpos += ctrl[0];
    if (newpos + ctrl[1] > newsize)
      errx(1, "Corrupt patch\n");
    lenread = fread(new + newpos, 1, ctrl[1], epf);
    if (lenread < ctrl[1])
      errx(1, "Corrupt patch\n");
    newpos += ctrl[1];
    oldpos += ctrl[2];
  };
  if (fclose(cpf) || fclose(dpf) || fclose(epf))
    err(1, "fclose(%s)", argv[3]);
  if (((fd = open(argv[2], O_CREAT | O_TRUNC | O_WRONLY, 0666)) < 0) ||
      (write(fd, new, newsize) != newsize) || (close(fd) == -1))
    err(1, "%s", argv[2]);
  free(new);
  free(old);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     123d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    $0x1,%edi
lea    0xdca(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdd9(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    127a <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x20,%edx
call   1040 <fread@plt>
cmp    $0x20,%eax
jge    12de <main+0xde>
mov    -0x18(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%rax
je     12c3 <main+0xc3>
mov    $0x1,%edi
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xd69(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
lea    -0x150(%rbp),%rdi
lea    0xd5e(%rip),%rsi
mov    $0x8,%edx
call   10b0 <memcmp@plt>
cmp    $0x0,%rax
je     1313 <main+0x113>
mov    $0x1,%edi
lea    0xd25(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
lea    -0x150(%rbp),%rdi
add    $0x40,%rdi
call   1120 <offtin@plt>
mov    %eax,-0x40(%rbp)
lea    -0x150(%rbp),%rdi
add    $0x80,%rdi
call   1120 <offtin@plt>
mov    %eax,-0x44(%rbp)
lea    -0x150(%rbp),%rdi
add    $0xc0,%rdi
call   1120 <offtin@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x40(%rbp)
jl     1370 <main+0x170>
cmpl   $0x0,-0x44(%rbp)
jl     1370 <main+0x170>
cmpl   $0x0,-0x3c(%rbp)
jge    1383 <main+0x183>
mov    $0x1,%edi
lea    0xcb5(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     13b1 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xca9(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc65(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    13ee <main+0x1ee>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xc40(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20(%rbp),%rdi
mov    0x2bc7(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1100 <fseeko@plt>
cmp    $0x0,%rax
je     142f <main+0x22f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xc3b(%rip),%rsi
mov    $0x20,%ecx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xbe7(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    146c <main+0x26c>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xbc2(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%esi
add    $0x20,%esi
mov    0x2b43(%rip),%rax
mov    (%rax),%edx
call   1100 <fseeko@plt>
cmp    $0x0,%rax
je     14b2 <main+0x2b2>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x40(%rbp),%eax
add    $0x20,%eax
movslq %eax,%rcx
mov    $0x1,%edi
lea    0xbb3(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xb64(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    14ef <main+0x2ef>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0xb3f(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%esi
add    $0x20,%esi
add    -0x44(%rbp),%esi
mov    0x2abd(%rip),%rax
mov    (%rax),%edx
call   1100 <fseeko@plt>
cmp    $0x0,%rax
je     153b <main+0x33b>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x40(%rbp),%eax
add    $0x20,%eax
add    -0x44(%rbp),%eax
movslq %eax,%rcx
mov    $0x1,%edi
lea    0xb2a(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2a86(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <open@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jl     15e3 <main+0x3e3>
mov    -0x34(%rbp),%edi
mov    0x2a6f(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1080 <lseek@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xffffffff,%eax
je     15e3 <main+0x3e3>
mov    -0x38(%rbp),%edi
add    $0x1,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x198(%rbp)
cmp    $0x0,%rax
je     15e3 <main+0x3e3>
mov    -0x34(%rbp),%edi
mov    0x2a1c(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1080 <lseek@plt>
cmp    $0x0,%rax
jne    15e3 <main+0x3e3>
mov    -0x34(%rbp),%edi
mov    -0x198(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   10a0 <read@plt>
cmp    -0x38(%rbp),%eax
jne    15e3 <main+0x3e3>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    15fe <main+0x3fe>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    $0x1,%edi
lea    0xa78(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x3c(%rbp),%edi
add    $0x1,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x1a0(%rbp)
cmp    $0x0,%rax
jne    162a <main+0x42a>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   10d0 <err@plt>
movl   $0x0,-0x1a4(%rbp)
movl   $0x0,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    18b0 <main+0x6b0>
movl   $0x0,-0x1bc(%rbp)
cmpl   $0x2,-0x1bc(%rbp)
jg     16d4 <main+0x4d4>
lea    -0x190(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
mov    $0x8,%edx
call   1040 <fread@plt>
mov    %eax,-0x1b8(%rbp)
cmpl   $0x8,-0x1b8(%rbp)
jge    16a4 <main+0x4a4>
mov    $0x1,%edi
lea    0x994(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
lea    -0x190(%rbp),%rdi
call   1120 <offtin@plt>
mov    %eax,%ecx
movslq -0x1bc(%rbp),%rax
mov    %ecx,-0x1b4(%rbp,%rax,4)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    1657 <main+0x457>
mov    -0x1a8(%rbp),%eax
add    -0x1b4(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    16fc <main+0x4fc>
mov    $0x1,%edi
lea    0x93c(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x1a0(%rbp),%rdi
movslq -0x1a8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x1b4(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %eax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
cmp    -0x1b4(%rbp),%eax
jge    1750 <main+0x550>
mov    $0x1,%edi
lea    0x8e8(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
movl   $0x0,-0x1bc(%rbp)
mov    -0x1bc(%rbp),%eax
cmp    -0x1b4(%rbp),%eax
jge    17e7 <main+0x5e7>
mov    -0x1a4(%rbp),%eax
add    -0x1bc(%rbp),%eax
cmp    $0x0,%eax
jl     17ce <main+0x5ce>
mov    -0x1a4(%rbp),%eax
add    -0x1bc(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    17ce <main+0x5ce>
mov    -0x198(%rbp),%rax
mov    -0x1a4(%rbp),%ecx
add    -0x1bc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x1a0(%rbp),%rax
mov    -0x1a8(%rbp),%ecx
add    -0x1bc(%rbp),%ecx
movslq %ecx,%rcx
add    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
jmp    17d3 <main+0x5d3>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    175a <main+0x55a>
mov    -0x1b4(%rbp),%eax
add    -0x1a8(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1b4(%rbp),%eax
add    -0x1a4(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
mov    -0x1a8(%rbp),%eax
add    -0x1b0(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    1833 <main+0x633>
mov    $0x1,%edi
lea    0x805(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x1a0(%rbp),%rdi
movslq -0x1a8(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x1b0(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    %eax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%eax
cmp    -0x1b0(%rbp),%eax
jge    1887 <main+0x687>
mov    $0x1,%edi
lea    0x7b1(%rip),%rsi
mov    $0x0,%al
call   1070 <errx@plt>
mov    -0x1b0(%rbp),%eax
add    -0x1a8(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
mov    -0x1ac(%rbp),%eax
add    -0x1a4(%rbp),%eax
mov    %eax,-0x1a4(%rbp)
jmp    163e <main+0x43e>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
jne    18e9 <main+0x6e9>
mov    -0x28(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
jne    18e9 <main+0x6e9>
mov    -0x30(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     1904 <main+0x704>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
mov    $0x1,%edi
lea    0x756(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x26e5(%rip),%rax
mov    (%rax),%esi
mov    0x26d4(%rip),%rax
or     (%rax),%esi
mov    0x268b(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   10f0 <open@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jl     1969 <main+0x769>
mov    -0x34(%rbp),%edi
mov    -0x1a0(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   1050 <write@plt>
cmp    -0x3c(%rbp),%eax
jne    1969 <main+0x769>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    1984 <main+0x784>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    $0x1,%edi
lea    0x6f2(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x1a0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x198(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %rsi,%r12
cmp    $0x4,%edi
je     1230 <main+0x30>
mov    (%r12),%rdx
lea    0xddc(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <errx@plt>
mov    0x18(%r12),%rdi
lea    0xde9(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1261 <main+0x61>
mov    0x18(%r12),%rdx
lea    0xdd2(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
lea    0x90(%rsp),%rdi
mov    $0x1,%esi
mov    $0x20,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
cmp    $0x1f,%eax
jg     12b8 <main+0xb8>
mov    %r15,%rdi
call   10c0 <feof@plt>
test   %rax,%rax
je     12a0 <main+0xa0>
lea    0xd9d(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <errx@plt>
mov    0x18(%r12),%rdx
lea    0xd94(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
lea    0xd8b(%rip),%rsi
lea    0x90(%rsp),%rdi
mov    $0x8,%edx
call   10b0 <memcmp@plt>
test   %rax,%rax
je     12e9 <main+0xe9>
lea    0xd54(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <errx@plt>
lea    0xd0(%rsp),%rdi
call   1120 <offtin@plt>
mov    %eax,%r14d
lea    0x110(%rsp),%rdi
call   1120 <offtin@plt>
mov    %eax,%ebx
lea    0x150(%rsp),%rdi
call   1120 <offtin@plt>
mov    %rax,0x8(%rsp)
test   %r14d,%r14d
js     132a <main+0x12a>
test   %ebx,%ebx
js     132a <main+0x12a>
cmpl   $0x0,0x8(%rsp)
jns    133d <main+0x13d>
lea    0xd00(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1070 <errx@plt>
mov    %ebx,0x20(%rsp)
mov    %r15,%rdi
call   1060 <fclose@plt>
test   %rax,%rax
je     1366 <main+0x166>
mov    0x18(%r12),%rdx
lea    0xcf9(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x18(%r12),%rdi
lea    0xcb3(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1397 <main+0x197>
mov    0x18(%r12),%rdx
lea    0xc9c(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x2c22(%rip),%r15
mov    (%r15),%edx
mov    %rbx,0x48(%rsp)
mov    %rbx,%rdi
mov    $0x20,%esi
call   1100 <fseeko@plt>
test   %rax,%rax
je     13d5 <main+0x1d5>
mov    0x18(%r12),%rdx
lea    0xc9a(%rip),%rsi
mov    $0x20,%ecx
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x18(%r12),%rdi
lea    0xc44(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1406 <main+0x206>
mov    0x18(%r12),%rdx
lea    0xc2d(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
add    $0x20,%r14d
mov    (%r15),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1100 <fseeko@plt>
test   %rax,%rax
je     1438 <main+0x238>
mov    0x18(%r12),%rdx
movslq %r14d,%rcx
lea    0xc32(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x18(%r12),%rdi
lea    0xbe1(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1469 <main+0x269>
mov    0x18(%r12),%rdx
lea    0xbca(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    %rbx,0x40(%rsp)
add    0x20(%rsp),%r14d
mov    (%r15),%edx
mov    %rbp,0x38(%rsp)
mov    %rbp,%rdi
mov    %r14d,%esi
call   1100 <fseeko@plt>
test   %rax,%rax
je     14a6 <main+0x2a6>
mov    0x18(%r12),%rdx
movslq %r14d,%rcx
lea    0xbc4(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    %r12,0x30(%rsp)
mov    0x8(%r12),%rdi
mov    0x2b19(%rip),%rax
mov    (%rax),%esi
xor    %r15d,%r15d
xor    %edx,%edx
call   10f0 <open@plt>
test   %eax,%eax
mov    0x48(%rsp),%r14
js     1545 <main+0x345>
mov    %eax,%ebx
mov    0x2b03(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1080 <lseek@plt>
mov    %rax,%r15
cmp    $0xffffffff,%r15d
je     153e <main+0x33e>
lea    0x1(%r15),%edi
call   10e0 <malloc@plt>
test   %rax,%rax
je     1854 <main+0x654>
mov    %rax,0x10(%rsp)
mov    0x2ab9(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1080 <lseek@plt>
test   %rax,%rax
jne    1545 <main+0x345>
mov    %ebx,%edi
mov    0x10(%rsp),%rsi
mov    %r15d,%edx
call   10a0 <read@plt>
cmp    %r15d,%eax
jne    1545 <main+0x345>
mov    %ebx,%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
mov    0x8(%rsp),%rbx
jne    1566 <main+0x366>
jmp    154a <main+0x34a>
mov    $0xffffffffffffffff,%r15
mov    0x8(%rsp),%rbx
mov    0x30(%rsp),%rax
mov    0x8(%rax),%rdx
lea    0xb15(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
lea    0x1(%rbx),%edi
call   10e0 <malloc@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1586 <main+0x386>
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   10d0 <err@plt>
test   %ebx,%ebx
jle    177c <main+0x57c>
movslq %r15d,%r12
lea    0x50(%rsp),%rbx
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    15bb <main+0x3bb>
nopl   (%rax)
add    0x2c(%rsp),%r15d
mov    %r15d,%ebp
cmp    %ebx,%r13d
mov    0x48(%rsp),%r14
lea    0x50(%rsp),%rbx
jge    177c <main+0x57c>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x7,%eax
jg     15e8 <main+0x3e8>
mov    $0x1,%edi
lea    0xa50(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
mov    %rbx,%rdi
call   1120 <offtin@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x7,%eax
jg     1620 <main+0x420>
mov    $0x1,%edi
lea    0xa18(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
mov    %rbx,%rdi
call   1120 <offtin@plt>
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x8,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x7,%eax
jg     165a <main+0x45a>
mov    $0x1,%edi
lea    0x9de(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
mov    %rbx,%rdi
call   1120 <offtin@plt>
mov    %eax,0x2c(%rsp)
lea    (%r15,%r13,1),%r14d
cmp    0x8(%rsp),%r14d
jle    1684 <main+0x484>
mov    $0x1,%edi
lea    0x9b4(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
movslq %r13d,%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,8),%r13
mov    %r13,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    0x40(%rsp),%rcx
call   1040 <fread@plt>
cmp    %r15d,%eax
jge    16bd <main+0x4bd>
mov    $0x1,%edi
lea    0x97b(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
test   %r15d,%r15d
mov    0x10(%rsp),%rdi
jle    1710 <main+0x510>
movslq %ebp,%rax
mov    %r15d,%ecx
xor    %edx,%edx
jmp    16e9 <main+0x4e9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     1710 <main+0x510>
mov    %rax,%rsi
add    %rdx,%rsi
js     16e0 <main+0x4e0>
cmp    %r12,%rsi
jge    16e0 <main+0x4e0>
mov    %esi,%esi
mov    (%rdi,%rsi,8),%rsi
add    %rsi,0x0(%r13,%rdx,8)
jmp    16e0 <main+0x4e0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x20(%rsp),%rdx
lea    (%rdx,%r14,1),%r13d
mov    0x8(%rsp),%rbx
cmp    %ebx,%r13d
jle    173b <main+0x53b>
mov    $0x1,%edi
lea    0x902(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
mov    0x20(%rsp),%rdx
add    %ebp,%r15d
movslq %r14d,%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    $0x1,%esi
mov    %rdx,%rbp
mov    0x38(%rsp),%rcx
call   1040 <fread@plt>
cmp    %ebp,%eax
jge    15a0 <main+0x3a0>
mov    $0x1,%edi
lea    0x8c1(%rip),%rsi
xor    %eax,%eax
call   1070 <errx@plt>
jmp    15a0 <main+0x3a0>
mov    %r14,%rdi
call   1060 <fclose@plt>
test   %rax,%rax
mov    0x30(%rsp),%r14
jne    17ac <main+0x5ac>
mov    0x40(%rsp),%rdi
call   1060 <fclose@plt>
test   %rax,%rax
jne    17ac <main+0x5ac>
mov    0x38(%rsp),%rdi
call   1060 <fclose@plt>
test   %rax,%rax
je     17c3 <main+0x5c3>
mov    0x18(%r14),%rdx
lea    0x89c(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x282e(%rip),%rax
mov    0x281f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x10(%r14),%rdi
mov    0x27d0(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   10f0 <open@plt>
test   %eax,%eax
js     1815 <main+0x615>
mov    %eax,%ebx
mov    %eax,%edi
mov    0x18(%rsp),%rsi
mov    0x8(%rsp),%rbp
mov    %ebp,%edx
call   1050 <write@plt>
cmp    %ebp,%eax
jne    1815 <main+0x615>
mov    %ebx,%edi
call   1090 <close@plt>
cmp    $0xffffffff,%eax
jne    182c <main+0x62c>
mov    0x10(%r14),%rdx
lea    0x84f(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10d0 <err@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    1545 <main+0x345>

LLVM IR (-O0):
@.str = [37 x i8] c"usage: %s oldfile newfile patchfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"fopen(%s)\00"
@.str.3 = [15 x i8] c"Corrupt patch\0A\00"
@.str.4 = [10 x i8] c"fread(%s)\00"
@.str.5 = [9 x i8] c"BSDIFF40\00"
@.str.6 = [11 x i8] c"fclose(%s)\00"
@SEEK_SET = global i32 0
@.str.7 = [17 x i8] c"fseeko(%s, %lld)\00"
@O_RDONLY = global i32 0
@SEEK_END = global i32 0
@.str.8 = [3 x i8] c"%s\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_WRONLY = 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
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [32 x i64]
%16 = alloca [8 x i64]
%17 = alloca i64*
%18 = alloca i64*
%19 = alloca i32
%20 = alloca i32
%21 = alloca [3 x i32]
%22 = alloca i32
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 4
br i1 %25, label %26, label %31
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %26, %2
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 3
%34 = load i8*, i8** %33
%35 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %35, i32** %6
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %42
37: ; preds = %31
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 3
%40 = load i8*, i8** %39
%41 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %37, %31
%43 = getelementptr inbounds [32 x i64], [32 x i64]* %15, i64 0, i64 0
%44 = load i32*, i32** %6
%45 = call i32 @fread(i64* %43, i32 1, i32 32, i32* %44)
%46 = icmp slt i32 %45, 32
br i1 %46, label %47, label %58
47: ; preds = %42
%48 = load i32*, i32** %6
%49 = call i64 @feof(i32* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %47
%52 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %47
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %56)
br label %58
58: ; preds = %53, %42
%59 = getelementptr inbounds [32 x i64], [32 x i64]* %15, i64 0, i64 0
%60 = call i64 @memcmp(i64* %59, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 8)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %64
64: ; preds = %62, %58
%65 = getelementptr inbounds [32 x i64], [32 x i64]* %15, i64 0, i64 0
%66 = getelementptr inbounds i64, i64* %65, i64 8
%67 = call i32 @offtin(i64* %66)
store i32 %67, i32* %13
%68 = getelementptr inbounds [32 x i64], [32 x i64]* %15, i64 0, i64 0
%69 = getelementptr inbounds i64, i64* %68, i64 16
%70 = call i32 @offtin(i64* %69)
store i32 %70, i32* %14
%71 = getelementptr inbounds [32 x i64], [32 x i64]* %15, i64 0, i64 0
%72 = getelementptr inbounds i64, i64* %71, i64 24
%73 = call i32 @offtin(i64* %72)
store i32 %73, i32* %12
%74 = load i32, i32* %13
%75 = icmp slt i32 %74, 0
br i1 %75, label %82, label %76
76: ; preds = %64
%77 = load i32, i32* %14
%78 = icmp slt i32 %77, 0
br i1 %78, label %82, label %79
79: ; preds = %76
%80 = load i32, i32* %12
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %79, %76, %64
%83 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %82, %79
%85 = load i32*, i32** %6
%86 = call i64 @fclose(i32* %85)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %93
88: ; preds = %84
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 3
%91 = load i8*, i8** %90
%92 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %91)
br label %93
93: ; preds = %88, %84
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 3
%96 = load i8*, i8** %95
%97 = call i32* @fopen(i8* %96, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %97, i32** %7
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %104
99: ; preds = %93
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 3
%102 = load i8*, i8** %101
%103 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %102)
br label %104
104: ; preds = %99, %93
%105 = load i32*, i32** %7
%106 = load i32, i32* @SEEK_SET
%107 = call i64 @fseeko(i32* %105, i32 32, i32 %106)
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %114
109: ; preds = %104
%110 = load i8**, i8*** %5
%111 = getelementptr inbounds i8*, i8** %110, i64 3
%112 = load i8*, i8** %111
%113 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %112, i64 32)
br label %114
114: ; preds = %109, %104
%115 = load i8**, i8*** %5
%116 = getelementptr inbounds i8*, i8** %115, i64 3
%117 = load i8*, i8** %116
%118 = call i32* @fopen(i8* %117, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %118, i32** %8
%119 = icmp eq i32* %118, null
br i1 %119, label %120, label %125
120: ; preds = %114
%121 = load i8**, i8*** %5
%122 = getelementptr inbounds i8*, i8** %121, i64 3
%123 = load i8*, i8** %122
%124 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %123)
br label %125
125: ; preds = %120, %114
%126 = load i32*, i32** %8
%127 = load i32, i32* %13
%128 = add nsw i32 32, %127
%129 = load i32, i32* @SEEK_SET
%130 = call i64 @fseeko(i32* %126, i32 %128, i32 %129)
%131 = icmp ne i64 %130, 0
br i1 %131, label %132, label %140
132: ; preds = %125
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 3
%135 = load i8*, i8** %134
%136 = load i32, i32* %13
%137 = add nsw i32 32, %136
%138 = sext i32 %137 to i64
%139 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %135, i64 %138)
br label %140
140: ; preds = %132, %125
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 3
%143 = load i8*, i8** %142
%144 = call i32* @fopen(i8* %143, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %144, i32** %9
%145 = icmp eq i32* %144, null
br i1 %145, label %146, label %151
146: ; preds = %140
%147 = load i8**, i8*** %5
%148 = getelementptr inbounds i8*, i8** %147, i64 3
%149 = load i8*, i8** %148
%150 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %149)
br label %151
151: ; preds = %146, %140
%152 = load i32*, i32** %9
%153 = load i32, i32* %13
%154 = add nsw i32 32, %153
%155 = load i32, i32* %14
%156 = add nsw i32 %154, %155
%157 = load i32, i32* @SEEK_SET
%158 = call i64 @fseeko(i32* %152, i32 %156, i32 %157)
%159 = icmp ne i64 %158, 0
br i1 %159, label %160, label %170
160: ; preds = %151
%161 = load i8**, i8*** %5
%162 = getelementptr inbounds i8*, i8** %161, i64 3
%163 = load i8*, i8** %162
%164 = load i32, i32* %13
%165 = add nsw i32 32, %164
%166 = load i32, i32* %14
%167 = add nsw i32 %165, %166
%168 = sext i32 %167 to i64
%169 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %163, i64 %168)
br label %170
170: ; preds = %160, %151
%171 = load i8**, i8*** %5
%172 = getelementptr inbounds i8*, i8** %171, i64 1
%173 = load i8*, i8** %172
%174 = load i32, i32* @O_RDONLY
%175 = call i32 @open(i8* %173, i32 %174, i32 0)
store i32 %175, i32* %10
%176 = icmp slt i32 %175, 0
br i1 %176, label %204, label %177
177: ; preds = %170
%178 = load i32, i32* %10
%179 = load i32, i32* @SEEK_END
%180 = call i64 @lseek(i32 %178, i32 0, i32 %179)
%181 = trunc i64 %180 to i32
store i32 %181, i32* %11
%182 = icmp eq i32 %181, -1
br i1 %182, label %204, label %183
183: ; preds = %177
%184 = load i32, i32* %11
%185 = add nsw i32 %184, 1
%186 = call i64* @malloc(i32 %185)
store i64* %186, i64** %17
%187 = icmp eq i64* %186, null
br i1 %187, label %204, label %188
188: ; preds = %183
%189 = load i32, i32* %10
%190 = load i32, i32* @SEEK_SET
%191 = call i64 @lseek(i32 %189, i32 0, i32 %190)
%192 = icmp ne i64 %191, 0
br i1 %192, label %204, label %193
193: ; preds = %188
%194 = load i32, i32* %10
%195 = load i64*, i64** %17
%196 = load i32, i32* %11
%197 = call i32 @read(i32 %194, i64* %195, i32 %196)
%198 = load i32, i32* %11
%199 = icmp ne i32 %197, %198
br i1 %199, label %204, label %200
200: ; preds = %193
%201 = load i32, i32* %10
%202 = call i32 @close(i32 %201)
%203 = icmp eq i32 %202, -1
br i1 %203, label %204, label %209
204: ; preds = %200, %193, %188, %183, %177, %170
%205 = load i8**, i8*** %5
%206 = getelementptr inbounds i8*, i8** %205, i64 1
%207 = load i8*, i8** %206
%208 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %207)
br label %209
209: ; preds = %204, %200
%210 = load i32, i32* %12
%211 = add nsw i32 %210, 1
%212 = call i64* @malloc(i32 %211)
store i64* %212, i64** %18
%213 = icmp eq i64* %212, null
br i1 %213, label %214, label %216
214: ; preds = %209
%215 = call i32 (i32, i8*, ...) @err(i32 1, i8* null)
br label %216
216: ; preds = %214, %209
store i32 0, i32* %19
store i32 0, i32* %20
br label %217
217: ; preds = %335, %216
%218 = load i32, i32* %20
%219 = load i32, i32* %12
%220 = icmp slt i32 %218, %219
br i1 %220, label %221, label %344
221: ; preds = %217
store i32 0, i32* %23
br label %222
222: ; preds = %239, %221
%223 = load i32, i32* %23
%224 = icmp sle i32 %223, 2
br i1 %224, label %225, label %242
225: ; preds = %222
%226 = getelementptr inbounds [8 x i64], [8 x i64]* %16, i64 0, i64 0
%227 = load i32*, i32** %7
%228 = call i32 @fread(i64* %226, i32 1, i32 8, i32* %227)
store i32 %228, i32* %22
%229 = load i32, i32* %22
%230 = icmp slt i32 %229, 8
br i1 %230, label %231, label %233
231: ; preds = %225
%232 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %233
233: ; preds = %231, %225
%234 = getelementptr inbounds [8 x i64], [8 x i64]* %16, i64 0, i64 0
%235 = call i32 @offtin(i64* %234)
%236 = load i32, i32* %23
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 %237
store i32 %235, i32* %238
br label %239
239: ; preds = %233
%240 = load i32, i32* %23
%241 = add nsw i32 %240, 1
store i32 %241, i32* %23
br label %222
242: ; preds = %222
%243 = load i32, i32* %20
%244 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%245 = load i32, i32* %244
%246 = add nsw i32 %243, %245
%247 = load i32, i32* %12
%248 = icmp sgt i32 %246, %247
br i1 %248, label %249, label %251
249: ; preds = %242
%250 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %251
251: ; preds = %249, %242
%252 = load i64*, i64** %18
%253 = load i32, i32* %20
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds i64, i64* %252, i64 %254
%256 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%257 = load i32, i32* %256
%258 = load i32*, i32** %8
%259 = call i32 @fread(i64* %255, i32 1, i32 %257, i32* %258)
store i32 %259, i32* %22
%260 = load i32, i32* %22
%261 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%262 = load i32, i32* %261
%263 = icmp slt i32 %260, %262
br i1 %263, label %264, label %266
264: ; preds = %251
%265 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %266
266: ; preds = %264, %251
store i32 0, i32* %23
br label %267
267: ; preds = %300, %266
%268 = load i32, i32* %23
%269 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%270 = load i32, i32* %269
%271 = icmp slt i32 %268, %270
br i1 %271, label %272, label %303
272: ; preds = %267
%273 = load i32, i32* %19
%274 = load i32, i32* %23
%275 = add nsw i32 %273, %274
%276 = icmp sge i32 %275, 0
br i1 %276, label %277, label %299
277: ; preds = %272
%278 = load i32, i32* %19
%279 = load i32, i32* %23
%280 = add nsw i32 %278, %279
%281 = load i32, i32* %11
%282 = icmp slt i32 %280, %281
br i1 %282, label %283, label %299
283: ; preds = %277
%284 = load i64*, i64** %17
%285 = load i32, i32* %19
%286 = load i32, i32* %23
%287 = add nsw i32 %285, %286
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds i64, i64* %284, i64 %288
%290 = load i64, i64* %289
%291 = load i64*, i64** %18
%292 = load i32, i32* %20
%293 = load i32, i32* %23
%294 = add nsw i32 %292, %293
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds i64, i64* %291, i64 %295
%297 = load i64, i64* %296
%298 = add nsw i64 %297, %290
store i64 %298, i64* %296
br label %299
299: ; preds = %283, %277, %272
br label %300
300: ; preds = %299
%301 = load i32, i32* %23
%302 = add nsw i32 %301, 1
store i32 %302, i32* %23
br label %267
303: ; preds = %267
%304 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%305 = load i32, i32* %304
%306 = load i32, i32* %20
%307 = add nsw i32 %306, %305
store i32 %307, i32* %20
%308 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 0
%309 = load i32, i32* %308
%310 = load i32, i32* %19
%311 = add nsw i32 %310, %309
store i32 %311, i32* %19
%312 = load i32, i32* %20
%313 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 1
%314 = load i32, i32* %313
%315 = add nsw i32 %312, %314
%316 = load i32, i32* %12
%317 = icmp sgt i32 %315, %316
br i1 %317, label %318, label %320
318: ; preds = %303
%319 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %320
320: ; preds = %318, %303
%321 = load i64*, i64** %18
%322 = load i32, i32* %20
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds i64, i64* %321, i64 %323
%325 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 1
%326 = load i32, i32* %325
%327 = load i32*, i32** %9
%328 = call i32 @fread(i64* %324, i32 1, i32 %326, i32* %327)
store i32 %328, i32* %22
%329 = load i32, i32* %22
%330 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 1
%331 = load i32, i32* %330
%332 = icmp slt i32 %329, %331
br i1 %332, label %333, label %335
333: ; preds = %320
%334 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %335
335: ; preds = %333, %320
%336 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 1
%337 = load i32, i32* %336
%338 = load i32, i32* %20
%339 = add nsw i32 %338, %337
store i32 %339, i32* %20
%340 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 2
%341 = load i32, i32* %340
%342 = load i32, i32* %19
%343 = add nsw i32 %342, %341
store i32 %343, i32* %19
br label %217
344: ; preds = %217
%345 = load i32*, i32** %7
%346 = call i64 @fclose(i32* %345)
%347 = icmp ne i64 %346, 0
br i1 %347, label %356, label %348
348: ; preds = %344
%349 = load i32*, i32** %8
%350 = call i64 @fclose(i32* %349)
%351 = icmp ne i64 %350, 0
br i1 %351, label %356, label %352
352: ; preds = %348
%353 = load i32*, i32** %9
%354 = call i64 @fclose(i32* %353)
%355 = icmp ne i64 %354, 0
br i1 %355, label %356, label %361
356: ; preds = %352, %348, %344
%357 = load i8**, i8*** %5
%358 = getelementptr inbounds i8*, i8** %357, i64 3
%359 = load i8*, i8** %358
%360 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %359)
br label %361
361: ; preds = %356, %352
%362 = load i8**, i8*** %5
%363 = getelementptr inbounds i8*, i8** %362, i64 2
%364 = load i8*, i8** %363
%365 = load i32, i32* @O_CREAT
%366 = load i32, i32* @O_TRUNC
%367 = or i32 %365, %366
%368 = load i32, i32* @O_WRONLY
%369 = or i32 %367, %368
%370 = call i32 @open(i8* %364, i32 %369, i32 438)
store i32 %370, i32* %10
%371 = icmp slt i32 %370, 0
br i1 %371, label %383, label %372
372: ; preds = %361
%373 = load i32, i32* %10
%374 = load i64*, i64** %18
%375 = load i32, i32* %12
%376 = call i32 @write(i32 %373, i64* %374, i32 %375)
%377 = load i32, i32* %12
%378 = icmp ne i32 %376, %377
br i1 %378, label %383, label %379
379: ; preds = %372
%380 = load i32, i32* %10
%381 = call i32 @close(i32 %380)
%382 = icmp eq i32 %381, -1
br i1 %382, label %383, label %388
383: ; preds = %379, %372, %361
%384 = load i8**, i8*** %5
%385 = getelementptr inbounds i8*, i8** %384, i64 2
%386 = load i8*, i8** %385
%387 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %386)
br label %388
388: ; preds = %383, %379
%389 = load i64*, i64** %18
%390 = call i32 @free(i64* %389)
%391 = load i64*, i64** %17
%392 = call i32 @free(i64* %391)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"usage: %s oldfile newfile patchfile\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"fopen(%s)\00"
@.str.3 = [15 x i8] c"Corrupt patch\0A\00"
@.str.4 = [10 x i8] c"fread(%s)\00"
@.str.5 = [9 x i8] c"BSDIFF40\00"
@.str.6 = [11 x i8] c"fclose(%s)\00"
@SEEK_SET = global i32 0
@.str.7 = [17 x i8] c"fseeko(%s, %lld)\00"
@O_RDONLY = global i32 0
@SEEK_END = global i32 0
@.str.8 = [3 x i8] c"%s\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_WRONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i64]
%4 = alloca [8 x i64]
%5 = bitcast [32 x i64]* %3 to i8*
%6 = bitcast [8 x i64]* %4 to i8*
%7 = icmp eq i32 %0, 4
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %2
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %12
%18 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %16, %11
%20 = getelementptr inbounds [32 x i64], [32 x i64]* %3, i64 0, i64 0
%21 = call i32 @fread(i64* %20, i32 1, i32 32, i32* %14)
%22 = icmp slt i32 %21, 32
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = tail call i64 @feof(i32* %14)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
%29 = load i8*, i8** %12
%30 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %19
%32 = call i64 @memcmp(i64* %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 8)
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %31
%35 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = getelementptr inbounds [32 x i64], [32 x i64]* %3, i64 0, i64 8
%38 = call i32 @offtin(i64* %37)
%39 = getelementptr inbounds [32 x i64], [32 x i64]* %3, i64 0, i64 16
%40 = call i32 @offtin(i64* %39)
%41 = getelementptr inbounds [32 x i64], [32 x i64]* %3, i64 0, i64 24
%42 = call i32 @offtin(i64* %41)
%43 = icmp slt i32 %38, 0
%44 = icmp slt i32 %40, 0
%45 = select i1 %43, i1 true, i1 %44
%46 = icmp slt i32 %42, 0
%47 = select i1 %45, i1 true, i1 %46
br i1 %47, label %48, label %50
48: ; preds = %36
%49 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %36, %48
%51 = call i64 @fclose(i32* %14)
%52 = icmp eq i64 %51, 0
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = load i8*, i8** %12
%55 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %53, %50
%57 = load i8*, i8** %12
%58 = call i32* @fopen(i8* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%59 = icmp eq i32* %58, null
br i1 %59, label %60, label %63
60: ; preds = %56
%61 = load i8*, i8** %12
%62 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %61)
br label %63
63: ; preds = %60, %56
%64 = load i32, i32* @SEEK_SET
%65 = call i64 @fseeko(i32* %58, i32 32, i32 %64)
%66 = icmp eq i64 %65, 0
br i1 %66, label %70, label %67
67: ; preds = %63
%68 = load i8*, i8** %12
%69 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %68, i64 32)
br label %70
70: ; preds = %67, %63
%71 = load i8*, i8** %12
%72 = call i32* @fopen(i8* %71, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%73 = icmp eq i32* %72, null
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = load i8*, i8** %12
%76 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %75)
br label %77
77: ; preds = %74, %70
%78 = add nsw i32 %38, 32
%79 = load i32, i32* @SEEK_SET
%80 = call i64 @fseeko(i32* %72, i32 %78, i32 %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %77
%83 = load i8*, i8** %12
%84 = sext i32 %78 to i64
%85 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %83, i64 %84)
br label %86
86: ; preds = %82, %77
%87 = load i8*, i8** %12
%88 = call i32* @fopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%89 = icmp eq i32* %88, null
br i1 %89, label %90, label %93
90: ; preds = %86
%91 = load i8*, i8** %12
%92 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %91)
br label %93
93: ; preds = %90, %86
%94 = add nsw i32 %78, %40
%95 = load i32, i32* @SEEK_SET
%96 = call i64 @fseeko(i32* %88, i32 %94, i32 %95)
%97 = icmp eq i64 %96, 0
br i1 %97, label %102, label %98
98: ; preds = %93
%99 = load i8*, i8** %12
%100 = sext i32 %94 to i64
%101 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %99, i64 %100)
br label %102
102: ; preds = %98, %93
%103 = getelementptr inbounds i8*, i8** %1, i64 1
%104 = load i8*, i8** %103
%105 = load i32, i32* @O_RDONLY
%106 = call i32 @open(i8* %104, i32 %105, i32 0)
%107 = icmp slt i32 %106, 0
br i1 %107, label %127, label %108
108: ; preds = %102
%109 = load i32, i32* @SEEK_END
%110 = call i64 @lseek(i32 %106, i32 0, i32 %109)
%111 = trunc i64 %110 to i32
%112 = icmp eq i32 %111, -1
br i1 %112, label %127, label %113
113: ; preds = %108
%114 = add nuw nsw i32 %111, 1
%115 = call i64* @malloc(i32 %114)
%116 = icmp eq i64* %115, null
br i1 %116, label %127, label %117
117: ; preds = %113
%118 = load i32, i32* @SEEK_SET
%119 = call i64 @lseek(i32 %106, i32 0, i32 %118)
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %127
121: ; preds = %117
%122 = call i32 @read(i32 %106, i64* %115, i32 %111)
%123 = icmp eq i32 %122, %111
br i1 %123, label %124, label %127
124: ; preds = %121
%125 = call i32 @close(i32 %106)
%126 = icmp eq i32 %125, -1
br i1 %126, label %127, label %132
127: ; preds = %124, %121, %117, %113, %108, %102
%128 = phi i64 [ 0, %102 ], [ -1, %108 ], [ %110, %113 ], [ %110, %117 ], [ %110, %121 ], [ %110, %124 ]
%129 = phi i64* [ undef, %102 ], [ undef, %108 ], [ null, %113 ], [ %115, %117 ], [ %115, %121 ], [ %115, %124 ]
%130 = load i8*, i8** %103
%131 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %130)
br label %132
132: ; preds = %127, %124
%133 = phi i64 [ %128, %127 ], [ %110, %124 ]
%134 = phi i64* [ %129, %127 ], [ %115, %124 ]
%135 = add nsw i32 %42, 1
%136 = call i64* @malloc(i32 %135)
%137 = icmp eq i64* %136, null
br i1 %137, label %138, label %140
138: ; preds = %132
%139 = call i32 (i32, i8*, ...) @err(i32 1, i8* null)
br label %140
140: ; preds = %138, %132
%141 = icmp sgt i32 %42, 0
br i1 %141, label %142, label %216
142: ; preds = %140
%143 = getelementptr inbounds [8 x i64], [8 x i64]* %4, i64 0, i64 0
%144 = shl i64 %133, 32
%145 = ashr exact i64 %144, 32
br label %146
146: ; preds = %142, %213
%147 = phi i32 [ 0, %142 ], [ %202, %213 ]
%148 = phi i32 [ 0, %142 ], [ %214, %213 ]
%149 = call i32 @fread(i64* %143, i32 1, i32 8, i32* %58)
%150 = icmp slt i32 %149, 8
br i1 %150, label %151, label %153
151: ; preds = %146
%152 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %153
153: ; preds = %151, %146
%154 = call i32 @offtin(i64* %143)
%155 = call i32 @fread(i64* %143, i32 1, i32 8, i32* %58)
%156 = icmp slt i32 %155, 8
br i1 %156, label %157, label %159
157: ; preds = %153
%158 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %159
159: ; preds = %157, %153
%160 = call i32 @offtin(i64* %143)
%161 = call i32 @fread(i64* %143, i32 1, i32 8, i32* %58)
%162 = icmp slt i32 %161, 8
br i1 %162, label %163, label %165
163: ; preds = %159
%164 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %165
165: ; preds = %163, %159
%166 = call i32 @offtin(i64* %143)
%167 = add nsw i32 %154, %147
%168 = icmp sgt i32 %167, %42
br i1 %168, label %169, label %171
169: ; preds = %165
%170 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %171
171: ; preds = %169, %165
%172 = sext i32 %147 to i64
%173 = getelementptr inbounds i64, i64* %136, i64 %172
%174 = call i32 @fread(i64* %173, i32 1, i32 %154, i32* %72)
%175 = icmp slt i32 %174, %154
br i1 %175, label %176, label %178
176: ; preds = %171
%177 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %178
178: ; preds = %176, %171
%179 = icmp sgt i32 %154, 0
br i1 %179, label %180, label %200
180: ; preds = %178
%181 = sext i32 %148 to i64
%182 = zext i32 %154 to i64
br label %183
183: ; preds = %180, %197
%184 = phi i64 [ 0, %180 ], [ %198, %197 ]
%185 = add nsw i64 %184, %181
%186 = icmp sgt i64 %185, -1
%187 = icmp slt i64 %185, %145
%188 = select i1 %186, i1 %187, i1 false
br i1 %188, label %189, label %197
189: ; preds = %183
%190 = and i64 %185, 4294967295
%191 = getelementptr inbounds i64, i64* %134, i64 %190
%192 = load i64, i64* %191
%193 = add nsw i64 %184, %172
%194 = getelementptr inbounds i64, i64* %136, i64 %193
%195 = load i64, i64* %194
%196 = add nsw i64 %195, %192
store i64 %196, i64* %194
br label %197
197: ; preds = %183, %189
%198 = add nuw nsw i64 %184, 1
%199 = icmp eq i64 %198, %182
br i1 %199, label %200, label %183
200: ; preds = %197, %178
%201 = add nsw i32 %154, %148
%202 = add nsw i32 %160, %167
%203 = icmp sgt i32 %202, %42
br i1 %203, label %204, label %206
204: ; preds = %200
%205 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %206
206: ; preds = %204, %200
%207 = sext i32 %167 to i64
%208 = getelementptr inbounds i64, i64* %136, i64 %207
%209 = call i32 @fread(i64* %208, i32 1, i32 %160, i32* %88)
%210 = icmp slt i32 %209, %160
br i1 %210, label %211, label %213
211: ; preds = %206
%212 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %213
213: ; preds = %211, %206
%214 = add nsw i32 %201, %166
%215 = icmp slt i32 %202, %42
br i1 %215, label %146, label %216
216: ; preds = %213, %140
%217 = call i64 @fclose(i32* %58)
%218 = icmp eq i64 %217, 0
br i1 %218, label %219, label %225
219: ; preds = %216
%220 = call i64 @fclose(i32* %72)
%221 = icmp eq i64 %220, 0
br i1 %221, label %222, label %225
222: ; preds = %219
%223 = call i64 @fclose(i32* %88)
%224 = icmp eq i64 %223, 0
br i1 %224, label %228, label %225
225: ; preds = %222, %219, %216
%226 = load i8*, i8** %12
%227 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %226)
br label %228
228: ; preds = %225, %222
%229 = getelementptr inbounds i8*, i8** %1, i64 2
%230 = load i8*, i8** %229
%231 = load i32, i32* @O_CREAT
%232 = load i32, i32* @O_TRUNC
%233 = or i32 %232, %231
%234 = load i32, i32* @O_WRONLY
%235 = or i32 %233, %234
%236 = call i32 @open(i8* %230, i32 %235, i32 438)
%237 = icmp slt i32 %236, 0
br i1 %237, label %244, label %238
238: ; preds = %228
%239 = call i32 @write(i32 %236, i64* %136, i32 %42)
%240 = icmp eq i32 %239, %42
br i1 %240, label %241, label %244
241: ; preds = %238
%242 = call i32 @close(i32 %236)
%243 = icmp eq i32 %242, -1
br i1 %243, label %244, label %247
244: ; preds = %241, %238, %228
%245 = load i8*, i8** %229
%246 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %245)
br label %247
247: ; preds = %244, %241
%248 = call i32 @free(i64* %136)
%249 = call i32 @free(i64* %134)
ret i32 0
}