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

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ SEEK_SET;
size_t atoi(int /*<<< orphan*/);
size_t atol(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
size_t getopt(int, char **, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
unsigned char *malloc(size_t);
int open(char *, int, int);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ printf(char *, ...);
unsigned char random();
int read(int, unsigned char *, size_t);
int /*<<< orphan*/ srandom(size_t);
int /*<<< orphan*/ stdout;
int truncate(char *, size_t);
int write(int, unsigned char *, size_t);
int main(int argc, char *argv[]) {
  char *filename;
  int i, fd, ret;
  unsigned char *buf, val;
  struct timeval t1, t2, t3;
  size_t ch, off, seed, size;
  seed = 35438;
  size = 12345678;
  gettimeofday(&t1, NULL);
  while ((ch = getopt(argc, argv, "s:S:")) != -1) {
    switch (ch) {
    case 's':
      seed = atoi(optarg);
      break;
    case 'S':
      size = atol(optarg);
      break;
    }
  }
  if (optind != argc - 1) {
    printf("Usage: a.out [-s seed] [-S size] filename\n");
    exit(1);
  }
  buf = malloc(size);
  if (buf == NULL) {
    printf("Allocation failed with errno = %d\n", errno);
    exit(1);
  }
  filename = argv[optind];
  printf("seed = %d, size = %ld, file name = %s.\n\n", seed, size, filename);
  fflush(stdout);
  fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
  if (fd < 0) {
    printf("Fail to open file, errno = %d\n", errno);
    exit(1);
  }
  ret = truncate(filename, size);
  if (ret < 0) {
    printf("Fail to truncate file, errno = %d\n", errno);
    exit(1);
  }
  ret = read(fd, buf, size);
  if (ret != size) {
    printf("Fail to read file, errno = %d\n", errno);
    exit(1);
  }
  srandom(seed);
  for (i = 0; i < size; i++) {
    if (buf[i]) {
      printf("File content is corrupted (0 versus %x)\n", buf[i]);
      exit(1);
    }
    buf[i] = random();
  }
  ret = lseek(fd, 0, SEEK_SET);
  if (ret < 0) {
    printf("Fail to lseek file, errno = %d\n", errno);
    exit(1);
  }
  ret = write(fd, buf, size);
  if (ret != size) {
    printf("Fail to write file, errno = %d\n", errno);
    exit(1);
  }
  close(fd);
  fd = open(filename, O_RDWR, 0600);
  off = size * 3 / 4;
  printf("Truncate file to %d bytes ...\n", off);
  ret = truncate(filename, off);
  if (ret < 0) {
    printf("Fail to truncate file, errno = %d\n", errno);
    exit(1);
  }
  printf("Truncate file to %d bytes ...\n", size);
  ret = truncate(filename, size);
  if (ret < 0) {
    printf("Fail to truncate file, errno = %d\n", errno);
    exit(1);
  }
  srandom(seed);
  ret = read(fd, buf, size);
  if (ret != size) {
    printf("Fail to read file, errno = %d\n", errno);
    exit(1);
  }
  for (i = 0; i < size; i++) {
    val = random();
    if (i < off && buf[i] != val) {
      printf("File content is corrupted (%#x versus %#x)\n", buf[i], val);
      exit(1);
    }
    if (i >= off && buf[i]) {
      printf("File content is corrupted (%#x versus %#x)\n", buf[i], 0);
      exit(1);
    }
  }
  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);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x8a6e,-0x80(%rbp)
movq   $0xbc614e,-0x88(%rbp)
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdb9(%rip),%rdx
call   1100 <getopt@plt>
mov    %rax,-0x70(%rbp)
cmp    $0xffffffffffffffff,%rax
je     12bb <main+0xbb>
mov    -0x70(%rbp),%rax
mov    %rax,-0x90(%rbp)
sub    $0x53,%rax
je     12a1 <main+0xa1>
jmp    1274 <main+0x74>
mov    -0x90(%rbp),%rax
sub    $0x73,%rax
jne    12b6 <main+0xb6>
jmp    128a <main+0x8a>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
call   1110 <atoi@plt>
mov    %rax,-0x80(%rbp)
jmp    12b6 <main+0xb6>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
call   10e0 <atol@plt>
mov    %rax,-0x88(%rbp)
jmp    1239 <main+0x39>
mov    0x2d06(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     12ea <main+0xea>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x88(%rbp),%rdi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1326 <main+0x126>
mov    0x2cac(%rip),%rax
mov    (%rax),%esi
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x2c97(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x80(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c48(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c5e(%rip),%rax
mov    (%rax),%esi
mov    0x2c7d(%rip),%rax
or     (%rax),%esi
mov    0x2c64(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
call   10f0 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    13be <main+0x1be>
mov    0x2c14(%rip),%rax
mov    (%rax),%esi
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x88(%rbp),%rsi
call   10a0 <truncate@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    13fc <main+0x1fc>
mov    0x2bd6(%rip),%rax
mov    (%rax),%esi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x88(%rbp),%rdx
call   1090 <read@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x88(%rbp),%rax
je     1444 <main+0x244>
mov    0x2b8e(%rip),%rax
mov    (%rax),%esi
lea    0xc8b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x80(%rbp),%rdi
call   1030 <srandom@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x88(%rbp),%rax
jae    14bd <main+0x2bd>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     149b <main+0x29b>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xc53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    $0x0,%al
call   10b0 <random@plt>
mov    %al,%dl
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1454 <main+0x254>
mov    -0x20(%rbp),%edi
mov    0x2ae9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    14fe <main+0x2fe>
mov    0x2ad4(%rip),%rax
mov    (%rax),%esi
lea    0xc19(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x88(%rbp),%rdx
call   1040 <write@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x88(%rbp),%rax
je     1546 <main+0x346>
mov    0x2a8c(%rip),%rax
mov    (%rax),%esi
lea    0xbf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    -0x18(%rbp),%rdi
mov    0x2a77(%rip),%rax
mov    (%rax),%esi
mov    $0x180,%edx
call   10f0 <open@plt>
mov    %eax,-0x20(%rbp)
imul   $0x3,-0x88(%rbp),%rax
03
shr    $0x2,%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rsi
lea    0xbc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x78(%rbp),%rsi
call   10a0 <truncate@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    15c5 <main+0x3c5>
mov    0x2a0d(%rip),%rax
mov    (%rax),%esi
lea    0xae7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x88(%rbp),%rsi
lea    0xb73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x88(%rbp),%rsi
call   10a0 <truncate@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1618 <main+0x418>
mov    0x29ba(%rip),%rax
mov    (%rax),%esi
lea    0xa94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x80(%rbp),%rdi
call   1030 <srandom@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x88(%rbp),%rdx
call   1090 <read@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x88(%rbp),%rax
je     1669 <main+0x469>
mov    0x2969(%rip),%rax
mov    (%rax),%esi
lea    0xa66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x88(%rbp),%rax
jae    1735 <main+0x535>
mov    $0x0,%al
call   10b0 <random@plt>
mov    %al,-0x31(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x78(%rbp),%rax
jae    16d9 <main+0x4d9>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x31(%rbp),%ecx
cmp    %ecx,%eax
je     16d9 <main+0x4d9>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
movzbl -0x31(%rbp),%edx
lea    0xa9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movslq -0x1c(%rbp),%rax
cmp    -0x78(%rbp),%rax
jb     1722 <main+0x522>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1722 <main+0x522>
mov    -0x30(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xa56(%rip),%rdi
xor    %edx,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1727 <main+0x527>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1670 <main+0x470>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <gettimeofday@plt>
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
jge    1767 <main+0x567>
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,-0x94(%rbp)
mov    -0x60(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x94(%rbp),%edx
lea    0x9d3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@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    $0x28,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0x18(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
mov    $0xbc614e,%r12d
mov    $0x8a6e,%r14d
lea    0xdbe(%rip),%r15
mov    0x2da7(%rip),%r13
jmp    1260 <main+0x50>
mov    0x0(%r13),%edi
call   1120 <atoi@plt>
mov    %rax,%r14
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1110 <getopt@plt>
cmp    $0x53,%rax
je     1281 <main+0x71>
cmp    $0x73,%rax
je     124b <main+0x3b>
cmp    $0xffffffffffffffff,%rax
jne    1260 <main+0x50>
jmp    128f <main+0x7f>
mov    0x0(%r13),%edi
call   10f0 <atol@plt>
mov    %rax,%r12
jmp    1260 <main+0x50>
mov    0x2d32(%rip),%rax
movslq (%rax),%r13
add    $0xffffffff,%ebx
cmp    %ebx,%r13d
jne    12c3 <main+0xb3>
mov    %r12,%rdi
call   10d0 <malloc@plt>
test   %rax,%rax
jne    12d9 <main+0xc9>
mov    0x2d03(%rip),%rax
mov    (%rax),%esi
lea    0xd47(%rip),%rdi
jmp    14db <main+0x2cb>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
mov    %rax,%r15
mov    0x0(%rbp,%r13,8),%rbx
lea    0xd40(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
call   10e0 <fflush@plt>
mov    0x2cc3(%rip),%rcx
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
or     (%rcx),%esi
mov    0x2cc9(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
mov    $0x180,%edx
call   1100 <open@plt>
test   %eax,%eax
jns    1347 <main+0x137>
mov    0x2c7f(%rip),%rax
mov    (%rax),%esi
lea    0xd0f(%rip),%rdi
jmp    14db <main+0x2cb>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <truncate@plt>
test   %eax,%eax
jns    136d <main+0x15d>
mov    0x2c59(%rip),%rax
mov    (%rax),%esi
lea    0xd08(%rip),%rdi
jmp    14db <main+0x2cb>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10a0 <read@plt>
cltq
cmp    %rax,%r12
jne    14cb <main+0x2bb>
mov    %r14,%rdi
call   1030 <srandom@plt>
test   %r12,%r12
je     13c1 <main+0x1b1>
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r15,%r13,1),%esi
test   %esi,%esi
jne    14ec <main+0x2dc>
xor    %eax,%eax
call   10c0 <random@plt>
mov    %al,(%r15,%r13,1)
add    $0x1,%r13
cmp    %r13,%r12
jne    13a0 <main+0x190>
mov    0x2be8(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1070 <lseek@plt>
test   %eax,%eax
jns    13ec <main+0x1dc>
mov    0x2bda(%rip),%rax
mov    (%rax),%esi
lea    0xcf4(%rip),%rdi
jmp    14db <main+0x2cb>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <write@plt>
cltq
cmp    %rax,%r12
jne    14f5 <main+0x2e5>
mov    %ebp,%edi
call   1090 <close@plt>
mov    0x2bbe(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
mov    $0x180,%edx
call   1100 <open@plt>
mov    %eax,%ebp
lea    (%r12,%r12,2),%r13
shr    $0x2,%r13
lea    0xce9(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10b0 <truncate@plt>
test   %eax,%eax
js     1358 <main+0x148>
lea    0xcc5(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10b0 <truncate@plt>
test   %eax,%eax
js     1358 <main+0x148>
mov    %r14,%rdi
call   1030 <srandom@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   10a0 <read@plt>
cltq
cmp    %rax,%r12
jne    14cb <main+0x2bb>
test   %r12,%r12
jne    1507 <main+0x2f7>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1080 <gettimeofday@plt>
mov    0x8(%rsp),%rax
cmp    0x18(%rsp),%rax
jge    154a <main+0x33a>
add    $0xf4240,%rax
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
mov    %eax,0x10(%rsp)
jmp    154e <main+0x33e>
mov    0x2ae6(%rip),%rax
mov    (%rax),%esi
lea    0xbb8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xbbf(%rip),%rdi
jmp    14db <main+0x2cb>
mov    0x2abc(%rip),%rax
mov    (%rax),%esi
lea    0xbf6(%rip),%rdi
jmp    14db <main+0x2cb>
xor    %ebx,%ebx
jmp    1525 <main+0x315>
nopl   0x0(%rax,%rax,1)
test   %esi,%esi
jne    15c6 <main+0x3b6>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1494 <main+0x284>
xor    %eax,%eax
call   10c0 <random@plt>
movzbl (%r15,%rbx,1),%esi
cmp    %rbx,%r13
jbe    1510 <main+0x300>
cmp    %al,%sil
je     1518 <main+0x308>
movzbl %al,%edx
lea    0xbf5(%rip),%rdi
jmp    15cf <main+0x3bf>
mov    0x10(%rsp),%eax
sub    0x20(%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    0xbae(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
call   1130 <exit@plt>
lea    0xb6d(%rip),%rdi
xor    %edx,%edx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i32 }
@.str = [5 x i8] c"s:S:\00"
@optarg = global i32 0
@optind = global i32 0
@.str.1 = [43 x i8] c"Usage: a.out [-s seed] [-S size] filename\0A\00"
@.str.2 = [35 x i8] c"Allocation failed with errno = %d\0A\00"
@errno = global i32 0
@.str.3 = [41 x i8] c"seed = %d, size = %ld, file name = %s.\0A\0A\00"
@stdout = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.4 = [31 x i8] c"Fail to open file, errno = %d\0A\00"
@.str.5 = [35 x i8] c"Fail to truncate file, errno = %d\0A\00"
@.str.6 = [31 x i8] c"Fail to read file, errno = %d\0A\00"
@.str.7 = [41 x i8] c"File content is corrupted (0 versus %x)\0A\00"
@SEEK_SET = global i32 0
@.str.8 = [32 x i8] c"Fail to lseek file, errno = %d\0A\00"
@.str.9 = [32 x i8] c"Fail to write file, errno = %d\0A\00"
@.str.10 = [31 x i8] c"Truncate file to %d bytes ...\0A\00"
@.str.11 = [44 x i8] c"File content is corrupted (%#x versus %#x)\0A\00"
@.str.12 = [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 i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca %struct.timeval
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 35438, i64* %17
store i64 12345678, i64* %18
%19 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
br label %20
20: ; preds = %33, %2
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i64 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i64 %23, i64* %15
%24 = icmp ne i64 %23, -1
br i1 %24, label %25, label %34
25: ; preds = %20
%26 = load i64, i64* %15
switch i64 %26, label %33 [
i64 115, label %27
i64 83, label %30
]
27: ; preds = %25
%28 = load i32, i32* @optarg
%29 = call i64 @atoi(i32 %28)
store i64 %29, i64* %17
br label %33
30: ; preds = %25
%31 = load i32, i32* @optarg
%32 = call i64 @atol(i32 %31)
store i64 %32, i64* %18
br label %33
33: ; preds = %25, %30, %27
br label %20
34: ; preds = %20
%35 = load i32, i32* @optind
%36 = load i32, i32* %4
%37 = sub nsw i32 %36, 1
%38 = icmp ne i32 %35, %37
br i1 %38, label %39, label %42
39: ; preds = %34
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %34
%43 = load i64, i64* %18
%44 = call i8* @malloc(i64 %43)
store i8* %44, i8** %10
%45 = load i8*, i8** %10
%46 = icmp eq i8* %45, null
br i1 %46, label %47, label %51
47: ; preds = %42
%48 = load i32, i32* @errno
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %42
%52 = load i8**, i8*** %5
%53 = load i32, i32* @optind
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
store i8* %56, i8** %6
%57 = load i64, i64* %17
%58 = load i64, i64* %18
%59 = load i8*, i8** %6
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i64 %57, i64 %58, i8* %59)
%61 = load i32, i32* @stdout
%62 = call i32 @fflush(i32 %61)
%63 = load i8*, i8** %6
%64 = load i32, i32* @O_RDWR
%65 = load i32, i32* @O_CREAT
%66 = or i32 %64, %65
%67 = load i32, i32* @O_TRUNC
%68 = or i32 %66, %67
%69 = call i32 @open(i8* %63, i32 %68, i32 384)
store i32 %69, i32* %8
%70 = load i32, i32* %8
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %51
%73 = load i32, i32* @errno
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %73)
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %51
%77 = load i8*, i8** %6
%78 = load i64, i64* %18
%79 = call i32 @truncate(i8* %77, i64 %78)
store i32 %79, i32* %9
%80 = load i32, i32* %9
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %86
82: ; preds = %76
%83 = load i32, i32* @errno
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %83)
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %76
%87 = load i32, i32* %8
%88 = load i8*, i8** %10
%89 = load i64, i64* %18
%90 = call i32 @read(i32 %87, i8* %88, i64 %89)
store i32 %90, i32* %9
%91 = load i32, i32* %9
%92 = sext i32 %91 to i64
%93 = load i64, i64* %18
%94 = icmp ne i64 %92, %93
br i1 %94, label %95, label %99
95: ; preds = %86
%96 = load i32, i32* @errno
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %96)
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %86
%100 = load i64, i64* %17
%101 = call i32 @srandom(i64 %100)
store i32 0, i32* %7
br label %102
102: ; preds = %129, %99
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = load i64, i64* %18
%106 = icmp ult i64 %104, %105
br i1 %106, label %107, label %132
107: ; preds = %102
%108 = load i8*, i8** %10
%109 = load i32, i32* %7
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %108, i64 %110
%112 = load i8, i8* %111
%113 = icmp ne i8 %112, 0
br i1 %113, label %114, label %123
114: ; preds = %107
%115 = load i8*, i8** %10
%116 = load i32, i32* %7
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds i8, i8* %115, i64 %117
%119 = load i8, i8* %118
%120 = zext i8 %119 to i32
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i32 %120)
%122 = call i32 @exit(i32 1)
unreachable
123: ; preds = %107
%124 = call zeroext i8 (...) @random()
%125 = load i8*, i8** %10
%126 = load i32, i32* %7
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i8, i8* %125, i64 %127
store i8 %124, i8* %128
br label %129
129: ; preds = %123
%130 = load i32, i32* %7
%131 = add nsw i32 %130, 1
store i32 %131, i32* %7
br label %102
132: ; preds = %102
%133 = load i32, i32* %8
%134 = load i32, i32* @SEEK_SET
%135 = call i32 @lseek(i32 %133, i32 0, i32 %134)
store i32 %135, i32* %9
%136 = load i32, i32* %9
%137 = icmp slt i32 %136, 0
br i1 %137, label %138, label %142
138: ; preds = %132
%139 = load i32, i32* @errno
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %139)
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %132
%143 = load i32, i32* %8
%144 = load i8*, i8** %10
%145 = load i64, i64* %18
%146 = call i32 @write(i32 %143, i8* %144, i64 %145)
store i32 %146, i32* %9
%147 = load i32, i32* %9
%148 = sext i32 %147 to i64
%149 = load i64, i64* %18
%150 = icmp ne i64 %148, %149
br i1 %150, label %151, label %155
151: ; preds = %142
%152 = load i32, i32* @errno
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %152)
%154 = call i32 @exit(i32 1)
unreachable
155: ; preds = %142
%156 = load i32, i32* %8
%157 = call i32 @close(i32 %156)
%158 = load i8*, i8** %6
%159 = load i32, i32* @O_RDWR
%160 = call i32 @open(i8* %158, i32 %159, i32 384)
store i32 %160, i32* %8
%161 = load i64, i64* %18
%162 = mul i64 %161, 3
%163 = udiv i64 %162, 4
store i64 %163, i64* %16
%164 = load i64, i64* %16
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i64 %164)
%166 = load i8*, i8** %6
%167 = load i64, i64* %16
%168 = call i32 @truncate(i8* %166, i64 %167)
store i32 %168, i32* %9
%169 = load i32, i32* %9
%170 = icmp slt i32 %169, 0
br i1 %170, label %171, label %175
171: ; preds = %155
%172 = load i32, i32* @errno
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %172)
%174 = call i32 @exit(i32 1)
unreachable
175: ; preds = %155
%176 = load i64, i64* %18
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i64 %176)
%178 = load i8*, i8** %6
%179 = load i64, i64* %18
%180 = call i32 @truncate(i8* %178, i64 %179)
store i32 %180, i32* %9
%181 = load i32, i32* %9
%182 = icmp slt i32 %181, 0
br i1 %182, label %183, label %187
183: ; preds = %175
%184 = load i32, i32* @errno
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %184)
%186 = call i32 @exit(i32 1)
unreachable
187: ; preds = %175
%188 = load i64, i64* %17
%189 = call i32 @srandom(i64 %188)
%190 = load i32, i32* %8
%191 = load i8*, i8** %10
%192 = load i64, i64* %18
%193 = call i32 @read(i32 %190, i8* %191, i64 %192)
store i32 %193, i32* %9
%194 = load i32, i32* %9
%195 = sext i32 %194 to i64
%196 = load i64, i64* %18
%197 = icmp ne i64 %195, %196
br i1 %197, label %198, label %202
198: ; preds = %187
%199 = load i32, i32* @errno
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %199)
%201 = call i32 @exit(i32 1)
unreachable
202: ; preds = %187
store i32 0, i32* %7
br label %203
203: ; preds = %258, %202
%204 = load i32, i32* %7
%205 = sext i32 %204 to i64
%206 = load i64, i64* %18
%207 = icmp ult i64 %205, %206
br i1 %207, label %208, label %261
208: ; preds = %203
%209 = call zeroext i8 (...) @random()
store i8 %209, i8* %11
%210 = load i32, i32* %7
%211 = sext i32 %210 to i64
%212 = load i64, i64* %16
%213 = icmp ult i64 %211, %212
br i1 %213, label %214, label %235
214: ; preds = %208
%215 = load i8*, i8** %10
%216 = load i32, i32* %7
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds i8, i8* %215, i64 %217
%219 = load i8, i8* %218
%220 = zext i8 %219 to i32
%221 = load i8, i8* %11
%222 = zext i8 %221 to i32
%223 = icmp ne i32 %220, %222
br i1 %223, label %224, label %235
224: ; preds = %214
%225 = load i8*, i8** %10
%226 = load i32, i32* %7
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds i8, i8* %225, i64 %227
%229 = load i8, i8* %228
%230 = zext i8 %229 to i32
%231 = load i8, i8* %11
%232 = zext i8 %231 to i32
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %230, i32 %232)
%234 = call i32 @exit(i32 1)
unreachable
235: ; preds = %214, %208
%236 = load i32, i32* %7
%237 = sext i32 %236 to i64
%238 = load i64, i64* %16
%239 = icmp uge i64 %237, %238
br i1 %239, label %240, label %257
240: ; preds = %235
%241 = load i8*, i8** %10
%242 = load i32, i32* %7
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds i8, i8* %241, i64 %243
%245 = load i8, i8* %244
%246 = zext i8 %245 to i32
%247 = icmp ne i32 %246, 0
br i1 %247, label %248, label %257
248: ; preds = %240
%249 = load i8*, i8** %10
%250 = load i32, i32* %7
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i8, i8* %249, i64 %251
%253 = load i8, i8* %252
%254 = zext i8 %253 to i32
%255 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %254, i32 0)
%256 = call i32 @exit(i32 1)
unreachable
257: ; preds = %240, %235
br label %258
258: ; preds = %257
%259 = load i32, i32* %7
%260 = add nsw i32 %259, 1
store i32 %260, i32* %7
br label %203
261: ; preds = %203
%262 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%263 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%264 = load i64, i64* %263
%265 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%266 = load i64, i64* %265
%267 = icmp slt i64 %264, %266
br i1 %267, label %268, label %275
268: ; preds = %261
%269 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%270 = load i64, i64* %269
%271 = add nsw i64 %270, 1000000
store i64 %271, i64* %269
%272 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%273 = load i32, i32* %272
%274 = add nsw i32 %273, -1
store i32 %274, i32* %272
br label %275
275: ; preds = %268, %261
%276 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%277 = load i32, i32* %276
%278 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%279 = load i32, i32* %278
%280 = sub nsw i32 %277, %279
%281 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
store i32 %280, i32* %281
%282 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%283 = load i64, i64* %282
%284 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%285 = load i64, i64* %284
%286 = sub nsw i64 %283, %285
%287 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
store i64 %286, i64* %287
%288 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%289 = load i32, i32* %288
%290 = sdiv i32 %289, 3600
%291 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%292 = load i32, i32* %291
%293 = srem i32 %292, 3600
%294 = sdiv i32 %293, 60
%295 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%296 = load i32, i32* %295
%297 = srem i32 %296, 60
%298 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i32 %290, i32 %294, i32 %297)
%299 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
@.str = [5 x i8] c"s:S:\00"
@optarg = global i32 0
@optind = global i32 0
@.str.2 = [35 x i8] c"Allocation failed with errno = %d\0A\00"
@errno = global i32 0
@.str.3 = [41 x i8] c"seed = %d, size = %ld, file name = %s.\0A\0A\00"
@stdout = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.4 = [31 x i8] c"Fail to open file, errno = %d\0A\00"
@.str.5 = [35 x i8] c"Fail to truncate file, errno = %d\0A\00"
@.str.6 = [31 x i8] c"Fail to read file, errno = %d\0A\00"
@.str.7 = [41 x i8] c"File content is corrupted (0 versus %x)\0A\00"
@SEEK_SET = global i32 0
@.str.8 = [32 x i8] c"Fail to lseek file, errno = %d\0A\00"
@.str.9 = [32 x i8] c"Fail to write file, errno = %d\0A\00"
@.str.10 = [31 x i8] c"Truncate file to %d bytes ...\0A\00"
@.str.11 = [44 x i8] c"File content is corrupted (%#x versus %#x)\0A\00"
@.str.12 = [40 x i8] c"\0ATotal elapsed time is %02d:%02d:%02d.\0A\00"
@str = [42 x i8] c"Usage: a.out [-s seed] [-S size] filename\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i8*
%6 = bitcast %struct.timeval* %4 to i8*
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
br label %8
8: ; preds = %15, %2
%9 = phi i64 [ %17, %15 ], [ 35438, %2 ]
%10 = phi i64 [ %12, %15 ], [ 12345678, %2 ]
br label %11
11: ; preds = %8, %18
%12 = phi i64 [ %10, %8 ], [ %20, %18 ]
br label %13
13: ; preds = %11, %13
%14 = tail call i64 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i64 %14, label %13 [
i64 -1, label %21
i64 115, label %15
i64 83, label %18
]
15: ; preds = %13
%16 = load i32, i32* @optarg
%17 = tail call i64 @atoi(i32 %16)
br label %8
18: ; preds = %13
%19 = load i32, i32* @optarg
%20 = tail call i64 @atol(i32 %19)
br label %11
21: ; preds = %13
%22 = load i32, i32* @optind
%23 = add nsw i32 %0, -1
%24 = icmp eq i32 %22, %23
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%27 = tail call i32 @exit(i32 1)
unreachable
28: ; preds = %21
%29 = tail call i8* @malloc(i64 %12)
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* @errno
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %28
%36 = sext i32 %22 to i64
%37 = getelementptr inbounds i8*, i8** %1, i64 %36
%38 = load i8*, i8** %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i64 %9, i64 %12, i8* %38)
%40 = load i32, i32* @stdout
%41 = tail call i32 @fflush(i32 %40)
%42 = load i32, i32* @O_RDWR
%43 = load i32, i32* @O_CREAT
%44 = or i32 %43, %42
%45 = load i32, i32* @O_TRUNC
%46 = or i32 %44, %45
%47 = tail call i32 @open(i8* %38, i32 %46, i32 384)
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %35
%50 = load i32, i32* @errno
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = tail call i32 @exit(i32 1)
unreachable
53: ; preds = %35
%54 = tail call i32 @truncate(i8* %38, i64 %12)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %53
%57 = load i32, i32* @errno
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %57)
%59 = tail call i32 @exit(i32 1)
unreachable
60: ; preds = %53
%61 = tail call i32 @read(i32 %47, i8* %29, i64 %12)
%62 = sext i32 %61 to i64
%63 = icmp eq i64 %12, %62
br i1 %63, label %68, label %64
64: ; preds = %60
%65 = load i32, i32* @errno
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %65)
%67 = tail call i32 @exit(i32 1)
unreachable
68: ; preds = %60
%69 = tail call i32 @srandom(i64 %9)
%70 = icmp eq i64 %12, 0
br i1 %70, label %84, label %71
71: ; preds = %68, %80
%72 = phi i64 [ %82, %80 ], [ 0, %68 ]
%73 = getelementptr inbounds i8, i8* %29, i64 %72
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 0
br i1 %75, label %80, label %76
76: ; preds = %71
%77 = zext i8 %74 to i32
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i32 %77)
%79 = tail call i32 @exit(i32 1)
unreachable
80: ; preds = %71
%81 = tail call zeroext i8 (...) @random()
store i8 %81, i8* %73
%82 = add nuw i64 %72, 1
%83 = icmp eq i64 %82, %12
br i1 %83, label %84, label %71
84: ; preds = %80, %68
%85 = load i32, i32* @SEEK_SET
%86 = tail call i32 @lseek(i32 %47, i32 0, i32 %85)
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %92
88: ; preds = %84
%89 = load i32, i32* @errno
%90 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %89)
%91 = tail call i32 @exit(i32 1)
unreachable
92: ; preds = %84
%93 = tail call i32 @write(i32 %47, i8* %29, i64 %12)
%94 = sext i32 %93 to i64
%95 = icmp eq i64 %12, %94
br i1 %95, label %100, label %96
96: ; preds = %92
%97 = load i32, i32* @errno
%98 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %97)
%99 = tail call i32 @exit(i32 1)
unreachable
100: ; preds = %92
%101 = tail call i32 @close(i32 %47)
%102 = load i32, i32* @O_RDWR
%103 = tail call i32 @open(i8* %38, i32 %102, i32 384)
%104 = mul i64 %12, 3
%105 = lshr i64 %104, 2
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i64 %105)
%107 = tail call i32 @truncate(i8* %38, i64 %105)
%108 = icmp slt i32 %107, 0
br i1 %108, label %109, label %113
109: ; preds = %100
%110 = load i32, i32* @errno
%111 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %110)
%112 = tail call i32 @exit(i32 1)
unreachable
113: ; preds = %100
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i64 %12)
%115 = tail call i32 @truncate(i8* %38, i64 %12)
%116 = icmp slt i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %113
%118 = load i32, i32* @errno
%119 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %118)
%120 = tail call i32 @exit(i32 1)
unreachable
121: ; preds = %113
%122 = tail call i32 @srandom(i64 %9)
%123 = tail call i32 @read(i32 %103, i8* %29, i64 %12)
%124 = sext i32 %123 to i64
%125 = icmp eq i64 %12, %124
br i1 %125, label %126, label %127
126: ; preds = %121
br i1 %70, label %153, label %131
127: ; preds = %121
%128 = load i32, i32* @errno
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %128)
%130 = tail call i32 @exit(i32 1)
unreachable
131: ; preds = %126, %150
%132 = phi i64 [ %151, %150 ], [ 0, %126 ]
%133 = tail call zeroext i8 (...) @random()
%134 = icmp ugt i64 %105, %132
%135 = getelementptr inbounds i8, i8* %29, i64 %132
%136 = load i8, i8* %135
br i1 %134, label %137, label %144
137: ; preds = %131
%138 = icmp eq i8 %136, %133
br i1 %138, label %150, label %139
139: ; preds = %137
%140 = zext i8 %133 to i32
%141 = zext i8 %136 to i32
%142 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %141, i32 %140)
%143 = tail call i32 @exit(i32 1)
unreachable
144: ; preds = %131
%145 = icmp eq i8 %136, 0
br i1 %145, label %150, label %146
146: ; preds = %144
%147 = zext i8 %136 to i32
%148 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.11, i64 0, i64 0), i32 %147, i32 0)
%149 = tail call i32 @exit(i32 1)
unreachable
150: ; preds = %137, %144
%151 = add nuw i64 %132, 1
%152 = icmp eq i64 %151, %12
br i1 %152, label %153, label %131
153: ; preds = %150, %126
%154 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%155 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%156 = load i64, i64* %155
%157 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%158 = load i64, i64* %157
%159 = icmp slt i64 %156, %158
br i1 %159, label %163, label %160
160: ; preds = %153
%161 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%162 = load i32, i32* %161
br label %168
163: ; preds = %153
%164 = add nsw i64 %156, 1000000
store i64 %164, i64* %155
%165 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%166 = load i32, i32* %165
%167 = add nsw i32 %166, -1
store i32 %167, i32* %165
br label %168
168: ; preds = %160, %163
%169 = phi i32 [ %162, %160 ], [ %167, %163 ]
%170 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%171 = load i32, i32* %170
%172 = sub nsw i32 %169, %171
%173 = sdiv i32 %172, 3600
%174 = srem i32 %172, 3600
%175 = trunc i32 %174 to i16
%176 = sdiv i16 %175, 60
%177 = sext i16 %176 to i32
%178 = srem i32 %172, 60
%179 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.12, i64 0, i64 0), i32 %173, i32 %177, i32 %178)
%180 = tail call i32 @exit(i32 0)
unreachable
}