#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 timeval {
  scalar_t__ tv_usec;
  int tv_sec;
};
struct stat {
  long st_size;
};

/* Variables and functions */
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ assert(int);
size_t atoi(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ fstat(int, struct stat *);
int fsync(int);
size_t getopt(int, char **, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned char *malloc(size_t);
int open(char *, int, ...);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ printf(char *, ...);
long random();
size_t read(int, unsigned char *, size_t);
int /*<<< orphan*/ srandom(size_t);
int /*<<< orphan*/ stdout;
int unlink(char *);
size_t write(int, unsigned char *, size_t);
main(int argc, char *argv[]) {
  long val, fsize;
  char *filename;
  struct stat stbuf;
  unsigned char *buf;
  struct timeval t1, t2, t3;
  int fd, error = 0, readonly = 0, delete = 0;
  size_t i, j, c, seed, size, bsize, nblocks, remainder = 0;
  bsize = 5678;
  nblocks = 1234567;
  seed = 4456;
  gettimeofday(&t1, NULL);
  while ((c = getopt(argc, argv, "b:s:n:rd")) != -1) {
    switch (c) {
    case 'b':
      bsize = atoi(optarg);
      break;
    case 's':
      seed = atoi(optarg);
      break;
    case 'n':
      nblocks = atoi(optarg);
      break;
    case 'r':
      readonly = 1;
      break;
    case 'd':
      delete = 1;
      break;
    }
  }
  if (optind != argc - 1) {
    printf("Usage: a.out [-s seed] [-r] [-b bsize] [-n nblocks ] filename\n");
    exit(1);
  }
  filename = argv[optind];
  if (readonly)
    fd = open(filename, O_RDONLY);
  else
    fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
  if (fd < 0) {
    printf("Fail to open file, errno = %d\n", errno);
    exit(1);
  }
  if (fstat(fd, &stbuf) < 0) {
    printf("Failed to stat file %s, errno = %d\n", filename, errno);
    exit(1);
  }
  if (readonly) {
    fsize = stbuf.st_size;
    nblocks = fsize / bsize;
    if (fsize % bsize)
      remainder = 1;
  } else {
    assert(!stbuf.st_size);
    fsize = (long)nblocks * bsize;
  }
  buf = malloc(bsize);
  if (buf == NULL) {
    printf("Fail to allocate memory, errno = %d\n", errno);
    exit(1);
  }
  srandom(seed);
  printf("Seed = %d, file name = %s, bsize = %d, blocks = %d, size = %ld\n",
         seed, filename, bsize, nblocks + remainder, fsize);
  fflush(stdout);
  for (i = 0; i < nblocks; i++) {
    if (readonly)
      size = read(fd, buf, bsize);
    else {
      for (j = 0; j < bsize; j++) {
        val = random();
        buf[j] = (unsigned char)val & 0xff;
      }
      size = write(fd, buf, bsize);
    }
    if (size != bsize) {
      printf("Fail to %s file, errno = %d\n", readonly ? "read" : "write",
             errno);
      break;
    }
    if (!readonly)
      continue;
    for (j = 0; j < bsize; j++) {
      val = random();
      if (buf[j] != (unsigned char)val & 0xff) {
        printf("Unexpected data at offset = %ld\n", i * nblocks * j);
        error++;
        break;
      }
    }
    if (error > 10)
      break;
  }
  if (error || !readonly || nblocks * bsize == fsize)
    goto done;
  remainder = fsize - (long)nblocks * bsize;
  size = read(fd, buf, remainder);
  if (size != remainder) {
    printf("Fail to %s file, errno = %d\n", readonly ? "read" : "write", errno);
    goto done;
  }
  for (i = 0; i < remainder; i++) {
    val = random();
    if (buf[i] != (unsigned char)val & 0xff) {
      printf("Unexpected data at offset = %ld\n", bsize * nblocks * i);
      error++;
    }
  }
done:
  if (!error && readonly)
    printf(
        "Good news! No corruption has been found (last block has %d bytes)\n",
        remainder);
  if (!error && !readonly) {
    error = fsync(fd);
    if (!error)
      printf("File has been created successfully.\007\n");
    else
      printf("Fail to fsync file, errno = %d.\007\n", errno);
  }
  close(fd);
  if (!error && delete) {
    error = unlink(filename);
    if (!error)
      printf("File has been deleted successfully!\007\n");
    else
      printf("Fail to delete file %s, errno = %d.\007\n", filename, errno);
  }
  gettimeofday(&t2, NULL);
  if (t2.tv_usec < t1.tv_usec) {
    t2.tv_usec += 1000000;
    t2.tv_sec--;
  }
  t3.tv_sec = t2.tv_sec - t1.tv_sec;
  t3.tv_usec = t2.tv_usec - t1.tv_usec;
  printf("\nTotal elapsed time is %02d:%02d:%02d.\n", t3.tv_sec / 3600,
         (t3.tv_sec % 3600) / 60, t3.tv_sec % 60);
  if (error)
    exit(1);
  else
    exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movq   $0x0,-0xb8(%rbp)
movq   $0x162e,-0xa8(%rbp)
movq   $0x12d687,-0xb0(%rbp)
movq   $0x1168,-0x98(%rbp)
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdc3(%rip),%rdx
call   1100 <getopt@plt>
mov    %rax,-0x90(%rbp)
cmp    $0xffffffffffffffff,%rax
je     1334 <main+0x124>
mov    -0x90(%rbp),%rax
add    $0xffffffffffffff9e,%rax
mov    %rax,-0xc0(%rbp)
sub    $0x11,%rax
ja     132f <main+0x11f>
mov    -0xc0(%rbp),%rax
lea    0xd3b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
call   1110 <atoi@plt>
mov    %rax,-0xa8(%rbp)
jmp    132f <main+0x11f>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1110 <atoi@plt>
mov    %rax,-0x98(%rbp)
jmp    132f <main+0x11f>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
call   1110 <atoi@plt>
mov    %rax,-0xb0(%rbp)
jmp    132f <main+0x11f>
movl   $0x1,-0x74(%rbp)
jmp    132f <main+0x11f>
movl   $0x1,-0x78(%rbp)
jmp    1277 <main+0x67>
mov    0x2c85(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1363 <main+0x153>
lea    0xcff(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2c52(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x74(%rbp)
je     139f <main+0x18f>
mov    -0x28(%rbp),%rdi
mov    0x2c3a(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10f0 <open@plt>
mov    %eax,-0x6c(%rbp)
jmp    13cd <main+0x1bd>
mov    -0x28(%rbp),%rdi
mov    0x2c26(%rip),%rax
mov    (%rax),%esi
mov    0x2c45(%rip),%rax
or     (%rax),%esi
mov    0x2c2c(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   10f0 <open@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
jge    13f8 <main+0x1e8>
mov    0x2bd2(%rip),%rax
mov    (%rax),%esi
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x6c(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1130 <fstat@plt>
cmp    $0x0,%rax
jge    1433 <main+0x223>
mov    -0x28(%rbp),%rsi
mov    0x2b97(%rip),%rax
mov    (%rax),%edx
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
cmpl   $0x0,-0x74(%rbp)
je     1484 <main+0x274>
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0xa8(%rbp)
mov    %rax,-0xb0(%rbp)
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0xa8(%rbp)
cmp    $0x0,%rdx
je     147f <main+0x26f>
movq   $0x1,-0xb8(%rbp)
jmp    14ab <main+0x29b>
cmpq   $0x0,-0x30(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0xb0(%rbp),%rax
imul   -0xa8(%rbp),%rax
ff
mov    %rax,-0x20(%rbp)
mov    -0xa8(%rbp),%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    14e7 <main+0x2d7>
mov    0x2ae3(%rip),%rax
mov    (%rax),%esi
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x98(%rbp),%rdi
call   1030 <srandom@plt>
mov    -0x98(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0xb0(%rbp),%r8
add    -0xb8(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2a7c(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0xb0(%rbp),%rax
jae    170c <main+0x4fc>
cmpl   $0x0,-0x74(%rbp)
je     1575 <main+0x365>
mov    -0x6c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
call   1090 <read@plt>
mov    %rax,-0xa0(%rbp)
jmp    15ec <main+0x3dc>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0xa8(%rbp),%rax
jae    15d2 <main+0x3c2>
mov    $0x0,%al
call   10b0 <random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl %al,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x38(%rbp),%rax
mov    -0x88(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    1580 <main+0x370>
mov    -0x6c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
call   1050 <write@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
cmp    -0xa8(%rbp),%rax
je     1634 <main+0x424>
mov    -0x74(%rbp),%ecx
lea    0xb50(%rip),%rsi
lea    0xb44(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    0x2991(%rip),%rax
mov    (%rax),%edx
lea    0xb10(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    170c <main+0x4fc>
cmpl   $0x0,-0x74(%rbp)
jne    1643 <main+0x433>
jmp    16fb <main+0x4eb>
movq   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0xa8(%rbp),%rax
jae    16e7 <main+0x4d7>
mov    $0x0,%al
call   10b0 <random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x88(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movzbl %cl,%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     16cb <main+0x4bb>
mov    -0x80(%rbp),%rsi
imul   -0xb0(%rbp),%rsi
ff
imul   -0x88(%rbp),%rsi
ff
lea    0xaaa(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    16e7 <main+0x4d7>
jmp    16d0 <main+0x4c0>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    164e <main+0x43e>
cmpl   $0xa,-0x70(%rbp)
jle    16f6 <main+0x4e6>
jmp    170c <main+0x4fc>
jmp    16fb <main+0x4eb>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    153b <main+0x32b>
cmpl   $0x0,-0x70(%rbp)
jne    1739 <main+0x529>
cmpl   $0x0,-0x74(%rbp)
je     1739 <main+0x529>
mov    -0xb0(%rbp),%rax
imul   -0xa8(%rbp),%rax
ff
cmp    -0x20(%rbp),%rax
jne    173e <main+0x52e>
jmp    1852 <main+0x642>
mov    -0x20(%rbp),%rax
mov    -0xb0(%rbp),%rcx
imul   -0xa8(%rbp),%rcx
ff
sub    %rcx,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x6c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
call   1090 <read@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
cmp    -0xb8(%rbp),%rax
je     17bd <main+0x5ad>
mov    -0x74(%rbp),%ecx
lea    0x9c7(%rip),%rsi
lea    0x9bb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    0x2808(%rip),%rax
mov    (%rax),%edx
lea    0x987(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1852 <main+0x642>
movq   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0xb8(%rbp),%rax
jae    184d <main+0x63d>
mov    $0x0,%al
call   10b0 <random@plt>
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x80(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movzbl %cl,%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     1837 <main+0x627>
mov    -0xa8(%rbp),%rsi
imul   -0xb0(%rbp),%rsi
ff
imul   -0x80(%rbp),%rsi
lea    0x939(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    183c <main+0x62c>
mov    -0x80(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x80(%rbp)
jmp    17c5 <main+0x5b5>
jmp    1852 <main+0x642>
cmpl   $0x0,-0x70(%rbp)
jne    187b <main+0x66b>
cmpl   $0x0,-0x74(%rbp)
je     187b <main+0x66b>
mov    -0xb8(%rbp),%rsi
lea    0x90d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x0,-0x70(%rbp)
jne    18d3 <main+0x6c3>
cmpl   $0x0,-0x74(%rbp)
jne    18d3 <main+0x6c3>
mov    -0x6c(%rbp),%edi
call   10e0 <fsync@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jne    18b7 <main+0x6a7>
lea    0x919(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    18ce <main+0x6be>
mov    0x26f2(%rip),%rax
mov    (%rax),%esi
lea    0x923(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    18d3 <main+0x6c3>
mov    -0x6c(%rbp),%edi
call   1080 <close@plt>
cmpl   $0x0,-0x70(%rbp)
jne    1938 <main+0x728>
cmpl   $0x0,-0x78(%rbp)
je     1938 <main+0x728>
mov    -0x28(%rbp),%rdi
call   1040 <unlink@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x0,-0x70(%rbp)
jne    1918 <main+0x708>
lea    0x900(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1933 <main+0x723>
mov    -0x28(%rbp),%rsi
mov    0x268d(%rip),%rax
mov    (%rax),%edx
lea    0x906(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1938 <main+0x728>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    196a <main+0x75a>
mov    -0x58(%rbp),%rax
add    $0xf4240,%rax
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
sub    -0x40(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x58(%rbp),%rax
sub    -0x48(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x60(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc4(%rbp)
mov    -0x60(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0xc4(%rbp),%edx
lea    0x897(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x0,-0x70(%rbp)
je     19dc <main+0x7cc>
mov    $0x1,%edi
call   1120 <exit@plt>
xor    %edi,%edi
call   1120 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
mov    %rax,0x20(%rsp)
lea    0x58(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
mov    $0x12d687,%eax
mov    %rax,0x10(%rsp)
mov    $0x162e,%r12d
mov    $0x1168,%eax
mov    %rax,0x8(%rsp)
lea    0xde1(%rip),%r14
lea    0xd92(%rip),%r15
mov    0x2d7b(%rip),%r13
movl   $0x0,0x2c(%rsp)
jmp    1286 <main+0x66>
nop
cmp    $0xffffffffffffffff,%rax
je     12e7 <main+0xc7>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1110 <getopt@plt>
lea    -0x62(%rax),%rcx
cmp    $0x11,%rcx
ja     1280 <main+0x60>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    0x0(%r13),%edi
call   1120 <atoi@plt>
mov    %rax,%r12
jmp    1286 <main+0x66>
movl   $0x1,0x2c(%rsp)
jmp    1286 <main+0x66>
mov    0x0(%r13),%edi
call   1120 <atoi@plt>
mov    %rax,0x10(%rsp)
jmp    1286 <main+0x66>
mov    $0x1,%al
mov    %rax,0x20(%rsp)
jmp    1286 <main+0x66>
mov    0x0(%r13),%edi
call   1120 <atoi@plt>
mov    %rax,0x8(%rsp)
jmp    1286 <main+0x66>
mov    0x2cd2(%rip),%rax
movslq (%rax),%rax
add    $0xffffffff,%ebp
cmp    %ebp,%eax
jne    131c <main+0xfc>
mov    (%rbx,%rax,8),%r15
mov    0x20(%rsp),%rbp
test   $0x1,%bpl
je     1332 <main+0x112>
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1100 <open@plt>
jmp    135c <main+0x13c>
lea    0xf1c(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    0x2c97(%rip),%rax
mov    0x2cb8(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2c9d(%rip),%rax
or     (%rax),%esi
mov    %r15,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   1100 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1383 <main+0x163>
mov    0x2c47(%rip),%rax
mov    (%rax),%esi
lea    0xcdf(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0x50(%rsp),%rsi
mov    %ebx,%edi
call   1140 <fstat@plt>
test   %rax,%rax
jns    13b3 <main+0x193>
mov    0x2c15(%rip),%rax
mov    (%rax),%edx
lea    0xccc(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1819 <main+0x5f9>
mov    0x50(%rsp),%r13
test   $0x1,%bpl
je     13d4 <main+0x1b4>
mov    %r13,%rax
or     %r12,%rax
shr    $0x20,%rax
jne    13ef <main+0x1cf>
mov    %r13d,%eax
xor    %edx,%edx
div    %r12d
jmp    13f7 <main+0x1d7>
xor    %edi,%edi
test   %r13,%r13
sete   %dil
call   10b0 <assert@plt>
mov    0x10(%rsp),%r13
imul   %r12,%r13
xor    %eax,%eax
jmp    1404 <main+0x1e4>
mov    %r13,%rax
xor    %edx,%edx
div    %r12
mov    %rax,0x10(%rsp)
xor    %eax,%eax
test   %rdx,%rdx
setne  %al
mov    %rax,0x18(%rsp)
mov    %r12,%rdi
call   10d0 <malloc@plt>
test   %rax,%rax
jne    142b <main+0x20b>
mov    0x2b93(%rip),%rax
mov    (%rax),%esi
lea    0xc6e(%rip),%rdi
jmp    1372 <main+0x152>
mov    %rax,%r14
mov    %ebx,0x4(%rsp)
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <srandom@plt>
mov    0x10(%rsp),%rax
mov    0x18(%rsp),%rcx
lea    (%rcx,%rax,1),%r8
lea    0xc65(%rip),%rdi
mov    %r13,%r9
xor    %r13d,%r13d
mov    %rbx,%rsi
mov    %r15,0x48(%rsp)
mov    %r15,%rdx
mov    %rax,%rbx
mov    %r12,%rcx
mov    %r9,0x40(%rsp)
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2b2a(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
test   %rbx,%rbx
je     15c6 <main+0x3a6>
xor    %r13d,%r13d
xor    %r15d,%r15d
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    14e3 <main+0x2c3>
nopl   (%rax)
lea    0xc7a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rbx
cmpl   $0xa,0x8(%rsp)
jg     1710 <main+0x4f0>
add    $0x1,%r15
add    %rbx,%r13
cmp    %rbx,%r15
je     15c1 <main+0x3a1>
test   $0x1,%bpl
je     1510 <main+0x2f0>
mov    0x4(%rsp),%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   10a0 <read@plt>
cmp    %r12,%rax
je     1553 <main+0x333>
jmp    15a3 <main+0x383>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %r12,%r12
je     1582 <main+0x362>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <random@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1520 <main+0x300>
mov    0x4(%rsp),%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <write@plt>
cmp    %r12,%rax
mov    0x10(%rsp),%rbx
jne    159a <main+0x37a>
test   $0x1,%bpl
je     14d3 <main+0x2b3>
test   %r12,%r12
je     14c8 <main+0x2a8>
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %eax,%eax
call   10c0 <random@plt>
cmp    %al,(%r14,%rbp,1)
jne    14a0 <main+0x280>
add    $0x1,%rbp
add    %r13,%rbx
cmp    %rbp,%r12
jne    1560 <main+0x340>
jmp    14be <main+0x29e>
mov    0x4(%rsp),%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1060 <write@plt>
cmp    %r12,%rax
je     14d3 <main+0x2b3>
lea    0xb7a(%rip),%rsi
jmp    15aa <main+0x38a>
lea    0xb6c(%rip),%rsi
mov    0x29ff(%rip),%rax
mov    (%rax),%edx
lea    0xb3f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%r13
test   %r13d,%r13d
setne  %al
mov    %ebp,%ecx
not    %cl
or     %cl,%al
test   $0x1,%al
jne    169e <main+0x47e>
imul   %r12,%rbx
xor    %r13d,%r13d
mov    0x40(%rsp),%r15
sub    %rbx,%r15
je     169e <main+0x47e>
mov    %cl,0x10(%rsp)
mov    0x4(%rsp),%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10a0 <read@plt>
cmp    %r15,%rax
jne    161b <main+0x3fb>
test   %r15,%r15
jne    1643 <main+0x423>
xor    %r13d,%r13d
xor    %eax,%eax
mov    %rax,0x18(%rsp)
jmp    169a <main+0x47a>
mov    0x298e(%rip),%rax
mov    (%rax),%edx
lea    0xace(%rip),%rdi
lea    0xae4(%rip),%rsi
xor    %r13d,%r13d
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r15,0x18(%rsp)
jmp    169a <main+0x47a>
mov    %r15,%r12
mov    %rbx,%r15
mov    %rbp,0x20(%rsp)
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    166c <main+0x44c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
add    %r15,%rbx
cmp    %r12,%rbp
jae    1690 <main+0x470>
xor    %eax,%eax
call   10c0 <random@plt>
cmp    %al,(%r14,%rbp,1)
je     1660 <main+0x440>
lea    0xaa1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r13d
jmp    1660 <main+0x440>
mov    %r12,0x18(%rsp)
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%cl
test   %r13d,%r13d
setne  %al
or     %cl,%al
test   $0x1,%al
jne    16c0 <main+0x4a0>
lea    0xa91(%rip),%rdi
xor    %r13d,%r13d
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,0x8(%rsp)
test   %r13d,%r13d
setne  %al
or     %bpl,%al
test   $0x1,%al
jne    1710 <main+0x4f0>
mov    0x4(%rsp),%edi
call   10f0 <fsync@plt>
test   %eax,%eax
jne    16f4 <main+0x4d4>
lea    0xb0f(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
mov    %rax,0x8(%rsp)
jmp    1710 <main+0x4f0>
mov    %rax,0x8(%rsp)
mov    0x28b0(%rip),%rax
mov    (%rax),%esi
lea    0xa7c(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x4(%rsp),%edi
call   1090 <close@plt>
mov    0x8(%rsp),%rbx
test   %ebx,%ebx
jne    1769 <main+0x549>
cmpl   $0x0,0x2c(%rsp)
je     1769 <main+0x549>
mov    0x48(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <unlink@plt>
test   %eax,%eax
jne    174a <main+0x52a>
lea    0xad9(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
jmp    1769 <main+0x549>
mov    0x285f(%rip),%rax
mov    (%rax),%edx
lea    0xa4d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebx
lea    0x30(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
mov    0x30(%rsp),%rax
cmp    0x58(%rsp),%rax
jge    1799 <main+0x579>
add    $0xf4240,%rax
mov    %rax,0x30(%rsp)
mov    0x38(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x38(%rsp)
jmp    179d <main+0x57d>
mov    0x38(%rsp),%eax
sub    0x60(%rsp),%eax
movslq %eax,%rcx
imul   $0xffffffff91a2b3c5,%rcx,%rsi
shr    $0x20,%rsi
add    %ecx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0xb,%esi
add    %eax,%esi
imul   $0xe10,%esi,%eax
mov    %ecx,%edx
sub    %eax,%edx
movswl %dx,%eax
imul   $0xffff8889,%eax,%eax
shr    $0x10,%eax
add    %edx,%eax
movzwl %ax,%eax
movswl %ax,%edx
shr    $0xf,%eax
sar    $0x5,%edx
add    %eax,%edx
movswl %dx,%edx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x5,%eax
add    %edi,%eax
imul   $0x3c,%eax,%eax
sub    %eax,%ecx
lea    0x9c6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %ebx,%ebx
jne    1819 <main+0x5f9>
xor    %edi,%edi
call   1130 <exit@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i64 }
%struct.timeval = type { i64, i32 }
@.str = [9 x i8] c"b:s:n:rd\00"
@optarg = global i32 0
@optind = global i32 0
@.str.1 = [63 x i8] c"Usage: a.out [-s seed] [-r] [-b bsize] [-n nblocks ] filename\0A\00"
@O_RDONLY = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [31 x i8] c"Fail to open file, errno = %d\0A\00"
@errno = global i32 0
@.str.3 = [36 x i8] c"Failed to stat file %s, errno = %d\0A\00"
@.str.4 = [37 x i8] c"Fail to allocate memory, errno = %d\0A\00"
@.str.5 = [64 x i8] c"Seed = %d, file name = %s, bsize = %d, blocks = %d, size = %ld\0A\00"
@stdout = global i32 0
@.str.6 = [29 x i8] c"Fail to %s file, errno = %d\0A\00"
@.str.7 = [5 x i8] c"read\00"
@.str.8 = [6 x i8] c"write\00"
@.str.9 = [33 x i8] c"Unexpected data at offset = %ld\0A\00"
@.str.10 = [67 x i8] c"Good news! No corruption has been found (last block has %d bytes)\0A\00"
@.str.11 = [38 x i8] c"File has been created successfully.\07\0A\00"
@.str.12 = [34 x i8] c"Fail to fsync file, errno = %d.\07\0A\00"
@.str.13 = [38 x i8] c"File has been deleted successfully!\07\0A\00"
@.str.14 = [38 x i8] c"Fail to delete file %s, errno = %d.\07\0A\00"
@.str.15 = [40 x i8] c"\0ATotal elapsed time is %02d:%02d:%02d.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
%9 = alloca %struct.stat
%10 = alloca i8*
%11 = alloca %struct.timeval
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i64
%25 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store i64 0, i64* %25
store i64 5678, i64* %23
store i64 1234567, i64* %24
store i64 4456, i64* %21
%26 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
br label %27
27: ; preds = %45, %2
%28 = load i32, i32* %4
%29 = load i8**, i8*** %5
%30 = call i64 @getopt(i32 %28, i8** %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i64 %30, i64* %20
%31 = icmp ne i64 %30, -1
br i1 %31, label %32, label %46
32: ; preds = %27
%33 = load i64, i64* %20
switch i64 %33, label %45 [
i64 98, label %34
i64 115, label %37
i64 110, label %40
i64 114, label %43
i64 100, label %44
]
34: ; preds = %32
%35 = load i32, i32* @optarg
%36 = call i64 @atoi(i32 %35)
store i64 %36, i64* %23
br label %45
37: ; preds = %32
%38 = load i32, i32* @optarg
%39 = call i64 @atoi(i32 %38)
store i64 %39, i64* %21
br label %45
40: ; preds = %32
%41 = load i32, i32* @optarg
%42 = call i64 @atoi(i32 %41)
store i64 %42, i64* %24
br label %45
43: ; preds = %32
store i32 1, i32* %16
br label %45
44: ; preds = %32
store i32 1, i32* %17
br label %45
45: ; preds = %32, %44, %43, %40, %37, %34
br label %27
46: ; preds = %27
%47 = load i32, i32* @optind
%48 = load i32, i32* %4
%49 = sub nsw i32 %48, 1
%50 = icmp ne i32 %47, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %46
%55 = load i8**, i8*** %5
%56 = load i32, i32* @optind
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
store i8* %59, i8** %8
%60 = load i32, i32* %16
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %54
%63 = load i8*, i8** %8
%64 = load i32, i32* @O_RDONLY
%65 = call i32 (i8*, i32, ...) @open(i8* %63, i32 %64)
store i32 %65, i32* %14
br label %74
66: ; preds = %54
%67 = load i8*, i8** %8
%68 = load i32, i32* @O_RDWR
%69 = load i32, i32* @O_CREAT
%70 = or i32 %68, %69
%71 = load i32, i32* @O_TRUNC
%72 = or i32 %70, %71
%73 = call i32 (i8*, i32, ...) @open(i8* %67, i32 %72, i32 384)
store i32 %73, i32* %14
br label %74
74: ; preds = %66, %62
%75 = load i32, i32* %14
%76 = icmp slt i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = load i32, i32* @errno
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %78)
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %74
%82 = load i32, i32* %14
%83 = call i64 @fstat(i32 %82, %struct.stat* %9)
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %81
%86 = load i8*, i8** %8
%87 = load i32, i32* @errno
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %86, i32 %87)
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %81
%91 = load i32, i32* %16
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %105
93: ; preds = %90
%94 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%95 = load i64, i64* %94
store i64 %95, i64* %7
%96 = load i64, i64* %7
%97 = load i64, i64* %23
%98 = udiv i64 %96, %97
store i64 %98, i64* %24
%99 = load i64, i64* %7
%100 = load i64, i64* %23
%101 = urem i64 %99, %100
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %104
103: ; preds = %93
store i64 1, i64* %25
br label %104
104: ; preds = %103, %93
br label %115
105: ; preds = %90
%106 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%107 = load i64, i64* %106
%108 = icmp ne i64 %107, 0
%109 = xor i1 %108, true
%110 = zext i1 %109 to i32
%111 = call i32 @assert(i32 %110)
%112 = load i64, i64* %24
%113 = load i64, i64* %23
%114 = mul i64 %112, %113
store i64 %114, i64* %7
br label %115
115: ; preds = %105, %104
%116 = load i64, i64* %23
%117 = call i8* @malloc(i64 %116)
store i8* %117, i8** %10
%118 = load i8*, i8** %10
%119 = icmp eq i8* %118, null
br i1 %119, label %120, label %124
120: ; preds = %115
%121 = load i32, i32* @errno
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %121)
%123 = call i32 @exit(i32 1)
unreachable
124: ; preds = %115
%125 = load i64, i64* %21
%126 = call i32 @srandom(i64 %125)
%127 = load i64, i64* %21
%128 = load i8*, i8** %8
%129 = load i64, i64* %23
%130 = load i64, i64* %24
%131 = load i64, i64* %25
%132 = add i64 %130, %131
%133 = load i64, i64* %7
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0), i64 %127, i8* %128, i64 %129, i64 %132, i64 %133)
%135 = load i32, i32* @stdout
%136 = call i32 @fflush(i32 %135)
store i64 0, i64* %18
br label %137
137: ; preds = %224, %124
%138 = load i64, i64* %18
%139 = load i64, i64* %24
%140 = icmp ult i64 %138, %139
br i1 %140, label %141, label %227
141: ; preds = %137
%142 = load i32, i32* %16
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %149
144: ; preds = %141
%145 = load i32, i32* %14
%146 = load i8*, i8** %10
%147 = load i64, i64* %23
%148 = call i64 @read(i32 %145, i8* %146, i64 %147)
store i64 %148, i64* %22
br label %172
149: ; preds = %141
store i64 0, i64* %19
br label %150
150: ; preds = %164, %149
%151 = load i64, i64* %19
%152 = load i64, i64* %23
%153 = icmp ult i64 %151, %152
br i1 %153, label %154, label %167
154: ; preds = %150
%155 = call i64 (...) @random()
store i64 %155, i64* %6
%156 = load i64, i64* %6
%157 = trunc i64 %156 to i8
%158 = zext i8 %157 to i32
%159 = and i32 %158, 255
%160 = trunc i32 %159 to i8
%161 = load i8*, i8** %10
%162 = load i64, i64* %19
%163 = getelementptr inbounds i8, i8* %161, i64 %162
store i8 %160, i8* %163
br label %164
164: ; preds = %154
%165 = load i64, i64* %19
%166 = add i64 %165, 1
store i64 %166, i64* %19
br label %150
167: ; preds = %150
%168 = load i32, i32* %14
%169 = load i8*, i8** %10
%170 = load i64, i64* %23
%171 = call i64 @write(i32 %168, i8* %169, i64 %170)
store i64 %171, i64* %22
br label %172
172: ; preds = %167, %144
%173 = load i64, i64* %22
%174 = load i64, i64* %23
%175 = icmp ne i64 %173, %174
br i1 %175, label %176, label %183
176: ; preds = %172
%177 = load i32, i32* %16
%178 = icmp ne i32 %177, 0
%179 = zext i1 %178 to i64
%180 = select i1 %178, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
%181 = load i32, i32* @errno
%182 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %180, i32 %181)
br label %227
183: ; preds = %172
%184 = load i32, i32* %16
%185 = icmp ne i32 %184, 0
br i1 %185, label %187, label %186
186: ; preds = %183
br label %224
187: ; preds = %183
store i64 0, i64* %19
br label %188
188: ; preds = %216, %187
%189 = load i64, i64* %19
%190 = load i64, i64* %23
%191 = icmp ult i64 %189, %190
br i1 %191, label %192, label %219
192: ; preds = %188
%193 = call i64 (...) @random()
store i64 %193, i64* %6
%194 = load i8*, i8** %10
%195 = load i64, i64* %19
%196 = getelementptr inbounds i8, i8* %194, i64 %195
%197 = load i8, i8* %196
%198 = zext i8 %197 to i32
%199 = load i64, i64* %6
%200 = trunc i64 %199 to i8
%201 = zext i8 %200 to i32
%202 = icmp ne i32 %198, %201
%203 = zext i1 %202 to i32
%204 = and i32 %203, 255
%205 = icmp ne i32 %204, 0
br i1 %205, label %206, label %215
206: ; preds = %192
%207 = load i64, i64* %18
%208 = load i64, i64* %24
%209 = mul i64 %207, %208
%210 = load i64, i64* %19
%211 = mul i64 %209, %210
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i64 %211)
%213 = load i32, i32* %15
%214 = add nsw i32 %213, 1
store i32 %214, i32* %15
br label %219
215: ; preds = %192
br label %216
216: ; preds = %215
%217 = load i64, i64* %19
%218 = add i64 %217, 1
store i64 %218, i64* %19
br label %188
219: ; preds = %206, %188
%220 = load i32, i32* %15
%221 = icmp sgt i32 %220, 10
br i1 %221, label %222, label %223
222: ; preds = %219
br label %227
223: ; preds = %219
br label %224
224: ; preds = %223, %186
%225 = load i64, i64* %18
%226 = add i64 %225, 1
store i64 %226, i64* %18
br label %137
227: ; preds = %222, %176, %137
%228 = load i32, i32* %15
%229 = icmp ne i32 %228, 0
br i1 %229, label %239, label %230
230: ; preds = %227
%231 = load i32, i32* %16
%232 = icmp ne i32 %231, 0
br i1 %232, label %233, label %239
233: ; preds = %230
%234 = load i64, i64* %24
%235 = load i64, i64* %23
%236 = mul i64 %234, %235
%237 = load i64, i64* %7
%238 = icmp eq i64 %236, %237
br i1 %238, label %239, label %240
239: ; preds = %233, %230, %227
br label %293
240: ; preds = %233
%241 = load i64, i64* %7
%242 = load i64, i64* %24
%243 = load i64, i64* %23
%244 = mul i64 %242, %243
%245 = sub i64 %241, %244
store i64 %245, i64* %25
%246 = load i32, i32* %14
%247 = load i8*, i8** %10
%248 = load i64, i64* %25
%249 = call i64 @read(i32 %246, i8* %247, i64 %248)
store i64 %249, i64* %22
%250 = load i64, i64* %22
%251 = load i64, i64* %25
%252 = icmp ne i64 %250, %251
br i1 %252, label %253, label %260
253: ; preds = %240
%254 = load i32, i32* %16
%255 = icmp ne i32 %254, 0
%256 = zext i1 %255 to i64
%257 = select i1 %255, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
%258 = load i32, i32* @errno
%259 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %257, i32 %258)
br label %293
260: ; preds = %240
store i64 0, i64* %18
br label %261
261: ; preds = %289, %260
%262 = load i64, i64* %18
%263 = load i64, i64* %25
%264 = icmp ult i64 %262, %263
br i1 %264, label %265, label %292
265: ; preds = %261
%266 = call i64 (...) @random()
store i64 %266, i64* %6
%267 = load i8*, i8** %10
%268 = load i64, i64* %18
%269 = getelementptr inbounds i8, i8* %267, i64 %268
%270 = load i8, i8* %269
%271 = zext i8 %270 to i32
%272 = load i64, i64* %6
%273 = trunc i64 %272 to i8
%274 = zext i8 %273 to i32
%275 = icmp ne i32 %271, %274
%276 = zext i1 %275 to i32
%277 = and i32 %276, 255
%278 = icmp ne i32 %277, 0
br i1 %278, label %279, label %288
279: ; preds = %265
%280 = load i64, i64* %23
%281 = load i64, i64* %24
%282 = mul i64 %280, %281
%283 = load i64, i64* %18
%284 = mul i64 %282, %283
%285 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i64 %284)
%286 = load i32, i32* %15
%287 = add nsw i32 %286, 1
store i32 %287, i32* %15
br label %288
288: ; preds = %279, %265
br label %289
289: ; preds = %288
%290 = load i64, i64* %18
%291 = add i64 %290, 1
store i64 %291, i64* %18
br label %261
292: ; preds = %261
br label %293
293: ; preds = %292, %253, %239
%294 = load i32, i32* %15
%295 = icmp ne i32 %294, 0
br i1 %295, label %302, label %296
296: ; preds = %293
%297 = load i32, i32* %16
%298 = icmp ne i32 %297, 0
br i1 %298, label %299, label %302
299: ; preds = %296
%300 = load i64, i64* %25
%301 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.10, i64 0, i64 0), i64 %300)
br label %302
302: ; preds = %299, %296, %293
%303 = load i32, i32* %15
%304 = icmp ne i32 %303, 0
br i1 %304, label %319, label %305
305: ; preds = %302
%306 = load i32, i32* %16
%307 = icmp ne i32 %306, 0
br i1 %307, label %319, label %308
308: ; preds = %305
%309 = load i32, i32* %14
%310 = call i32 @fsync(i32 %309)
store i32 %310, i32* %15
%311 = load i32, i32* %15
%312 = icmp ne i32 %311, 0
br i1 %312, label %315, label %313
313: ; preds = %308
%314 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %318
315: ; preds = %308
%316 = load i32, i32* @errno
%317 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i32 %316)
br label %318
318: ; preds = %315, %313
br label %319
319: ; preds = %318, %305, %302
%320 = load i32, i32* %14
%321 = call i32 @close(i32 %320)
%322 = load i32, i32* %15
%323 = icmp ne i32 %322, 0
br i1 %323, label %339, label %324
324: ; preds = %319
%325 = load i32, i32* %17
%326 = icmp ne i32 %325, 0
br i1 %326, label %327, label %339
327: ; preds = %324
%328 = load i8*, i8** %8
%329 = call i32 @unlink(i8* %328)
store i32 %329, i32* %15
%330 = load i32, i32* %15
%331 = icmp ne i32 %330, 0
br i1 %331, label %334, label %332
332: ; preds = %327
%333 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
br label %338
334: ; preds = %327
%335 = load i8*, i8** %8
%336 = load i32, i32* @errno
%337 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), i8* %335, i32 %336)
br label %338
338: ; preds = %334, %332
br label %339
339: ; preds = %338, %324, %319
%340 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
%341 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%342 = load i64, i64* %341
%343 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%344 = load i64, i64* %343
%345 = icmp slt i64 %342, %344
br i1 %345, label %346, label %353
346: ; preds = %339
%347 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%348 = load i64, i64* %347
%349 = add nsw i64 %348, 1000000
store i64 %349, i64* %347
%350 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%351 = load i32, i32* %350
%352 = add nsw i32 %351, -1
store i32 %352, i32* %350
br label %353
353: ; preds = %346, %339
%354 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%355 = load i32, i32* %354
%356 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%357 = load i32, i32* %356
%358 = sub nsw i32 %355, %357
%359 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
store i32 %358, i32* %359
%360 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%361 = load i64, i64* %360
%362 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%363 = load i64, i64* %362
%364 = sub nsw i64 %361, %363
%365 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
store i64 %364, i64* %365
%366 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%367 = load i32, i32* %366
%368 = sdiv i32 %367, 3600
%369 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%370 = load i32, i32* %369
%371 = srem i32 %370, 3600
%372 = sdiv i32 %371, 60
%373 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%374 = load i32, i32* %373
%375 = srem i32 %374, 60
%376 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %368, i32 %372, i32 %375)
%377 = load i32, i32* %15
%378 = icmp ne i32 %377, 0
br i1 %378, label %379, label %381
379: ; preds = %353
%380 = call i32 @exit(i32 1)
unreachable
381: ; preds = %353
%382 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.stat = type { i64 }
%struct.timeval = type { i64, i32 }
@.str = [9 x i8] c"b:s:n:rd\00"
@optarg = global i32 0
@optind = global i32 0
@O_RDONLY = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [31 x i8] c"Fail to open file, errno = %d\0A\00"
@errno = global i32 0
@.str.3 = [36 x i8] c"Failed to stat file %s, errno = %d\0A\00"
@.str.4 = [37 x i8] c"Fail to allocate memory, errno = %d\0A\00"
@.str.5 = [64 x i8] c"Seed = %d, file name = %s, bsize = %d, blocks = %d, size = %ld\0A\00"
@stdout = global i32 0
@.str.6 = [29 x i8] c"Fail to %s file, errno = %d\0A\00"
@.str.7 = [5 x i8] c"read\00"
@.str.8 = [6 x i8] c"write\00"
@.str.9 = [33 x i8] c"Unexpected data at offset = %ld\0A\00"
@.str.10 = [67 x i8] c"Good news! No corruption has been found (last block has %d bytes)\0A\00"
@.str.12 = [34 x i8] c"Fail to fsync file, errno = %d.\07\0A\00"
@.str.14 = [38 x i8] c"Fail to delete file %s, errno = %d.\07\0A\00"
@.str.15 = [40 x i8] c"\0ATotal elapsed time is %02d:%02d:%02d.\0A\00"
@str = [37 x i8] c"File has been created successfully.\07\00"
@str.16 = [37 x i8] c"File has been deleted successfully!\07\00"
@str.17 = [62 x i8] c"Usage: a.out [-s seed] [-r] [-b bsize] [-n nblocks ] filename\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = bitcast %struct.stat* %3 to i8*
%7 = bitcast %struct.timeval* %4 to i8*
%8 = bitcast %struct.timeval* %5 to i8*
%9 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
br label %10
10: ; preds = %30, %2
%11 = phi i1 [ false, %2 ], [ true, %30 ]
%12 = phi i32 [ 0, %2 ], [ %17, %30 ]
%13 = phi i64 [ 4456, %2 ], [ %22, %30 ]
%14 = phi i64 [ 5678, %2 ], [ %26, %30 ]
%15 = phi i64 [ 1234567, %2 ], [ %29, %30 ]
br label %16
16: ; preds = %30, %10
%17 = phi i32 [ %12, %10 ], [ 1, %30 ]
%18 = phi i64 [ %13, %10 ], [ %22, %30 ]
%19 = phi i64 [ %14, %10 ], [ %26, %30 ]
%20 = phi i64 [ %15, %10 ], [ %29, %30 ]
br label %21
21: ; preds = %16, %35
%22 = phi i64 [ %18, %16 ], [ %37, %35 ]
%23 = phi i64 [ %19, %16 ], [ %26, %35 ]
%24 = phi i64 [ %20, %16 ], [ %29, %35 ]
br label %25
25: ; preds = %21, %32
%26 = phi i64 [ %23, %21 ], [ %34, %32 ]
%27 = phi i64 [ %24, %21 ], [ %29, %32 ]
br label %28
28: ; preds = %25, %38
%29 = phi i64 [ %27, %25 ], [ %40, %38 ]
br label %30
30: ; preds = %28, %30
%31 = tail call i64 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
switch i64 %31, label %30 [
i64 -1, label %41
i64 98, label %32
i64 115, label %35
i64 110, label %38
i64 114, label %10
i64 100, label %16
]
32: ; preds = %30
%33 = load i32, i32* @optarg
%34 = tail call i64 @atoi(i32 %33)
br label %25
35: ; preds = %30
%36 = load i32, i32* @optarg
%37 = tail call i64 @atoi(i32 %36)
br label %21
38: ; preds = %30
%39 = load i32, i32* @optarg
%40 = tail call i64 @atoi(i32 %39)
br label %28
41: ; preds = %30
%42 = load i32, i32* @optind
%43 = add nsw i32 %0, -1
%44 = icmp eq i32 %42, %43
br i1 %44, label %48, label %45
45: ; preds = %41
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.17, i64 0, i64 0))
%47 = tail call i32 @exit(i32 1)
unreachable
48: ; preds = %41
%49 = sext i32 %42 to i64
%50 = getelementptr inbounds i8*, i8** %1, i64 %49
%51 = load i8*, i8** %50
br i1 %11, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* @O_RDONLY
%54 = tail call i32 (i8*, i32, ...) @open(i8* %51, i32 %53)
br label %62
55: ; preds = %48
%56 = load i32, i32* @O_RDWR
%57 = load i32, i32* @O_CREAT
%58 = or i32 %57, %56
%59 = load i32, i32* @O_TRUNC
%60 = or i32 %58, %59
%61 = tail call i32 (i8*, i32, ...) @open(i8* %51, i32 %60, i32 384)
br label %62
62: ; preds = %55, %52
%63 = phi i32 [ %54, %52 ], [ %61, %55 ]
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i32, i32* @errno
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %66)
%68 = tail call i32 @exit(i32 1)
unreachable
69: ; preds = %62
%70 = call i64 @fstat(i32 %63, %struct.stat* %3)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load i32, i32* @errno
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %51, i32 %73)
%75 = tail call i32 @exit(i32 1)
unreachable
76: ; preds = %69
%77 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%78 = load i64, i64* %77
br i1 %11, label %79, label %84
79: ; preds = %76
%80 = udiv i64 %78, %26
%81 = urem i64 %78, %26
%82 = icmp ne i64 %81, 0
%83 = zext i1 %82 to i64
br label %89
84: ; preds = %76
%85 = icmp eq i64 %78, 0
%86 = zext i1 %85 to i32
%87 = tail call i32 @assert(i32 %86)
%88 = mul i64 %29, %26
br label %89
89: ; preds = %79, %84
%90 = phi i64 [ %88, %84 ], [ %78, %79 ]
%91 = phi i64 [ %29, %84 ], [ %80, %79 ]
%92 = phi i64 [ 0, %84 ], [ %83, %79 ]
%93 = tail call i8* @malloc(i64 %26)
%94 = icmp eq i8* %93, null
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = load i32, i32* @errno
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %96)
%98 = tail call i32 @exit(i32 1)
unreachable
99: ; preds = %89
%100 = tail call i32 @srandom(i64 %22)
%101 = add i64 %92, %91
%102 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0), i64 %22, i8* %51, i64 %26, i64 %101, i64 %90)
%103 = load i32, i32* @stdout
%104 = tail call i32 @fflush(i32 %103)
%105 = icmp eq i64 %91, 0
br i1 %105, label %156, label %106
106: ; preds = %99
%107 = icmp eq i64 %26, 0
br label %108
108: ; preds = %106, %152
%109 = phi i64 [ 0, %106 ], [ %154, %152 ]
%110 = phi i32 [ 0, %106 ], [ %153, %152 ]
br i1 %11, label %125, label %111
111: ; preds = %108
br i1 %107, label %122, label %112
112: ; preds = %111, %112
%113 = phi i64 [ %117, %112 ], [ 0, %111 ]
%114 = tail call i64 (...) @random()
%115 = trunc i64 %114 to i8
%116 = getelementptr inbounds i8, i8* %93, i64 %113
store i8 %115, i8* %116
%117 = add nuw i64 %113, 1
%118 = icmp eq i64 %117, %26
br i1 %118, label %119, label %112
119: ; preds = %112
%120 = tail call i64 @write(i32 %63, i8* %93, i64 %26)
%121 = icmp eq i64 %120, %26
br i1 %121, label %132, label %128
122: ; preds = %111
%123 = tail call i64 @write(i32 %63, i8* %93, i64 %26)
%124 = icmp eq i64 %123, %26
br i1 %124, label %152, label %128
125: ; preds = %108
%126 = tail call i64 @read(i32 %63, i8* %93, i64 %26)
%127 = icmp eq i64 %126, %26
br i1 %127, label %133, label %128
128: ; preds = %122, %125, %119
%129 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %122 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), %125 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %119 ]
%130 = load i32, i32* @errno
%131 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* %129, i32 %130)
br label %156
132: ; preds = %119
br i1 %11, label %133, label %152
133: ; preds = %125, %132
br i1 %107, label %149, label %134
134: ; preds = %133, %146
%135 = phi i64 [ %147, %146 ], [ 0, %133 ]
%136 = tail call i64 (...) @random()
%137 = getelementptr inbounds i8, i8* %93, i64 %135
%138 = load i8, i8* %137
%139 = trunc i64 %136 to i8
%140 = icmp eq i8 %138, %139
br i1 %140, label %146, label %141
141: ; preds = %134
%142 = mul i64 %109, %91
%143 = mul i64 %142, %135
%144 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i64 %143)
%145 = add nsw i32 %110, 1
br label %149
146: ; preds = %134
%147 = add nuw i64 %135, 1
%148 = icmp eq i64 %147, %26
br i1 %148, label %149, label %134
149: ; preds = %146, %133, %141
%150 = phi i32 [ %145, %141 ], [ %110, %133 ], [ %110, %146 ]
%151 = icmp sgt i32 %150, 10
br i1 %151, label %207, label %152
152: ; preds = %122, %149, %132
%153 = phi i32 [ %150, %149 ], [ %110, %132 ], [ %110, %122 ]
%154 = add nuw i64 %109, 1
%155 = icmp eq i64 %154, %91
br i1 %155, label %156, label %108
156: ; preds = %152, %99, %128
%157 = phi i32 [ %110, %128 ], [ 0, %99 ], [ %153, %152 ]
%158 = icmp eq i32 %157, 0
%159 = and i1 %158, %11
br i1 %159, label %160, label %188
160: ; preds = %156
%161 = mul i64 %91, %26
%162 = icmp eq i64 %90, %161
br i1 %162, label %188, label %163
163: ; preds = %160
%164 = sub i64 %90, %161
%165 = tail call i64 @read(i32 %63, i8* %93, i64 %164)
%166 = icmp eq i64 %165, %164
br i1 %166, label %167, label %169
167: ; preds = %163
%168 = icmp eq i64 %164, 0
br i1 %168, label %188, label %172
169: ; preds = %163
%170 = load i32, i32* @errno
%171 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %170)
br label %188
172: ; preds = %167, %184
%173 = phi i64 [ %186, %184 ], [ 0, %167 ]
%174 = phi i32 [ %185, %184 ], [ 0, %167 ]
%175 = tail call i64 (...) @random()
%176 = getelementptr inbounds i8, i8* %93, i64 %173
%177 = load i8, i8* %176
%178 = trunc i64 %175 to i8
%179 = icmp eq i8 %177, %178
br i1 %179, label %184, label %180
180: ; preds = %172
%181 = mul i64 %173, %161
%182 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i64 %181)
%183 = add nsw i32 %174, 1
br label %184
184: ; preds = %172, %180
%185 = phi i32 [ %183, %180 ], [ %174, %172 ]
%186 = add nuw i64 %173, 1
%187 = icmp ult i64 %186, %164
br i1 %187, label %172, label %188
188: ; preds = %184, %167, %156, %160, %169
%189 = phi i32 [ 0, %160 ], [ 0, %169 ], [ %157, %156 ], [ 0, %167 ], [ %185, %184 ]
%190 = phi i64 [ %92, %160 ], [ %164, %169 ], [ %92, %156 ], [ 0, %167 ], [ %164, %184 ]
%191 = icmp eq i32 %189, 0
%192 = and i1 %191, %11
br i1 %192, label %193, label %195
193: ; preds = %188
%194 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.10, i64 0, i64 0), i64 %190)
br label %195
195: ; preds = %193, %188
%196 = phi i32 [ 0, %193 ], [ %189, %188 ]
%197 = icmp ne i32 %196, 0
%198 = or i1 %197, %11
br i1 %198, label %207, label %199
199: ; preds = %195
%200 = tail call i32 @fsync(i32 %63)
%201 = icmp eq i32 %200, 0
br i1 %201, label %202, label %204
202: ; preds = %199
%203 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %207
204: ; preds = %199
%205 = load i32, i32* @errno
%206 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i32 %205)
br label %207
207: ; preds = %149, %202, %204, %195
%208 = phi i32 [ %196, %195 ], [ %200, %204 ], [ 0, %202 ], [ %150, %149 ]
%209 = tail call i32 @close(i32 %63)
%210 = icmp eq i32 %208, 0
%211 = icmp ne i32 %17, 0
%212 = select i1 %210, i1 %211, i1 false
br i1 %212, label %213, label %221
213: ; preds = %207
%214 = tail call i32 @unlink(i8* %51)
%215 = icmp eq i32 %214, 0
br i1 %215, label %216, label %218
216: ; preds = %213
%217 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.16, i64 0, i64 0))
br label %221
218: ; preds = %213
%219 = load i32, i32* @errno
%220 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.14, i64 0, i64 0), i8* %51, i32 %219)
br label %221
221: ; preds = %216, %218, %207
%222 = phi i32 [ 1, %218 ], [ 0, %216 ], [ %208, %207 ]
%223 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%224 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%225 = load i64, i64* %224
%226 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%227 = load i64, i64* %226
%228 = icmp slt i64 %225, %227
br i1 %228, label %232, label %229
229: ; preds = %221
%230 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%231 = load i32, i32* %230
br label %237
232: ; preds = %221
%233 = add nsw i64 %225, 1000000
store i64 %233, i64* %224
%234 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%235 = load i32, i32* %234
%236 = add nsw i32 %235, -1
store i32 %236, i32* %234
br label %237
237: ; preds = %229, %232
%238 = phi i32 [ %231, %229 ], [ %236, %232 ]
%239 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%240 = load i32, i32* %239
%241 = sub nsw i32 %238, %240
%242 = sdiv i32 %241, 3600
%243 = srem i32 %241, 3600
%244 = trunc i32 %243 to i16
%245 = sdiv i16 %244, 60
%246 = sext i16 %245 to i32
%247 = srem i32 %241, 60
%248 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.15, i64 0, i64 0), i32 %242, i32 %246, i32 %247)
%249 = icmp eq i32 %222, 0
br i1 %249, label %252, label %250
250: ; preds = %237
%251 = tail call i32 @exit(i32 1)
unreachable
252: ; preds = %237
%253 = tail call i32 @exit(i32 0)
unreachable
}