#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 */
struct stat {
  int st_size;
  int /*<<< orphan*/ st_mode;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ FIBMAP;
int /*<<< orphan*/ FIGETBSZ;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_TRUNC;
int O_WRONLY;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fchmod(int, int /*<<< orphan*/);
int /*<<< orphan*/ fchown(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ ftruncate(int, int);
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
scalar_t__ lseek(int, int, int /*<<< orphan*/);
unsigned char *malloc(int);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, ...);
int read(int, unsigned char *, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int write(int, unsigned char *, int);
int main(int argc, char **argv) {
  struct stat statinfo1, statinfo2;
  int fd1, fd2, fd3;
  int num_blocks;
  int block_size;
  int i;
  int sparse_blocks;
  int zero_blocks;
  int different_blocks;
  int copied_blocks;
  int percent = -1;
  unsigned char *buffer1;
  if (argc != 4) {
    fprintf(stderr, "%s a fast sparse-aware binary file patcher.\n", argv[0]);
    fprintf(stderr, "Usage: %s DIFF FILE1 FILE2\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if ((fd1 = open(argv[1], O_RDONLY)) < 0) {
    fprintf(stderr, "Cannot open %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  if ((fd2 = open(argv[2], O_RDONLY)) < 0) {
    fprintf(stderr, "Cannot open %s\n", argv[2]);
    close(fd1);
    exit(EXIT_FAILURE);
  }
  if (ioctl(fd1, FIGETBSZ, &block_size) < 0) {
    fprintf(stderr, "Cannot get block size\n");
    close(fd1);
    close(fd2);
    exit(EXIT_FAILURE);
  }
  if (fstat(fd1, &statinfo1) < 0) {
    fprintf(stderr, "Cannot stat %s\n", argv[1]);
    close(fd1);
    close(fd2);
    exit(EXIT_FAILURE);
  }
  if (fstat(fd2, &statinfo2) < 0) {
    fprintf(stderr, "Cannot stat %s\n", argv[2]);
    close(fd1);
    close(fd2);
    exit(EXIT_FAILURE);
  }
  if (statinfo1.st_size != statinfo2.st_size) {
    fprintf(stderr, "Files have different sizes, cannot patch\n");
    close(fd1);
    close(fd2);
    exit(EXIT_FAILURE);
  }
  num_blocks = (statinfo1.st_size + block_size - 1) / block_size;
  if ((fd3 = open(argv[3], O_WRONLY | O_CREAT | O_TRUNC, 0777)) < 0) {
    fprintf(stderr, "Cannot open %s\n", argv[3]);
    close(fd1);
    close(fd2);
    exit(EXIT_FAILURE);
  }
  buffer1 = malloc(block_size);
  if (!buffer1) {
    fprintf(stderr, "Cannot allocate buffer\n");
    close(fd1);
    close(fd2);
    close(fd3);
    exit(EXIT_FAILURE);
  }
  sparse_blocks = 0;
  zero_blocks = 0;
  different_blocks = 0;
  copied_blocks = 0;
  for (i = 0; i < num_blocks; i++) {
    int block = i;
    int sblock = i;
    int nread = 0;
    if (ioctl(fd1, FIBMAP, &block) || ioctl(fd2, FIBMAP, &sblock)) {
      printf("ioctl failed: %s in block %d, are you root ?\n", strerror(errno),
             i);
      close(fd1);
      close(fd2);
      close(fd3);
      exit(EXIT_FAILURE);
    }
    if (percent != ((i + 1) * 100 / num_blocks)) {
      percent = (i + 1) * 100 / num_blocks;
      printf("%08d/%08d (%d%%), S:%08d, Z:%08d, C:%08d ,M:%08d \r", i + 1,
             num_blocks, percent, sparse_blocks, zero_blocks, copied_blocks,
             different_blocks);
      fflush(0);
    }
    if (!block && !sblock) {
      if (lseek(fd1, block_size, SEEK_CUR) < 0 ||
          lseek(fd2, block_size, SEEK_CUR) < 0 ||
          lseek(fd3, block_size, SEEK_CUR) < 0) {
        fprintf(stderr, "Seek failed.\n");
        close(fd1);
        close(fd2);
        close(fd3);
        exit(EXIT_FAILURE);
      }
      sparse_blocks++;
      continue;
    }
    if (!block && sblock) {
      nread = read(fd2, buffer1, block_size);
      if (nread < block_size) {
        if (i != (num_blocks - 1)) {
          fprintf(stderr, "Unexpected short read.\n");
          close(fd1);
          close(fd2);
          close(fd3);
          exit(EXIT_FAILURE);
        }
      }
      if (nread == -1) {
        fprintf(stderr, "Cannot read block %d on %s\n", i, argv[2]);
      } else {
        int n;
        for (n = 0; n < nread; n++) {
          if (buffer1[n])
            break;
        }
        if (n == nread) {
          if (lseek(fd1, nread, SEEK_CUR) < 0 ||
              lseek(fd3, nread, SEEK_CUR) < 0) {
            fprintf(stderr, "Seek failed.\n");
            close(fd1);
            close(fd2);
            close(fd3);
            exit(EXIT_FAILURE);
          }
          zero_blocks++;
          continue;
        } else {
          if (write(fd3, buffer1, nread) != nread) {
            fprintf(stderr, "Cannot write block %d on %s\n", i, argv[3]);
          } else {
            if (lseek(fd1, nread, SEEK_CUR) < 0) {
              fprintf(stderr, "Seek failed.\n");
              close(fd1);
              close(fd2);
              close(fd3);
              exit(EXIT_FAILURE);
            }
            copied_blocks++;
            continue;
          }
        }
      }
    }
    if (block) {
      nread = read(fd1, buffer1, block_size);
      if (nread < block_size) {
        if (i != (num_blocks - 1)) {
          fprintf(stderr, "Unexpected short read.\n");
          close(fd1);
          close(fd2);
          close(fd3);
          exit(EXIT_FAILURE);
        }
      }
      if (nread == -1) {
        fprintf(stderr, "Cannot read block %d on %s\n", i, argv[2]);
      } else {
        int n;
        for (n = 0; n < nread; n++) {
          if (buffer1[n])
            break;
        }
        if (n == nread) {
          if (lseek(fd2, nread, SEEK_CUR) < 0 ||
              lseek(fd3, nread, SEEK_CUR) < 0) {
            fprintf(stderr, "Seek failed.\n");
            close(fd1);
            close(fd2);
            close(fd3);
            exit(EXIT_FAILURE);
          }
          zero_blocks++;
          continue;
        } else {
          if (write(fd3, buffer1, nread) != nread) {
            fprintf(stderr, "Cannot write block %d on %s\n", i, argv[3]);
          } else {
            if (lseek(fd2, nread, SEEK_CUR) < 0) {
              fprintf(stderr, "Seek failed.\n");
              close(fd1);
              close(fd2);
              close(fd3);
              exit(EXIT_FAILURE);
            }
            different_blocks++;
            continue;
          }
        }
      }
    }
  }
  close(fd1);
  close(fd2);
  ftruncate(fd3, statinfo2.st_size);
  fchown(fd3, statinfo2.st_uid, statinfo2.st_gid);
  fchmod(fd3, statinfo2.st_mode);
  close(fd3);
  free(buffer1);
  printf("\n");
  printf("Report:\n");
  printf("%d byte block size\n", block_size);
  printf("  total %08d blocks\n", num_blocks);
  printf("Skipped %08d sparse blocks\n", sparse_blocks);
  printf("  found %08d zero blocks (now sparse)\n", zero_blocks);
  printf(" copied %08d blocks\n", copied_blocks);
  printf("  wrote %08d different blocks\n", different_blocks);
  printf("  ------------------------------------\n");
  printf("  Sum:  %08d blocks accounted for.\n",
         (sparse_blocks + zero_blocks + copied_blocks + different_blocks));
  exit(EXIT_SUCCESS);
}


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)
movl   $0xffffffff,-0x5c(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1284 <main+0x74>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d35(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10f0 <open@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    12d5 <main+0xc5>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd89(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10f0 <open@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jge    132e <main+0x11e>
mov    0x2cb8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd38(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x34(%rbp),%edi
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
lea    -0x44(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
jge    1382 <main+0x172>
mov    0x2c64(%rip),%rax
mov    (%rax),%edi
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x34(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1130 <fstat@plt>
cmp    $0x0,%rax
jge    13d5 <main+0x1c5>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xcc0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x38(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1130 <fstat@plt>
cmp    $0x0,%rax
jge    1428 <main+0x218>
mov    0x2bc6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc6d(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     1469 <main+0x259>
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
lea    0xc3c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x20(%rbp),%eax
add    -0x44(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x44(%rbp)
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x2b00(%rip),%rax
mov    (%rax),%esi
mov    0x2b67(%rip),%rax
or     (%rax),%esi
mov    0x2b56(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
mov    $0x0,%al
call   10f0 <open@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jge    14f1 <main+0x2e1>
mov    0x2afd(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xb7d(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    0x2ab6(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x44(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    1545 <main+0x335>
mov    0x2aa9(%rip),%rax
mov    (%rax),%edi
lea    0xb92(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x2a62(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1bb1 <main+0x9a1>
mov    -0x48(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2a17(%rip),%rax
mov    (%rax),%esi
lea    -0x6c(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
jne    15c5 <main+0x3b5>
mov    -0x38(%rbp),%edi
mov    0x29f8(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
je     160d <main+0x3fd>
mov    0x29e4(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
mov    %rax,%rsi
mov    -0x48(%rbp),%edx
lea    0xae2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x299a(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x5c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x40(%rbp)
mov    %eax,%ecx
mov    -0x80(%rbp),%eax
cmp    %ecx,%eax
je     1675 <main+0x465>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x40(%rbp)
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%esi
add    $0x1,%esi
mov    -0x40(%rbp),%edx
mov    -0x5c(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x50(%rbp),%r9d
mov    -0x58(%rbp),%r10d
mov    -0x54(%rbp),%eax
lea    0xa91(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <fflush@plt>
cmpl   $0x0,-0x6c(%rbp)
jne    172e <main+0x51e>
cmpl   $0x0,-0x70(%rbp)
jne    172e <main+0x51e>
mov    -0x34(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    0x2942(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     16e3 <main+0x4d3>
mov    -0x38(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    0x2924(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     16e3 <main+0x4d3>
mov    -0x3c(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    0x2906(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    1720 <main+0x510>
mov    0x28ce(%rip),%rax
mov    (%rax),%edi
lea    0xa30(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x2887(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1ba3 <main+0x993>
cmpl   $0x0,-0x6c(%rbp)
jne    196b <main+0x75b>
cmpl   $0x0,-0x70(%rbp)
je     196b <main+0x75b>
mov    -0x38(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   10a0 <read@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    17b3 <main+0x5a3>
mov    -0x48(%rbp),%eax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     17ae <main+0x59e>
mov    0x2840(%rip),%rax
mov    (%rax),%edi
lea    0x9b0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x27f9(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
jmp    17b3 <main+0x5a3>
cmpl   $0xffffffff,-0x74(%rbp)
jne    17e4 <main+0x5d4>
mov    0x27f4(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0x971(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1966 <main+0x756>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    1821 <main+0x611>
mov    -0x68(%rbp),%rax
movslq -0x78(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     180e <main+0x5fe>
jmp    1821 <main+0x611>
jmp    1813 <main+0x603>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    17eb <main+0x5db>
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jne    18b4 <main+0x6a4>
mov    -0x34(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x279e(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     1869 <main+0x659>
mov    -0x3c(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x2780(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    18a6 <main+0x696>
mov    0x2748(%rip),%rax
mov    (%rax),%edi
lea    0x8aa(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x2701(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1ba3 <main+0x993>
mov    -0x3c(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    -0x74(%rbp),%edx
call   1040 <write@plt>
cmp    -0x74(%rbp),%eax
je     18f3 <main+0x6e3>
mov    0x26e5(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0x87e(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    195c <main+0x74c>
mov    -0x34(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x26d8(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    194e <main+0x73e>
mov    0x26a0(%rip),%rax
mov    (%rax),%edi
lea    0x802(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x2659(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1ba3 <main+0x993>
jmp    1961 <main+0x751>
jmp    1966 <main+0x756>
jmp    196b <main+0x75b>
cmpl   $0x0,-0x6c(%rbp)
je     1b9e <main+0x98e>
mov    -0x34(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    -0x44(%rbp),%edx
call   10a0 <read@plt>
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    19e6 <main+0x7d6>
mov    -0x48(%rbp),%eax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     19e1 <main+0x7d1>
mov    0x260d(%rip),%rax
mov    (%rax),%edi
lea    0x77d(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x25c6(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
jmp    19e6 <main+0x7d6>
cmpl   $0xffffffff,-0x74(%rbp)
jne    1a17 <main+0x807>
mov    0x25c1(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0x73e(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1b99 <main+0x989>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    1a54 <main+0x844>
mov    -0x68(%rbp),%rax
movslq -0x7c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1a41 <main+0x831>
jmp    1a54 <main+0x844>
jmp    1a46 <main+0x836>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1a1e <main+0x80e>
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jne    1ae7 <main+0x8d7>
mov    -0x38(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x256b(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     1a9c <main+0x88c>
mov    -0x3c(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x254d(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    1ad9 <main+0x8c9>
mov    0x2515(%rip),%rax
mov    (%rax),%edi
lea    0x677(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x24ce(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1ba3 <main+0x993>
mov    -0x3c(%rbp),%edi
mov    -0x68(%rbp),%rsi
mov    -0x74(%rbp),%edx
call   1040 <write@plt>
cmp    -0x74(%rbp),%eax
je     1b26 <main+0x916>
mov    0x24b2(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0x64b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1b8f <main+0x97f>
mov    -0x38(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    0x24a5(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    1b81 <main+0x971>
mov    0x246d(%rip),%rax
mov    (%rax),%edi
lea    0x5cf(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    0x2426(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1ba3 <main+0x993>
jmp    1b94 <main+0x984>
jmp    1b99 <main+0x989>
jmp    1b9e <main+0x98e>
jmp    1ba3 <main+0x993>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1568 <main+0x358>
mov    -0x34(%rbp),%edi
call   1090 <close@plt>
mov    -0x38(%rbp),%edi
call   1090 <close@plt>
mov    -0x3c(%rbp),%edi
mov    -0x30(%rbp),%esi
call   1060 <ftruncate@plt>
mov    -0x3c(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1100 <fchown@plt>
mov    -0x3c(%rbp),%edi
mov    -0x2c(%rbp),%esi
call   10e0 <fchmod@plt>
mov    -0x3c(%rbp),%edi
call   1090 <close@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
lea    0x5f8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x577(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0x56f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0x572(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4c(%rbp),%esi
lea    0x576(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0x581(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%esi
lea    0x597(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%esi
lea    0x59b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x5ac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4c(%rbp),%esi
add    -0x50(%rbp),%esi
add    -0x58(%rbp),%esi
add    -0x54(%rbp),%esi
lea    0x5ba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x22f1(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%r13
cmp    $0x4,%edi
jne    1278 <main+0x48>
mov    0x8(%r13),%rdi
mov    0x2d74(%rip),%rbp
mov    0x0(%rbp),%esi
xor    %eax,%eax
call   1110 <open@plt>
test   %eax,%eax
jns    12ac <main+0x7c>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r13),%rdx
lea    0xdd3(%rip),%rsi
jmp    12a0 <main+0x70>
mov    0x2d39(%rip),%rbx
mov    (%rbx),%edi
mov    0x0(%r13),%rdx
lea    0xd74(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
mov    0x0(%r13),%rdx
lea    0xd8d(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    137a <main+0x14a>
mov    %eax,%r15d
lea    0x10(%r13),%r12
mov    0x10(%r13),%rdi
mov    0x0(%rbp),%esi
xor    %eax,%eax
call   1110 <open@plt>
test   %eax,%eax
jns    12e8 <main+0xb8>
mov    0x2cec(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xd70(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%edi
jmp    1375 <main+0x145>
mov    %eax,%ebp
mov    0x2cdf(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdx
mov    %r15d,%edi
call   10a0 <ioctl@plt>
test   %rax,%rax
jns    131e <main+0xee>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
lea    0xd44(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    136b <main+0x13b>
lea    0x78(%rsp),%rsi
mov    %r15d,%edi
call   1150 <fstat@plt>
test   %rax,%rax
jns    133f <main+0x10f>
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r13),%rdx
jmp    135d <main+0x12d>
lea    0x60(%rsp),%rsi
mov    %ebp,%edi
call   1150 <fstat@plt>
test   %rax,%rax
jns    1388 <main+0x158>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
mov    (%r12),%rdx
lea    0xd0c(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    0x78(%rsp),%ebx
cmp    0x60(%rsp),%ebx
jne    13f4 <main+0x1c4>
mov    0xc(%rsp),%ecx
lea    (%rbx,%rcx,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %ecx
mov    %rax,0x28(%rsp)
mov    0x18(%r13),%rdi
mov    0x2bd9(%rip),%rax
mov    0x2c42(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
add    $0x18,%r13
mov    0x2c2b(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
xor    %eax,%eax
call   1110 <open@plt>
mov    %eax,0x8(%rsp)
test   %eax,%eax
jns    1409 <main+0x1d9>
mov    0x2bd6(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
lea    0xc5a(%rip),%rsi
jmp    1364 <main+0x134>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
lea    0xc7c(%rip),%rsi
jmp    1315 <main+0xe5>
mov    0xc(%rsp),%edi
call   10e0 <malloc@plt>
test   %rax,%rax
jne    1446 <main+0x216>
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
lea    0xc83(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
mov    0x8(%rsp),%edi
jmp    1375 <main+0x145>
mov    %rax,0x18(%rsp)
mov    %rbx,0x70(%rsp)
mov    %r12,0x58(%rsp)
mov    %r13,0x50(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
mov    $0x0,%eax
mov    %rax,0x30(%rsp)
mov    $0x0,%eax
mov    %rax,0x38(%rsp)
cmpl   $0x0,0x28(%rsp)
jle    17d7 <main+0x5a7>
mov    0x28(%rsp),%rax
add    $0xffffffff,%eax
mov    %eax,0x44(%rsp)
movl   $0xffffffff,0x48(%rsp)
ff
mov    0x2b04(%rip),%rbx
mov    0x2b2d(%rip),%r14
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,0x38(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
jmp    1508 <main+0x2d8>
mov    0x2ae3(%rip),%rax
mov    (%rax),%edi
mov    0x58(%rsp),%rax
mov    (%rax),%rcx
lea    0xc63(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%ebp
mov    %ebx,%r15d
cmp    0x28(%rsp),%r13d
mov    0x2aa6(%rip),%rbx
je     17d7 <main+0x5a7>
mov    %r13d,%r12d
mov    %r13d,0x24(%rsp)
mov    %r13d,0x4c(%rsp)
mov    (%rbx),%esi
mov    %r15d,%edi
lea    0x24(%rsp),%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jne    18e3 <main+0x6b3>
mov    (%rbx),%esi
mov    %ebp,%edi
lea    0x4c(%rsp),%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jne    18e3 <main+0x6b3>
mov    %r15d,%ebx
mov    %ebp,%r15d
lea    0x1(%r12),%r13d
imul   $0x64,%r13d,%eax
cltd
idivl  0x28(%rsp)
cmp    %eax,0x48(%rsp)
je     1599 <main+0x369>
mov    %eax,%ebp
lea    0xb89(%rip),%rdi
mov    %r13d,%esi
mov    0x28(%rsp),%rdx
mov    %eax,%ecx
mov    0x14(%rsp),%r8d
mov    0x10(%rsp),%r9d
xor    %eax,%eax
push   0x30(%rsp)
push   0x40(%rsp)
call   1070 <printf@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   10f0 <fflush@plt>
mov    %ebp,0x48(%rsp)
mov    0x24(%rsp),%ecx
mov    0x4c(%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
je     1620 <main+0x3f0>
test   %ecx,%ecx
mov    %r15d,%ebp
jne    16e4 <main+0x4b4>
test   %eax,%eax
je     16e4 <main+0x4b4>
mov    0xc(%rsp),%edx
mov    %ebp,%edi
mov    0x18(%rsp),%rsi
call   10c0 <read@plt>
mov    %eax,%ebp
cmp    0xc(%rsp),%eax
jge    15dd <main+0x3ad>
cmp    0x44(%rsp),%r12d
jne    1928 <main+0x6f8>
mov    0x58(%rsp),%rcx
lea    0xb60(%rip),%rsi
cmp    $0xffffffff,%ebp
je     16cb <main+0x49b>
test   %ebp,%ebp
jle    1674 <main+0x444>
mov    %ebp,%ecx
xor    %eax,%eax
mov    0x18(%rsp),%rsi
nop
cmpb   $0x0,(%rsi,%rax,1)
jne    167b <main+0x44b>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1600 <main+0x3d0>
jmp    167f <main+0x44f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
mov    (%r14),%edx
mov    %ebx,%edi
call   1090 <lseek@plt>
test   %rax,%rax
mov    %r15d,%ebp
js     190a <main+0x6da>
mov    0xc(%rsp),%esi
mov    (%r14),%edx
mov    %ebp,%edi
call   1090 <lseek@plt>
test   %rax,%rax
js     190a <main+0x6da>
mov    0xc(%rsp),%esi
mov    (%r14),%edx
mov    0x8(%rsp),%edi
call   1090 <lseek@plt>
test   %rax,%rax
js     190a <main+0x6da>
addl   $0x1,0x14(%rsp)
jmp    14f3 <main+0x2c3>
xor    %eax,%eax
mov    0x18(%rsp),%rsi
cmp    %ebp,%eax
jne    1689 <main+0x459>
mov    (%r14),%edx
mov    %ebx,%edi
jmp    1752 <main+0x522>
mov    0x8(%rsp),%edi
mov    %ebp,%edx
call   1060 <write@plt>
mov    0x50(%rsp),%rcx
lea    0xac5(%rip),%rsi
cmp    %ebp,%eax
jne    16cb <main+0x49b>
mov    (%r14),%edx
mov    %ebx,%edi
mov    %ebp,%esi
call   1090 <lseek@plt>
test   %rax,%rax
js     193a <main+0x70a>
mov    0x38(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x38(%rsp)
jmp    14f0 <main+0x2c0>
mov    0x28e6(%rip),%rax
mov    (%rax),%edi
mov    (%rcx),%rcx
mov    %r12d,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%ebp
cmpl   $0x0,0x24(%rsp)
je     14f3 <main+0x2c3>
mov    0xc(%rsp),%edx
mov    %ebx,%edi
mov    0x18(%rsp),%rsi
call   10c0 <read@plt>
mov    %eax,%ebp
cmp    0xc(%rsp),%eax
jge    1712 <main+0x4e2>
cmp    0x44(%rsp),%r12d
jne    1928 <main+0x6f8>
cmp    $0xffffffff,%ebp
je     14ce <main+0x29e>
test   %ebp,%ebp
jle    1741 <main+0x511>
mov    %ebp,%ecx
xor    %eax,%eax
mov    0x18(%rsp),%rsi
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rsi,%rax,1)
jne    1748 <main+0x518>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1730 <main+0x500>
jmp    174c <main+0x51c>
xor    %eax,%eax
mov    0x18(%rsp),%rsi
cmp    %ebp,%eax
jne    1783 <main+0x553>
mov    (%r14),%edx
mov    %r15d,%edi
mov    %ebp,%esi
call   1090 <lseek@plt>
test   %rax,%rax
js     193a <main+0x70a>
mov    (%r14),%edx
mov    0x8(%rsp),%edi
mov    %ebp,%esi
call   1090 <lseek@plt>
test   %rax,%rax
js     193a <main+0x70a>
addl   $0x1,0x10(%rsp)
jmp    14f0 <main+0x2c0>
mov    0x8(%rsp),%edi
mov    %ebp,%edx
call   1060 <write@plt>
cmp    %ebp,%eax
jne    17ba <main+0x58a>
mov    (%r14),%edx
mov    %r15d,%edi
mov    %ebp,%esi
call   1090 <lseek@plt>
test   %rax,%rax
js     193a <main+0x70a>
mov    0x30(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x30(%rsp)
jmp    14f0 <main+0x2c0>
mov    0x27f7(%rip),%rax
mov    (%rax),%edi
mov    0x50(%rsp),%rax
mov    (%rax),%rcx
lea    0x993(%rip),%rsi
jmp    14e6 <main+0x2b6>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
mov    0x8(%rsp),%ebx
mov    %ebx,%edi
mov    0x70(%rsp),%rsi
call   1080 <ftruncate@plt>
mov    0x68(%rsp),%edx
mov    0x6c(%rsp),%esi
mov    %ebx,%edi
call   1120 <fchown@plt>
mov    0x64(%rsp),%esi
mov    %ebx,%edi
call   1100 <fchmod@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xa14(%rip),%rdi
call   1050 <puts@plt>
mov    0xc(%rsp),%esi
lea    0x940(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x946(%rip),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x948(%rip),%rdi
mov    0x14(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x94e(%rip),%rdi
mov    0x10(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x961(%rip),%rdi
mov    0x38(%rsp),%r15
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x960(%rip),%rdi
mov    0x30(%rsp),%rbp
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x996(%rip),%rdi
call   1050 <puts@plt>
add    %r14d,%ebx
add    %ebp,%ebx
add    %r15d,%ebx
lea    0x956(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x26bc(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    0x26c6(%rip),%rax
mov    (%rax),%edi
call   1140 <strerror@plt>
lea    0x7ca(%rip),%rdi
mov    %rax,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    142e <main+0x1fe>
mov    0x26a7(%rip),%rax
mov    (%rax),%edi
lea    0x809(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %ebx,%edi
jmp    1431 <main+0x201>
mov    0x2689(%rip),%rax
mov    (%rax),%edi
lea    0x7f9(%rip),%rsi
jmp    194a <main+0x71a>
mov    0x2677(%rip),%rax
mov    (%rax),%edi
lea    0x7d9(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %r15d,%edi
jmp    1438 <main+0x208>

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [45 x i8] c"%s a fast sparse-aware binary file patcher.\0A\00"
@.str.1 = [28 x i8] c"Usage: %s DIFF FILE1 FILE2\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [16 x i8] c"Cannot open %s\0A\00"
@FIGETBSZ = global i32 0
@.str.3 = [23 x i8] c"Cannot get block size\0A\00"
@.str.4 = [16 x i8] c"Cannot stat %s\0A\00"
@.str.5 = [42 x i8] c"Files have different sizes, cannot patch\0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [24 x i8] c"Cannot allocate buffer\0A\00"
@FIBMAP = global i32 0
@.str.7 = [46 x i8] c"ioctl failed: %s in block %d, are you root ?\0A\00"
@errno = global i32 0
@.str.8 = [51 x i8] c"%08d/%08d (%d%%), S:%08d, Z:%08d, C:%08d ,M:%08d \0D\00"
@SEEK_CUR = global i32 0
@.str.9 = [14 x i8] c"Seek failed.\0A\00"
@.str.10 = [24 x i8] c"Unexpected short read.\0A\00"
@.str.11 = [28 x i8] c"Cannot read block %d on %s\0A\00"
@.str.12 = [29 x i8] c"Cannot write block %d on %s\0A\00"
@.str.13 = [2 x i8] c"\0A\00"
@.str.14 = [9 x i8] c"Report:\0A\00"
@.str.15 = [20 x i8] c"%d byte block size\0A\00"
@.str.16 = [21 x i8] c" total %08d blocks\0A\00"
@.str.17 = [28 x i8] c"Skipped %08d sparse blocks\0A\00"
@.str.18 = [39 x i8] c" found %08d zero blocks (now sparse)\0A\00"
@.str.19 = [21 x i8] c" copied %08d blocks\0A\00"
@.str.20 = [31 x i8] c" wrote %08d different blocks\0A\00"
@.str.21 = [40 x i8] c" ------------------------------------\0A\00"
@.str.22 = [36 x i8] c" Sum: %08d blocks accounted for.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.stat
%7 = alloca %struct.stat
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %18
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 4
br i1 %26, label %27, label %40
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @stderr
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %2
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = load i32, i32* @O_RDONLY
%45 = call i32 (i8*, i32, ...) @open(i8* %43, i32 %44)
store i32 %45, i32* %8
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %55
47: ; preds = %40
%48 = load i32, i32* @stderr
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %51)
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; preds = %40
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = load i32, i32* @O_RDONLY
%60 = call i32 (i8*, i32, ...) @open(i8* %58, i32 %59)
store i32 %60, i32* %9
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %72
62: ; preds = %55
%63 = load i32, i32* @stderr
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 2
%66 = load i8*, i8** %65
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %8
%69 = call i32 @close(i32 %68)
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %55
%73 = load i32, i32* %8
%74 = load i32, i32* @FIGETBSZ
%75 = call i64 @ioctl(i32 %73, i32 %74, i32* %12)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %86
77: ; preds = %72
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%80 = load i32, i32* %8
%81 = call i32 @close(i32 %80)
%82 = load i32, i32* %9
%83 = call i32 @close(i32 %82)
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %72
%87 = load i32, i32* %8
%88 = call i64 @fstat(i32 %87, %struct.stat* %6)
%89 = icmp slt i64 %88, 0
br i1 %89, label %90, label %102
90: ; preds = %86
%91 = load i32, i32* @stderr
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 1
%94 = load i8*, i8** %93
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %94)
%96 = load i32, i32* %8
%97 = call i32 @close(i32 %96)
%98 = load i32, i32* %9
%99 = call i32 @close(i32 %98)
%100 = load i32, i32* @EXIT_FAILURE
%101 = call i32 @exit(i32 %100)
unreachable
102: ; preds = %86
%103 = load i32, i32* %9
%104 = call i64 @fstat(i32 %103, %struct.stat* %7)
%105 = icmp slt i64 %104, 0
br i1 %105, label %106, label %118
106: ; preds = %102
%107 = load i32, i32* @stderr
%108 = load i8**, i8*** %5
%109 = getelementptr inbounds i8*, i8** %108, i64 2
%110 = load i8*, i8** %109
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %110)
%112 = load i32, i32* %8
%113 = call i32 @close(i32 %112)
%114 = load i32, i32* %9
%115 = call i32 @close(i32 %114)
%116 = load i32, i32* @EXIT_FAILURE
%117 = call i32 @exit(i32 %116)
unreachable
118: ; preds = %102
%119 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%120 = load i32, i32* %119
%121 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%122 = load i32, i32* %121
%123 = icmp ne i32 %120, %122
br i1 %123, label %124, label %133
124: ; preds = %118
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%127 = load i32, i32* %8
%128 = call i32 @close(i32 %127)
%129 = load i32, i32* %9
%130 = call i32 @close(i32 %129)
%131 = load i32, i32* @EXIT_FAILURE
%132 = call i32 @exit(i32 %131)
unreachable
133: ; preds = %118
%134 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%135 = load i32, i32* %134
%136 = load i32, i32* %12
%137 = add nsw i32 %135, %136
%138 = sub nsw i32 %137, 1
%139 = load i32, i32* %12
%140 = sdiv i32 %138, %139
store i32 %140, i32* %11
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 3
%143 = load i8*, i8** %142
%144 = load i32, i32* @O_WRONLY
%145 = load i32, i32* @O_CREAT
%146 = or i32 %144, %145
%147 = load i32, i32* @O_TRUNC
%148 = or i32 %146, %147
%149 = call i32 (i8*, i32, ...) @open(i8* %143, i32 %148, i32 511)
store i32 %149, i32* %10
%150 = icmp slt i32 %149, 0
br i1 %150, label %151, label %163
151: ; preds = %133
%152 = load i32, i32* @stderr
%153 = load i8**, i8*** %5
%154 = getelementptr inbounds i8*, i8** %153, i64 3
%155 = load i8*, i8** %154
%156 = call i32 (i32, i8*, ...) @fprintf(i32 %152, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %155)
%157 = load i32, i32* %8
%158 = call i32 @close(i32 %157)
%159 = load i32, i32* %9
%160 = call i32 @close(i32 %159)
%161 = load i32, i32* @EXIT_FAILURE
%162 = call i32 @exit(i32 %161)
unreachable
163: ; preds = %133
%164 = load i32, i32* %12
%165 = call i8* @malloc(i32 %164)
store i8* %165, i8** %19
%166 = load i8*, i8** %19
%167 = icmp ne i8* %166, null
br i1 %167, label %179, label %168
168: ; preds = %163
%169 = load i32, i32* @stderr
%170 = call i32 (i32, i8*, ...) @fprintf(i32 %169, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%171 = load i32, i32* %8
%172 = call i32 @close(i32 %171)
%173 = load i32, i32* %9
%174 = call i32 @close(i32 %173)
%175 = load i32, i32* %10
%176 = call i32 @close(i32 %175)
%177 = load i32, i32* @EXIT_FAILURE
%178 = call i32 @exit(i32 %177)
unreachable
179: ; preds = %163
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i32 0, i32* %13
br label %180
180: ; preds = %519, %179
%181 = load i32, i32* %13
%182 = load i32, i32* %11
%183 = icmp slt i32 %181, %182
br i1 %183, label %184, label %522
184: ; preds = %180
%185 = load i32, i32* %13
store i32 %185, i32* %20
%186 = load i32, i32* %13
store i32 %186, i32* %21
store i32 0, i32* %22
%187 = load i32, i32* %8
%188 = load i32, i32* @FIBMAP
%189 = call i64 @ioctl(i32 %187, i32 %188, i32* %20)
%190 = icmp ne i64 %189, 0
br i1 %190, label %196, label %191
191: ; preds = %184
%192 = load i32, i32* %9
%193 = load i32, i32* @FIBMAP
%194 = call i64 @ioctl(i32 %192, i32 %193, i32* %21)
%195 = icmp ne i64 %194, 0
br i1 %195, label %196, label %209
196: ; preds = %191, %184
%197 = load i32, i32* @errno
%198 = call i8* @strerror(i32 %197)
%199 = load i32, i32* %13
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %198, i32 %199)
%201 = load i32, i32* %8
%202 = call i32 @close(i32 %201)
%203 = load i32, i32* %9
%204 = call i32 @close(i32 %203)
%205 = load i32, i32* %10
%206 = call i32 @close(i32 %205)
%207 = load i32, i32* @EXIT_FAILURE
%208 = call i32 @exit(i32 %207)
unreachable
209: ; preds = %191
%210 = load i32, i32* %18
%211 = load i32, i32* %13
%212 = add nsw i32 %211, 1
%213 = mul nsw i32 %212, 100
%214 = load i32, i32* %11
%215 = sdiv i32 %213, %214
%216 = icmp ne i32 %210, %215
br i1 %216, label %217, label %233
217: ; preds = %209
%218 = load i32, i32* %13
%219 = add nsw i32 %218, 1
%220 = mul nsw i32 %219, 100
%221 = load i32, i32* %11
%222 = sdiv i32 %220, %221
store i32 %222, i32* %18
%223 = load i32, i32* %13
%224 = add nsw i32 %223, 1
%225 = load i32, i32* %11
%226 = load i32, i32* %18
%227 = load i32, i32* %14
%228 = load i32, i32* %15
%229 = load i32, i32* %17
%230 = load i32, i32* %16
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %224, i32 %225, i32 %226, i32 %227, i32 %228, i32 %229, i32 %230)
%232 = call i32 @fflush(i32 0)
br label %233
233: ; preds = %217, %209
%234 = load i32, i32* %20
%235 = icmp ne i32 %234, 0
br i1 %235, label %271, label %236
236: ; preds = %233
%237 = load i32, i32* %21
%238 = icmp ne i32 %237, 0
br i1 %238, label %271, label %239
239: ; preds = %236
%240 = load i32, i32* %8
%241 = load i32, i32* %12
%242 = load i32, i32* @SEEK_CUR
%243 = call i64 @lseek(i32 %240, i32 %241, i32 %242)
%244 = icmp slt i64 %243, 0
br i1 %244, label %257, label %245
245: ; preds = %239
%246 = load i32, i32* %9
%247 = load i32, i32* %12
%248 = load i32, i32* @SEEK_CUR
%249 = call i64 @lseek(i32 %246, i32 %247, i32 %248)
%250 = icmp slt i64 %249, 0
br i1 %250, label %257, label %251
251: ; preds = %245
%252 = load i32, i32* %10
%253 = load i32, i32* %12
%254 = load i32, i32* @SEEK_CUR
%255 = call i64 @lseek(i32 %252, i32 %253, i32 %254)
%256 = icmp slt i64 %255, 0
br i1 %256, label %257, label %268
257: ; preds = %251, %245, %239
%258 = load i32, i32* @stderr
%259 = call i32 (i32, i8*, ...) @fprintf(i32 %258, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%260 = load i32, i32* %8
%261 = call i32 @close(i32 %260)
%262 = load i32, i32* %9
%263 = call i32 @close(i32 %262)
%264 = load i32, i32* %10
%265 = call i32 @close(i32 %264)
%266 = load i32, i32* @EXIT_FAILURE
%267 = call i32 @exit(i32 %266)
unreachable
268: ; preds = %251
%269 = load i32, i32* %14
%270 = add nsw i32 %269, 1
store i32 %270, i32* %14
br label %519
271: ; preds = %236, %233
%272 = load i32, i32* %20
%273 = icmp ne i32 %272, 0
br i1 %273, label %396, label %274
274: ; preds = %271
%275 = load i32, i32* %21
%276 = icmp ne i32 %275, 0
br i1 %276, label %277, label %396
277: ; preds = %274
%278 = load i32, i32* %9
%279 = load i8*, i8** %19
%280 = load i32, i32* %12
%281 = call i32 @read(i32 %278, i8* %279, i32 %280)
store i32 %281, i32* %22
%282 = load i32, i32* %22
%283 = load i32, i32* %12
%284 = icmp slt i32 %282, %283
br i1 %284, label %285, label %302
285: ; preds = %277
%286 = load i32, i32* %13
%287 = load i32, i32* %11
%288 = sub nsw i32 %287, 1
%289 = icmp ne i32 %286, %288
br i1 %289, label %290, label %301
290: ; preds = %285
%291 = load i32, i32* @stderr
%292 = call i32 (i32, i8*, ...) @fprintf(i32 %291, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%293 = load i32, i32* %8
%294 = call i32 @close(i32 %293)
%295 = load i32, i32* %9
%296 = call i32 @close(i32 %295)
%297 = load i32, i32* %10
%298 = call i32 @close(i32 %297)
%299 = load i32, i32* @EXIT_FAILURE
%300 = call i32 @exit(i32 %299)
unreachable
301: ; preds = %285
br label %302
302: ; preds = %301, %277
%303 = load i32, i32* %22
%304 = icmp eq i32 %303, -1
br i1 %304, label %305, label %312
305: ; preds = %302
%306 = load i32, i32* @stderr
%307 = load i32, i32* %13
%308 = load i8**, i8*** %5
%309 = getelementptr inbounds i8*, i8** %308, i64 2
%310 = load i8*, i8** %309
%311 = call i32 (i32, i8*, ...) @fprintf(i32 %306, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %307, i8* %310)
br label %395
312: ; preds = %302
store i32 0, i32* %23
br label %313
313: ; preds = %326, %312
%314 = load i32, i32* %23
%315 = load i32, i32* %22
%316 = icmp slt i32 %314, %315
br i1 %316, label %317, label %329
317: ; preds = %313
%318 = load i8*, i8** %19
%319 = load i32, i32* %23
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds i8, i8* %318, i64 %320
%322 = load i8, i8* %321
%323 = icmp ne i8 %322, 0
br i1 %323, label %324, label %325
324: ; preds = %317
br label %329
325: ; preds = %317
br label %326
326: ; preds = %325
%327 = load i32, i32* %23
%328 = add nsw i32 %327, 1
store i32 %328, i32* %23
br label %313
329: ; preds = %324, %313
%330 = load i32, i32* %23
%331 = load i32, i32* %22
%332 = icmp eq i32 %330, %331
br i1 %332, label %333, label %359
333: ; preds = %329
%334 = load i32, i32* %8
%335 = load i32, i32* %22
%336 = load i32, i32* @SEEK_CUR
%337 = call i64 @lseek(i32 %334, i32 %335, i32 %336)
%338 = icmp slt i64 %337, 0
br i1 %338, label %345, label %339
339: ; preds = %333
%340 = load i32, i32* %10
%341 = load i32, i32* %22
%342 = load i32, i32* @SEEK_CUR
%343 = call i64 @lseek(i32 %340, i32 %341, i32 %342)
%344 = icmp slt i64 %343, 0
br i1 %344, label %345, label %356
345: ; preds = %339, %333
%346 = load i32, i32* @stderr
%347 = call i32 (i32, i8*, ...) @fprintf(i32 %346, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%348 = load i32, i32* %8
%349 = call i32 @close(i32 %348)
%350 = load i32, i32* %9
%351 = call i32 @close(i32 %350)
%352 = load i32, i32* %10
%353 = call i32 @close(i32 %352)
%354 = load i32, i32* @EXIT_FAILURE
%355 = call i32 @exit(i32 %354)
unreachable
356: ; preds = %339
%357 = load i32, i32* %15
%358 = add nsw i32 %357, 1
store i32 %358, i32* %15
br label %519
359: ; preds = %329
%360 = load i32, i32* %10
%361 = load i8*, i8** %19
%362 = load i32, i32* %22
%363 = call i32 @write(i32 %360, i8* %361, i32 %362)
%364 = load i32, i32* %22
%365 = icmp ne i32 %363, %364
br i1 %365, label %366, label %373
366: ; preds = %359
%367 = load i32, i32* @stderr
%368 = load i32, i32* %13
%369 = load i8**, i8*** %5
%370 = getelementptr inbounds i8*, i8** %369, i64 3
%371 = load i8*, i8** %370
%372 = call i32 (i32, i8*, ...) @fprintf(i32 %367, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %368, i8* %371)
br label %393
373: ; preds = %359
%374 = load i32, i32* %8
%375 = load i32, i32* %22
%376 = load i32, i32* @SEEK_CUR
%377 = call i64 @lseek(i32 %374, i32 %375, i32 %376)
%378 = icmp slt i64 %377, 0
br i1 %378, label %379, label %390
379: ; preds = %373
%380 = load i32, i32* @stderr
%381 = call i32 (i32, i8*, ...) @fprintf(i32 %380, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%382 = load i32, i32* %8
%383 = call i32 @close(i32 %382)
%384 = load i32, i32* %9
%385 = call i32 @close(i32 %384)
%386 = load i32, i32* %10
%387 = call i32 @close(i32 %386)
%388 = load i32, i32* @EXIT_FAILURE
%389 = call i32 @exit(i32 %388)
unreachable
390: ; preds = %373
%391 = load i32, i32* %17
%392 = add nsw i32 %391, 1
store i32 %392, i32* %17
br label %519
393: ; preds = %366
br label %394
394: ; preds = %393
br label %395
395: ; preds = %394, %305
br label %396
396: ; preds = %395, %274, %271
%397 = load i32, i32* %20
%398 = icmp ne i32 %397, 0
br i1 %398, label %399, label %518
399: ; preds = %396
%400 = load i32, i32* %8
%401 = load i8*, i8** %19
%402 = load i32, i32* %12
%403 = call i32 @read(i32 %400, i8* %401, i32 %402)
store i32 %403, i32* %22
%404 = load i32, i32* %22
%405 = load i32, i32* %12
%406 = icmp slt i32 %404, %405
br i1 %406, label %407, label %424
407: ; preds = %399
%408 = load i32, i32* %13
%409 = load i32, i32* %11
%410 = sub nsw i32 %409, 1
%411 = icmp ne i32 %408, %410
br i1 %411, label %412, label %423
412: ; preds = %407
%413 = load i32, i32* @stderr
%414 = call i32 (i32, i8*, ...) @fprintf(i32 %413, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%415 = load i32, i32* %8
%416 = call i32 @close(i32 %415)
%417 = load i32, i32* %9
%418 = call i32 @close(i32 %417)
%419 = load i32, i32* %10
%420 = call i32 @close(i32 %419)
%421 = load i32, i32* @EXIT_FAILURE
%422 = call i32 @exit(i32 %421)
unreachable
423: ; preds = %407
br label %424
424: ; preds = %423, %399
%425 = load i32, i32* %22
%426 = icmp eq i32 %425, -1
br i1 %426, label %427, label %434
427: ; preds = %424
%428 = load i32, i32* @stderr
%429 = load i32, i32* %13
%430 = load i8**, i8*** %5
%431 = getelementptr inbounds i8*, i8** %430, i64 2
%432 = load i8*, i8** %431
%433 = call i32 (i32, i8*, ...) @fprintf(i32 %428, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %429, i8* %432)
br label %517
434: ; preds = %424
store i32 0, i32* %24
br label %435
435: ; preds = %448, %434
%436 = load i32, i32* %24
%437 = load i32, i32* %22
%438 = icmp slt i32 %436, %437
br i1 %438, label %439, label %451
439: ; preds = %435
%440 = load i8*, i8** %19
%441 = load i32, i32* %24
%442 = sext i32 %441 to i64
%443 = getelementptr inbounds i8, i8* %440, i64 %442
%444 = load i8, i8* %443
%445 = icmp ne i8 %444, 0
br i1 %445, label %446, label %447
446: ; preds = %439
br label %451
447: ; preds = %439
br label %448
448: ; preds = %447
%449 = load i32, i32* %24
%450 = add nsw i32 %449, 1
store i32 %450, i32* %24
br label %435
451: ; preds = %446, %435
%452 = load i32, i32* %24
%453 = load i32, i32* %22
%454 = icmp eq i32 %452, %453
br i1 %454, label %455, label %481
455: ; preds = %451
%456 = load i32, i32* %9
%457 = load i32, i32* %22
%458 = load i32, i32* @SEEK_CUR
%459 = call i64 @lseek(i32 %456, i32 %457, i32 %458)
%460 = icmp slt i64 %459, 0
br i1 %460, label %467, label %461
461: ; preds = %455
%462 = load i32, i32* %10
%463 = load i32, i32* %22
%464 = load i32, i32* @SEEK_CUR
%465 = call i64 @lseek(i32 %462, i32 %463, i32 %464)
%466 = icmp slt i64 %465, 0
br i1 %466, label %467, label %478
467: ; preds = %461, %455
%468 = load i32, i32* @stderr
%469 = call i32 (i32, i8*, ...) @fprintf(i32 %468, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%470 = load i32, i32* %8
%471 = call i32 @close(i32 %470)
%472 = load i32, i32* %9
%473 = call i32 @close(i32 %472)
%474 = load i32, i32* %10
%475 = call i32 @close(i32 %474)
%476 = load i32, i32* @EXIT_FAILURE
%477 = call i32 @exit(i32 %476)
unreachable
478: ; preds = %461
%479 = load i32, i32* %15
%480 = add nsw i32 %479, 1
store i32 %480, i32* %15
br label %519
481: ; preds = %451
%482 = load i32, i32* %10
%483 = load i8*, i8** %19
%484 = load i32, i32* %22
%485 = call i32 @write(i32 %482, i8* %483, i32 %484)
%486 = load i32, i32* %22
%487 = icmp ne i32 %485, %486
br i1 %487, label %488, label %495
488: ; preds = %481
%489 = load i32, i32* @stderr
%490 = load i32, i32* %13
%491 = load i8**, i8*** %5
%492 = getelementptr inbounds i8*, i8** %491, i64 3
%493 = load i8*, i8** %492
%494 = call i32 (i32, i8*, ...) @fprintf(i32 %489, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %490, i8* %493)
br label %515
495: ; preds = %481
%496 = load i32, i32* %9
%497 = load i32, i32* %22
%498 = load i32, i32* @SEEK_CUR
%499 = call i64 @lseek(i32 %496, i32 %497, i32 %498)
%500 = icmp slt i64 %499, 0
br i1 %500, label %501, label %512
501: ; preds = %495
%502 = load i32, i32* @stderr
%503 = call i32 (i32, i8*, ...) @fprintf(i32 %502, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%504 = load i32, i32* %8
%505 = call i32 @close(i32 %504)
%506 = load i32, i32* %9
%507 = call i32 @close(i32 %506)
%508 = load i32, i32* %10
%509 = call i32 @close(i32 %508)
%510 = load i32, i32* @EXIT_FAILURE
%511 = call i32 @exit(i32 %510)
unreachable
512: ; preds = %495
%513 = load i32, i32* %16
%514 = add nsw i32 %513, 1
store i32 %514, i32* %16
br label %519
515: ; preds = %488
br label %516
516: ; preds = %515
br label %517
517: ; preds = %516, %427
br label %518
518: ; preds = %517, %396
br label %519
519: ; preds = %518, %512, %478, %390, %356, %268
%520 = load i32, i32* %13
%521 = add nsw i32 %520, 1
store i32 %521, i32* %13
br label %180
522: ; preds = %180
%523 = load i32, i32* %8
%524 = call i32 @close(i32 %523)
%525 = load i32, i32* %9
%526 = call i32 @close(i32 %525)
%527 = load i32, i32* %10
%528 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%529 = load i32, i32* %528
%530 = call i32 @ftruncate(i32 %527, i32 %529)
%531 = load i32, i32* %10
%532 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 3
%533 = load i32, i32* %532
%534 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 2
%535 = load i32, i32* %534
%536 = call i32 @fchown(i32 %531, i32 %533, i32 %535)
%537 = load i32, i32* %10
%538 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%539 = load i32, i32* %538
%540 = call i32 @fchmod(i32 %537, i32 %539)
%541 = load i32, i32* %10
%542 = call i32 @close(i32 %541)
%543 = load i8*, i8** %19
%544 = call i32 @free(i8* %543)
%545 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%546 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
%547 = load i32, i32* %12
%548 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 %547)
%549 = load i32, i32* %11
%550 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %549)
%551 = load i32, i32* %14
%552 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0), i32 %551)
%553 = load i32, i32* %15
%554 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), i32 %553)
%555 = load i32, i32* %17
%556 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i32 %555)
%557 = load i32, i32* %16
%558 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0), i32 %557)
%559 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.21, i64 0, i64 0))
%560 = load i32, i32* %14
%561 = load i32, i32* %15
%562 = add nsw i32 %560, %561
%563 = load i32, i32* %17
%564 = add nsw i32 %562, %563
%565 = load i32, i32* %16
%566 = add nsw i32 %564, %565
%567 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.22, i64 0, i64 0), i32 %566)
%568 = load i32, i32* @EXIT_SUCCESS
%569 = call i32 @exit(i32 %568)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [45 x i8] c"%s a fast sparse-aware binary file patcher.\0A\00"
@.str.1 = [28 x i8] c"Usage: %s DIFF FILE1 FILE2\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [16 x i8] c"Cannot open %s\0A\00"
@FIGETBSZ = global i32 0
@.str.3 = [23 x i8] c"Cannot get block size\0A\00"
@.str.4 = [16 x i8] c"Cannot stat %s\0A\00"
@.str.5 = [42 x i8] c"Files have different sizes, cannot patch\0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.6 = [24 x i8] c"Cannot allocate buffer\0A\00"
@FIBMAP = global i32 0
@.str.7 = [46 x i8] c"ioctl failed: %s in block %d, are you root ?\0A\00"
@errno = global i32 0
@.str.8 = [51 x i8] c"%08d/%08d (%d%%), S:%08d, Z:%08d, C:%08d ,M:%08d \0D\00"
@SEEK_CUR = global i32 0
@.str.9 = [14 x i8] c"Seek failed.\0A\00"
@.str.10 = [24 x i8] c"Unexpected short read.\0A\00"
@.str.11 = [28 x i8] c"Cannot read block %d on %s\0A\00"
@.str.12 = [29 x i8] c"Cannot write block %d on %s\0A\00"
@.str.15 = [20 x i8] c"%d byte block size\0A\00"
@.str.16 = [21 x i8] c" total %08d blocks\0A\00"
@.str.17 = [28 x i8] c"Skipped %08d sparse blocks\0A\00"
@.str.18 = [39 x i8] c" found %08d zero blocks (now sparse)\0A\00"
@.str.19 = [21 x i8] c" copied %08d blocks\0A\00"
@.str.20 = [31 x i8] c" wrote %08d different blocks\0A\00"
@.str.22 = [36 x i8] c" Sum: %08d blocks accounted for.\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"Report:\00"
@str.23 = [39 x i8] c" ------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast %struct.stat* %3 to i8*
%9 = bitcast %struct.stat* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = icmp eq i32 %0, 4
br i1 %11, label %21, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* @O_RDONLY
%25 = tail call i32 (i8*, i32, ...) @open(i8* %23, i32 %24)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %22
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %21
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = load i32, i32* @O_RDONLY
%37 = tail call i32 (i8*, i32, ...) @open(i8* %35, i32 %36)
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %46
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = load i8*, i8** %34
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %41)
%43 = tail call i32 @close(i32 %25)
%44 = load i32, i32* @EXIT_FAILURE
%45 = tail call i32 @exit(i32 %44)
unreachable
46: ; preds = %33
%47 = load i32, i32* @FIGETBSZ
%48 = call i64 @ioctl(i32 %25, i32 %47, i32* %5)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %57
50: ; preds = %46
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @close(i32 %25)
%54 = call i32 @close(i32 %37)
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %46
%58 = call i64 @fstat(i32 %25, %struct.stat* %3)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %68
60: ; preds = %57
%61 = load i32, i32* @stderr
%62 = load i8*, i8** %22
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %62)
%64 = call i32 @close(i32 %25)
%65 = call i32 @close(i32 %37)
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %57
%69 = call i64 @fstat(i32 %37, %struct.stat* %4)
%70 = icmp slt i64 %69, 0
br i1 %70, label %71, label %79
71: ; preds = %68
%72 = load i32, i32* @stderr
%73 = load i8*, i8** %34
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %73)
%75 = call i32 @close(i32 %25)
%76 = call i32 @close(i32 %37)
%77 = load i32, i32* @EXIT_FAILURE
%78 = call i32 @exit(i32 %77)
unreachable
79: ; preds = %68
%80 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%81 = load i32, i32* %80
%82 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%83 = load i32, i32* %82
%84 = icmp eq i32 %81, %83
br i1 %84, label %92, label %85
85: ; preds = %79
%86 = load i32, i32* @stderr
%87 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%88 = call i32 @close(i32 %25)
%89 = call i32 @close(i32 %37)
%90 = load i32, i32* @EXIT_FAILURE
%91 = call i32 @exit(i32 %90)
unreachable
92: ; preds = %79
%93 = load i32, i32* %5
%94 = add i32 %81, -1
%95 = add i32 %94, %93
%96 = sdiv i32 %95, %93
%97 = getelementptr inbounds i8*, i8** %1, i64 3
%98 = load i8*, i8** %97
%99 = load i32, i32* @O_WRONLY
%100 = load i32, i32* @O_CREAT
%101 = or i32 %100, %99
%102 = load i32, i32* @O_TRUNC
%103 = or i32 %101, %102
%104 = call i32 (i8*, i32, ...) @open(i8* %98, i32 %103, i32 511)
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %114
106: ; preds = %92
%107 = load i32, i32* @stderr
%108 = load i8*, i8** %97
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %108)
%110 = call i32 @close(i32 %25)
%111 = call i32 @close(i32 %37)
%112 = load i32, i32* @EXIT_FAILURE
%113 = call i32 @exit(i32 %112)
unreachable
114: ; preds = %92
%115 = load i32, i32* %5
%116 = call i8* @malloc(i32 %115)
%117 = icmp eq i8* %116, null
br i1 %117, label %124, label %118
118: ; preds = %114
%119 = icmp sgt i32 %96, 0
br i1 %119, label %120, label %359
120: ; preds = %118
%121 = bitcast i32* %6 to i8*
%122 = bitcast i32* %7 to i8*
%123 = add nsw i32 %96, -1
br label %132
124: ; preds = %114
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%127 = call i32 @close(i32 %25)
%128 = call i32 @close(i32 %37)
%129 = call i32 @close(i32 %104)
%130 = load i32, i32* @EXIT_FAILURE
%131 = call i32 @exit(i32 %130)
unreachable
132: ; preds = %120, %353
%133 = phi i32 [ 0, %120 ], [ %156, %353 ]
%134 = phi i32 [ -1, %120 ], [ %164, %353 ]
%135 = phi i32 [ 0, %120 ], [ %357, %353 ]
%136 = phi i32 [ 0, %120 ], [ %356, %353 ]
%137 = phi i32 [ 0, %120 ], [ %355, %353 ]
%138 = phi i32 [ 0, %120 ], [ %354, %353 ]
store i32 %133, i32* %6
store i32 %133, i32* %7
%139 = load i32, i32* @FIBMAP
%140 = call i64 @ioctl(i32 %25, i32 %139, i32* %6)
%141 = icmp eq i64 %140, 0
br i1 %141, label %142, label %146
142: ; preds = %132
%143 = load i32, i32* @FIBMAP
%144 = call i64 @ioctl(i32 %37, i32 %143, i32* %7)
%145 = icmp eq i64 %144, 0
br i1 %145, label %155, label %146
146: ; preds = %142, %132
%147 = load i32, i32* @errno
%148 = call i8* @strerror(i32 %147)
%149 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.7, i64 0, i64 0), i8* %148, i32 %133)
%150 = call i32 @close(i32 %25)
%151 = call i32 @close(i32 %37)
%152 = call i32 @close(i32 %104)
%153 = load i32, i32* @EXIT_FAILURE
%154 = call i32 @exit(i32 %153)
unreachable
155: ; preds = %142
%156 = add nuw nsw i32 %133, 1
%157 = mul nsw i32 %156, 100
%158 = sdiv i32 %157, %96
%159 = icmp eq i32 %134, %158
br i1 %159, label %163, label %160
160: ; preds = %155
%161 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.8, i64 0, i64 0), i32 %156, i32 %96, i32 %158, i32 %138, i32 %137, i32 %135, i32 %136)
%162 = call i32 @fflush(i32 0)
br label %163
163: ; preds = %160, %155
%164 = phi i32 [ %158, %160 ], [ %134, %155 ]
%165 = load i32, i32* %6
%166 = icmp ne i32 %165, 0
%167 = load i32, i32* %7
%168 = icmp ne i32 %167, 0
%169 = select i1 %166, i1 true, i1 %168
br i1 %169, label %195, label %170
170: ; preds = %163
%171 = load i32, i32* %5
%172 = load i32, i32* @SEEK_CUR
%173 = call i64 @lseek(i32 %25, i32 %171, i32 %172)
%174 = icmp slt i64 %173, 0
br i1 %174, label %185, label %175
175: ; preds = %170
%176 = load i32, i32* %5
%177 = load i32, i32* @SEEK_CUR
%178 = call i64 @lseek(i32 %37, i32 %176, i32 %177)
%179 = icmp slt i64 %178, 0
br i1 %179, label %185, label %180
180: ; preds = %175
%181 = load i32, i32* %5
%182 = load i32, i32* @SEEK_CUR
%183 = call i64 @lseek(i32 %104, i32 %181, i32 %182)
%184 = icmp slt i64 %183, 0
br i1 %184, label %185, label %193
185: ; preds = %180, %175, %170
%186 = load i32, i32* @stderr
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%188 = call i32 @close(i32 %25)
%189 = call i32 @close(i32 %37)
%190 = call i32 @close(i32 %104)
%191 = load i32, i32* @EXIT_FAILURE
%192 = call i32 @exit(i32 %191)
unreachable
193: ; preds = %180
%194 = add nsw i32 %138, 1
br label %353
195: ; preds = %163
%196 = icmp eq i32 %165, 0
%197 = select i1 %196, i1 %168, i1 false
br i1 %197, label %198, label %273
198: ; preds = %195
%199 = load i32, i32* %5
%200 = call i32 @read(i32 %37, i8* %116, i32 %199)
%201 = load i32, i32* %5
%202 = icmp sge i32 %200, %201
%203 = icmp eq i32 %133, %123
%204 = select i1 %202, i1 true, i1 %203
br i1 %204, label %213, label %205
205: ; preds = %198
%206 = load i32, i32* @stderr
%207 = call i32 (i32, i8*, ...) @fprintf(i32 %206, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%208 = call i32 @close(i32 %25)
%209 = call i32 @close(i32 %37)
%210 = call i32 @close(i32 %104)
%211 = load i32, i32* @EXIT_FAILURE
%212 = call i32 @exit(i32 %211)
unreachable
213: ; preds = %198
%214 = icmp eq i32 %200, -1
br i1 %214, label %267, label %215
215: ; preds = %213
%216 = icmp sgt i32 %200, 0
br i1 %216, label %217, label %229
217: ; preds = %215
%218 = zext i32 %200 to i64
br label %219
219: ; preds = %217, %224
%220 = phi i64 [ 0, %217 ], [ %225, %224 ]
%221 = getelementptr inbounds i8, i8* %116, i64 %220
%222 = load i8, i8* %221
%223 = icmp eq i8 %222, 0
br i1 %223, label %224, label %227
224: ; preds = %219
%225 = add nuw nsw i64 %220, 1
%226 = icmp eq i64 %225, %218
br i1 %226, label %232, label %219
227: ; preds = %219
%228 = trunc i64 %220 to i32
br label %229
229: ; preds = %227, %215
%230 = phi i32 [ 0, %215 ], [ %228, %227 ]
%231 = icmp eq i32 %230, %200
br i1 %231, label %232, label %250
232: ; preds = %224, %229
%233 = load i32, i32* @SEEK_CUR
%234 = call i64 @lseek(i32 %25, i32 %200, i32 %233)
%235 = icmp slt i64 %234, 0
br i1 %235, label %240, label %236
236: ; preds = %232
%237 = load i32, i32* @SEEK_CUR
%238 = call i64 @lseek(i32 %104, i32 %200, i32 %237)
%239 = icmp slt i64 %238, 0
br i1 %239, label %240, label %248
240: ; preds = %236, %232
%241 = load i32, i32* @stderr
%242 = call i32 (i32, i8*, ...) @fprintf(i32 %241, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%243 = call i32 @close(i32 %25)
%244 = call i32 @close(i32 %37)
%245 = call i32 @close(i32 %104)
%246 = load i32, i32* @EXIT_FAILURE
%247 = call i32 @exit(i32 %246)
unreachable
248: ; preds = %236
%249 = add nsw i32 %137, 1
br label %353
250: ; preds = %229
%251 = call i32 @write(i32 %104, i8* %116, i32 %200)
%252 = icmp eq i32 %251, %200
br i1 %252, label %253, label %267
253: ; preds = %250
%254 = load i32, i32* @SEEK_CUR
%255 = call i64 @lseek(i32 %25, i32 %200, i32 %254)
%256 = icmp slt i64 %255, 0
br i1 %256, label %257, label %265
257: ; preds = %253
%258 = load i32, i32* @stderr
%259 = call i32 (i32, i8*, ...) @fprintf(i32 %258, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%260 = call i32 @close(i32 %25)
%261 = call i32 @close(i32 %37)
%262 = call i32 @close(i32 %104)
%263 = load i32, i32* @EXIT_FAILURE
%264 = call i32 @exit(i32 %263)
unreachable
265: ; preds = %253
%266 = add nsw i32 %135, 1
br label %353
267: ; preds = %250, %213
%268 = phi i8** [ %34, %213 ], [ %97, %250 ]
%269 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), %213 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), %250 ]
%270 = load i32, i32* @stderr
%271 = load i8*, i8** %268
%272 = call i32 (i32, i8*, ...) @fprintf(i32 %270, i8* %269, i32 %133, i8* %271)
br label %273
273: ; preds = %267, %195
%274 = load i32, i32* %6
%275 = icmp eq i32 %274, 0
br i1 %275, label %353, label %276
276: ; preds = %273
%277 = load i32, i32* %5
%278 = call i32 @read(i32 %25, i8* %116, i32 %277)
%279 = load i32, i32* %5
%280 = icmp sge i32 %278, %279
%281 = icmp eq i32 %133, %123
%282 = select i1 %280, i1 true, i1 %281
br i1 %282, label %291, label %283
283: ; preds = %276
%284 = load i32, i32* @stderr
%285 = call i32 (i32, i8*, ...) @fprintf(i32 %284, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
%286 = call i32 @close(i32 %25)
%287 = call i32 @close(i32 %37)
%288 = call i32 @close(i32 %104)
%289 = load i32, i32* @EXIT_FAILURE
%290 = call i32 @exit(i32 %289)
unreachable
291: ; preds = %276
%292 = icmp eq i32 %278, -1
br i1 %292, label %297, label %293
293: ; preds = %291
%294 = icmp sgt i32 %278, 0
br i1 %294, label %295, label %311
295: ; preds = %293
%296 = zext i32 %278 to i64
br label %301
297: ; preds = %291
%298 = load i32, i32* @stderr
%299 = load i8*, i8** %34
%300 = call i32 (i32, i8*, ...) @fprintf(i32 %298, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), i32 %133, i8* %299)
br label %353
301: ; preds = %295, %306
%302 = phi i64 [ 0, %295 ], [ %307, %306 ]
%303 = getelementptr inbounds i8, i8* %116, i64 %302
%304 = load i8, i8* %303
%305 = icmp eq i8 %304, 0
br i1 %305, label %306, label %309
306: ; preds = %301
%307 = add nuw nsw i64 %302, 1
%308 = icmp eq i64 %307, %296
br i1 %308, label %314, label %301
309: ; preds = %301
%310 = trunc i64 %302 to i32
br label %311
311: ; preds = %309, %293
%312 = phi i32 [ 0, %293 ], [ %310, %309 ]
%313 = icmp eq i32 %312, %278
br i1 %313, label %314, label %332
314: ; preds = %306, %311
%315 = load i32, i32* @SEEK_CUR
%316 = call i64 @lseek(i32 %37, i32 %278, i32 %315)
%317 = icmp slt i64 %316, 0
br i1 %317, label %322, label %318
318: ; preds = %314
%319 = load i32, i32* @SEEK_CUR
%320 = call i64 @lseek(i32 %104, i32 %278, i32 %319)
%321 = icmp slt i64 %320, 0
br i1 %321, label %322, label %330
322: ; preds = %318, %314
%323 = load i32, i32* @stderr
%324 = call i32 (i32, i8*, ...) @fprintf(i32 %323, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%325 = call i32 @close(i32 %25)
%326 = call i32 @close(i32 %37)
%327 = call i32 @close(i32 %104)
%328 = load i32, i32* @EXIT_FAILURE
%329 = call i32 @exit(i32 %328)
unreachable
330: ; preds = %318
%331 = add nsw i32 %137, 1
br label %353
332: ; preds = %311
%333 = call i32 @write(i32 %104, i8* %116, i32 %278)
%334 = icmp eq i32 %333, %278
br i1 %334, label %339, label %335
335: ; preds = %332
%336 = load i32, i32* @stderr
%337 = load i8*, i8** %97
%338 = call i32 (i32, i8*, ...) @fprintf(i32 %336, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i32 %133, i8* %337)
br label %353
339: ; preds = %332
%340 = load i32, i32* @SEEK_CUR
%341 = call i64 @lseek(i32 %37, i32 %278, i32 %340)
%342 = icmp slt i64 %341, 0
br i1 %342, label %343, label %351
343: ; preds = %339
%344 = load i32, i32* @stderr
%345 = call i32 (i32, i8*, ...) @fprintf(i32 %344, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%346 = call i32 @close(i32 %25)
%347 = call i32 @close(i32 %37)
%348 = call i32 @close(i32 %104)
%349 = load i32, i32* @EXIT_FAILURE
%350 = call i32 @exit(i32 %349)
unreachable
351: ; preds = %339
%352 = add nsw i32 %136, 1
br label %353
353: ; preds = %265, %248, %330, %351, %335, %273, %297, %193
%354 = phi i32 [ %194, %193 ], [ %138, %297 ], [ %138, %273 ], [ %138, %335 ], [ %138, %351 ], [ %138, %330 ], [ %138, %248 ], [ %138, %265 ]
%355 = phi i32 [ %137, %193 ], [ %137, %297 ], [ %137, %273 ], [ %137, %335 ], [ %137, %351 ], [ %331, %330 ], [ %249, %248 ], [ %137, %265 ]
%356 = phi i32 [ %136, %193 ], [ %136, %297 ], [ %136, %273 ], [ %136, %335 ], [ %352, %351 ], [ %136, %330 ], [ %136, %248 ], [ %136, %265 ]
%357 = phi i32 [ %135, %193 ], [ %135, %297 ], [ %135, %273 ], [ %135, %335 ], [ %135, %351 ], [ %135, %330 ], [ %135, %248 ], [ %266, %265 ]
%358 = icmp eq i32 %156, %96
br i1 %358, label %359, label %132
359: ; preds = %353, %118
%360 = phi i32 [ 0, %118 ], [ %354, %353 ]
%361 = phi i32 [ 0, %118 ], [ %355, %353 ]
%362 = phi i32 [ 0, %118 ], [ %356, %353 ]
%363 = phi i32 [ 0, %118 ], [ %357, %353 ]
%364 = call i32 @close(i32 %25)
%365 = call i32 @close(i32 %37)
%366 = call i32 @ftruncate(i32 %104, i32 %81)
%367 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 3
%368 = load i32, i32* %367
%369 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 2
%370 = load i32, i32* %369
%371 = call i32 @fchown(i32 %104, i32 %368, i32 %370)
%372 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 1
%373 = load i32, i32* %372
%374 = call i32 @fchmod(i32 %104, i32 %373)
%375 = call i32 @close(i32 %104)
%376 = call i32 @free(i8* %116)
%377 = call i32 @putchar(i32 10)
%378 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%379 = load i32, i32* %5
%380 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 %379)
%381 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %96)
%382 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0), i32 %360)
%383 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0), i32 %361)
%384 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i32 %363)
%385 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0), i32 %362)
%386 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.23, i64 0, i64 0))
%387 = add nsw i32 %361, %360
%388 = add i32 %387, %362
%389 = add i32 %388, %363
%390 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.22, i64 0, i64 0), i32 %389)
%391 = load i32, i32* @EXIT_SUCCESS
%392 = call i32 @exit(i32 %391)
unreachable
}