#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 */
typedef int /*<<< orphan*/ fstr;
typedef int /*<<< orphan*/ errstr;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int O_WRONLY;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int);
int lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
char *mytime(char *, int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
char *strerror(int);
int unlink(char *);
int write(int, char *, int);
int main() {
  int fd[64];
  int res;
  char filename[64][80];
  char wbuf[26] = "abcdefghijklmnopqrstuvwxyz";
  char rbuf[26];
  const int iters = 1024 * 1024;
  int errfd;
  char errstr[1024];
  errfd = open("forensic-haven-test-errors", O_WRONLY | O_CREAT);
  if (errfd < 0) {
    printf("Error opening error file (%d %s). Exiting...\n", errno,
           strerror(errno));
    exit(1);
  }
  for (int jdx = 0; jdx < iters; jdx++) {
    for (int idx = 0; idx < 64; idx++) {
      char fstr[80];
      sprintf(filename[idx], "forensic-haven-test-%d", idx);
      printf("Opening %s\n", filename[idx]);
      sleep(3);
      fd[idx] = open(filename[idx], O_RDWR | O_CREAT);
      if (fd[idx] < 0) {
        sprintf(errstr, "%s zError on open: %s; %d %s\n",
                mytime(fstr, sizeof(fstr)), filename[idx], errno,
                strerror(errno));
        printf("%s", errstr);
        write(errfd, errstr, sizeof(errstr));
        continue;
      }
      printf("Writing %s\n", filename[idx]);
      for (int jdx = 0; jdx < 1024 * 128; jdx++) {
        int bytes_written = write(fd[idx], wbuf, 26);
        if (bytes_written < 1) {
          sprintf(errstr, "%s zError on write %s: %d %s\n",
                  mytime(fstr, sizeof(fstr)), filename[idx], errno,
                  strerror(errno));
          printf("%s", errstr);
          write(errfd, errstr, sizeof(errstr));
        }
      }
      printf("lseek on %s\n", filename[idx]);
      sleep(3);
      res = lseek(fd[idx], 0, SEEK_SET);
      if (res) {
        sprintf(errstr, "%s zError on lseek on %s: %d %s\n",
                mytime(fstr, sizeof(fstr)), filename[idx], errno,
                strerror(errno));
        printf("%s", errstr);
        write(errfd, errstr, sizeof(errstr));
      }
      printf("Reading %s\n", filename[idx]);
      for (int jdx = 0; jdx < 1024 * 128; jdx++) {
        int bytes_read = read(fd[idx], rbuf, 26);
        if (bytes_read < 1) {
          sprintf(errstr, "%s zError on read %s: %d %s\n",
                  mytime(fstr, sizeof(fstr)), filename[idx], errno,
                  strerror(errno));
          printf("%s", errstr);
          write(errfd, errstr, sizeof(errstr));
        }
      }
      printf("Closing %s\n", filename[idx]);
      close(fd[idx]);
      if (idx % 2 == 0) {
        printf("Unlinking %s\n", filename[idx]);
        sleep(3);
        res = unlink(filename[idx]);
        if (res) {
          sprintf(errstr, "%s zError on unlink %s: %d %s\n",
                  mytime(fstr, sizeof(fstr)), filename[idx], errno,
                  strerror(errno));
          printf("%s", errstr);
          write(errfd, errstr, sizeof(errstr));
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe27(%rip),%rax
mov    %rax,-0x1540(%rbp)
mov    0xe21(%rip),%rax
mov    %rax,-0x1538(%rbp)
mov    0xe1b(%rip),%rax
mov    %rax,-0x1530(%rbp)
mov    0xe15(%rip),%ax
mov    %ax,-0x1528(%rbp)
movl   $0x100000,-0x1564(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
mov    0x2dd4(%rip),%rax
or     (%rax),%esi
lea    0xded(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x1568(%rbp)
cmpl   $0x0,-0x1568(%rbp)
jge    1283 <main+0xc3>
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x19e4(%rbp)
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x19e4(%rbp),%esi
mov    %rax,%rdx
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x1974(%rbp)
cmpl   $0x100000,-0x1974(%rbp)
jge    1944 <main+0x784>
movl   $0x0,-0x1978(%rbp)
cmpl   $0x40,-0x1978(%rbp)
jge    192b <main+0x76b>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
mov    -0x1978(%rbp),%edx
lea    0xd8d(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    0x2cc9(%rip),%rax
or     (%rax),%esi
call   1090 <open@plt>
mov    %eax,%ecx
movslq -0x1978(%rbp),%rax
mov    %ecx,-0x110(%rbp,%rax,4)
movslq -0x1978(%rbp),%rax
cmpl   $0x0,-0x110(%rbp,%rax,4)
jge    1418 <main+0x258>
lea    -0x1970(%rbp),%rax
mov    %rax,-0x1a00(%rbp)
lea    -0x19d0(%rbp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,-0x19f8(%rbp)
movslq -0x1978(%rbp),%rcx
lea    -0x1520(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x19f0(%rbp)
mov    0x2c2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x19e8(%rbp)
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a00(%rbp),%rdi
mov    -0x19f8(%rbp),%rdx
mov    -0x19f0(%rbp),%rcx
mov    -0x19e8(%rbp),%r8d
mov    %rax,%r9
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1970(%rbp),%rsi
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1568(%rbp),%edi
lea    -0x1970(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    1917 <main+0x757>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xc73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x19d4(%rbp)
cmpl   $0x20000,-0x19d4(%rbp)
jge    1558 <main+0x398>
movslq -0x1978(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%edi
lea    -0x1540(%rbp),%rsi
mov    $0x1a,%edx
call   1040 <write@plt>
mov    %eax,-0x19d8(%rbp)
cmpl   $0x1,-0x19d8(%rbp)
jge    153f <main+0x37f>
lea    -0x1970(%rbp),%rax
mov    %rax,-0x1a20(%rbp)
lea    -0x19d0(%rbp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,-0x1a18(%rbp)
movslq -0x1978(%rbp),%rcx
lea    -0x1520(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x1a10(%rbp)
mov    0x2b00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1a04(%rbp)
mov    0x2af1(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a20(%rbp),%rdi
mov    -0x1a18(%rbp),%rdx
mov    -0x1a10(%rbp),%rcx
mov    -0x1a04(%rbp),%r8d
mov    %rax,%r9
lea    0xba7(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1970(%rbp),%rsi
lea    0xb83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1568(%rbp),%edi
lea    -0x1970(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    1544 <main+0x384>
mov    -0x19d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19d4(%rbp)
jmp    1445 <main+0x285>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xb5d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
movslq -0x1978(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%edi
mov    0x2a2e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
je     166e <main+0x4ae>
lea    -0x1970(%rbp),%rax
mov    %rax,-0x1a40(%rbp)
lea    -0x19d0(%rbp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,-0x1a38(%rbp)
movslq -0x1978(%rbp),%rcx
lea    -0x1520(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x1a30(%rbp)
mov    0x29d1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1a24(%rbp)
mov    0x29c2(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a40(%rbp),%rdi
mov    -0x1a38(%rbp),%rdx
mov    -0x1a30(%rbp),%rcx
mov    -0x1a24(%rbp),%r8d
mov    %rax,%r9
lea    0xaa3(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1970(%rbp),%rsi
lea    0xa54(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1568(%rbp),%edi
lea    -0x1970(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0xa75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x19dc(%rbp)
cmpl   $0x20000,-0x19dc(%rbp)
jge    17ae <main+0x5ee>
movslq -0x1978(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%edi
lea    -0x1560(%rbp),%rsi
mov    $0x1a,%edx
call   1080 <read@plt>
mov    %eax,-0x19e0(%rbp)
cmpl   $0x1,-0x19e0(%rbp)
jge    1795 <main+0x5d5>
lea    -0x1970(%rbp),%rax
mov    %rax,-0x1a60(%rbp)
lea    -0x19d0(%rbp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,-0x1a58(%rbp)
movslq -0x1978(%rbp),%rcx
lea    -0x1520(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x1a50(%rbp)
mov    0x28aa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1a44(%rbp)
mov    0x289b(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a60(%rbp),%rdi
mov    -0x1a58(%rbp),%rdx
mov    -0x1a50(%rbp),%rcx
mov    -0x1a44(%rbp),%r8d
mov    %rax,%r9
lea    0x9a9(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1970(%rbp),%rsi
lea    0x92d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1568(%rbp),%edi
lea    -0x1970(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    179a <main+0x5da>
mov    -0x19dc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19dc(%rbp)
jmp    169b <main+0x4db>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0x95e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x1978(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%edi
call   1070 <close@plt>
mov    -0x1978(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1912 <main+0x752>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
lea    0x91d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
movslq -0x1978(%rbp),%rax
lea    -0x1520(%rbp),%rdi
imul   $0x50,%rax,%rax
add    %rax,%rdi
call   1030 <unlink@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
je     190d <main+0x74d>
lea    -0x1970(%rbp),%rax
mov    %rax,-0x1a80(%rbp)
lea    -0x19d0(%rbp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,-0x1a78(%rbp)
movslq -0x1978(%rbp),%rcx
lea    -0x1520(%rbp),%rax
imul   $0x50,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x1a70(%rbp)
mov    0x2732(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1a64(%rbp)
mov    0x2723(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x1a80(%rbp),%rdi
mov    -0x1a78(%rbp),%rdx
mov    -0x1a70(%rbp),%rcx
mov    -0x1a64(%rbp),%r8d
mov    %rax,%r9
lea    0x868(%rip),%rsi
mov    $0x0,%al
call   10a0 <sprintf@plt>
lea    -0x1970(%rbp),%rsi
lea    0x7b5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1568(%rbp),%edi
lea    -0x1970(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    1912 <main+0x752>
jmp    1917 <main+0x757>
mov    -0x1978(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1978(%rbp)
jmp    12a7 <main+0xe7>
jmp    1930 <main+0x770>
mov    -0x1974(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1974(%rbp)
jmp    128d <main+0xcd>
mov    -0x4(%rbp),%eax
add    $0x1a80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18a8,%rsp
movups 0xe32(%rip),%xmm0
movups %xmm0,0x1a(%rsp)
movaps 0xe1c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x2dc8(%rip),%rax
mov    0x2e01(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe18(%rip),%rdi
call   1090 <open@plt>
mov    %eax,(%rsp)
test   %eax,%eax
js     15e2 <main+0x422>
lea    0xa0(%rsp),%rbx
xor    %eax,%eax
jmp    1232 <main+0x72>
xchg   %ax,%ax
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    $0x100000,%eax
je     15ce <main+0x40e>
mov    %eax,0x4(%rsp)
xor    %ebp,%ebp
jmp    12b5 <main+0xf5>
nopw   0x0(%rax,%rax,1)
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,%rbp
mov    0x2d77(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,%edi
call   10d0 <strerror@plt>
mov    %rbx,%rdi
lea    0xe18(%rip),%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r14d,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <sprintf@plt>
mov    0x8(%rsp),%rbp
lea    0xe17(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <write@plt>
add    $0x1,%rbp
cmp    $0x40,%rbp
je     1220 <main+0x60>
lea    0x0(,%rbp,4),%rax
add    %rbp,%rax
shl    $0x4,%rax
lea    (%rsp,%rax,1),%r13
add    $0x4a0,%r13
mov    %r13,%rdi
lea    0xd8a(%rip),%rsi
mov    %rbp,0x8(%rsp)
mov    %ebp,%edx
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xd8c(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
mov    0x2cce(%rip),%rax
or     (%rax),%esi
mov    %r13,%rdi
call   1090 <open@plt>
test   %eax,%eax
js     1240 <main+0x80>
mov    %eax,%r14d
lea    0xd79(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20000,%ebx
jmp    1349 <main+0x189>
nop
add    $0xffffffff,%ebx
je     13d0 <main+0x210>
mov    %r14d,%edi
lea    0x10(%rsp),%rsi
mov    $0x1a,%edx
call   1040 <write@plt>
test   %eax,%eax
jg     1340 <main+0x180>
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,%r15
mov    0x2c58(%rip),%rax
mov    (%rax),%r12d
mov    %r12d,%edi
call   10d0 <strerror@plt>
lea    0xa0(%rsp),%rbp
mov    %rbp,%rdi
lea    0xd1e(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    %r12d,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xcf5(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edi
mov    %rbp,%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    1340 <main+0x180>
xchg   %ax,%ax
lea    0xcfa(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
mov    0x2bd6(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
test   %eax,%eax
je     146c <main+0x2ac>
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,%r15
mov    0x2bb5(%rip),%rax
mov    (%rax),%r12d
mov    %r12d,%edi
call   10d0 <strerror@plt>
lea    0xa0(%rsp),%rbx
mov    %rbx,%rdi
lea    0xca6(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    %r12d,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xc52(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1040 <write@plt>
lea    0xc8c(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x20000,%ebx
jmp    1499 <main+0x2d9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%ebx
je     1520 <main+0x360>
mov    %r14d,%edi
lea    0x80(%rsp),%rsi
mov    $0x1a,%edx
call   1080 <read@plt>
test   %eax,%eax
jg     1490 <main+0x2d0>
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,%r15
mov    0x2b05(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xa0(%rsp),%r12
mov    %r12,%rdi
lea    0xc25(%rip),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    %ebp,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <sprintf@plt>
lea    0xba4(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    1490 <main+0x2d0>
nop
lea    0xc01(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%edi
call   1070 <close@plt>
mov    0x8(%rsp),%rbp
test   $0x1,%bpl
lea    0xa0(%rsp),%rbx
jne    12a7 <main+0xe7>
lea    0xbdd(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
mov    %r13,%rdi
call   1030 <unlink@plt>
test   %eax,%eax
je     12a7 <main+0xe7>
lea    0x30(%rsp),%rdi
mov    $0x50,%esi
call   10c0 <mytime@plt>
mov    %rax,%rbx
mov    0x2a3c(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,%edi
call   10d0 <strerror@plt>
lea    0xa0(%rsp),%rdi
lea    0xb94(%rip),%rsi
mov    %rbx,%rdx
lea    0xa0(%rsp),%rbx
mov    %r13,%rcx
mov    %r14d,%r8d
mov    %rax,%r9
xor    %eax,%eax
call   10a0 <sprintf@plt>
jmp    1286 <main+0xc6>
xor    %eax,%eax
add    $0x18a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x29e7(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xa3c(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@__const.main.wbuf = [26 x i8] c"abcdefghijklmnopqrstuvwxyz"
@.str = [27 x i8] c"forensic-haven-test-errors\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.1 = [46 x i8] c"Error opening error file (%d %s). Exiting...\0A\00"
@errno = global i32 0
@.str.2 = [23 x i8] c"forensic-haven-test-%d\00"
@.str.3 = [12 x i8] c"Opening %s\0A\00"
@O_RDWR = global i32 0
@.str.4 = [30 x i8] c"%s zError on open: %s; %d %s\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [12 x i8] c"Writing %s\0A\00"
@.str.7 = [30 x i8] c"%s zError on write %s: %d %s\0A\00"
@.str.8 = [13 x i8] c"lseek on %s\0A\00"
@SEEK_SET = global i32 0
@.str.9 = [33 x i8] c"%s zError on lseek on %s: %d %s\0A\00"
@.str.10 = [12 x i8] c"Reading %s\0A\00"
@.str.11 = [29 x i8] c"%s zError on read %s: %d %s\0A\00"
@.str.12 = [12 x i8] c"Closing %s\0A\00"
@.str.13 = [14 x i8] c"Unlinking %s\0A\00"
@.str.14 = [31 x i8] c"%s zError on unlink %s: %d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i32]
%3 = alloca i32
%4 = alloca [64 x [80 x i8]]
%5 = alloca [26 x i8]
%6 = alloca [26 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [80 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %1
%17 = bitcast [26 x i8]* %5 to i8*
store i32 1048576, i32* %7
%18 = load i32, i32* @O_WRONLY
%19 = load i32, i32* @O_CREAT
%20 = or i32 %18, %19
%21 = call i32 @open(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %20)
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %30
24: ; preds = %0
%25 = load i32, i32* @errno
%26 = load i32, i32* @errno
%27 = call i8* @strerror(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %25, i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %0
store i32 0, i32* %10
br label %31
31: ; preds = %245, %30
%32 = load i32, i32* %10
%33 = icmp slt i32 %32, 1048576
br i1 %33, label %34, label %248
34: ; preds = %31
store i32 0, i32* %11
br label %35
35: ; preds = %241, %34
%36 = load i32, i32* %11
%37 = icmp slt i32 %36, 64
br i1 %37, label %38, label %244
38: ; preds = %35
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %40
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %41, i64 0, i64 0
%43 = load i32, i32* %11
%44 = call i32 (i8*, i8*, ...) @sprintf(i8* %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %46
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %47, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %48)
%50 = call i32 @sleep(i32 3)
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %52
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %53, i64 0, i64 0
%55 = load i32, i32* @O_RDWR
%56 = load i32, i32* @O_CREAT
%57 = or i32 %55, %56
%58 = call i32 @open(i8* %54, i32 %57)
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %60
store i32 %58, i32* %61
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %84
67: ; preds = %38
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%70 = call i8* @mytime(i8* %69, i32 80)
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %72
%74 = getelementptr inbounds [80 x i8], [80 x i8]* %73, i64 0, i64 0
%75 = load i32, i32* @errno
%76 = load i32, i32* @errno
%77 = call i8* @strerror(i32 %76)
%78 = call i32 (i8*, i8*, ...) @sprintf(i8* %68, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %70, i8* %74, i32 %75, i8* %77)
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %79)
%81 = load i32, i32* %8
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%83 = call i32 @write(i32 %81, i8* %82, i32 1024)
br label %241
84: ; preds = %38
%85 = load i32, i32* %11
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %86
%88 = getelementptr inbounds [80 x i8], [80 x i8]* %87, i64 0, i64 0
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %88)
store i32 0, i32* %13
br label %90
90: ; preds = %120, %84
%91 = load i32, i32* %13
%92 = icmp slt i32 %91, 131072
br i1 %92, label %93, label %123
93: ; preds = %90
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%99 = call i32 @write(i32 %97, i8* %98, i32 26)
store i32 %99, i32* %14
%100 = load i32, i32* %14
%101 = icmp slt i32 %100, 1
br i1 %101, label %102, label %119
102: ; preds = %93
%103 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%104 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%105 = call i8* @mytime(i8* %104, i32 80)
%106 = load i32, i32* %11
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %107
%109 = getelementptr inbounds [80 x i8], [80 x i8]* %108, i64 0, i64 0
%110 = load i32, i32* @errno
%111 = load i32, i32* @errno
%112 = call i8* @strerror(i32 %111)
%113 = call i32 (i8*, i8*, ...) @sprintf(i8* %103, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %105, i8* %109, i32 %110, i8* %112)
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %114)
%116 = load i32, i32* %8
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%118 = call i32 @write(i32 %116, i8* %117, i32 1024)
br label %119
119: ; preds = %102, %93
br label %120
120: ; preds = %119
%121 = load i32, i32* %13
%122 = add nsw i32 %121, 1
store i32 %122, i32* %13
br label %90
123: ; preds = %90
%124 = load i32, i32* %11
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %125
%127 = getelementptr inbounds [80 x i8], [80 x i8]* %126, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %127)
%129 = call i32 @sleep(i32 3)
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %131
%133 = load i32, i32* %132
%134 = load i32, i32* @SEEK_SET
%135 = call i32 @lseek(i32 %133, i32 0, i32 %134)
store i32 %135, i32* %3
%136 = load i32, i32* %3
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %155
138: ; preds = %123
%139 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%140 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%141 = call i8* @mytime(i8* %140, i32 80)
%142 = load i32, i32* %11
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %143
%145 = getelementptr inbounds [80 x i8], [80 x i8]* %144, i64 0, i64 0
%146 = load i32, i32* @errno
%147 = load i32, i32* @errno
%148 = call i8* @strerror(i32 %147)
%149 = call i32 (i8*, i8*, ...) @sprintf(i8* %139, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %141, i8* %145, i32 %146, i8* %148)
%150 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %150)
%152 = load i32, i32* %8
%153 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%154 = call i32 @write(i32 %152, i8* %153, i32 1024)
br label %155
155: ; preds = %138, %123
%156 = load i32, i32* %11
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %157
%159 = getelementptr inbounds [80 x i8], [80 x i8]* %158, i64 0, i64 0
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %159)
store i32 0, i32* %15
br label %161
161: ; preds = %191, %155
%162 = load i32, i32* %15
%163 = icmp slt i32 %162, 131072
br i1 %163, label %164, label %194
164: ; preds = %161
%165 = load i32, i32* %11
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %166
%168 = load i32, i32* %167
%169 = getelementptr inbounds [26 x i8], [26 x i8]* %6, i64 0, i64 0
%170 = call i32 @read(i32 %168, i8* %169, i32 26)
store i32 %170, i32* %16
%171 = load i32, i32* %16
%172 = icmp slt i32 %171, 1
br i1 %172, label %173, label %190
173: ; preds = %164
%174 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%175 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%176 = call i8* @mytime(i8* %175, i32 80)
%177 = load i32, i32* %11
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %178
%180 = getelementptr inbounds [80 x i8], [80 x i8]* %179, i64 0, i64 0
%181 = load i32, i32* @errno
%182 = load i32, i32* @errno
%183 = call i8* @strerror(i32 %182)
%184 = call i32 (i8*, i8*, ...) @sprintf(i8* %174, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %176, i8* %180, i32 %181, i8* %183)
%185 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %185)
%187 = load i32, i32* %8
%188 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%189 = call i32 @write(i32 %187, i8* %188, i32 1024)
br label %190
190: ; preds = %173, %164
br label %191
191: ; preds = %190
%192 = load i32, i32* %15
%193 = add nsw i32 %192, 1
store i32 %193, i32* %15
br label %161
194: ; preds = %161
%195 = load i32, i32* %11
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %196
%198 = getelementptr inbounds [80 x i8], [80 x i8]* %197, i64 0, i64 0
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %198)
%200 = load i32, i32* %11
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %201
%203 = load i32, i32* %202
%204 = call i32 @close(i32 %203)
%205 = load i32, i32* %11
%206 = srem i32 %205, 2
%207 = icmp eq i32 %206, 0
br i1 %207, label %208, label %240
208: ; preds = %194
%209 = load i32, i32* %11
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %210
%212 = getelementptr inbounds [80 x i8], [80 x i8]* %211, i64 0, i64 0
%213 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8* %212)
%214 = call i32 @sleep(i32 3)
%215 = load i32, i32* %11
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %216
%218 = getelementptr inbounds [80 x i8], [80 x i8]* %217, i64 0, i64 0
%219 = call i32 @unlink(i8* %218)
store i32 %219, i32* %3
%220 = load i32, i32* %3
%221 = icmp ne i32 %220, 0
br i1 %221, label %222, label %239
222: ; preds = %208
%223 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%224 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%225 = call i8* @mytime(i8* %224, i32 80)
%226 = load i32, i32* %11
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %4, i64 0, i64 %227
%229 = getelementptr inbounds [80 x i8], [80 x i8]* %228, i64 0, i64 0
%230 = load i32, i32* @errno
%231 = load i32, i32* @errno
%232 = call i8* @strerror(i32 %231)
%233 = call i32 (i8*, i8*, ...) @sprintf(i8* %223, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0), i8* %225, i8* %229, i32 %230, i8* %232)
%234 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %234)
%236 = load i32, i32* %8
%237 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%238 = call i32 @write(i32 %236, i8* %237, i32 1024)
br label %239
239: ; preds = %222, %208
br label %240
240: ; preds = %239, %194
br label %241
241: ; preds = %240, %67
%242 = load i32, i32* %11
%243 = add nsw i32 %242, 1
store i32 %243, i32* %11
br label %35
244: ; preds = %35
br label %245
245: ; preds = %244
%246 = load i32, i32* %10
%247 = add nsw i32 %246, 1
store i32 %247, i32* %10
br label %31
248: ; preds = %31
%249 = load i32, i32* %1
ret i32 %249
}

LLVM IR (-O2):
@__const.main.wbuf = [26 x i8] c"abcdefghijklmnopqrstuvwxyz"
@.str = [27 x i8] c"forensic-haven-test-errors\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.1 = [46 x i8] c"Error opening error file (%d %s). Exiting...\0A\00"
@errno = global i32 0
@.str.2 = [23 x i8] c"forensic-haven-test-%d\00"
@.str.3 = [12 x i8] c"Opening %s\0A\00"
@O_RDWR = global i32 0
@.str.4 = [30 x i8] c"%s zError on open: %s; %d %s\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [12 x i8] c"Writing %s\0A\00"
@.str.7 = [30 x i8] c"%s zError on write %s: %d %s\0A\00"
@.str.8 = [13 x i8] c"lseek on %s\0A\00"
@SEEK_SET = global i32 0
@.str.9 = [33 x i8] c"%s zError on lseek on %s: %d %s\0A\00"
@.str.10 = [12 x i8] c"Reading %s\0A\00"
@.str.11 = [29 x i8] c"%s zError on read %s: %d %s\0A\00"
@.str.12 = [12 x i8] c"Closing %s\0A\00"
@.str.13 = [14 x i8] c"Unlinking %s\0A\00"
@.str.14 = [31 x i8] c"%s zError on unlink %s: %d %s\0A\00"
define i32 @main() {
%1 = alloca [64 x [80 x i8]]
%2 = alloca [26 x i8]
%3 = alloca [26 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [80 x i8]
%6 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %1, i64 0, i64 0, i64 0
%7 = getelementptr inbounds [26 x i8], [26 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* @O_WRONLY
%11 = load i32, i32* @O_CREAT
%12 = or i32 %11, %10
%13 = tail call i32 @open(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = icmp slt i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %0
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
br label %22
17: ; preds = %0
%18 = load i32, i32* @errno
%19 = tail call i8* @strerror(i32 %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %18, i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %15, %25
%23 = phi i32 [ 0, %15 ], [ %26, %25 ]
br label %28
24: ; preds = %25
ret i32 0
25: ; preds = %108
%26 = add nuw nsw i32 %23, 1
%27 = icmp eq i32 %26, 1048576
br i1 %27, label %24, label %22
28: ; preds = %22, %108
%29 = phi i64 [ 0, %22 ], [ %109, %108 ]
%30 = getelementptr inbounds [64 x [80 x i8]], [64 x [80 x i8]]* %1, i64 0, i64 %29, i64 0
%31 = trunc i64 %29 to i32
%32 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%34 = call i32 @sleep(i32 3)
%35 = load i32, i32* @O_RDWR
%36 = load i32, i32* @O_CREAT
%37 = or i32 %36, %35
%38 = call i32 @open(i8* %30, i32 %37)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %28
%41 = call i8* @mytime(i8* %16, i32 80)
%42 = load i32, i32* @errno
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %41, i8* %30, i32 %42, i8* %43)
br label %105
45: ; preds = %28
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %30)
br label %53
47: ; preds = %64
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* %30)
%49 = call i32 @sleep(i32 3)
%50 = load i32, i32* @SEEK_SET
%51 = call i32 @lseek(i32 %38, i32 0, i32 %50)
%52 = icmp eq i32 %51, 0
br i1 %52, label %74, label %67
53: ; preds = %45, %64
%54 = phi i32 [ 0, %45 ], [ %65, %64 ]
%55 = call i32 @write(i32 %38, i8* %7, i32 26)
%56 = icmp slt i32 %55, 1
br i1 %56, label %57, label %64
57: ; preds = %53
%58 = call i8* @mytime(i8* %16, i32 80)
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %58, i8* %30, i32 %59, i8* %60)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%63 = call i32 @write(i32 %13, i8* %9, i32 1024)
br label %64
64: ; preds = %57, %53
%65 = add nuw nsw i32 %54, 1
%66 = icmp eq i32 %65, 131072
br i1 %66, label %47, label %53
67: ; preds = %47
%68 = call i8* @mytime(i8* %16, i32 80)
%69 = load i32, i32* @errno
%70 = call i8* @strerror(i32 %69)
%71 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i8* %68, i8* %30, i32 %69, i8* %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%73 = call i32 @write(i32 %13, i8* %9, i32 1024)
br label %74
74: ; preds = %67, %47
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %30)
br label %81
76: ; preds = %92
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %30)
%78 = call i32 @close(i32 %38)
%79 = and i32 %31, 1
%80 = icmp eq i32 %79, 0
br i1 %80, label %95, label %108
81: ; preds = %74, %92
%82 = phi i32 [ 0, %74 ], [ %93, %92 ]
%83 = call i32 @read(i32 %38, i8* %8, i32 26)
%84 = icmp slt i32 %83, 1
br i1 %84, label %85, label %92
85: ; preds = %81
%86 = call i8* @mytime(i8* %16, i32 80)
%87 = load i32, i32* @errno
%88 = call i8* @strerror(i32 %87)
%89 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.11, i64 0, i64 0), i8* %86, i8* %30, i32 %87, i8* %88)
%90 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%91 = call i32 @write(i32 %13, i8* %9, i32 1024)
br label %92
92: ; preds = %85, %81
%93 = add nuw nsw i32 %82, 1
%94 = icmp eq i32 %93, 131072
br i1 %94, label %76, label %81
95: ; preds = %76
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i8* %30)
%97 = call i32 @sleep(i32 3)
%98 = call i32 @unlink(i8* %30)
%99 = icmp eq i32 %98, 0
br i1 %99, label %108, label %100
100: ; preds = %95
%101 = call i8* @mytime(i8* %16, i32 80)
%102 = load i32, i32* @errno
%103 = call i8* @strerror(i32 %102)
%104 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0), i8* %101, i8* %30, i32 %102, i8* %103)
br label %105
105: ; preds = %40, %100
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%107 = call i32 @write(i32 %13, i8* %9, i32 1024)
br label %108
108: ; preds = %105, %76, %95
%109 = add nuw nsw i64 %29, 1
%110 = icmp eq i64 %109, 64
br i1 %110, label %25, label %28
}