#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;
};
typedef scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int FALLOC_FL_KEEP_SIZE;
int FALLOC_FL_PUNCH_HOLE;
int /*<<< orphan*/ FIBMAP;
int /*<<< orphan*/ FIGETBSZ;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fallocate(int, int, scalar_t__, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fstat(int, struct stat *);
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
scalar_t__ lseek(int, int, int /*<<< orphan*/);
unsigned char *malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, unsigned char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct stat statinfo1;
  int fd1;
  int num_blocks;
  int block_size;
  int i;
  int sparse_blocks;
  int zero_blocks;
  int copied_blocks;
  int percent = -1;
  unsigned char *buffer1;
  if (argc != 2) {
    fprintf(stderr, "%s a fast sparse block generator.\n", argv[0]);
    fprintf(stderr, "Usage: %s FILE1\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if ((fd1 = open(argv[1], O_RDWR)) < 0) {
    fprintf(stderr, "Cannot open %s\n", argv[1]);
    exit(EXIT_FAILURE);
  }
  if (ioctl(fd1, FIGETBSZ, &block_size) < 0) {
    fprintf(stderr, "Cannot get block size\n");
    close(fd1);
    exit(EXIT_FAILURE);
  }
  if (fstat(fd1, &statinfo1) < 0) {
    fprintf(stderr, "Cannot stat %s\n", argv[1]);
    close(fd1);
    exit(EXIT_FAILURE);
  }
  num_blocks = (statinfo1.st_size + block_size - 1) / block_size;
  buffer1 = malloc(block_size);
  if (!buffer1) {
    fprintf(stderr, "Cannot allocate buffer\n");
    close(fd1);
    exit(EXIT_FAILURE);
  }
  sparse_blocks = 0;
  zero_blocks = 0;
  copied_blocks = 0;
  for (i = 0; i < num_blocks; i++) {
    int block = i;
    int nread = 0;
    if (ioctl(fd1, FIBMAP, &block)) {
      printf("ioctl failed: %s in block %d, are you root ?\n", strerror(errno),
             i);
      close(fd1);
      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  \r", i + 1, num_blocks,
             percent, sparse_blocks, zero_blocks, copied_blocks);
      fflush(0);
    }
    if (!block) {
      if (lseek(fd1, block_size, SEEK_CUR) < 0) {
        fprintf(stderr, "Seek failed.\n");
        close(fd1);
        exit(EXIT_FAILURE);
      }
      sparse_blocks++;
      continue;
    }
    off_t filepos;
    filepos = lseek(fd1, 0, SEEK_CUR);
    nread = read(fd1, buffer1, block_size);
    if (nread < block_size) {
      if (i != (num_blocks - 1)) {
        fprintf(stderr, "Unexpected short read.\n");
        close(fd1);
        exit(EXIT_FAILURE);
      }
    }
    int n;
    for (n = 0; n < nread; n++) {
      if (buffer1[n])
        break;
    }
    if (n == nread) {
      if (fallocate(fd1, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, filepos,
                    nread)) {
        fprintf(stderr, "Hole punch fallocate() call failed, may not be "
                        "supported on this filesystem.\n");
        perror("Details");
        close(fd1);
        exit(EXIT_FAILURE);
      }
      zero_blocks++;
      continue;
    } else {
      copied_blocks++;
      continue;
    }
  }
  close(fd1);
  fflush(stdout);
  printf("\n");
  printf("Report:\n");
  printf("%d byte block size\n", block_size);
  printf("  total %08d blocks\n", num_blocks);
  printf("  found %08d sparse blocks\n", sparse_blocks);
  printf("  found %08d zero blocks (now sparse)\n", zero_blocks);
  printf("  found %08d data blocks\n", copied_blocks);
  printf("  ------------------------------------\n");
  printf("  Sum:  %08d blocks accounted for.\n",
         (sparse_blocks + zero_blocks + copied_blocks));
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x38(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1251 <main+0x71>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xde2(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    12a0 <main+0xc0>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
lea    -0x24(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
jge    12ec <main+0x10c>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x1c(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1100 <fstat@plt>
cmp    $0x0,%rax
jge    1337 <main+0x157>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd41(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%eax
add    -0x24(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x24(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%edi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    138b <main+0x1ab>
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
lea    0xcfd(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1623 <main+0x443>
mov    -0x28(%rbp),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x1c(%rbp),%edi
mov    0x2bde(%rip),%rax
mov    (%rax),%esi
lea    -0x44(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0x0,%rax
je     1417 <main+0x237>
mov    0x2bca(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
mov    -0x28(%rbp),%edx
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2b90(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x20(%rbp)
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
cmp    %ecx,%eax
je     1476 <main+0x296>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
imul   $0x64,%eax,%eax
cltd
idivl  -0x20(%rbp)
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
mov    -0x34(%rbp),%eax
lea    0xc4c(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   10b0 <fflush@plt>
cmpl   $0x0,-0x44(%rbp)
jne    14d9 <main+0x2f9>
mov    -0x1c(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    0x2b4b(%rip),%rax
mov    (%rax),%edx
call   1040 <lseek@plt>
cmp    $0x0,%rax
jge    14cb <main+0x2eb>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
lea    0xc2f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1615 <main+0x435>
mov    -0x1c(%rbp),%edi
mov    0x2af5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <lseek@plt>
mov    %rax,-0x50(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x40(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1070 <read@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1551 <main+0x371>
mov    -0x28(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     154c <main+0x36c>
mov    0x2a9a(%rip),%rax
mov    (%rax),%edi
lea    0xbbc(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2a5b(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    1551 <main+0x371>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    158e <main+0x3ae>
mov    -0x40(%rbp),%rax
movslq -0x54(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     157b <main+0x39b>
jmp    158e <main+0x3ae>
jmp    1580 <main+0x3a0>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1558 <main+0x378>
mov    -0x54(%rbp),%eax
cmp    -0x48(%rbp),%eax
jne    160c <main+0x42c>
mov    -0x1c(%rbp),%edi
mov    0x2a3c(%rip),%rax
mov    (%rax),%esi
mov    0x2a0b(%rip),%rax
or     (%rax),%esi
mov    -0x50(%rbp),%rdx
mov    -0x48(%rbp),%ecx
call   1080 <fallocate@plt>
cmp    $0x0,%rax
je     15fe <main+0x41e>
mov    0x29f4(%rip),%rax
mov    (%rax),%edi
lea    0xb2e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
lea    0xb6e(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x29a9(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1615 <main+0x435>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    13a7 <main+0x1c7>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    0x2966(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xb0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xb03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xb06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xb0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xb15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xb2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xb37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
add    -0x30(%rbp),%esi
add    -0x34(%rbp),%esi
lea    0xb48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x28ba(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1242 <main+0x42>
mov    0x8(%rbx),%rdi
mov    0x2dc7(%rip),%rax
mov    (%rax),%esi
call   10e0 <open@plt>
test   %eax,%eax
jns    1273 <main+0x73>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xdf4(%rip),%rsi
jmp    126a <main+0x6a>
mov    0x2d77(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xdaa(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xdb9(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    12db <main+0xdb>
mov    %eax,%ebp
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebp,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
jns    12a8 <main+0xa8>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xda5(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    12d4 <main+0xd4>
lea    0x20(%rsp),%rsi
mov    %ebp,%edi
call   1120 <fstat@plt>
test   %rax,%rax
jns    12e9 <main+0xe9>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd8e(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    0x20(%rsp),%eax
mov    0x8(%rsp),%edi
add    %edi,%eax
add    $0xffffffff,%eax
cltd
idiv   %edi
mov    %eax,%r13d
call   10c0 <malloc@plt>
test   %rax,%rax
jne    1318 <main+0x118>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
lea    0xd55(%rip),%rsi
jmp    129f <main+0x9f>
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
test   %r13d,%r13d
jle    14cb <main+0x2cb>
mov    %rax,%rbx
lea    -0x1(%r13),%eax
mov    %eax,0x24(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
xor    %r14d,%r14d
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
jmp    137e <main+0x17e>
nopl   0x0(%rax)
addl   $0x1,0xc(%rsp)
cmp    %r13d,%r14d
je     14cb <main+0x2cb>
mov    %r14d,%r15d
mov    %r14d,0x1c(%rsp)
mov    0x2c1b(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
lea    0x1c(%rsp),%rdx
call   1070 <ioctl@plt>
test   %rax,%rax
jne    1586 <main+0x386>
mov    %ebp,%r12d
lea    0x1(%r15),%r14d
imul   $0x64,%r14d,%eax
cltd
idiv   %r13d
cmp    %eax,0x18(%rsp)
je     13ed <main+0x1ed>
mov    %eax,%ebp
mov    0xc(%rsp),%eax
mov    %eax,(%rsp)
lea    0xce8(%rip),%rdi
mov    %r14d,%esi
mov    %r13d,%edx
mov    %ebp,%ecx
mov    0x10(%rsp),%r8d
mov    0x14(%rsp),%r9d
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10d0 <fflush@plt>
mov    %ebp,0x18(%rsp)
cmpl   $0x0,0x1c(%rsp)
je     1460 <main+0x260>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%ebp
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %rax,%r12
mov    0x8(%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1090 <read@plt>
cmp    0x8(%rsp),%eax
jge    142c <main+0x22c>
cmp    0x24(%rsp),%r15d
jne    15ad <main+0x3ad>
test   %eax,%eax
jle    1490 <main+0x290>
mov    %eax,%edx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,(%rbx,%rcx,1)
jne    1492 <main+0x292>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1440 <main+0x240>
jmp    149a <main+0x29a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%esi
mov    0x2b6d(%rip),%rax
mov    (%rax),%edx
mov    %r12d,%ebp
mov    %r12d,%edi
call   1060 <lseek@plt>
test   %rax,%rax
js     15c2 <main+0x3c2>
addl   $0x1,0x10(%rsp)
jmp    1375 <main+0x175>
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    %eax,%ecx
jne    1370 <main+0x170>
mov    0x2b17(%rip),%rcx
mov    (%rcx),%esi
mov    0x2b36(%rip),%rcx
or     (%rcx),%esi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %eax,%ecx
call   10a0 <fallocate@plt>
test   %rax,%rax
jne    15d7 <main+0x3d7>
addl   $0x1,0x14(%rsp)
jmp    1375 <main+0x175>
mov    %ebp,%edi
call   1080 <close@plt>
mov    0x2abf(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd12(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%esi
lea    0xc58(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc5e(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc62(%rip),%rdi
mov    0x10(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc68(%rip),%rdi
mov    0x14(%rsp),%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc7b(%rip),%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcad(%rip),%rdi
call   1040 <puts@plt>
add    %ebp,%ebx
add    %r14d,%ebx
lea    0xc70(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2a11(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    0x2a23(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xae8(%rip),%rdi
mov    %rax,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12d4 <main+0xd4>
mov    0x2a0c(%rip),%rax
mov    (%rax),%edi
lea    0xb2e(%rip),%rsi
jmp    129f <main+0x9f>
mov    0x29f7(%rip),%rax
mov    (%rax),%edi
lea    0xb0b(%rip),%rsi
jmp    129f <main+0x9f>
mov    0x29e2(%rip),%rax
mov    (%rax),%edi
lea    0xb1c(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0xb5c(%rip),%rdi
call   10f0 <perror@plt>
jmp    12d4 <main+0xd4>

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"%s a fast sparse block generator.\0A\00"
@.str.1 = [17 x i8] c"Usage: %s FILE1\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDWR = 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 = [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 = [44 x i8] c"%08d/%08d (%d%%), S:%08d, Z:%08d, C:%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"
@FALLOC_FL_PUNCH_HOLE = global i32 0
@FALLOC_FL_KEEP_SIZE = global i32 0
@.str.10 = [78 x i8] c"Hole punch fallocate() call failed, may not be supported on this filesystem.\0A\00"
@.str.11 = [8 x i8] c"Details\00"
@stdout = global i32 0
@.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" found %08d sparse blocks\0A\00"
@.str.17 = [39 x i8] c" found %08d zero blocks (now sparse)\0A\00"
@.str.18 = [26 x i8] c" found %08d data blocks\0A\00"
@.str.19 = [40 x i8] c" ------------------------------------\0A\00"
@.str.20 = [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 i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %14
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %35
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %26)
%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 ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %2
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = load i32, i32* @O_RDWR
%40 = call i32 @open(i8* %38, i32 %39)
store i32 %40, i32* %7
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %50
42: ; preds = %35
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %35
%51 = load i32, i32* %7
%52 = load i32, i32* @FIGETBSZ
%53 = call i64 @ioctl(i32 %51, i32 %52, i32* %9)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* %7
%59 = call i32 @close(i32 %58)
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %50
%63 = load i32, i32* %7
%64 = call i64 @fstat(i32 %63, %struct.stat* %6)
%65 = icmp slt i64 %64, 0
br i1 %65, label %66, label %76
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %70)
%72 = load i32, i32* %7
%73 = call i32 @close(i32 %72)
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %62
%77 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%78 = load i32, i32* %77
%79 = load i32, i32* %9
%80 = add nsw i32 %78, %79
%81 = sub nsw i32 %80, 1
%82 = load i32, i32* %9
%83 = sdiv i32 %81, %82
store i32 %83, i32* %8
%84 = load i32, i32* %9
%85 = call i8* @malloc(i32 %84)
store i8* %85, i8** %15
%86 = load i8*, i8** %15
%87 = icmp ne i8* %86, null
br i1 %87, label %95, label %88
88: ; preds = %76
%89 = load i32, i32* @stderr
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%91 = load i32, i32* %7
%92 = call i32 @close(i32 %91)
%93 = load i32, i32* @EXIT_FAILURE
%94 = call i32 @exit(i32 %93)
unreachable
95: ; preds = %76
store i32 0, i32* %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %10
br label %96
96: ; preds = %225, %95
%97 = load i32, i32* %10
%98 = load i32, i32* %8
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %228
100: ; preds = %96
%101 = load i32, i32* %10
store i32 %101, i32* %16
store i32 0, i32* %17
%102 = load i32, i32* %7
%103 = load i32, i32* @FIBMAP
%104 = call i64 @ioctl(i32 %102, i32 %103, i32* %16)
%105 = icmp ne i64 %104, 0
br i1 %105, label %106, label %115
106: ; preds = %100
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = load i32, i32* %10
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %108, i32 %109)
%111 = load i32, i32* %7
%112 = call i32 @close(i32 %111)
%113 = load i32, i32* @EXIT_FAILURE
%114 = call i32 @exit(i32 %113)
unreachable
115: ; preds = %100
%116 = load i32, i32* %14
%117 = load i32, i32* %10
%118 = add nsw i32 %117, 1
%119 = mul nsw i32 %118, 100
%120 = load i32, i32* %8
%121 = sdiv i32 %119, %120
%122 = icmp ne i32 %116, %121
br i1 %122, label %123, label %138
123: ; preds = %115
%124 = load i32, i32* %10
%125 = add nsw i32 %124, 1
%126 = mul nsw i32 %125, 100
%127 = load i32, i32* %8
%128 = sdiv i32 %126, %127
store i32 %128, i32* %14
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 1
%131 = load i32, i32* %8
%132 = load i32, i32* %14
%133 = load i32, i32* %11
%134 = load i32, i32* %12
%135 = load i32, i32* %13
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i32 %130, i32 %131, i32 %132, i32 %133, i32 %134, i32 %135)
%137 = call i32 @fflush(i32 0)
br label %138
138: ; preds = %123, %115
%139 = load i32, i32* %16
%140 = icmp ne i32 %139, 0
br i1 %140, label %157, label %141
141: ; preds = %138
%142 = load i32, i32* %7
%143 = load i32, i32* %9
%144 = load i32, i32* @SEEK_CUR
%145 = call i64 @lseek(i32 %142, i32 %143, i32 %144)
%146 = icmp slt i64 %145, 0
br i1 %146, label %147, label %154
147: ; preds = %141
%148 = load i32, i32* @stderr
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%150 = load i32, i32* %7
%151 = call i32 @close(i32 %150)
%152 = load i32, i32* @EXIT_FAILURE
%153 = call i32 @exit(i32 %152)
unreachable
154: ; preds = %141
%155 = load i32, i32* %11
%156 = add nsw i32 %155, 1
store i32 %156, i32* %11
br label %225
157: ; preds = %138
%158 = load i32, i32* %7
%159 = load i32, i32* @SEEK_CUR
%160 = call i64 @lseek(i32 %158, i32 0, i32 %159)
store i64 %160, i64* %18
%161 = load i32, i32* %7
%162 = load i8*, i8** %15
%163 = load i32, i32* %9
%164 = call i32 @read(i32 %161, i8* %162, i32 %163)
store i32 %164, i32* %17
%165 = load i32, i32* %17
%166 = load i32, i32* %9
%167 = icmp slt i32 %165, %166
br i1 %167, label %168, label %181
168: ; preds = %157
%169 = load i32, i32* %10
%170 = load i32, i32* %8
%171 = sub nsw i32 %170, 1
%172 = icmp ne i32 %169, %171
br i1 %172, label %173, label %180
173: ; preds = %168
%174 = load i32, i32* @stderr
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%176 = load i32, i32* %7
%177 = call i32 @close(i32 %176)
%178 = load i32, i32* @EXIT_FAILURE
%179 = call i32 @exit(i32 %178)
unreachable
180: ; preds = %168
br label %181
181: ; preds = %180, %157
store i32 0, i32* %19
br label %182
182: ; preds = %195, %181
%183 = load i32, i32* %19
%184 = load i32, i32* %17
%185 = icmp slt i32 %183, %184
br i1 %185, label %186, label %198
186: ; preds = %182
%187 = load i8*, i8** %15
%188 = load i32, i32* %19
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i8, i8* %187, i64 %189
%191 = load i8, i8* %190
%192 = icmp ne i8 %191, 0
br i1 %192, label %193, label %194
193: ; preds = %186
br label %198
194: ; preds = %186
br label %195
195: ; preds = %194
%196 = load i32, i32* %19
%197 = add nsw i32 %196, 1
store i32 %197, i32* %19
br label %182
198: ; preds = %193, %182
%199 = load i32, i32* %19
%200 = load i32, i32* %17
%201 = icmp eq i32 %199, %200
br i1 %201, label %202, label %222
202: ; preds = %198
%203 = load i32, i32* %7
%204 = load i32, i32* @FALLOC_FL_PUNCH_HOLE
%205 = load i32, i32* @FALLOC_FL_KEEP_SIZE
%206 = or i32 %204, %205
%207 = load i64, i64* %18
%208 = load i32, i32* %17
%209 = call i64 @fallocate(i32 %203, i32 %206, i64 %207, i32 %208)
%210 = icmp ne i64 %209, 0
br i1 %210, label %211, label %219
211: ; preds = %202
%212 = load i32, i32* @stderr
%213 = call i32 (i32, i8*, ...) @fprintf(i32 %212, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.10, i64 0, i64 0))
%214 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%215 = load i32, i32* %7
%216 = call i32 @close(i32 %215)
%217 = load i32, i32* @EXIT_FAILURE
%218 = call i32 @exit(i32 %217)
unreachable
219: ; preds = %202
%220 = load i32, i32* %12
%221 = add nsw i32 %220, 1
store i32 %221, i32* %12
br label %225
222: ; preds = %198
%223 = load i32, i32* %13
%224 = add nsw i32 %223, 1
store i32 %224, i32* %13
br label %225
225: ; preds = %222, %219, %154
%226 = load i32, i32* %10
%227 = add nsw i32 %226, 1
store i32 %227, i32* %10
br label %96
228: ; preds = %96
%229 = load i32, i32* %7
%230 = call i32 @close(i32 %229)
%231 = load i32, i32* @stdout
%232 = call i32 @fflush(i32 %231)
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%235 = load i32, i32* %9
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %235)
%237 = load i32, i32* %8
%238 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %237)
%239 = load i32, i32* %11
%240 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i32 %239)
%241 = load i32, i32* %12
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i32 %241)
%243 = load i32, i32* %13
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i32 %243)
%245 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.19, i64 0, i64 0))
%246 = load i32, i32* %11
%247 = load i32, i32* %12
%248 = add nsw i32 %246, %247
%249 = load i32, i32* %13
%250 = add nsw i32 %248, %249
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0), i32 %250)
%252 = load i32, i32* @EXIT_SUCCESS
%253 = call i32 @exit(i32 %252)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"%s a fast sparse block generator.\0A\00"
@.str.1 = [17 x i8] c"Usage: %s FILE1\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDWR = 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 = [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 = [44 x i8] c"%08d/%08d (%d%%), S:%08d, Z:%08d, C:%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"
@FALLOC_FL_PUNCH_HOLE = global i32 0
@FALLOC_FL_KEEP_SIZE = global i32 0
@.str.10 = [78 x i8] c"Hole punch fallocate() call failed, may not be supported on this filesystem.\0A\00"
@.str.11 = [8 x i8] c"Details\00"
@stdout = global i32 0
@.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" found %08d sparse blocks\0A\00"
@.str.17 = [39 x i8] c" found %08d zero blocks (now sparse)\0A\00"
@.str.18 = [26 x i8] c" found %08d data blocks\0A\00"
@.str.20 = [36 x i8] c" Sum: %08d blocks accounted for.\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"Report:\00"
@str.21 = [39 x i8] c" ------------------------------------\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca i32
%6 = bitcast %struct.stat* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = icmp eq i32 %0, 2
br i1 %8, label %18, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %1
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = load i32, i32* @O_RDWR
%22 = tail call i32 @open(i8* %20, i32 %21)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %19
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %18
%31 = load i32, i32* @FIGETBSZ
%32 = call i64 @ioctl(i32 %22, i32 %31, i32* %4)
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %30
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @close(i32 %22)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %30
%41 = call i64 @fstat(i32 %22, %struct.stat* %3)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = load i32, i32* @stderr
%45 = load i8*, i8** %19
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = call i32 @close(i32 %22)
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %40
%51 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%52 = load i32, i32* %51
%53 = load i32, i32* %4
%54 = add i32 %52, -1
%55 = add i32 %54, %53
%56 = sdiv i32 %55, %53
%57 = call i8* @malloc(i32 %53)
%58 = icmp eq i8* %57, null
br i1 %58, label %64, label %59
59: ; preds = %50
%60 = icmp sgt i32 %56, 0
br i1 %60, label %61, label %165
61: ; preds = %59
%62 = bitcast i32* %5 to i8*
%63 = add nsw i32 %56, -1
br label %70
64: ; preds = %50
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%67 = call i32 @close(i32 %22)
%68 = load i32, i32* @EXIT_FAILURE
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %61, %160
%71 = phi i32 [ 0, %61 ], [ %87, %160 ]
%72 = phi i32 [ 0, %61 ], [ %163, %160 ]
%73 = phi i32 [ -1, %61 ], [ %95, %160 ]
%74 = phi i32 [ 0, %61 ], [ %162, %160 ]
%75 = phi i32 [ 0, %61 ], [ %161, %160 ]
store i32 %71, i32* %5
%76 = load i32, i32* @FIBMAP
%77 = call i64 @ioctl(i32 %22, i32 %76, i32* %5)
%78 = icmp eq i64 %77, 0
br i1 %78, label %86, label %79
79: ; preds = %70
%80 = load i32, i32* @errno
%81 = call i8* @strerror(i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i8* %81, i32 %71)
%83 = call i32 @close(i32 %22)
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %70
%87 = add nuw nsw i32 %71, 1
%88 = mul nsw i32 %87, 100
%89 = sdiv i32 %88, %56
%90 = icmp eq i32 %73, %89
br i1 %90, label %94, label %91
91: ; preds = %86
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i32 %87, i32 %56, i32 %89, i32 %72, i32 %75, i32 %74)
%93 = call i32 @fflush(i32 0)
br label %94
94: ; preds = %91, %86
%95 = phi i32 [ %89, %91 ], [ %73, %86 ]
%96 = load i32, i32* %5
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %111
98: ; preds = %94
%99 = load i32, i32* %4
%100 = load i32, i32* @SEEK_CUR
%101 = call i64 @lseek(i32 %22, i32 %99, i32 %100)
%102 = icmp slt i64 %101, 0
br i1 %102, label %103, label %109
103: ; preds = %98
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%106 = call i32 @close(i32 %22)
%107 = load i32, i32* @EXIT_FAILURE
%108 = call i32 @exit(i32 %107)
unreachable
109: ; preds = %98
%110 = add nsw i32 %72, 1
br label %160
111: ; preds = %94
%112 = load i32, i32* @SEEK_CUR
%113 = call i64 @lseek(i32 %22, i32 0, i32 %112)
%114 = load i32, i32* %4
%115 = call i32 @read(i32 %22, i8* %57, i32 %114)
%116 = load i32, i32* %4
%117 = icmp sge i32 %115, %116
%118 = icmp eq i32 %71, %63
%119 = select i1 %117, i1 true, i1 %118
br i1 %119, label %120, label %124
120: ; preds = %111
%121 = icmp sgt i32 %115, 0
br i1 %121, label %122, label %140
122: ; preds = %120
%123 = zext i32 %115 to i64
br label %130
124: ; preds = %111
%125 = load i32, i32* @stderr
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%127 = call i32 @close(i32 %22)
%128 = load i32, i32* @EXIT_FAILURE
%129 = call i32 @exit(i32 %128)
unreachable
130: ; preds = %122, %135
%131 = phi i64 [ 0, %122 ], [ %136, %135 ]
%132 = getelementptr inbounds i8, i8* %57, i64 %131
%133 = load i8, i8* %132
%134 = icmp eq i8 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %130
%136 = add nuw nsw i64 %131, 1
%137 = icmp eq i64 %136, %123
br i1 %137, label %143, label %130
138: ; preds = %130
%139 = trunc i64 %131 to i32
br label %140
140: ; preds = %138, %120
%141 = phi i32 [ 0, %120 ], [ %139, %138 ]
%142 = icmp eq i32 %141, %115
br i1 %142, label %143, label %158
143: ; preds = %135, %140
%144 = load i32, i32* @FALLOC_FL_PUNCH_HOLE
%145 = load i32, i32* @FALLOC_FL_KEEP_SIZE
%146 = or i32 %145, %144
%147 = call i64 @fallocate(i32 %22, i32 %146, i64 %113, i32 %115)
%148 = icmp eq i64 %147, 0
br i1 %148, label %156, label %149
149: ; preds = %143
%150 = load i32, i32* @stderr
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.10, i64 0, i64 0))
%152 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%153 = call i32 @close(i32 %22)
%154 = load i32, i32* @EXIT_FAILURE
%155 = call i32 @exit(i32 %154)
unreachable
156: ; preds = %143
%157 = add nsw i32 %75, 1
br label %160
158: ; preds = %140
%159 = add nsw i32 %74, 1
br label %160
160: ; preds = %156, %158, %109
%161 = phi i32 [ %75, %109 ], [ %157, %156 ], [ %75, %158 ]
%162 = phi i32 [ %74, %109 ], [ %74, %156 ], [ %159, %158 ]
%163 = phi i32 [ %110, %109 ], [ %72, %156 ], [ %72, %158 ]
%164 = icmp eq i32 %87, %56
br i1 %164, label %165, label %70
165: ; preds = %160, %59
%166 = phi i32 [ 0, %59 ], [ %161, %160 ]
%167 = phi i32 [ 0, %59 ], [ %162, %160 ]
%168 = phi i32 [ 0, %59 ], [ %163, %160 ]
%169 = call i32 @close(i32 %22)
%170 = load i32, i32* @stdout
%171 = call i32 @fflush(i32 %170)
%172 = call i32 @putchar(i32 10)
%173 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%174 = load i32, i32* %4
%175 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %174)
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 %56)
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0), i32 %168)
%178 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i32 %166)
%179 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i32 %167)
%180 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.21, i64 0, i64 0))
%181 = add i32 %167, %166
%182 = add i32 %181, %168
%183 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0), i32 %182)
%184 = load i32, i32* @EXIT_SUCCESS
%185 = call i32 @exit(i32 %184)
unreachable
}