#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;
};

/* 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*/ 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 identical_blocks;
  int different_blocks;
  int percent = -1;
  unsigned char *buffer1, *buffer2;
  if (argc != 4) {
    fprintf(stderr, "%s a fast sparse-aware binary file differ.\n", argv[0]);
    fprintf(stderr, "Usage: %s FILE2 FILE1 DIFF\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(fd1, &statinfo2) < 0) {
    fprintf(stderr, "Cannot stat %s\n", argv[2]);
    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);
  buffer2 = malloc(block_size);
  if (!buffer1 || !buffer2) {
    fprintf(stderr, "Cannot allocate buffer\n");
    close(fd1);
    close(fd2);
    close(fd3);
    exit(EXIT_FAILURE);
  }
  sparse_blocks = 0;
  zero_blocks = 0;
  identical_blocks = 0;
  different_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, I:%08d ,M:%08d \r", i + 1,
             num_blocks, percent, sparse_blocks, zero_blocks, identical_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++;
    } else {
      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[1]);
      }
      if (!sblock) {
        int n;
        for (n = 0; n < nread; n++) {
          if (buffer1[n])
            break;
        }
        if (n == nread) {
          if (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);
          }
          zero_blocks++;
          continue;
        }
      }
      if (read(fd2, buffer2, nread) != nread) {
        fprintf(stderr, "Cannot read block %d on %s\n", i, argv[2]);
      } else {
        int n;
        for (n = 0; n < nread; n++) {
          if (buffer1[n] != buffer2[n])
            break;
        }
        if (n == nread) {
          if (lseek(fd3, nread, SEEK_CUR) < 0) {
            fprintf(stderr, "Seek failed.\n");
            close(fd1);
            close(fd2);
            close(fd3);
            exit(EXIT_FAILURE);
          }
          identical_blocks++;
          continue;
        }
      }
      if (write(fd3, buffer1, nread) != block_size) {
        fprintf(stderr, "Cannot write block %d on %s\n", i, argv[3]);
      } else {
        different_blocks++;
      }
    }
  }
  close(fd1);
  close(fd2);
  ftruncate(fd3, statinfo1.st_size);
  close(fd3);
  free(buffer1);
  free(buffer2);
  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\n", zero_blocks);
  printf("  found %08d identical blocks\n", identical_blocks);
  printf("  wrote %08d different blocks\n", different_blocks);
  printf("  ------------------------------------\n");
  printf("  Sum:  %08d blocks accounted for.\n",
         (sparse_blocks + zero_blocks + identical_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,-0x4c(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1264 <main+0x74>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xddd(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    12b5 <main+0xc5>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d04(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    130e <main+0x11e>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xd57(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x24(%rbp),%edi
mov    0x2cb8(%rip),%rax
mov    (%rax),%esi
lea    -0x34(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
jge    1362 <main+0x172>
mov    0x2c84(%rip),%rax
mov    (%rax),%edi
lea    0xd1b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1110 <fstat@plt>
cmp    $0x0,%rax
jge    13b5 <main+0x1c5>
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xcdf(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    0x2bf2(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1110 <fstat@plt>
cmp    $0x0,%rax
jge    1408 <main+0x218>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc8c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%eax
add    -0x34(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x34(%rbp)
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
mov    0x2b61(%rip),%rax
mov    (%rax),%esi
mov    0x2bc8(%rip),%rax
or     (%rax),%esi
mov    0x2bb7(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
mov    $0x0,%al
call   10e0 <open@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    1490 <main+0x2a0>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xbdd(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    0x2b17(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x34(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x34(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     14be <main+0x2ce>
cmpq   $0x0,-0x60(%rbp)
jne    14fb <main+0x30b>
mov    0x2af3(%rip),%rax
mov    (%rax),%edi
lea    0xbb1(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x2aac(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    19c4 <main+0x7d4>
mov    -0x38(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2a61(%rip),%rax
mov    (%rax),%esi
lea    -0x64(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
jne    157b <main+0x38b>
mov    -0x28(%rbp),%edi
mov    0x2a42(%rip),%rax
mov    (%rax),%esi
lea    -0x68(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
je     15c3 <main+0x3d3>
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
mov    -0x38(%rbp),%edx
lea    0xb01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x29e4(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x78(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,%ecx
mov    -0x78(%rbp),%eax
cmp    %ecx,%eax
je     162b <main+0x43b>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x30(%rbp)
mov    %eax,-0x4c(%rbp)
mov    -0x38(%rbp),%esi
add    $0x1,%esi
mov    -0x30(%rbp),%edx
mov    -0x4c(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    -0x40(%rbp),%r9d
mov    -0x44(%rbp),%r10d
mov    -0x48(%rbp),%eax
lea    0xab0(%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,-0x64(%rbp)
jne    16e4 <main+0x4f4>
cmpl   $0x0,-0x68(%rbp)
jne    16e4 <main+0x4f4>
mov    -0x24(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    0x298c(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     1699 <main+0x4a9>
mov    -0x28(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    0x296e(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     1699 <main+0x4a9>
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    0x2950(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    16d6 <main+0x4e6>
mov    0x2918(%rip),%rax
mov    (%rax),%edi
lea    0xa4f(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x28d1(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    19b1 <main+0x7c1>
mov    -0x24(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   10a0 <read@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1755 <main+0x565>
mov    -0x38(%rbp),%eax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1750 <main+0x560>
mov    0x289e(%rip),%rax
mov    (%rax),%edi
lea    0x9e3(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x2857(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    1755 <main+0x565>
cmpl   $0xffffffff,-0x6c(%rbp)
jne    1781 <main+0x591>
mov    0x2852(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0x9a4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
cmpl   $0x0,-0x68(%rbp)
jne    1860 <main+0x670>
movl   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    17c8 <main+0x5d8>
mov    -0x58(%rbp),%rax
movslq -0x70(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     17b5 <main+0x5c5>
jmp    17c8 <main+0x5d8>
jmp    17ba <main+0x5ca>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    1792 <main+0x5a2>
mov    -0x70(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jne    185b <main+0x66b>
mov    -0x28(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    0x27f7(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jl     1810 <main+0x620>
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    0x27d9(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    184d <main+0x65d>
mov    0x27a1(%rip),%rax
mov    (%rax),%edi
lea    0x8d8(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x275a(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    19b6 <main+0x7c6>
jmp    1860 <main+0x670>
mov    -0x28(%rbp),%edi
mov    -0x60(%rbp),%rsi
mov    -0x6c(%rbp),%edx
call   10a0 <read@plt>
cmp    -0x6c(%rbp),%eax
je     189f <main+0x6af>
mov    0x2739(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0x88b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1964 <main+0x774>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jge    18ea <main+0x6fa>
mov    -0x58(%rbp),%rax
movslq -0x74(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x60(%rbp),%rcx
movslq -0x74(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     18d7 <main+0x6e7>
jmp    18ea <main+0x6fa>
jmp    18dc <main+0x6ec>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    18a6 <main+0x6b6>
mov    -0x74(%rbp),%eax
cmp    -0x6c(%rbp),%eax
jne    195f <main+0x76f>
mov    -0x2c(%rbp),%edi
mov    -0x6c(%rbp),%esi
mov    0x26d5(%rip),%rax
mov    (%rax),%edx
call   1070 <lseek@plt>
cmp    $0x0,%rax
jge    1951 <main+0x761>
mov    0x269d(%rip),%rax
mov    (%rax),%edi
lea    0x7d4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    0x2656(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    19b6 <main+0x7c6>
jmp    1964 <main+0x774>
mov    -0x2c(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    -0x6c(%rbp),%edx
call   1040 <write@plt>
cmp    -0x34(%rbp),%eax
je     19a3 <main+0x7b3>
mov    0x2635(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0x7a3(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    19ac <main+0x7bc>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    19b1 <main+0x7c1>
jmp    19b6 <main+0x7c6>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    151e <main+0x32e>
mov    -0x24(%rbp),%edi
call   1090 <close@plt>
mov    -0x28(%rbp),%edi
call   1090 <close@plt>
mov    -0x2c(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <ftruncate@plt>
mov    -0x2c(%rbp),%edi
call   1090 <close@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
lea    0x823(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x749(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0x741(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0x744(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0x748(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0x753(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0x75c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%esi
lea    0x76a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0x77b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x3c(%rbp),%esi
add    -0x40(%rbp),%esi
add    -0x44(%rbp),%esi
add    -0x48(%rbp),%esi
lea    0x789(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x24ee(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbp
cmp    $0x4,%edi
jne    1254 <main+0x44>
mov    0x8(%rbp),%rdi
mov    0x2d97(%rip),%rbx
mov    (%rbx),%esi
xor    %eax,%eax
call   1100 <open@plt>
test   %eax,%eax
jns    1288 <main+0x78>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
lea    0xdf6(%rip),%rsi
jmp    127c <main+0x6c>
mov    0x2d5d(%rip),%rbx
mov    (%rbx),%edi
mov    0x0(%rbp),%rdx
lea    0xd98(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%rdx
lea    0xdb0(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1354 <main+0x144>
mov    %eax,%r14d
mov    0x10(%rbp),%rdi
mov    (%rbx),%esi
xor    %eax,%eax
call   1100 <open@plt>
test   %eax,%eax
jns    12bf <main+0xaf>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rdx
lea    0xd98(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r14d,%edi
jmp    134f <main+0x13f>
mov    %eax,%r15d
mov    0x2d07(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
mov    %r14d,%ebx
mov    %r14d,%edi
call   10a0 <ioctl@plt>
test   %rax,%rax
jns    12f9 <main+0xe9>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
lea    0xd68(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1345 <main+0x135>
lea    0x50(%rsp),%rsi
mov    %ebx,%edi
call   1130 <fstat@plt>
test   %rax,%rax
jns    1319 <main+0x109>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbp),%rdx
jmp    1337 <main+0x127>
lea    0x60(%rsp),%rsi
mov    %ebx,%edi
call   1130 <fstat@plt>
test   %rax,%rax
jns    1362 <main+0x152>
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbp),%rdx
lea    0xd31(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x50(%rsp),%r12d
mov    0x4(%rsp),%ecx
lea    (%r12,%rcx,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %ecx
mov    %rax,0x20(%rsp)
mov    0x2c07(%rip),%rax
mov    0x2c70(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x18(%rbp),%rdi
mov    0x2c59(%rip),%rax
or     (%rax),%esi
mov    $0x1ff,%edx
xor    %eax,%eax
call   1100 <open@plt>
mov    %eax,(%rsp)
test   %eax,%eax
jns    13cf <main+0x1bf>
mov    0x2c05(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rbp),%rdx
lea    0xc88(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r14d,%edi
jmp    1347 <main+0x137>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
call   10e0 <malloc@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   10e0 <malloc@plt>
test   %r13,%r13
je     178f <main+0x57f>
test   %rax,%rax
je     178f <main+0x57f>
mov    %rax,0x40(%rsp)
mov    %r12,0x58(%rsp)
mov    %rbp,0x48(%rsp)
movl   $0x0,0x14(%rsp)
mov    $0x0,%eax
mov    %rax,0x28(%rsp)
mov    $0x0,%eax
mov    %rax,0x30(%rsp)
movl   $0x0,0x18(%rsp)
cmpl   $0x0,0x20(%rsp)
mov    %r14d,%edi
mov    %r15d,%ebx
jle    17b6 <main+0x5a6>
mov    0x20(%rsp),%rax
add    $0xffffffff,%eax
mov    %eax,0x54(%rsp)
movl   $0xffffffff,0x38(%rsp)
ff
mov    0x2b53(%rip),%r14
xor    %ecx,%ecx
movl   $0x0,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
mov    %rax,0x28(%rsp)
movl   $0x0,0x14(%rsp)
mov    %edi,0xc(%rsp)
mov    %ebx,0x8(%rsp)
jmp    14a2 <main+0x292>
mov    0x30(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x30(%rsp)
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%ecx
cmp    0x20(%rsp),%ecx
je     17b6 <main+0x5a6>
mov    %ecx,%ebp
mov    %ecx,0x3c(%rsp)
mov    %ecx,0x1c(%rsp)
mov    (%r14),%esi
mov    %edi,%r15d
lea    0x3c(%rsp),%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jne    18ad <main+0x69d>
mov    (%r14),%esi
mov    %ebx,%edi
lea    0x1c(%rsp),%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
jne    18ad <main+0x69d>
mov    %r13,%r12
mov    %ebx,%r13d
lea    0x1(%rbp),%eax
mov    %eax,0x10(%rsp)
imul   $0x64,%eax,%eax
cltd
idivl  0x20(%rsp)
cmp    %eax,0x38(%rsp)
je     1534 <main+0x324>
mov    %eax,%ebx
lea    0xbc4(%rip),%rdi
mov    0x10(%rsp),%esi
mov    0x20(%rsp),%rdx
mov    %eax,%ecx
mov    0x18(%rsp),%r8d
mov    0x14(%rsp),%r9d
xor    %eax,%eax
push   0x30(%rsp)
push   0x30(%rsp)
call   1070 <printf@plt>
add    $0x10,%rsp
xor    %edi,%edi
call   10f0 <fflush@plt>
mov    %ebx,0x38(%rsp)
mov    0x3c(%rsp),%eax
or     0x1c(%rsp),%eax
mov    0x4(%rsp),%edx
je     15b0 <main+0x3a0>
mov    %r15d,%edi
mov    %r12,%r13
mov    %r12,%rsi
call   10c0 <read@plt>
mov    %eax,%r15d
cmp    0x4(%rsp),%eax
jge    1563 <main+0x353>
cmp    0x54(%rsp),%ebp
jne    18fe <main+0x6ee>
cmp    $0xffffffff,%r15d
je     1611 <main+0x401>
cmpl   $0x0,0x1c(%rsp)
jne    16b0 <main+0x4a0>
test   %r15d,%r15d
jle    165d <main+0x44d>
mov    %r15d,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,0x0(%r13,%rbx,1)
jne    165f <main+0x44f>
add    $0x1,%rbx
cmp    %rbx,%rax
jne    1590 <main+0x380>
jmp    1664 <main+0x454>
nopw   0x0(%rax,%rax,1)
mov    0x2a21(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %r15d,%edi
mov    %edx,%esi
mov    %eax,%edx
call   1090 <lseek@plt>
test   %rax,%rax
mov    %r13d,%ebx
js     18d0 <main+0x6c0>
mov    0x4(%rsp),%esi
mov    0x0(%rbp),%edx
mov    %ebx,%edi
call   1090 <lseek@plt>
test   %rax,%rax
js     18d0 <main+0x6c0>
mov    0x4(%rsp),%esi
mov    0x0(%rbp),%edx
mov    (%rsp),%edi
call   1090 <lseek@plt>
test   %rax,%rax
js     18d0 <main+0x6c0>
addl   $0x1,0x18(%rsp)
mov    %r15d,%edi
mov    %r12,%r13
jmp    1494 <main+0x284>
mov    0x29a0(%rip),%rax
mov    (%rax),%edi
mov    0x48(%rsp),%rax
mov    0x8(%rax),%rcx
xor    %ebx,%ebx
lea    0xaf2(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
cmpl   $0x0,0x1c(%rsp)
je     165f <main+0x44f>
mov    0x8(%rsp),%edi
mov    0x40(%rsp),%rsi
mov    %r15d,%edx
call   10c0 <read@plt>
xor    %ecx,%ecx
cmp    %r15d,%eax
jne    16f6 <main+0x4e6>
jmp    171c <main+0x50c>
xor    %ebx,%ebx
cmp    %r15d,%ebx
jne    16b0 <main+0x4a0>
mov    0x4(%rsp),%esi
mov    0x2969(%rip),%rbp
mov    0x0(%rbp),%edx
mov    0x8(%rsp),%edi
mov    %edi,%ebx
call   1090 <lseek@plt>
test   %rax,%rax
js     1910 <main+0x700>
mov    0x4(%rsp),%esi
mov    0x0(%rbp),%edx
mov    (%rsp),%edi
call   1090 <lseek@plt>
test   %rax,%rax
js     1910 <main+0x700>
addl   $0x1,0x14(%rsp)
jmp    1490 <main+0x280>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%edi
mov    0x40(%rsp),%rsi
mov    %r15d,%edx
call   10c0 <read@plt>
cmp    %r15d,%eax
jne    16f6 <main+0x4e6>
test   %r15d,%r15d
jle    171a <main+0x50a>
mov    %r15d,%eax
xor    %ecx,%ecx
mov    0x40(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x0(%r13,%rcx,1),%edx
cmp    (%rsi,%rcx,1),%dl
jne    171c <main+0x50c>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    16e0 <main+0x4d0>
jmp    1721 <main+0x511>
mov    0x28bb(%rip),%rax
mov    (%rax),%edi
mov    0x48(%rsp),%rax
mov    0x10(%rax),%rcx
lea    0xa0f(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    1750 <main+0x540>
xor    %ecx,%ecx
cmp    %r15d,%ecx
jne    1750 <main+0x540>
mov    0x28b0(%rip),%rax
mov    (%rax),%edx
mov    (%rsp),%edi
mov    %r15d,%esi
call   1090 <lseek@plt>
test   %rax,%rax
js     192d <main+0x71d>
mov    0x28(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x28(%rsp)
jmp    148c <main+0x27c>
mov    (%rsp),%edi
mov    %r13,%rsi
mov    %r15d,%edx
call   1060 <write@plt>
cmp    0x4(%rsp),%eax
je     147f <main+0x26f>
mov    0x2849(%rip),%rax
mov    (%rax),%edi
mov    0x48(%rsp),%rax
mov    0x18(%rax),%rcx
lea    0x9b9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10d0 <fprintf@plt>
jmp    148c <main+0x27c>
mov    0x2822(%rip),%rax
mov    (%rax),%edi
lea    0x8e0(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    %r15d,%edi
jmp    18f1 <main+0x6e1>
call   10b0 <close@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%rsp),%ebx
mov    %ebx,%edi
mov    0x58(%rsp),%rsi
call   1080 <ftruncate@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xa1d(%rip),%rdi
call   1050 <puts@plt>
mov    0x4(%rsp),%esi
lea    0x94c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x952(%rip),%rdi
mov    0x20(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x954(%rip),%rdi
mov    0x18(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x95a(%rip),%rdi
mov    0x14(%rsp),%r15d
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x95e(%rip),%rdi
mov    0x28(%rsp),%rbx
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x968(%rip),%rdi
mov    0x30(%rsp),%rbp
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x99e(%rip),%rdi
call   1050 <puts@plt>
add    %r15d,%ebx
add    %ebp,%ebx
add    %r14d,%ebx
lea    0x95e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x26f2(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x26fc(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0x7d5(%rip),%rdi
mov    %rax,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    18e7 <main+0x6d7>
mov    0x26e1(%rip),%rax
mov    (%rax),%edi
lea    0x818(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    (%rsp),%edi
jmp    134f <main+0x13f>
mov    0x26b3(%rip),%rax
mov    (%rax),%edi
lea    0x7f8(%rip),%rsi
jmp    193d <main+0x72d>
mov    0x26a1(%rip),%rax
mov    (%rax),%edi
lea    0x7d8(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0xc(%rsp),%edi
jmp    18ea <main+0x6da>
mov    0x2684(%rip),%rax
mov    (%rax),%edi
lea    0x7bb(%rip),%rsi
xor    %eax,%eax
call   10d0 <fprintf@plt>
mov    0xc(%rsp),%edi
call   10b0 <close@plt>
mov    0x8(%rsp),%edi
jmp    18f1 <main+0x6e1>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [44 x i8] c"%s a fast sparse-aware binary file differ.\0A\00"
@.str.1 = [28 x i8] c"Usage: %s FILE2 FILE1 DIFF\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"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.5 = [24 x i8] c"Cannot allocate buffer\0A\00"
@FIBMAP = global i32 0
@.str.6 = [46 x i8] c"ioctl failed: %s in block %d, are you root ?\0A\00"
@errno = global i32 0
@.str.7 = [51 x i8] c"%08d/%08d (%d%%), S:%08d, Z:%08d, I:%08d ,M:%08d \0D\00"
@SEEK_CUR = global i32 0
@.str.8 = [14 x i8] c"Seek failed.\0A\00"
@.str.9 = [24 x i8] c"Unexpected short read.\0A\00"
@.str.10 = [28 x i8] c"Cannot read block %d on %s\0A\00"
@.str.11 = [29 x i8] c"Cannot write block %d on %s\0A\00"
@.str.14 = [20 x i8] c"%d byte block size\0A\00"
@.str.15 = [21 x i8] c" total %08d blocks\0A\00"
@.str.16 = [28 x i8] c"Skipped %08d sparse blocks\0A\00"
@.str.17 = [26 x i8] c" found %08d zero blocks\0A\00"
@.str.18 = [31 x i8] c" found %08d identical blocks\0A\00"
@.str.19 = [31 x i8] c" wrote %08d different blocks\0A\00"
@.str.21 = [36 x i8] c" Sum: %08d blocks accounted for.\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"Report:\00"
@str.22 = [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 ([44 x i8], [44 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 %25, %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 = load i32, i32* %5
%83 = add i32 %81, -1
%84 = add i32 %83, %82
%85 = sdiv i32 %84, %82
%86 = getelementptr inbounds i8*, i8** %1, i64 3
%87 = load i8*, i8** %86
%88 = load i32, i32* @O_WRONLY
%89 = load i32, i32* @O_CREAT
%90 = or i32 %89, %88
%91 = load i32, i32* @O_TRUNC
%92 = or i32 %90, %91
%93 = call i32 (i8*, i32, ...) @open(i8* %87, i32 %92, i32 511)
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %103
95: ; preds = %79
%96 = load i32, i32* @stderr
%97 = load i8*, i8** %86
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %97)
%99 = call i32 @close(i32 %25)
%100 = call i32 @close(i32 %37)
%101 = load i32, i32* @EXIT_FAILURE
%102 = call i32 @exit(i32 %101)
unreachable
103: ; preds = %79
%104 = load i32, i32* %5
%105 = call i8* @malloc(i32 %104)
%106 = call i8* @malloc(i32 %104)
%107 = icmp ne i8* %105, null
%108 = icmp ne i8* %106, null
%109 = and i1 %107, %108
br i1 %109, label %110, label %116
110: ; preds = %103
%111 = icmp sgt i32 %85, 0
br i1 %111, label %112, label %308
112: ; preds = %110
%113 = bitcast i32* %6 to i8*
%114 = bitcast i32* %7 to i8*
%115 = add nsw i32 %85, -1
br label %124
116: ; preds = %103
%117 = load i32, i32* @stderr
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%119 = call i32 @close(i32 %25)
%120 = call i32 @close(i32 %37)
%121 = call i32 @close(i32 %93)
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %112, %302
%125 = phi i32 [ 0, %112 ], [ %148, %302 ]
%126 = phi i32 [ 0, %112 ], [ %306, %302 ]
%127 = phi i32 [ -1, %112 ], [ %156, %302 ]
%128 = phi i32 [ 0, %112 ], [ %305, %302 ]
%129 = phi i32 [ 0, %112 ], [ %304, %302 ]
%130 = phi i32 [ 0, %112 ], [ %303, %302 ]
store i32 %125, i32* %6
store i32 %125, i32* %7
%131 = load i32, i32* @FIBMAP
%132 = call i64 @ioctl(i32 %25, i32 %131, i32* %6)
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %138
134: ; preds = %124
%135 = load i32, i32* @FIBMAP
%136 = call i64 @ioctl(i32 %37, i32 %135, i32* %7)
%137 = icmp eq i64 %136, 0
br i1 %137, label %147, label %138
138: ; preds = %134, %124
%139 = load i32, i32* @errno
%140 = call i8* @strerror(i32 %139)
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %140, i32 %125)
%142 = call i32 @close(i32 %25)
%143 = call i32 @close(i32 %37)
%144 = call i32 @close(i32 %93)
%145 = load i32, i32* @EXIT_FAILURE
%146 = call i32 @exit(i32 %145)
unreachable
147: ; preds = %134
%148 = add nuw nsw i32 %125, 1
%149 = mul nsw i32 %148, 100
%150 = sdiv i32 %149, %85
%151 = icmp eq i32 %127, %150
br i1 %151, label %155, label %152
152: ; preds = %147
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.7, i64 0, i64 0), i32 %148, i32 %85, i32 %150, i32 %126, i32 %130, i32 %129, i32 %128)
%154 = call i32 @fflush(i32 0)
br label %155
155: ; preds = %152, %147
%156 = phi i32 [ %150, %152 ], [ %127, %147 ]
%157 = load i32, i32* %6
%158 = icmp ne i32 %157, 0
%159 = load i32, i32* %7
%160 = icmp ne i32 %159, 0
%161 = select i1 %158, i1 true, i1 %160
%162 = load i32, i32* %5
br i1 %161, label %187, label %163
163: ; preds = %155
%164 = load i32, i32* @SEEK_CUR
%165 = call i64 @lseek(i32 %25, i32 %162, i32 %164)
%166 = icmp slt i64 %165, 0
br i1 %166, label %177, label %167
167: ; preds = %163
%168 = load i32, i32* %5
%169 = load i32, i32* @SEEK_CUR
%170 = call i64 @lseek(i32 %37, i32 %168, i32 %169)
%171 = icmp slt i64 %170, 0
br i1 %171, label %177, label %172
172: ; preds = %167
%173 = load i32, i32* %5
%174 = load i32, i32* @SEEK_CUR
%175 = call i64 @lseek(i32 %93, i32 %173, i32 %174)
%176 = icmp slt i64 %175, 0
br i1 %176, label %177, label %185
177: ; preds = %172, %167, %163
%178 = load i32, i32* @stderr
%179 = call i32 (i32, i8*, ...) @fprintf(i32 %178, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%180 = call i32 @close(i32 %25)
%181 = call i32 @close(i32 %37)
%182 = call i32 @close(i32 %93)
%183 = load i32, i32* @EXIT_FAILURE
%184 = call i32 @exit(i32 %183)
unreachable
185: ; preds = %172
%186 = add nsw i32 %126, 1
br label %302
187: ; preds = %155
%188 = call i32 @read(i32 %25, i8* %105, i32 %162)
%189 = load i32, i32* %5
%190 = icmp sge i32 %188, %189
%191 = icmp eq i32 %125, %115
%192 = select i1 %190, i1 true, i1 %191
br i1 %192, label %201, label %193
193: ; preds = %187
%194 = load i32, i32* @stderr
%195 = call i32 (i32, i8*, ...) @fprintf(i32 %194, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%196 = call i32 @close(i32 %25)
%197 = call i32 @close(i32 %37)
%198 = call i32 @close(i32 %93)
%199 = load i32, i32* @EXIT_FAILURE
%200 = call i32 @exit(i32 %199)
unreachable
201: ; preds = %187
%202 = icmp eq i32 %188, -1
br i1 %202, label %206, label %203
203: ; preds = %201
%204 = load i32, i32* %7
%205 = icmp eq i32 %204, 0
br i1 %205, label %212, label %249
206: ; preds = %201
%207 = load i32, i32* @stderr
%208 = load i8*, i8** %22
%209 = call i32 (i32, i8*, ...) @fprintf(i32 %207, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %125, i8* %208)
%210 = load i32, i32* %7
%211 = icmp eq i32 %210, 0
br i1 %211, label %226, label %252
212: ; preds = %203
%213 = icmp sgt i32 %188, 0
br i1 %213, label %214, label %226
214: ; preds = %212
%215 = zext i32 %188 to i64
br label %216
216: ; preds = %214, %221
%217 = phi i64 [ 0, %214 ], [ %222, %221 ]
%218 = getelementptr inbounds i8, i8* %105, i64 %217
%219 = load i8, i8* %218
%220 = icmp eq i8 %219, 0
br i1 %220, label %221, label %224
221: ; preds = %216
%222 = add nuw nsw i64 %217, 1
%223 = icmp eq i64 %222, %215
br i1 %223, label %229, label %216
224: ; preds = %216
%225 = trunc i64 %217 to i32
br label %226
226: ; preds = %224, %206, %212
%227 = phi i32 [ 0, %212 ], [ 0, %206 ], [ %225, %224 ]
%228 = icmp eq i32 %227, %188
br i1 %228, label %229, label %249
229: ; preds = %221, %226
%230 = load i32, i32* %5
%231 = load i32, i32* @SEEK_CUR
%232 = call i64 @lseek(i32 %37, i32 %230, i32 %231)
%233 = icmp slt i64 %232, 0
br i1 %233, label %239, label %234
234: ; preds = %229
%235 = load i32, i32* %5
%236 = load i32, i32* @SEEK_CUR
%237 = call i64 @lseek(i32 %93, i32 %235, i32 %236)
%238 = icmp slt i64 %237, 0
br i1 %238, label %239, label %247
239: ; preds = %234, %229
%240 = load i32, i32* @stderr
%241 = call i32 (i32, i8*, ...) @fprintf(i32 %240, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%242 = call i32 @close(i32 %25)
%243 = call i32 @close(i32 %37)
%244 = call i32 @close(i32 %93)
%245 = load i32, i32* @EXIT_FAILURE
%246 = call i32 @exit(i32 %245)
unreachable
247: ; preds = %234
%248 = add nsw i32 %130, 1
br label %302
249: ; preds = %226, %203
%250 = call i32 @read(i32 %37, i8* %106, i32 %188)
%251 = icmp eq i32 %250, %188
br i1 %251, label %255, label %259
252: ; preds = %206
%253 = call i32 @read(i32 %37, i8* %106, i32 %188)
%254 = icmp eq i32 %253, %188
br i1 %254, label %275, label %259
255: ; preds = %249
%256 = icmp sgt i32 %188, 0
br i1 %256, label %257, label %275
257: ; preds = %255
%258 = zext i32 %188 to i64
br label %263
259: ; preds = %252, %249
%260 = load i32, i32* @stderr
%261 = load i8*, i8** %34
%262 = call i32 (i32, i8*, ...) @fprintf(i32 %260, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i32 %125, i8* %261)
br label %292
263: ; preds = %257, %270
%264 = phi i64 [ 0, %257 ], [ %271, %270 ]
%265 = getelementptr inbounds i8, i8* %105, i64 %264
%266 = load i8, i8* %265
%267 = getelementptr inbounds i8, i8* %106, i64 %264
%268 = load i8, i8* %267
%269 = icmp eq i8 %266, %268
br i1 %269, label %270, label %273
270: ; preds = %263
%271 = add nuw nsw i64 %264, 1
%272 = icmp eq i64 %271, %258
br i1 %272, label %278, label %263
273: ; preds = %263
%274 = trunc i64 %264 to i32
br label %275
275: ; preds = %273, %252, %255
%276 = phi i32 [ 0, %255 ], [ 0, %252 ], [ %274, %273 ]
%277 = icmp eq i32 %276, %188
br i1 %277, label %278, label %292
278: ; preds = %270, %275
%279 = load i32, i32* @SEEK_CUR
%280 = call i64 @lseek(i32 %93, i32 %188, i32 %279)
%281 = icmp slt i64 %280, 0
br i1 %281, label %282, label %290
282: ; preds = %278
%283 = load i32, i32* @stderr
%284 = call i32 (i32, i8*, ...) @fprintf(i32 %283, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%285 = call i32 @close(i32 %25)
%286 = call i32 @close(i32 %37)
%287 = call i32 @close(i32 %93)
%288 = load i32, i32* @EXIT_FAILURE
%289 = call i32 @exit(i32 %288)
unreachable
290: ; preds = %278
%291 = add nsw i32 %129, 1
br label %302
292: ; preds = %275, %259
%293 = call i32 @write(i32 %93, i8* %105, i32 %188)
%294 = load i32, i32* %5
%295 = icmp eq i32 %293, %294
br i1 %295, label %300, label %296
296: ; preds = %292
%297 = load i32, i32* @stderr
%298 = load i8*, i8** %86
%299 = call i32 (i32, i8*, ...) @fprintf(i32 %297, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i32 %125, i8* %298)
br label %302
300: ; preds = %292
%301 = add nsw i32 %128, 1
br label %302
302: ; preds = %290, %247, %185, %300, %296
%303 = phi i32 [ %130, %296 ], [ %130, %300 ], [ %130, %185 ], [ %248, %247 ], [ %130, %290 ]
%304 = phi i32 [ %129, %296 ], [ %129, %300 ], [ %129, %185 ], [ %129, %247 ], [ %291, %290 ]
%305 = phi i32 [ %128, %296 ], [ %301, %300 ], [ %128, %185 ], [ %128, %247 ], [ %128, %290 ]
%306 = phi i32 [ %126, %296 ], [ %126, %300 ], [ %186, %185 ], [ %126, %247 ], [ %126, %290 ]
%307 = icmp eq i32 %148, %85
br i1 %307, label %308, label %124
308: ; preds = %302, %110
%309 = phi i32 [ 0, %110 ], [ %303, %302 ]
%310 = phi i32 [ 0, %110 ], [ %304, %302 ]
%311 = phi i32 [ 0, %110 ], [ %305, %302 ]
%312 = phi i32 [ 0, %110 ], [ %306, %302 ]
%313 = call i32 @close(i32 %25)
%314 = call i32 @close(i32 %37)
%315 = call i32 @ftruncate(i32 %93, i32 %81)
%316 = call i32 @close(i32 %93)
%317 = call i32 @free(i8* %105)
%318 = call i32 @free(i8* %106)
%319 = call i32 @putchar(i32 10)
%320 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%321 = load i32, i32* %5
%322 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %321)
%323 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %85)
%324 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i32 %312)
%325 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0), i32 %309)
%326 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.18, i64 0, i64 0), i32 %310)
%327 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.19, i64 0, i64 0), i32 %311)
%328 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.22, i64 0, i64 0))
%329 = add i32 %310, %309
%330 = add i32 %329, %311
%331 = add i32 %330, %312
%332 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.21, i64 0, i64 0), i32 %331)
%333 = load i32, i32* @EXIT_SUCCESS
%334 = call i32 @exit(i32 %333)
unreachable
}