#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 {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ _IONBF;
char *alloc_buf(int, int);
int atoi(char *);
int atol(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int get_alignment(char *);
int /*<<< orphan*/ get_timer(struct timeval *);
int open_file(char *, long, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ run_random_all(char *, int, int, long, char *, int, int, int,
                                  int, int);
int /*<<< orphan*/ run_random_one(char *, int, int, long, char *, int, int, int,
                                  int, int, int);
int /*<<< orphan*/ run_sequential_all(char *, int, int, long, char *, int, int,
                                      int, int, int);
int /*<<< orphan*/ run_sequential_one(char *, int, int, long, char *, int, int,
                                      int, int, int, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(char *);
int /*<<< orphan*/ timersub(struct timeval *, struct timeval *,
                            struct timeval *);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char *argv[]) {
  char *label, *fname;
  long max_filesize;
  int max_seconds;
  struct timeval tvstart, tvend, tvdiff;
  long i;
  int timeofday_latency;
  int fd;
  int alignment;
  int opt_quick = 0;
  char *buf = NULL;
  setvbuf(stdout, NULL, _IONBF, 0);
  setvbuf(stderr, NULL, _IONBF, 0);
  fprintf(stderr,
          "%s %s by arjen@openquery.com, modified by O. Doucet (github: "
          "odoucet)\n\n",
          argv[0], "2014-07-18");
  if (argc < 5 || argc > 6) {
    fprintf(
        stderr,
        "Usage: %s [--quick] <testlabel> <filename> <MBfilesize> <seconds>\n",
        argv[0]);
    fprintf(stderr,
            "  --quick only tests with 16K blocks (InnoDB page size)\n");
    fprintf(stderr,
            "  Sample command line using a 1GB file with 60 secs/test:\n");
    fprintf(stderr, "  %s MyTestHD /mntpoint/testfile 1024 60 >mytesthd.csv\n",
            argv[0]);
    exit(0);
  }
  i = 1;
  if (!strcmp(argv[i], "--quick")) {
    opt_quick = 1;
    i++;
  }
  label = strdup(argv[i++]);
  fname = strdup(argv[i++]);
  max_filesize = atol(argv[i++]) * (1024 * 1024);
  max_seconds = atoi(argv[i++]);
  if (max_filesize < (8 * 1024 * 1024) * 4) {
    fprintf(stderr,
            "Filesize should be at least %.0f MB (or patch hdlatency.c and "
            "decrease MAX_BUFSIZE)\n",
            (float)(8 * 1024 * 1024) * 4 / 1024.0 / 1024.0);
    exit(1);
  }
  printf("; %s %s by %s, operating on file '%s'\n", argv[0], "2014-07-18",
         "arjen@openquery.com and O. Doucet (github: odoucet)", fname);
  fprintf(stderr, "* Calculating timekeeping latency over %d seconds...", 5);
  i = 0;
  get_timer(&tvstart);
  do {
    get_timer(&tvend);
    timersub(&tvend, &tvstart, &tvdiff);
    i++;
  } while (tvdiff.tv_sec < 5);
  timeofday_latency =
      ((tvdiff.tv_sec * 1000000) + tvdiff.tv_usec) / (i / 100000);
  fprintf(stderr, " %d usecs per %d calls\n", timeofday_latency, 100000);
  printf("label,iotype,rw,fsize,msize,alignment,direct,max_seconds,iosize,num_"
         "iterations,usecs,iterations_per_second,avg_usecs_per_iteration\n");
  if ((fd = open_file(fname, max_filesize, 1)) < 0 ||
      (alignment = get_alignment(fname)) < 1 ||
      (opt_quick && alignment > 16384) ||
      (buf = alloc_buf((8 * 1024 * 1024), alignment)) == NULL)
    fprintf(stderr,
            "DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d "
            "alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\n",
            fd, alignment, opt_quick, (alignment > 16384), (buf == NULL));
  else if ((opt_quick &&
            (!run_sequential_one(label, 1, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 1, max_seconds,
                                 timeofday_latency, 16384) ||
             !run_sequential_one(label, 0, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 1, max_seconds,
                                 timeofday_latency, 16384) ||
             !run_random_one(label, 1, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency,
                             16384) ||
             !run_random_one(label, 0, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency,
                             16384) ||
             !run_random_one(label, 2, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency,
                             16384))) ||
           (!opt_quick &&
            (!run_sequential_all(label, 1, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 1, max_seconds,
                                 timeofday_latency) ||
             !run_sequential_all(label, 0, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 1, max_seconds,
                                 timeofday_latency) ||
             !run_random_all(label, 1, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency) ||
             !run_random_all(label, 0, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency) ||
             !run_random_all(label, 2, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 1, max_seconds, timeofday_latency))))
    fprintf(stderr, "run fail\n");
  if (fd >= 0)
    close(fd);
  unlink(fname);
  if (buf != NULL)
    free(buf);
  if ((fd = open_file(fname, max_filesize, 0)) < 0 ||
      (alignment = get_alignment(fname)) < 1 ||
      (opt_quick && alignment > 16384) ||
      (buf = alloc_buf((8 * 1024 * 1024), alignment)) == NULL)
    fprintf(stderr,
            "NON DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d "
            "alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\n",
            fd, alignment, opt_quick, (alignment > 16384), (buf == NULL));
  else if ((opt_quick &&
            (!run_sequential_one(label, 1, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 0, max_seconds,
                                 timeofday_latency, 16384) ||
             !run_random_one(label, 1, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 0, max_seconds, timeofday_latency,
                             16384))) ||
           (!opt_quick &&
            (!run_sequential_all(label, 1, fd, max_filesize, buf,
                                 (8 * 1024 * 1024), alignment, 0, max_seconds,
                                 timeofday_latency) ||
             !run_random_all(label, 1, fd, max_filesize, buf, (8 * 1024 * 1024),
                             alignment, 0, max_seconds, timeofday_latency))))
    fprintf(stderr, "run fail\n");
  close(fd);
  unlink(fname);
  if (buf != NULL)
    free(buf);
  fprintf(stderr, "Benchmark finished.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x98,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x68(%rbp)
movq   $0x0,-0x70(%rbp)
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
mov    0x2d6f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1110 <setvbuf@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
mov    0x2d52(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1110 <setvbuf@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xd4e(%rip),%rsi
lea    0xd8f(%rip),%rcx
mov    $0x0,%al
call   10d0 <fprintf@plt>
cmpl   $0x5,-0x10(%rbp)
jl     12dc <main+0x9c>
cmpl   $0x6,-0x10(%rbp)
jle    134d <main+0x10d>
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xd68(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2cd7(%rip),%rax
mov    (%rax),%edi
lea    0xd94(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%edi
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xdd3(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1140 <exit@plt>
movq   $0x1,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde2(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%eax
jne    1389 <main+0x149>
movl   $0x1,-0x68(%rbp)
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    (%rax,%rcx,8),%rdi
call   1150 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    (%rax,%rcx,8),%rdi
call   1150 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    (%rax,%rcx,8),%rdi
call   1120 <atol@plt>
shl    $0x14,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x58(%rbp)
mov    (%rax,%rcx,8),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x34(%rbp)
cmpq   $0x2000000,-0x30(%rbp)
02
jge    1444 <main+0x204>
mov    0x2bb6(%rip),%rax
mov    (%rax),%edi
lea    0xd27(%rip),%rsi
movsd  0xbcd(%rip),%xmm0
mov    $0x1,%al
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x28(%rbp),%r8
lea    0xd51(%rip),%rdi
lea    0xbf3(%rip),%rdx
lea    0xd6a(%rip),%rcx
mov    $0x0,%al
call   1090 <printf@plt>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
lea    0xd87(%rip),%rsi
mov    $0x5,%edx
mov    $0x0,%al
call   10d0 <fprintf@plt>
movq   $0x0,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1100 <get_timer@plt>
lea    -0x48(%rbp),%rdi
call   1100 <get_timer@plt>
lea    -0x48(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1160 <timersub@plt>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
cmpl   $0x5,-0x50(%rbp)
jl     1498 <main+0x258>
imul   $0xf4240,-0x50(%rbp),%eax
add    -0x4c(%rbp),%eax
cltq
mov    %rax,-0x78(%rbp)
mov    -0x58(%rbp),%rax
mov    $0x186a0,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
cqto
idiv   %rcx
mov    %eax,-0x5c(%rbp)
mov    0x2adc(%rip),%rax
mov    (%rax),%edi
mov    -0x5c(%rbp),%edx
lea    0xd2f(%rip),%rsi
mov    $0x186a0,%ecx
mov    $0x0,%al
call   10d0 <fprintf@plt>
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1080 <open_file@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
jl     1587 <main+0x347>
mov    -0x28(%rbp),%rdi
call   1060 <get_alignment@plt>
mov    %eax,-0x64(%rbp)
cmp    $0x1,%eax
jl     1587 <main+0x347>
cmpl   $0x0,-0x68(%rbp)
je     156c <main+0x32c>
cmpl   $0x4000,-0x64(%rbp)
jg     1587 <main+0x347>
mov    -0x64(%rbp),%esi
mov    $0x800000,%edi
call   1070 <alloc_buf@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
jne    15cd <main+0x38d>
mov    0x2a4a(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0x68(%rbp),%r8d
cmpl   $0x4000,-0x64(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%r9d
cmpq   $0x0,-0x70(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
lea    0xd23(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    18e9 <main+0x6a9>
cmpl   $0x0,-0x68(%rbp)
je     1761 <main+0x521>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10a0 <run_sequential_one@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
xor    %esi,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10a0 <run_sequential_one@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10e0 <run_random_one@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
xor    %esi,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10e0 <run_random_one@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x2,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10e0 <run_random_one@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
cmpl   $0x0,-0x68(%rbp)
jne    18e4 <main+0x6a4>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1050 <run_sequential_all@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
xor    %esi,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1050 <run_sequential_all@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10f0 <run_random_all@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
xor    %esi,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10f0 <run_random_all@plt>
cmp    $0x0,%eax
je     18cd <main+0x68d>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x2,%esi
mov    $0x800000,%r9d
mov    %r11d,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10f0 <run_random_all@plt>
cmp    $0x0,%eax
jne    18e4 <main+0x6a4>
mov    0x2704(%rip),%rax
mov    (%rax),%edi
lea    0x9f6(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    18e9 <main+0x6a9>
cmpl   $0x0,-0x60(%rbp)
jl     18fb <main+0x6bb>
mov    -0x60(%rbp),%edi
call   10b0 <close@plt>
mov    -0x28(%rbp),%rdi
call   1040 <unlink@plt>
cmpq   $0x0,-0x70(%rbp)
je     1918 <main+0x6d8>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1080 <open_file@plt>
mov    %eax,-0x60(%rbp)
cmp    $0x0,%eax
jl     197a <main+0x73a>
mov    -0x28(%rbp),%rdi
call   1060 <get_alignment@plt>
mov    %eax,-0x64(%rbp)
cmp    $0x1,%eax
jl     197a <main+0x73a>
cmpl   $0x0,-0x68(%rbp)
je     195f <main+0x71f>
cmpl   $0x4000,-0x64(%rbp)
jg     197a <main+0x73a>
mov    -0x64(%rbp),%esi
mov    $0x800000,%edi
call   1070 <alloc_buf@plt>
mov    %rax,-0x70(%rbp)
cmp    $0x0,%rax
jne    19c0 <main+0x780>
mov    0x2657(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0x68(%rbp),%r8d
cmpl   $0x4000,-0x64(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%r9d
cmpq   $0x0,-0x70(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
lea    0x92c(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1b28 <main+0x8e8>
cmpl   $0x0,-0x68(%rbp)
je     1a6e <main+0x82e>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
xor    %ebx,%ebx
mov    %r11d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10a0 <run_sequential_one@plt>
cmp    $0x0,%eax
je     1b0c <main+0x8cc>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
xor    %ebx,%ebx
mov    %r11d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
movl   $0x4000,0x20(%rsp)
call   10e0 <run_random_one@plt>
cmp    $0x0,%eax
je     1b0c <main+0x8cc>
cmpl   $0x0,-0x68(%rbp)
jne    1b23 <main+0x8e3>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
xor    %ebx,%ebx
mov    %r11d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1050 <run_sequential_all@plt>
cmp    $0x0,%eax
je     1b0c <main+0x8cc>
mov    -0x20(%rbp),%rdi
mov    -0x60(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8
mov    -0x64(%rbp),%r11d
mov    -0x34(%rbp),%r10d
mov    -0x5c(%rbp),%eax
mov    $0x1,%esi
mov    $0x800000,%r9d
xor    %ebx,%ebx
mov    %r11d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   10f0 <run_random_all@plt>
cmp    $0x0,%eax
jne    1b23 <main+0x8e3>
mov    0x24c5(%rip),%rax
mov    (%rax),%edi
lea    0x7b7(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
jmp    1b28 <main+0x8e8>
mov    -0x60(%rbp),%edi
call   10b0 <close@plt>
mov    -0x28(%rbp),%rdi
call   1040 <unlink@plt>
cmpq   $0x0,-0x70(%rbp)
je     1b4d <main+0x90d>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    0x2484(%rip),%rax
mov    (%rax),%edi
lea    0x7e9(%rip),%rsi
mov    $0x0,%al
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1140 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    0x2d75(%rip),%rbp
mov    0x0(%rbp),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1120 <setvbuf@plt>
mov    0x2d52(%rip),%r12
mov    (%r12),%edi
mov    0x0(%rbp),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1120 <setvbuf@plt>
mov    (%r12),%edi
mov    (%r15),%rdx
lea    0xd64(%rip),%rsi
lea    0xda5(%rip),%rcx
xor    %eax,%eax
call   10e0 <fprintf@plt>
add    $0xfffffff9,%ebx
cmp    $0xfffffffd,%ebx
ja     130f <main+0xbf>
mov    (%r12),%edi
mov    (%r15),%rdx
lea    0xd93(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    (%r12),%edi
lea    0xdc4(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    (%r12),%edi
lea    0xdeb(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    (%r12),%edi
mov    (%r15),%rdx
lea    0xe11(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   1150 <exit@plt>
mov    0x8(%r15),%rdi
lea    0xe30(%rip),%rsi
call   10d0 <strcmp@plt>
xor    %r14d,%r14d
mov    %eax,0x34(%rsp)
test   %eax,%eax
sete   %r14b
mov    0x8(%r15,%r14,8),%rdi
call   1160 <strdup@plt>
mov    %rax,0x20(%rsp)
mov    0x10(%r15,%r14,8),%rdi
call   1160 <strdup@plt>
mov    %rax,%r13
mov    0x18(%r15,%r14,8),%rdi
call   1130 <atol@plt>
mov    %eax,%ebx
mov    0x20(%r15,%r14,8),%rdi
call   1140 <atoi@plt>
cmp    $0x1f,%ebx
jg     1387 <main+0x137>
mov    (%r12),%edi
lea    0xde4(%rip),%rsi
movsd  0xc8a(%rip),%xmm0
mov    $0x1,%al
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    %rax,0x38(%rsp)
shl    $0x14,%ebx
movslq %ebx,%rax
mov    %rax,0x8(%rsp)
mov    (%r15),%rsi
lea    0xe06(%rip),%rdi
lea    0xca8(%rip),%rdx
lea    0xe1f(%rip),%rcx
xor    %ebp,%ebp
mov    %r13,0x10(%rsp)
mov    %r13,%r8
xor    %eax,%eax
call   10a0 <printf@plt>
mov    (%r12),%edi
lea    0xe37(%rip),%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   10e0 <fprintf@plt>
lea    0x50(%rsp),%r15
mov    %r15,%rdi
call   1110 <get_timer@plt>
lea    0x48(%rsp),%rbx
lea    0x40(%rsp),%r13
xchg   %ax,%ax
mov    %rbx,%rdi
call   1110 <get_timer@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   1170 <timersub@plt>
add    $0x1,%rbp
movslq 0x40(%rsp),%rax
cmp    $0x5,%rax
jl     13f0 <main+0x1a0>
imul   $0xf4240,%rax,%rsi
shr    $0x5,%rbp
movabs $0xa7c5ac471b47843,%rcx
5a 7c 0a
mov    %rbp,%rax
mul    %rcx
mov    %rdx,%rcx
movslq 0x44(%rsp),%rax
add    %rsi,%rax
shr    $0x7,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1454 <main+0x204>
xor    %edx,%edx
div    %ecx
mov    %eax,%r15d
jmp    145c <main+0x20c>
cqto
idiv   %rcx
mov    %rax,%r15
mov    0x10(%rsp),%rbx
mov    (%r12),%edi
lea    0xdcb(%rip),%rsi
mov    %r15d,%edx
mov    $0x186a0,%ecx
xor    %eax,%eax
call   10e0 <fprintf@plt>
lea    0xe55(%rip),%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
mov    0x8(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x1,%edx
call   1090 <open_file@plt>
mov    %eax,%r13d
test   %r13d,%r13d
mov    %r15,0x18(%rsp)
js     14e4 <main+0x294>
mov    0x10(%rsp),%rdi
call   1070 <get_alignment@plt>
test   %eax,%eax
jle    14e4 <main+0x294>
cmpl   $0x0,0x34(%rsp)
jne    14c5 <main+0x275>
cmp    $0x4000,%eax
ja     14e4 <main+0x294>
mov    $0x800000,%edi
mov    %rax,0x28(%rsp)
mov    %eax,%esi
call   1080 <alloc_buf@plt>
test   %rax,%rax
jne    1625 <main+0x3d5>
mov    0x28(%rsp),%rax
mov    (%r12),%edi
xor    %r9d,%r9d
cmp    $0x4001,%eax
setge  %r9b
sub    $0x8,%rsp
lea    0xd5e(%rip),%rsi
xor    %ebp,%ebp
mov    %r13d,%edx
mov    %rax,0x30(%rsp)
mov    %rax,%rcx
mov    %r14d,%r8d
xor    %eax,%eax
push   $0x1
call   10e0 <fprintf@plt>
add    $0x10,%rsp
test   %r13d,%r13d
js     1540 <main+0x2f0>
mov    %r13d,%edi
call   10c0 <close@plt>
mov    0x10(%rsp),%r13
mov    %r13,%rdi
call   1040 <unlink@plt>
test   %rbp,%rbp
jne    1552 <main+0x302>
xor    %r15d,%r15d
jmp    155d <main+0x30d>
mov    0x10(%rsp),%r13
mov    %r13,%rdi
call   1040 <unlink@plt>
xor    %r15d,%r15d
jmp    155d <main+0x30d>
mov    %rbp,%r15
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1090 <open_file@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1577 <main+0x327>
mov    0x28(%rsp),%rcx
jmp    1594 <main+0x344>
mov    %r13,%rdi
call   1070 <get_alignment@plt>
mov    %eax,%ecx
test   %eax,%eax
jle    1594 <main+0x344>
cmpl   $0x0,0x34(%rsp)
jne    15fe <main+0x3ae>
cmp    $0x4000,%ecx
jbe    15fe <main+0x3ae>
mov    (%r12),%edi
xor    %r9d,%r9d
cmp    $0x4001,%ecx
setge  %r9b
xor    %ebx,%ebx
test   %r15,%r15
sete   %bl
sub    $0x8,%rsp
lea    0xca1(%rip),%rsi
mov    %ebp,%edx
mov    %r14d,%r8d
xor    %eax,%eax
push   %rbx
call   10e0 <fprintf@plt>
add    $0x10,%rsp
mov    %ebp,%edi
call   10c0 <close@plt>
mov    %r13,%rdi
call   1040 <unlink@plt>
test   %r15,%r15
je     15e5 <main+0x395>
mov    %r15,%rdi
call   1030 <free@plt>
mov    (%r12),%edi
lea    0xcd2(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   1150 <exit@plt>
mov    $0x800000,%edi
mov    %rcx,0x28(%rsp)
mov    %ecx,%esi
call   1080 <alloc_buf@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
jne    1768 <main+0x518>
xor    %r15d,%r15d
jmp    1570 <main+0x320>
mov    %rax,%rbp
cmpl   $0x0,0x34(%rsp)
mov    0x38(%rsp),%rbx
jne    17f7 <main+0x5a7>
sub    $0x8,%rsp
mov    0x28(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   $0x4000
push   %r15
push   %rbx
push   $0x1
mov    0x50(%rsp),%r15
push   %r15
call   10b0 <run_sequential_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
sub    $0x8,%rsp
mov    0x28(%rsp),%rdi
xor    %esi,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
push   %rbx
push   $0x1
push   %r15
call   10b0 <run_sequential_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
sub    $0x8,%rsp
mov    0x28(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
push   %rbx
push   $0x1
push   %r15
call   10f0 <run_random_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
sub    $0x8,%rsp
mov    0x28(%rsp),%rdi
xor    %esi,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
push   %rbx
push   $0x1
push   %r15
call   10f0 <run_random_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
sub    $0x8,%rsp
mov    0x28(%rsp),%rdi
mov    $0x2,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
push   %rbx
push   $0x1
push   %r15
call   10f0 <run_random_one@plt>
add    $0x30,%rsp
jmp    18ed <main+0x69d>
cmpl   $0x0,0x34(%rsp)
jne    190d <main+0x6bd>
sub    $0x8,%rsp
mov    0x28(%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    0x18(%rsp),%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
mov    0x50(%rsp),%rbx
push   %rbx
push   $0x0
mov    0x50(%rsp),%r15
push   %r15
call   10b0 <run_sequential_one@plt>
add    $0x30,%rsp
test   %eax,%eax
je     197a <main+0x72a>
sub    $0x8,%rsp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    $0x800000,%r9d
push   $0x4000
push   0x28(%rsp)
push   %rbx
push   $0x0
push   %r15
call   10f0 <run_random_one@plt>
add    $0x30,%rsp
jmp    1976 <main+0x726>
mov    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   %r15
push   %rbx
push   $0x1
mov    0x40(%rsp),%r15
push   %r15
call   1050 <run_sequential_all@plt>
add    $0x20,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
mov    0x20(%rsp),%rdi
xor    %esi,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
push   %rbx
push   $0x1
push   %r15
call   1050 <run_sequential_all@plt>
add    $0x20,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
mov    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
push   %rbx
push   $0x1
push   %r15
call   1100 <run_random_all@plt>
add    $0x20,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
mov    0x20(%rsp),%rdi
xor    %esi,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
push   %rbx
push   $0x1
push   %r15
call   1100 <run_random_all@plt>
add    $0x20,%rsp
test   %eax,%eax
je     18f1 <main+0x6a1>
mov    0x20(%rsp),%rdi
mov    $0x2,%esi
mov    %r13d,%edx
mov    0x8(%rsp),%rcx
mov    %rbp,%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
push   %rbx
push   $0x1
push   %r15
call   1100 <run_random_all@plt>
add    $0x20,%rsp
test   %eax,%eax
jne    1903 <main+0x6b3>
mov    (%r12),%edi
lea    0x953(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    0x8(%rsp),%rbx
jmp    1521 <main+0x2d1>
mov    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    0x10(%rsp),%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
mov    0x40(%rsp),%rbx
push   %rbx
push   $0x0
mov    0x40(%rsp),%r15
push   %r15
call   1050 <run_sequential_all@plt>
add    $0x20,%rsp
test   %eax,%eax
je     197a <main+0x72a>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    0x8(%rsp),%rcx
mov    0x10(%rsp),%r8
mov    $0x800000,%r9d
push   0x18(%rsp)
push   %rbx
push   $0x0
push   %r15
call   1100 <run_random_all@plt>
add    $0x20,%rsp
test   %eax,%eax
jne    198c <main+0x73c>
mov    (%r12),%edi
lea    0x8ca(%rip),%rsi
xor    %eax,%eax
call   10e0 <fprintf@plt>
mov    0x10(%rsp),%r15
jmp    15c9 <main+0x379>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@stdout = global i32 0
@_IONBF = global i32 0
@stderr = global i32 0
@.str = [72 x i8] c"%s %s by arjen@openquery.com, modified by O. Doucet (github: odoucet)\0A\0A\00"
@.str.1 = [11 x i8] c"2014-07-18\00"
@.str.2 = [67 x i8] c"Usage: %s [--quick] <testlabel> <filename> <MBfilesize> <seconds>\0A\00"
@.str.3 = [57 x i8] c" --quick only tests with 16K blocks (InnoDB page size)\0A\00"
@.str.4 = [59 x i8] c" Sample command line using a 1GB file with 60 secs/test:\0A\00"
@.str.5 = [56 x i8] c" %s MyTestHD /mntpoint/testfile 1024 60 >mytesthd.csv\0A\00"
@.str.6 = [8 x i8] c"--quick\00"
@.str.7 = [85 x i8] c"Filesize should be at least %.0f MB (or patch hdlatency.c and decrease MAX_BUFSIZE)\0A\00"
@.str.8 = [39 x i8] c"; %s %s by %s, operating on file '%s'\0A\00"
@.str.9 = [52 x i8] c"arjen@openquery.com and O. Doucet (github: odoucet)\00"
@.str.10 = [53 x i8] c"* Calculating timekeeping latency over %d seconds...\00"
@.str.11 = [24 x i8] c" %d usecs per %d calls\0A\00"
@.str.12 = [132 x i8] c"label,iotype,rw,fsize,msize,alignment,direct,max_seconds,iosize,num_iterations,usecs,iterations_per_second,avg_usecs_per_iteration\0A\00"
@.str.13 = [101 x i8] c"DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\0A\00"
@.str.14 = [10 x i8] c"run fail\0A\00"
@.str.15 = [105 x i8] c"NON DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\0A\00"
@.str.16 = [21 x i8] c"Benchmark finished.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca %struct.timeval
%11 = alloca %struct.timeval
%12 = alloca %struct.timeval
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %17
store i8* null, i8** %18
%19 = load i32, i32* @stdout
%20 = load i32, i32* @_IONBF
%21 = call i32 @setvbuf(i32 %19, i32* null, i32 %20, i32 0)
%22 = load i32, i32* @stderr
%23 = load i32, i32* @_IONBF
%24 = call i32 @setvbuf(i32 %22, i32* null, i32 %23, i32 0)
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 5
br i1 %31, label %35, label %32
32: ; preds = %2
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 6
br i1 %34, label %35, label %51
35: ; preds = %32, %2
%36 = load i32, i32* @stderr
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 0
%39 = load i8*, i8** %38
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i8* %39)
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
%45 = load i32, i32* @stderr
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0), i8* %48)
%50 = call i32 @exit(i32 0)
unreachable
51: ; preds = %32
store i64 1, i64* %13
%52 = load i8**, i8*** %5
%53 = load i64, i64* %13
%54 = getelementptr inbounds i8*, i8** %52, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %51
store i32 1, i32* %17
%59 = load i64, i64* %13
%60 = add nsw i64 %59, 1
store i64 %60, i64* %13
br label %61
61: ; preds = %58, %51
%62 = load i8**, i8*** %5
%63 = load i64, i64* %13
%64 = add nsw i64 %63, 1
store i64 %64, i64* %13
%65 = getelementptr inbounds i8*, i8** %62, i64 %63
%66 = load i8*, i8** %65
%67 = call i8* @strdup(i8* %66)
store i8* %67, i8** %6
%68 = load i8**, i8*** %5
%69 = load i64, i64* %13
%70 = add nsw i64 %69, 1
store i64 %70, i64* %13
%71 = getelementptr inbounds i8*, i8** %68, i64 %69
%72 = load i8*, i8** %71
%73 = call i8* @strdup(i8* %72)
store i8* %73, i8** %7
%74 = load i8**, i8*** %5
%75 = load i64, i64* %13
%76 = add nsw i64 %75, 1
store i64 %76, i64* %13
%77 = getelementptr inbounds i8*, i8** %74, i64 %75
%78 = load i8*, i8** %77
%79 = call i32 @atol(i8* %78)
%80 = mul nsw i32 %79, 1048576
%81 = sext i32 %80 to i64
store i64 %81, i64* %8
%82 = load i8**, i8*** %5
%83 = load i64, i64* %13
%84 = add nsw i64 %83, 1
store i64 %84, i64* %13
%85 = getelementptr inbounds i8*, i8** %82, i64 %83
%86 = load i8*, i8** %85
%87 = call i32 @atoi(i8* %86)
store i32 %87, i32* %9
%88 = load i64, i64* %8
%89 = icmp slt i64 %88, 33554432
br i1 %89, label %90, label %94
90: ; preds = %61
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.7, i64 0, i64 0), double 3.200000e+01)
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %61
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 0
%97 = load i8*, i8** %96
%98 = load i8*, i8** %7
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %97, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i8* %98)
%100 = load i32, i32* @stderr
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0), i32 5)
store i64 0, i64* %13
%102 = call i32 @get_timer(%struct.timeval* %10)
br label %103
103: ; preds = %108, %94
%104 = call i32 @get_timer(%struct.timeval* %11)
%105 = call i32 @timersub(%struct.timeval* %11, %struct.timeval* %10, %struct.timeval* %12)
%106 = load i64, i64* %13
%107 = add nsw i64 %106, 1
store i64 %107, i64* %13
br label %108
108: ; preds = %103
%109 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%110 = load i32, i32* %109
%111 = icmp slt i32 %110, 5
br i1 %111, label %103, label %112
112: ; preds = %108
%113 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%114 = load i32, i32* %113
%115 = mul nsw i32 %114, 1000000
%116 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%117 = load i32, i32* %116
%118 = add nsw i32 %115, %117
%119 = sext i32 %118 to i64
%120 = load i64, i64* %13
%121 = sdiv i64 %120, 100000
%122 = sdiv i64 %119, %121
%123 = trunc i64 %122 to i32
store i32 %123, i32* %14
%124 = load i32, i32* @stderr
%125 = load i32, i32* %14
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %125, i32 100000)
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str.12, i64 0, i64 0))
%128 = load i8*, i8** %7
%129 = load i64, i64* %8
%130 = call i32 @open_file(i8* %128, i64 %129, i32 1)
store i32 %130, i32* %15
%131 = icmp slt i32 %130, 0
br i1 %131, label %146, label %132
132: ; preds = %112
%133 = load i8*, i8** %7
%134 = call i32 @get_alignment(i8* %133)
store i32 %134, i32* %16
%135 = icmp slt i32 %134, 1
br i1 %135, label %146, label %136
136: ; preds = %132
%137 = load i32, i32* %17
%138 = icmp ne i32 %137, 0
br i1 %138, label %139, label %142
139: ; preds = %136
%140 = load i32, i32* %16
%141 = icmp sgt i32 %140, 16384
br i1 %141, label %146, label %142
142: ; preds = %139, %136
%143 = load i32, i32* %16
%144 = call i8* @alloc_buf(i32 8388608, i32 %143)
store i8* %144, i8** %18
%145 = icmp eq i8* %144, null
br i1 %145, label %146, label %158
146: ; preds = %142, %139, %132, %112
%147 = load i32, i32* @stderr
%148 = load i32, i32* %15
%149 = load i32, i32* %16
%150 = load i32, i32* %17
%151 = load i32, i32* %16
%152 = icmp sgt i32 %151, 16384
%153 = zext i1 %152 to i32
%154 = load i8*, i8** %18
%155 = icmp eq i8* %154, null
%156 = zext i1 %155 to i32
%157 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.13, i64 0, i64 0), i32 %148, i32 %149, i32 %150, i32 %153, i32 %156)
br label %268
158: ; preds = %142
%159 = load i32, i32* %17
%160 = icmp ne i32 %159, 0
br i1 %160, label %161, label %211
161: ; preds = %158
%162 = load i8*, i8** %6
%163 = load i32, i32* %15
%164 = load i64, i64* %8
%165 = load i8*, i8** %18
%166 = load i32, i32* %16
%167 = load i32, i32* %9
%168 = load i32, i32* %14
%169 = call i32 @run_sequential_one(i8* %162, i32 1, i32 %163, i64 %164, i8* %165, i32 8388608, i32 %166, i32 1, i32 %167, i32 %168, i32 16384)
%170 = icmp ne i32 %169, 0
br i1 %170, label %171, label %264
171: ; preds = %161
%172 = load i8*, i8** %6
%173 = load i32, i32* %15
%174 = load i64, i64* %8
%175 = load i8*, i8** %18
%176 = load i32, i32* %16
%177 = load i32, i32* %9
%178 = load i32, i32* %14
%179 = call i32 @run_sequential_one(i8* %172, i32 0, i32 %173, i64 %174, i8* %175, i32 8388608, i32 %176, i32 1, i32 %177, i32 %178, i32 16384)
%180 = icmp ne i32 %179, 0
br i1 %180, label %181, label %264
181: ; preds = %171
%182 = load i8*, i8** %6
%183 = load i32, i32* %15
%184 = load i64, i64* %8
%185 = load i8*, i8** %18
%186 = load i32, i32* %16
%187 = load i32, i32* %9
%188 = load i32, i32* %14
%189 = call i32 @run_random_one(i8* %182, i32 1, i32 %183, i64 %184, i8* %185, i32 8388608, i32 %186, i32 1, i32 %187, i32 %188, i32 16384)
%190 = icmp ne i32 %189, 0
br i1 %190, label %191, label %264
191: ; preds = %181
%192 = load i8*, i8** %6
%193 = load i32, i32* %15
%194 = load i64, i64* %8
%195 = load i8*, i8** %18
%196 = load i32, i32* %16
%197 = load i32, i32* %9
%198 = load i32, i32* %14
%199 = call i32 @run_random_one(i8* %192, i32 0, i32 %193, i64 %194, i8* %195, i32 8388608, i32 %196, i32 1, i32 %197, i32 %198, i32 16384)
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %264
201: ; preds = %191
%202 = load i8*, i8** %6
%203 = load i32, i32* %15
%204 = load i64, i64* %8
%205 = load i8*, i8** %18
%206 = load i32, i32* %16
%207 = load i32, i32* %9
%208 = load i32, i32* %14
%209 = call i32 @run_random_one(i8* %202, i32 2, i32 %203, i64 %204, i8* %205, i32 8388608, i32 %206, i32 1, i32 %207, i32 %208, i32 16384)
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %264
211: ; preds = %201, %158
%212 = load i32, i32* %17
%213 = icmp ne i32 %212, 0
br i1 %213, label %267, label %214
214: ; preds = %211
%215 = load i8*, i8** %6
%216 = load i32, i32* %15
%217 = load i64, i64* %8
%218 = load i8*, i8** %18
%219 = load i32, i32* %16
%220 = load i32, i32* %9
%221 = load i32, i32* %14
%222 = call i32 @run_sequential_all(i8* %215, i32 1, i32 %216, i64 %217, i8* %218, i32 8388608, i32 %219, i32 1, i32 %220, i32 %221)
%223 = icmp ne i32 %222, 0
br i1 %223, label %224, label %264
224: ; preds = %214
%225 = load i8*, i8** %6
%226 = load i32, i32* %15
%227 = load i64, i64* %8
%228 = load i8*, i8** %18
%229 = load i32, i32* %16
%230 = load i32, i32* %9
%231 = load i32, i32* %14
%232 = call i32 @run_sequential_all(i8* %225, i32 0, i32 %226, i64 %227, i8* %228, i32 8388608, i32 %229, i32 1, i32 %230, i32 %231)
%233 = icmp ne i32 %232, 0
br i1 %233, label %234, label %264
234: ; preds = %224
%235 = load i8*, i8** %6
%236 = load i32, i32* %15
%237 = load i64, i64* %8
%238 = load i8*, i8** %18
%239 = load i32, i32* %16
%240 = load i32, i32* %9
%241 = load i32, i32* %14
%242 = call i32 @run_random_all(i8* %235, i32 1, i32 %236, i64 %237, i8* %238, i32 8388608, i32 %239, i32 1, i32 %240, i32 %241)
%243 = icmp ne i32 %242, 0
br i1 %243, label %244, label %264
244: ; preds = %234
%245 = load i8*, i8** %6
%246 = load i32, i32* %15
%247 = load i64, i64* %8
%248 = load i8*, i8** %18
%249 = load i32, i32* %16
%250 = load i32, i32* %9
%251 = load i32, i32* %14
%252 = call i32 @run_random_all(i8* %245, i32 0, i32 %246, i64 %247, i8* %248, i32 8388608, i32 %249, i32 1, i32 %250, i32 %251)
%253 = icmp ne i32 %252, 0
br i1 %253, label %254, label %264
254: ; preds = %244
%255 = load i8*, i8** %6
%256 = load i32, i32* %15
%257 = load i64, i64* %8
%258 = load i8*, i8** %18
%259 = load i32, i32* %16
%260 = load i32, i32* %9
%261 = load i32, i32* %14
%262 = call i32 @run_random_all(i8* %255, i32 2, i32 %256, i64 %257, i8* %258, i32 8388608, i32 %259, i32 1, i32 %260, i32 %261)
%263 = icmp ne i32 %262, 0
br i1 %263, label %267, label %264
264: ; preds = %254, %244, %234, %224, %214, %201, %191, %181, %171, %161
%265 = load i32, i32* @stderr
%266 = call i32 (i32, i8*, ...) @fprintf(i32 %265, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %267
267: ; preds = %264, %254, %211
br label %268
268: ; preds = %267, %146
%269 = load i32, i32* %15
%270 = icmp sge i32 %269, 0
br i1 %270, label %271, label %274
271: ; preds = %268
%272 = load i32, i32* %15
%273 = call i32 @close(i32 %272)
br label %274
274: ; preds = %271, %268
%275 = load i8*, i8** %7
%276 = call i32 @unlink(i8* %275)
%277 = load i8*, i8** %18
%278 = icmp ne i8* %277, null
br i1 %278, label %279, label %282
279: ; preds = %274
%280 = load i8*, i8** %18
%281 = call i32 @free(i8* %280)
br label %282
282: ; preds = %279, %274
%283 = load i8*, i8** %7
%284 = load i64, i64* %8
%285 = call i32 @open_file(i8* %283, i64 %284, i32 0)
store i32 %285, i32* %15
%286 = icmp slt i32 %285, 0
br i1 %286, label %301, label %287
287: ; preds = %282
%288 = load i8*, i8** %7
%289 = call i32 @get_alignment(i8* %288)
store i32 %289, i32* %16
%290 = icmp slt i32 %289, 1
br i1 %290, label %301, label %291
291: ; preds = %287
%292 = load i32, i32* %17
%293 = icmp ne i32 %292, 0
br i1 %293, label %294, label %297
294: ; preds = %291
%295 = load i32, i32* %16
%296 = icmp sgt i32 %295, 16384
br i1 %296, label %301, label %297
297: ; preds = %294, %291
%298 = load i32, i32* %16
%299 = call i8* @alloc_buf(i32 8388608, i32 %298)
store i8* %299, i8** %18
%300 = icmp eq i8* %299, null
br i1 %300, label %301, label %313
301: ; preds = %297, %294, %287, %282
%302 = load i32, i32* @stderr
%303 = load i32, i32* %15
%304 = load i32, i32* %16
%305 = load i32, i32* %17
%306 = load i32, i32* %16
%307 = icmp sgt i32 %306, 16384
%308 = zext i1 %307 to i32
%309 = load i8*, i8** %18
%310 = icmp eq i8* %309, null
%311 = zext i1 %310 to i32
%312 = call i32 (i32, i8*, ...) @fprintf(i32 %302, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.15, i64 0, i64 0), i32 %303, i32 %304, i32 %305, i32 %308, i32 %311)
br label %363
313: ; preds = %297
%314 = load i32, i32* %17
%315 = icmp ne i32 %314, 0
br i1 %315, label %316, label %336
316: ; preds = %313
%317 = load i8*, i8** %6
%318 = load i32, i32* %15
%319 = load i64, i64* %8
%320 = load i8*, i8** %18
%321 = load i32, i32* %16
%322 = load i32, i32* %9
%323 = load i32, i32* %14
%324 = call i32 @run_sequential_one(i8* %317, i32 1, i32 %318, i64 %319, i8* %320, i32 8388608, i32 %321, i32 0, i32 %322, i32 %323, i32 16384)
%325 = icmp ne i32 %324, 0
br i1 %325, label %326, label %359
326: ; preds = %316
%327 = load i8*, i8** %6
%328 = load i32, i32* %15
%329 = load i64, i64* %8
%330 = load i8*, i8** %18
%331 = load i32, i32* %16
%332 = load i32, i32* %9
%333 = load i32, i32* %14
%334 = call i32 @run_random_one(i8* %327, i32 1, i32 %328, i64 %329, i8* %330, i32 8388608, i32 %331, i32 0, i32 %332, i32 %333, i32 16384)
%335 = icmp ne i32 %334, 0
br i1 %335, label %336, label %359
336: ; preds = %326, %313
%337 = load i32, i32* %17
%338 = icmp ne i32 %337, 0
br i1 %338, label %362, label %339
339: ; preds = %336
%340 = load i8*, i8** %6
%341 = load i32, i32* %15
%342 = load i64, i64* %8
%343 = load i8*, i8** %18
%344 = load i32, i32* %16
%345 = load i32, i32* %9
%346 = load i32, i32* %14
%347 = call i32 @run_sequential_all(i8* %340, i32 1, i32 %341, i64 %342, i8* %343, i32 8388608, i32 %344, i32 0, i32 %345, i32 %346)
%348 = icmp ne i32 %347, 0
br i1 %348, label %349, label %359
349: ; preds = %339
%350 = load i8*, i8** %6
%351 = load i32, i32* %15
%352 = load i64, i64* %8
%353 = load i8*, i8** %18
%354 = load i32, i32* %16
%355 = load i32, i32* %9
%356 = load i32, i32* %14
%357 = call i32 @run_random_all(i8* %350, i32 1, i32 %351, i64 %352, i8* %353, i32 8388608, i32 %354, i32 0, i32 %355, i32 %356)
%358 = icmp ne i32 %357, 0
br i1 %358, label %362, label %359
359: ; preds = %349, %339, %326, %316
%360 = load i32, i32* @stderr
%361 = call i32 (i32, i8*, ...) @fprintf(i32 %360, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %362
362: ; preds = %359, %349, %336
br label %363
363: ; preds = %362, %301
%364 = load i32, i32* %15
%365 = call i32 @close(i32 %364)
%366 = load i8*, i8** %7
%367 = call i32 @unlink(i8* %366)
%368 = load i8*, i8** %18
%369 = icmp ne i8* %368, null
br i1 %369, label %370, label %373
370: ; preds = %363
%371 = load i8*, i8** %18
%372 = call i32 @free(i8* %371)
br label %373
373: ; preds = %370, %363
%374 = load i32, i32* @stderr
%375 = call i32 (i32, i8*, ...) @fprintf(i32 %374, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
%376 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@stdout = global i32 0
@_IONBF = global i32 0
@stderr = global i32 0
@.str = [72 x i8] c"%s %s by arjen@openquery.com, modified by O. Doucet (github: odoucet)\0A\0A\00"
@.str.1 = [11 x i8] c"2014-07-18\00"
@.str.2 = [67 x i8] c"Usage: %s [--quick] <testlabel> <filename> <MBfilesize> <seconds>\0A\00"
@.str.3 = [57 x i8] c" --quick only tests with 16K blocks (InnoDB page size)\0A\00"
@.str.4 = [59 x i8] c" Sample command line using a 1GB file with 60 secs/test:\0A\00"
@.str.5 = [56 x i8] c" %s MyTestHD /mntpoint/testfile 1024 60 >mytesthd.csv\0A\00"
@.str.6 = [8 x i8] c"--quick\00"
@.str.7 = [85 x i8] c"Filesize should be at least %.0f MB (or patch hdlatency.c and decrease MAX_BUFSIZE)\0A\00"
@.str.8 = [39 x i8] c"; %s %s by %s, operating on file '%s'\0A\00"
@.str.9 = [52 x i8] c"arjen@openquery.com and O. Doucet (github: odoucet)\00"
@.str.10 = [53 x i8] c"* Calculating timekeeping latency over %d seconds...\00"
@.str.11 = [24 x i8] c" %d usecs per %d calls\0A\00"
@.str.13 = [101 x i8] c"DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\0A\00"
@.str.14 = [10 x i8] c"run fail\0A\00"
@.str.15 = [105 x i8] c"NON DIRECT I/O init fail (fd=%d alignment=%d opt_quick=%d alignment>INNODB_PAGE_SIZE=%d buf_is_null=%d)\0A\00"
@.str.16 = [21 x i8] c"Benchmark finished.\0A\00"
@str = [131 x i8] c"label,iotype,rw,fsize,msize,alignment,direct,max_seconds,iosize,num_iterations,usecs,iterations_per_second,avg_usecs_per_iteration\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = bitcast %struct.timeval* %3 to i8*
%7 = bitcast %struct.timeval* %4 to i8*
%8 = bitcast %struct.timeval* %5 to i8*
%9 = load i32, i32* @stdout
%10 = load i32, i32* @_IONBF
%11 = tail call i32 @setvbuf(i32 %9, i32* null, i32 %10, i32 0)
%12 = load i32, i32* @stderr
%13 = load i32, i32* @_IONBF
%14 = tail call i32 @setvbuf(i32 %12, i32* null, i32 %13, i32 0)
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0), i8* %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%18 = add i32 %0, -7
%19 = icmp ult i32 %18, -2
br i1 %19, label %20, label %32
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %1
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%31 = tail call i32 @exit(i32 0)
unreachable
32: ; preds = %2
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = tail call i32 @strcmp(i8* dereferenceable(1) %34, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, i64 2, i64 1
%38 = zext i1 %36 to i32
%39 = add nuw nsw i64 %37, 1
%40 = getelementptr inbounds i8*, i8** %1, i64 %37
%41 = load i8*, i8** %40
%42 = tail call i8* @strdup(i8* %41)
%43 = add nuw nsw i64 %37, 2
%44 = getelementptr inbounds i8*, i8** %1, i64 %39
%45 = load i8*, i8** %44
%46 = tail call i8* @strdup(i8* %45)
%47 = add nuw nsw i64 %37, 3
%48 = getelementptr inbounds i8*, i8** %1, i64 %43
%49 = load i8*, i8** %48
%50 = tail call i32 @atol(i8* %49)
%51 = shl nsw i32 %50, 20
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8*, i8** %1, i64 %47
%54 = load i8*, i8** %53
%55 = tail call i32 @atoi(i8* %54)
%56 = icmp slt i32 %50, 32
br i1 %56, label %57, label %61
57: ; preds = %32
%58 = load i32, i32* @stderr
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.7, i64 0, i64 0), double 3.200000e+01)
%60 = tail call i32 @exit(i32 1)
unreachable
61: ; preds = %32
%62 = load i8*, i8** %1
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i8* %46)
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0), i32 5)
%66 = call i32 @get_timer(%struct.timeval* %3)
%67 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
br label %68
68: ; preds = %68, %61
%69 = phi i64 [ 0, %61 ], [ %72, %68 ]
%70 = call i32 @get_timer(%struct.timeval* %4)
%71 = call i32 @timersub(%struct.timeval* %4, %struct.timeval* %3, %struct.timeval* %5)
%72 = add nuw nsw i64 %69, 1
%73 = load i32, i32* %67
%74 = icmp slt i32 %73, 5
br i1 %74, label %68, label %75
75: ; preds = %68
%76 = mul nsw i32 %73, 1000000
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%78 = load i32, i32* %77
%79 = add nsw i32 %78, %76
%80 = sext i32 %79 to i64
%81 = udiv i64 %72, 100000
%82 = sdiv i64 %80, %81
%83 = trunc i64 %82 to i32
%84 = load i32, i32* @stderr
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), i32 %83, i32 100000)
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([131 x i8], [131 x i8]* @str, i64 0, i64 0))
%87 = call i32 @open_file(i8* %46, i64 %52, i32 1)
%88 = icmp slt i32 %87, 0
br i1 %88, label %132, label %89
89: ; preds = %75
%90 = call i32 @get_alignment(i8* %46)
%91 = icmp slt i32 %90, 1
br i1 %91, label %132, label %92
92: ; preds = %89
%93 = icmp ugt i32 %90, 16384
%94 = select i1 %36, i1 %93, i1 false
br i1 %94, label %132, label %95
95: ; preds = %92
%96 = call i8* @alloc_buf(i32 8388608, i32 %90)
%97 = icmp eq i8* %96, null
br i1 %97, label %132, label %98
98: ; preds = %95
br i1 %36, label %99, label %114
99: ; preds = %98
%100 = call i32 @run_sequential_one(i8* %42, i32 1, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83, i32 16384)
%101 = icmp eq i32 %100, 0
br i1 %101, label %129, label %102
102: ; preds = %99
%103 = call i32 @run_sequential_one(i8* %42, i32 0, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83, i32 16384)
%104 = icmp eq i32 %103, 0
br i1 %104, label %129, label %105
105: ; preds = %102
%106 = call i32 @run_random_one(i8* %42, i32 1, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83, i32 16384)
%107 = icmp eq i32 %106, 0
br i1 %107, label %129, label %108
108: ; preds = %105
%109 = call i32 @run_random_one(i8* %42, i32 0, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83, i32 16384)
%110 = icmp eq i32 %109, 0
br i1 %110, label %129, label %111
111: ; preds = %108
%112 = call i32 @run_random_one(i8* %42, i32 2, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83, i32 16384)
%113 = icmp eq i32 %112, 0
br i1 %113, label %129, label %141
114: ; preds = %98
%115 = call i32 @run_sequential_all(i8* %42, i32 1, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83)
%116 = icmp eq i32 %115, 0
br i1 %116, label %129, label %117
117: ; preds = %114
%118 = call i32 @run_sequential_all(i8* %42, i32 0, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83)
%119 = icmp eq i32 %118, 0
br i1 %119, label %129, label %120
120: ; preds = %117
%121 = call i32 @run_random_all(i8* %42, i32 1, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83)
%122 = icmp eq i32 %121, 0
br i1 %122, label %129, label %123
123: ; preds = %120
%124 = call i32 @run_random_all(i8* %42, i32 0, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83)
%125 = icmp eq i32 %124, 0
br i1 %125, label %129, label %126
126: ; preds = %123
%127 = call i32 @run_random_all(i8* %42, i32 2, i32 %87, i64 %52, i8* %96, i32 8388608, i32 %90, i32 1, i32 %55, i32 %83)
%128 = icmp eq i32 %127, 0
br i1 %128, label %129, label %141
129: ; preds = %126, %123, %120, %117, %114, %111, %108, %105, %102, %99
%130 = load i32, i32* @stderr
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %141
132: ; preds = %75, %89, %95, %92
%133 = phi i32 [ undef, %75 ], [ %90, %89 ], [ %90, %92 ], [ %90, %95 ]
%134 = load i32, i32* @stderr
%135 = icmp sgt i32 %133, 16384
%136 = zext i1 %135 to i32
%137 = call i32 (i32, i8*, ...) @fprintf(i32 %134, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.13, i64 0, i64 0), i32 %87, i32 %133, i32 %38, i32 %136, i32 1)
%138 = icmp sgt i32 %87, -1
br i1 %138, label %141, label %139
139: ; preds = %132
%140 = call i32 @unlink(i8* %46)
br label %149
141: ; preds = %129, %126, %111, %132
%142 = phi i8* [ null, %132 ], [ %96, %111 ], [ %96, %126 ], [ %96, %129 ]
%143 = phi i32 [ %133, %132 ], [ %90, %111 ], [ %90, %126 ], [ %90, %129 ]
%144 = call i32 @close(i32 %87)
%145 = call i32 @unlink(i8* %46)
%146 = icmp eq i8* %142, null
br i1 %146, label %149, label %147
147: ; preds = %141
%148 = call i32 @free(i8* %142)
br label %149
149: ; preds = %139, %147, %141
%150 = phi i32 [ %133, %139 ], [ %143, %147 ], [ %143, %141 ]
%151 = phi i8* [ null, %139 ], [ %142, %147 ], [ null, %141 ]
%152 = call i32 @open_file(i8* %46, i64 %52, i32 0)
%153 = icmp slt i32 %152, 0
br i1 %153, label %163, label %154
154: ; preds = %149
%155 = call i32 @get_alignment(i8* %46)
%156 = icmp slt i32 %155, 1
br i1 %156, label %163, label %157
157: ; preds = %154
%158 = icmp ugt i32 %155, 16384
%159 = select i1 %36, i1 %158, i1 false
br i1 %159, label %163, label %160
160: ; preds = %157
%161 = call i8* @alloc_buf(i32 8388608, i32 %155)
%162 = icmp eq i8* %161, null
br i1 %162, label %163, label %172
163: ; preds = %157, %160, %154, %149
%164 = phi i32 [ %150, %149 ], [ %155, %154 ], [ %155, %157 ], [ %155, %160 ]
%165 = phi i8* [ %151, %149 ], [ %151, %154 ], [ %151, %157 ], [ null, %160 ]
%166 = load i32, i32* @stderr
%167 = icmp sgt i32 %164, 16384
%168 = zext i1 %167 to i32
%169 = icmp eq i8* %165, null
%170 = zext i1 %169 to i32
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([105 x i8], [105 x i8]* @.str.15, i64 0, i64 0), i32 %152, i32 %164, i32 %38, i32 %168, i32 %170)
br label %188
172: ; preds = %160
br i1 %36, label %173, label %179
173: ; preds = %172
%174 = call i32 @run_sequential_one(i8* %42, i32 1, i32 %152, i64 %52, i8* %161, i32 8388608, i32 %155, i32 0, i32 %55, i32 %83, i32 16384)
%175 = icmp eq i32 %174, 0
br i1 %175, label %185, label %176
176: ; preds = %173
%177 = call i32 @run_random_one(i8* %42, i32 1, i32 %152, i64 %52, i8* %161, i32 8388608, i32 %155, i32 0, i32 %55, i32 %83, i32 16384)
%178 = icmp eq i32 %177, 0
br i1 %178, label %185, label %188
179: ; preds = %172
%180 = call i32 @run_sequential_all(i8* %42, i32 1, i32 %152, i64 %52, i8* %161, i32 8388608, i32 %155, i32 0, i32 %55, i32 %83)
%181 = icmp eq i32 %180, 0
br i1 %181, label %185, label %182
182: ; preds = %179
%183 = call i32 @run_random_all(i8* %42, i32 1, i32 %152, i64 %52, i8* %161, i32 8388608, i32 %155, i32 0, i32 %55, i32 %83)
%184 = icmp eq i32 %183, 0
br i1 %184, label %185, label %188
185: ; preds = %182, %179, %176, %173
%186 = load i32, i32* @stderr
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %188
188: ; preds = %176, %182, %185, %163
%189 = phi i8* [ %165, %163 ], [ %161, %182 ], [ %161, %185 ], [ %161, %176 ]
%190 = call i32 @close(i32 %152)
%191 = call i32 @unlink(i8* %46)
%192 = icmp eq i8* %189, null
br i1 %192, label %195, label %193
193: ; preds = %188
%194 = call i32 @free(i8* %189)
br label %195
195: ; preds = %193, %188
%196 = load i32, i32* @stderr
%197 = call i32 (i32, i8*, ...) @fprintf(i32 %196, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
%198 = call i32 @exit(i32 0)
unreachable
}