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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ fsync(int);
int /*<<< orphan*/ get_timer(struct timeval *);
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, long, long, int, int, int,
                          long, long long, long long, long, long);
int read(int, char *, long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ timersub(struct timeval *, struct timeval *,
                            struct timeval *);
int write(int, char *, long);
int run_sequential_one(char *label, int writeops, int fd, long fsize, char *buf,
                       long msize, int alignment, int direct, int max_seconds,
                       int timeofday_latency, long iosize) {
  long bytes_left;
  int bytes_io;
  struct timeval tvstart, tvend, tvdiff;
  long long num_iterations;
  long long usecs;
  lseek(fd, 0, SEEK_SET);
  fsync(fd);
  fprintf(stderr, "SEQ %s iosize=%ld\r", writeops ? "WRONLY" : "RDONLY",
          iosize);
  if (!get_timer(&tvstart))
    return (0);
  bytes_left = fsize;
  num_iterations = 0;
  do {
    if ((bytes_io =
             (writeops ? write(fd, buf, iosize) : read(fd, buf, iosize))) < 0) {
      fprintf(stderr, "cannot %s to file (errno %d)\n",
              writeops ? "write" : "read", errno);
      return (0);
    }
    if (writeops && !direct)
      fsync(fd);
    if (!get_timer(&tvend))
      return (0);
    bytes_left -= bytes_io;
    num_iterations++;
    timersub(&tvend, &tvstart, &tvdiff);
  } while (tvdiff.tv_sec < max_seconds && bytes_left >= iosize);
  usecs = ((tvdiff.tv_sec * 1000000LL) + tvdiff.tv_usec) -
          (((long long)num_iterations * timeofday_latency) / 100000);
  if (usecs < 1)
    usecs = 1;
  printf("%s,SEQ,%s,%ld,%ld,%d,%d,%d,%ld,%lld,%lld,%ld,%ld\n", label,
         writeops ? "WRONLY" : "RDONLY", fsize, msize, alignment, direct,
         max_seconds, iosize, num_iterations, usecs,
         (long)(1000000LL / (usecs / num_iterations)),
         (long)(usecs / num_iterations));
  return (1);
}


x86 assembly (clang, -O0):
<run_sequential_one>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd0,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    %edx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8,-0x48(%rbp)
mov    %r9,-0x50(%rbp)
mov    -0x38(%rbp),%edi
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <lseek@plt>
mov    -0x38(%rbp),%edi
call   1090 <fsync@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%ecx
lea    0xe34(%rip),%rdx
lea    0xe26(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    0x30(%rbp),%rax
mov    %eax,%ecx
lea    0xdff(%rip),%rsi
call   1070 <fprintf@plt>
lea    -0x70(%rbp),%rdi
call   1080 <get_timer@plt>
cmp    $0x0,%eax
jne    1224 <run_sequential_one+0xa4>
movl   $0x0,-0x24(%rbp)
jmp    1482 <run_sequential_one+0x302>
mov    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x98(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     125c <run_sequential_one+0xdc>
mov    -0x38(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   1030 <write@plt>
mov    %eax,-0xa4(%rbp)
jmp    1272 <run_sequential_one+0xf2>
mov    -0x38(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   1060 <read@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
mov    %eax,-0x5c(%rbp)
cmp    $0x0,%eax
jge    12c6 <run_sequential_one+0x146>
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
mov    -0x34(%rbp),%ecx
lea    0xdae(%rip),%rdx
lea    0xda1(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    0x2d2c(%rip),%rax
mov    (%rax),%ecx
lea    0xd6c(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
jmp    1482 <run_sequential_one+0x302>
cmpl   $0x0,-0x34(%rbp)
je     12e2 <run_sequential_one+0x162>
cmpl   $0x0,0x18(%rbp)
jne    12e2 <run_sequential_one+0x162>
mov    -0x38(%rbp),%edi
call   1090 <fsync@plt>
lea    -0x80(%rbp),%rdi
call   1080 <get_timer@plt>
cmp    $0x0,%eax
jne    1300 <run_sequential_one+0x180>
movl   $0x0,-0x24(%rbp)
jmp    1482 <run_sequential_one+0x302>
movslq -0x5c(%rbp),%rcx
mov    -0x58(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x98(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   10a0 <timersub@plt>
mov    -0x90(%rbp),%ecx
xor    %eax,%eax
cmp    0x20(%rbp),%ecx
mov    %al,-0xa5(%rbp)
jge    135d <run_sequential_one+0x1dd>
mov    -0x58(%rbp),%rax
cmp    0x30(%rbp),%rax
setge  %al
mov    %al,-0xa5(%rbp)
mov    -0xa5(%rbp),%al
test   $0x1,%al
jne    1237 <run_sequential_one+0xb7>
movslq -0x90(%rbp),%rax
imul   $0xf4240,%rax,%rax
add    -0x88(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x98(%rbp),%rax
movslq 0x28(%rbp),%rcx
imul   %rcx,%rax
mov    $0x186a0,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0xb0(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0xa0(%rbp)
cmpq   $0x1,-0xa0(%rbp)
01
jge    13cd <run_sequential_one+0x24d>
movq   $0x1,-0xa0(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
lea    0xc3f(%rip),%rax
lea    0xc31(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0xb8(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    0x10(%rbp),%r9d
mov    0x18(%rbp),%r12d
mov    0x20(%rbp),%r15d
mov    0x30(%rbp),%r14
mov    -0x98(%rbp),%rbx
mov    -0xa0(%rbp),%r11
mov    -0xa0(%rbp),%rax
cqto
idivq  -0x98(%rbp)
mov    %rax,%rdi
mov    $0xf4240,%eax
cqto
idiv   %rdi
mov    %rax,%r10
mov    -0xa0(%rbp),%rax
cqto
idivq  -0x98(%rbp)
mov    -0xb8(%rbp),%rdx
lea    0xbf6(%rip),%rdi
mov    %r12d,(%rsp)
mov    %r15d,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1040 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_sequential_one>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,0x28(%rsp)
mov    %rcx,%r12
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r13
mov    0xc0(%rsp),%rbp
mov    0x2e1e(%rip),%rax
mov    (%rax),%edx
xor    %r15d,%r15d
mov    %r14d,%edi
xor    %esi,%esi
call   1050 <lseek@plt>
mov    %r14d,%edi
call   1090 <fsync@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
test   %ebx,%ebx
lea    0xe3f(%rip),%rax
lea    0xe31(%rip),%rdx
cmove  %rax,%rdx
lea    0xe13(%rip),%rsi
mov    %rdx,0x18(%rsp)
mov    %ebp,%ecx
call   1070 <fprintf@plt>
lea    0x58(%rsp),%rdi
call   1080 <get_timer@plt>
test   %eax,%eax
je     1402 <run_sequential_one+0x282>
mov    %r13,0x8(%rsp)
mov    0xa8(%rsp),%ecx
test   %ebx,%ebx
sete   %al
test   %ecx,%ecx
setne  %cl
or     %al,%cl
mov    %cl,0x3(%rsp)
movslq 0xb8(%rsp),%rax
mov    %rax,0x30(%rsp)
xor    %r15d,%r15d
mov    %r12,0x10(%rsp)
xor    %ebp,%ebp
mov    %ebx,%edx
mov    %ebx,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
test   %edx,%edx
je     1290 <run_sequential_one+0x110>
mov    0x28(%rsp),%rsi
mov    0xc0(%rsp),%rdx
call   1030 <write@plt>
test   %eax,%eax
js     135d <run_sequential_one+0x1dd>
mov    %eax,%ebx
cmpb   $0x0,0x3(%rsp)
jne    1282 <run_sequential_one+0x102>
mov    %r14d,%edi
call   1090 <fsync@plt>
lea    0x48(%rsp),%r13
jmp    12b1 <run_sequential_one+0x131>
nopl   0x0(%rax)
mov    0x28(%rsp),%rsi
mov    0xc0(%rsp),%rdx
call   1060 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0x48(%rsp),%r13
js     1366 <run_sequential_one+0x1e6>
mov    %r13,%rdi
call   1080 <get_timer@plt>
test   %eax,%eax
je     1355 <run_sequential_one+0x1d5>
add    $0x1,%rbp
mov    %r13,%rdi
lea    0x58(%rsp),%rsi
lea    0x38(%rsp),%rdx
call   10a0 <timersub@plt>
movslq 0x38(%rsp),%rax
add    0x30(%rsp),%r15
mov    0xb0(%rsp),%ecx
cmp    %ecx,%eax
mov    0x4(%rsp),%edx
jge    1303 <run_sequential_one+0x183>
mov    %ebx,%ecx
sub    %rcx,%r12
cmp    0xc0(%rsp),%r12
jge    1250 <run_sequential_one+0xd0>
imul   $0xf4240,%rax,%rcx
movabs $0xd60e94ee392e1ef7,%rdx
94 0e d6
mov    %r15,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xe,%rdx
add    %rax,%rdx
add    %rcx,%rdx
add    0x40(%rsp),%rdx
test   %rdx,%rdx
mov    $0x1,%ebx
cmovg  %rdx,%rbx
mov    %rbx,%rax
or     %rbp,%rax
shr    $0x20,%rax
je     1390 <run_sequential_one+0x210>
mov    %rbx,%rax
xor    %edx,%edx
div    %rbp
mov    %rax,%r10
jmp    1399 <run_sequential_one+0x219>
xor    %r15d,%r15d
jmp    1402 <run_sequential_one+0x282>
lea    0xcdb(%rip),%rdx
jmp    136d <run_sequential_one+0x1ed>
lea    0xcd8(%rip),%rdx
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
mov    0x2c5b(%rip),%rax
mov    (%rax),%ecx
lea    0xc9b(%rip),%rsi
call   1070 <fprintf@plt>
xor    %r15d,%r15d
jmp    1402 <run_sequential_one+0x282>
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
mov    %eax,%r10d
mov    0x20(%rsp),%r8
mov    0x10(%rsp),%rcx
mov    0x8(%rsp),%rsi
cmp    $0xf4240,%r10
ja     13bd <run_sequential_one+0x23d>
mov    $0xf4240,%eax
xor    %edx,%edx
div    %r10d
jmp    13bf <run_sequential_one+0x23f>
xor    %eax,%eax
mov    0x18(%rsp),%rdx
sub    $0x8,%rsp
lea    0xc7b(%rip),%rdi
mov    0xa8(%rsp),%r9d
push   %r10
push   %rax
push   %rbx
push   %rbp
push   0xe8(%rsp)
mov    0xe0(%rsp),%eax
push   %rax
mov    0xe0(%rsp),%eax
push   %rax
call   1040 <printf@plt>
add    $0x40,%rsp
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"SEQ %s iosize=%ld\0D\00"
@.str.1 = [7 x i8] c"WRONLY\00"
@.str.2 = [7 x i8] c"RDONLY\00"
@.str.3 = [30 x i8] c"cannot %s to file (errno %d)\0A\00"
@.str.4 = [6 x i8] c"write\00"
@.str.5 = [5 x i8] c"read\00"
@errno = global i32 0
@.str.6 = [50 x i8] c"%s,SEQ,%s,%ld,%ld,%d,%d,%d,%ld,%lld,%lld,%ld,%ld\0A\00"
define i32 @run_sequential_one(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i64 %5, i32 %6, i32 %7, i32 %8, i32 %9, i64 %10) {
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i64
%24 = alloca i64
%25 = alloca i32
%26 = alloca %struct.timeval
%27 = alloca %struct.timeval
%28 = alloca %struct.timeval
%29 = alloca i64
%30 = alloca i64
store i8* %0, i8** %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store i64 %3, i64* %16
store i8* %4, i8** %17
store i64 %5, i64* %18
store i32 %6, i32* %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store i32 %9, i32* %22
store i64 %10, i64* %23
%31 = load i32, i32* %15
%32 = load i32, i32* @SEEK_SET
%33 = call i32 @lseek(i32 %31, i32 0, i32 %32)
%34 = load i32, i32* %15
%35 = call i32 @fsync(i32 %34)
%36 = load i32, i32* @stderr
%37 = load i32, i32* %14
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i64
%40 = select i1 %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%41 = load i64, i64* %23
%42 = trunc i64 %41 to i32
%43 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %40, i32 %42)
%44 = call i32 @get_timer(%struct.timeval* %26)
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %11
store i32 0, i32* %12
br label %144
47: ; preds = %11
%48 = load i64, i64* %16
store i64 %48, i64* %24
store i64 0, i64* %29
br label %49
49: ; preds = %103, %47
%50 = load i32, i32* %14
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %57
52: ; preds = %49
%53 = load i32, i32* %15
%54 = load i8*, i8** %17
%55 = load i64, i64* %23
%56 = call i32 @write(i32 %53, i8* %54, i64 %55)
br label %62
57: ; preds = %49
%58 = load i32, i32* %15
%59 = load i8*, i8** %17
%60 = load i64, i64* %23
%61 = call i32 @read(i32 %58, i8* %59, i64 %60)
br label %62
62: ; preds = %57, %52
%63 = phi i32 [ %56, %52 ], [ %61, %57 ]
store i32 %63, i32* %25
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %73
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = load i32, i32* %14
%68 = icmp ne i32 %67, 0
%69 = zext i1 %68 to i64
%70 = select i1 %68, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%71 = load i32, i32* @errno
%72 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %70, i32 %71)
store i32 0, i32* %12
br label %144
73: ; preds = %62
%74 = load i32, i32* %14
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load i32, i32* %20
%78 = icmp ne i32 %77, 0
br i1 %78, label %82, label %79
79: ; preds = %76
%80 = load i32, i32* %15
%81 = call i32 @fsync(i32 %80)
br label %82
82: ; preds = %79, %76, %73
%83 = call i32 @get_timer(%struct.timeval* %27)
%84 = icmp ne i32 %83, 0
br i1 %84, label %86, label %85
85: ; preds = %82
store i32 0, i32* %12
br label %144
86: ; preds = %82
%87 = load i32, i32* %25
%88 = sext i32 %87 to i64
%89 = load i64, i64* %24
%90 = sub nsw i64 %89, %88
store i64 %90, i64* %24
%91 = load i64, i64* %29
%92 = add nsw i64 %91, 1
store i64 %92, i64* %29
%93 = call i32 @timersub(%struct.timeval* %27, %struct.timeval* %26, %struct.timeval* %28)
br label %94
94: ; preds = %86
%95 = getelementptr inbounds %struct.timeval, %struct.timeval* %28, i32 0, i32 0
%96 = load i32, i32* %95
%97 = load i32, i32* %21
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %103
99: ; preds = %94
%100 = load i64, i64* %24
%101 = load i64, i64* %23
%102 = icmp sge i64 %100, %101
br label %103
103: ; preds = %99, %94
%104 = phi i1 [ false, %94 ], [ %102, %99 ]
br i1 %104, label %49, label %105
105: ; preds = %103
%106 = getelementptr inbounds %struct.timeval, %struct.timeval* %28, i32 0, i32 0
%107 = load i32, i32* %106
%108 = sext i32 %107 to i64
%109 = mul nsw i64 %108, 1000000
%110 = getelementptr inbounds %struct.timeval, %struct.timeval* %28, i32 0, i32 1
%111 = load i64, i64* %110
%112 = add nsw i64 %109, %111
%113 = load i64, i64* %29
%114 = load i32, i32* %22
%115 = sext i32 %114 to i64
%116 = mul nsw i64 %113, %115
%117 = sdiv i64 %116, 100000
%118 = sub nsw i64 %112, %117
store i64 %118, i64* %30
%119 = load i64, i64* %30
%120 = icmp slt i64 %119, 1
br i1 %120, label %121, label %122
121: ; preds = %105
store i64 1, i64* %30
br label %122
122: ; preds = %121, %105
%123 = load i8*, i8** %13
%124 = load i32, i32* %14
%125 = icmp ne i32 %124, 0
%126 = zext i1 %125 to i64
%127 = select i1 %125, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%128 = load i64, i64* %16
%129 = load i64, i64* %18
%130 = load i32, i32* %19
%131 = load i32, i32* %20
%132 = load i32, i32* %21
%133 = load i64, i64* %23
%134 = load i64, i64* %29
%135 = load i64, i64* %30
%136 = load i64, i64* %30
%137 = load i64, i64* %29
%138 = sdiv i64 %136, %137
%139 = sdiv i64 1000000, %138
%140 = load i64, i64* %30
%141 = load i64, i64* %29
%142 = sdiv i64 %140, %141
%143 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %123, i8* %127, i64 %128, i64 %129, i32 %130, i32 %131, i32 %132, i64 %133, i64 %134, i64 %135, i64 %139, i64 %142)
store i32 1, i32* %12
br label %144
144: ; preds = %122, %85, %65, %46
%145 = load i32, i32* %12
ret i32 %145
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@SEEK_SET = global i32 0
@stderr = global i32 0
@.str = [19 x i8] c"SEQ %s iosize=%ld\0D\00"
@.str.1 = [7 x i8] c"WRONLY\00"
@.str.2 = [7 x i8] c"RDONLY\00"
@.str.3 = [30 x i8] c"cannot %s to file (errno %d)\0A\00"
@.str.4 = [6 x i8] c"write\00"
@.str.5 = [5 x i8] c"read\00"
@errno = global i32 0
@.str.6 = [50 x i8] c"%s,SEQ,%s,%ld,%ld,%d,%d,%d,%ld,%lld,%lld,%ld,%ld\0A\00"
define i32 @run_sequential_one(i8* %0, i32 %1, i32 %2, i64 %3, i8* nocapture %4, i64 %5, i32 %6, i32 %7, i32 %8, i32 %9, i64 %10) {
%12 = alloca %struct.timeval
%13 = alloca %struct.timeval
%14 = alloca %struct.timeval
%15 = bitcast %struct.timeval* %12 to i8*
%16 = bitcast %struct.timeval* %13 to i8*
%17 = bitcast %struct.timeval* %14 to i8*
%18 = load i32, i32* @SEEK_SET
%19 = tail call i32 @lseek(i32 %2, i32 0, i32 %18)
%20 = tail call i32 @fsync(i32 %2)
%21 = load i32, i32* @stderr
%22 = icmp eq i32 %1, 0
%23 = select i1 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%24 = trunc i64 %10 to i32
%25 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %23, i32 %24)
%26 = call i32 @get_timer(%struct.timeval* %12)
%27 = icmp eq i32 %26, 0
br i1 %27, label %77, label %28
28: ; preds = %11
%29 = icmp ne i32 %7, 0
%30 = or i1 %22, %29
%31 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 0
br label %32
32: ; preds = %28, %53
%33 = phi i64 [ %55, %53 ], [ %3, %28 ]
%34 = phi i64 [ %56, %53 ], [ 0, %28 ]
br i1 %22, label %38, label %35
35: ; preds = %32
%36 = call i32 @write(i32 %2, i8* %4, i64 %10)
%37 = icmp slt i32 %36, 0
br i1 %37, label %41, label %46
38: ; preds = %32
%39 = call i32 @read(i32 %2, i8* %4, i64 %10)
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %49
41: ; preds = %38, %35
%42 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %38 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %35 ]
%43 = load i32, i32* @stderr
%44 = load i32, i32* @errno
%45 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i8* %42, i32 %44)
br label %77
46: ; preds = %35
br i1 %30, label %49, label %47
47: ; preds = %46
%48 = call i32 @fsync(i32 %2)
br label %49
49: ; preds = %38, %47, %46
%50 = phi i32 [ %36, %47 ], [ %36, %46 ], [ %39, %38 ]
%51 = call i32 @get_timer(%struct.timeval* %13)
%52 = icmp eq i32 %51, 0
br i1 %52, label %77, label %53
53: ; preds = %49
%54 = zext i32 %50 to i64
%55 = sub nsw i64 %33, %54
%56 = add nuw nsw i64 %34, 1
%57 = call i32 @timersub(%struct.timeval* %13, %struct.timeval* %12, %struct.timeval* %14)
%58 = load i32, i32* %31
%59 = icmp slt i32 %58, %8
%60 = icmp sge i64 %55, %10
%61 = select i1 %59, i1 %60, i1 false
br i1 %61, label %32, label %62
62: ; preds = %53
%63 = sext i32 %58 to i64
%64 = mul nsw i64 %63, 1000000
%65 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0, i32 1
%66 = load i64, i64* %65
%67 = sext i32 %9 to i64
%68 = mul nsw i64 %56, %67
%69 = sdiv i64 %68, -100000
%70 = add nsw i64 %64, %69
%71 = add i64 %70, %66
%72 = icmp sgt i64 %71, 1
%73 = select i1 %72, i64 %71, i64 1
%74 = udiv i64 %73, %56
%75 = udiv i64 1000000, %74
%76 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %23, i64 %3, i64 %5, i32 %6, i32 %7, i32 %8, i64 %10, i64 %56, i64 %73, i64 %75, i64 %74)
br label %77
77: ; preds = %49, %11, %62, %41
%78 = phi i32 [ 0, %41 ], [ 1, %62 ], [ 0, %11 ], [ 0, %49 ]
ret i32 %78
}