#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 {
  char *tv_sec;
  int /*<<< orphan*/ tv_usec;
};

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *,
                           int /*<<< orphan*/, char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int open(char *, int, int);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int write(int, char *, int);
int write_to_file(char *event, bool set) {
  int fd;
  int tmp;
  char buff[100];
  bool available[2] = {false, false};
  bool used[2] = {false, false};
  fd = open("/tmp/used_event_list", O_CREAT | O_RDWR, 0600);
  if (fd != -1) {
    tmp = read(fd, buff, 100);
    if (tmp >= 0) {
      if (buff[0] == '/') {
        available[0] = true;
        if (strcmp(event, buff) == 0) {
          used[0] = true;
          if (set)
            return (1);
        }
        if (buff[strlen(buff) + 1] == '/') {
          available[1] = true;
          if (strcmp(event, &buff[strlen(buff) + 1]) == 0) {
            used[1] = true;
            if (set)
              return (1);
          }
        }
      }
    }
  }
  close(fd);
  fd = open("/tmp/used_event_list", O_CREAT | O_RDWR, 0600);
  if (fd != -1) {
    tmp = write(fd,
                "                                                              "
                "                                      ",
                100);
    if (tmp <= 0)
      do {
        struct timeval now;
        gettimeofday(&now, NULL);
        fprintf(stderr,
                "[%ld.%06ld] "
                "E: "
                "cant write to file: %s",
                now.tv_sec, now.tv_usec, "/tmp/used_event_list");
      } while (0);
  } else {
    do {
      struct timeval now;
      gettimeofday(&now, NULL);
      fprintf(stderr,
              "[%ld.%06ld] "
              "E: "
              "cant open file: %s",
              now.tv_sec, now.tv_usec, "/tmp/used_event_list");
    } while (0);
  }
  close(fd);
  fd = open("/tmp/used_event_list", O_CREAT | O_RDWR, 0600);
  if (fd != -1) {
    if (set) {
      if (available[0]) {
        tmp = write(fd, buff, (strlen(buff) + 1));
        if (tmp <= 0)
          do {
            struct timeval now;
            gettimeofday(&now, NULL);
            fprintf(stderr,
                    "[%ld.%06ld] "
                    "E: "
                    "cant write to file: %s",
                    now.tv_sec, now.tv_usec, "/tmp/used_event_list");
          } while (0);
      }
      tmp = write(fd, event, (strlen(event) + 1));
      if (tmp <= 0)
        do {
          struct timeval now;
          gettimeofday(&now, NULL);
          fprintf(stderr,
                  "[%ld.%06ld] "
                  "E: "
                  "cant write to file: %s",
                  now.tv_sec, now.tv_usec, "/tmp/used_event_list");
        } while (0);
    } else {
      if (available[0] && !used[0]) {
        tmp = write(fd, buff, (strlen(buff) + 1));
        if (tmp <= 0)
          do {
            struct timeval now;
            gettimeofday(&now, NULL);
            fprintf(stderr,
                    "[%ld.%06ld] "
                    "E: "
                    "cant write to file: %s",
                    now.tv_sec, now.tv_usec, "/tmp/used_event_list");
          } while (0);
      }
      if (available[1] && !used[1]) {
        tmp = write(fd, &buff[strlen(buff) + 1],
                    (strlen(&buff[strlen(buff) + 1]) + 1));
        if (tmp <= 0)
          do {
            struct timeval now;
            gettimeofday(&now, NULL);
            fprintf(stderr,
                    "[%ld.%06ld] "
                    "E: "
                    "cant write to file: %s",
                    now.tv_sec, now.tv_usec, "/tmp/used_event_list");
          } while (0);
      }
    }
  } else {
    do {
      struct timeval now;
      gettimeofday(&now, NULL);
      fprintf(stderr,
              "[%ld.%06ld] "
              "E: "
              "cant open file: %s",
              now.tv_sec, now.tv_usec, "/tmp/used_event_list");
    } while (0);
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<write_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    -0x88(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%esi
mov    0x2e08(%rip),%rax
or     (%rax),%esi
lea    0xe1f(%rip),%rdi
mov    $0x180,%edx
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     12fe <write_to_file+0x16e>
mov    -0x18(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x64,%edx
call   1080 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     12f9 <write_to_file+0x169>
movsbl -0x80(%rbp),%eax
cmp    $0x2f,%eax
jne    12f4 <write_to_file+0x164>
movl   $0x1,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1269 <write_to_file+0xd9>
movl   $0x1,-0x90(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1264 <write_to_file+0xd4>
movl   $0x1,-0x4(%rbp)
jmp    1708 <write_to_file+0x578>
jmp    1269 <write_to_file+0xd9>
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x2f,%eax
jne    12ef <write_to_file+0x15f>
movl   $0x1,-0x84(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x108(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x108(%rbp),%rdi
add    $0x1,%eax
cltq
lea    -0x80(%rbp),%rsi
add    %rax,%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12ea <write_to_file+0x15a>
movl   $0x1,-0x8c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12e5 <write_to_file+0x155>
movl   $0x1,-0x4(%rbp)
jmp    1708 <write_to_file+0x578>
jmp    12ea <write_to_file+0x15a>
jmp    12ef <write_to_file+0x15f>
jmp    12f4 <write_to_file+0x164>
jmp    12f9 <write_to_file+0x169>
jmp    12fe <write_to_file+0x16e>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
mov    0x2cca(%rip),%rax
or     (%rax),%esi
lea    0xce1(%rip),%rdi
mov    $0x180,%edx
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     139f <write_to_file+0x20f>
mov    -0x18(%rbp),%edi
lea    0xcd5(%rip),%rsi
mov    $0x64,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     139a <write_to_file+0x20a>
jmp    135c <write_to_file+0x1cc>
lea    -0xa0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2c5d(%rip),%rax
mov    (%rax),%edi
mov    -0xa0(%rbp),%rdx
mov    -0x98(%rbp),%ecx
lea    0xcf1(%rip),%rsi
lea    0xc70(%rip),%r8
call   10a0 <fprintf@plt>
jmp    139a <write_to_file+0x20a>
jmp    13e2 <write_to_file+0x252>
jmp    13a4 <write_to_file+0x214>
lea    -0xb0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
mov    -0xb0(%rbp),%rdx
mov    -0xa8(%rbp),%ecx
lea    0xccf(%rip),%rsi
lea    0xc28(%rip),%r8
call   10a0 <fprintf@plt>
jmp    13e2 <write_to_file+0x252>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
mov    0x2c07(%rip),%rax
mov    (%rax),%esi
mov    0x2be6(%rip),%rax
or     (%rax),%esi
lea    0xbfd(%rip),%rdi
mov    $0x180,%edx
call   10b0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     16b6 <write_to_file+0x526>
cmpl   $0x0,-0x14(%rbp)
je     1543 <write_to_file+0x3b3>
cmpl   $0x0,-0x88(%rbp)
je     14ba <write_to_file+0x32a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x114(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x110(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x114(%rbp),%edi
mov    -0x110(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     14b5 <write_to_file+0x325>
jmp    1477 <write_to_file+0x2e7>
lea    -0xc0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2b42(%rip),%rax
mov    (%rax),%edi
mov    -0xc0(%rbp),%rdx
mov    -0xb8(%rbp),%ecx
lea    0xbd6(%rip),%rsi
lea    0xb55(%rip),%r8
call   10a0 <fprintf@plt>
jmp    14b5 <write_to_file+0x325>
jmp    14ba <write_to_file+0x32a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x124(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x124(%rbp),%edi
mov    -0x120(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     153e <write_to_file+0x3ae>
jmp    1500 <write_to_file+0x370>
lea    -0xd0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2ab9(%rip),%rax
mov    (%rax),%edi
mov    -0xd0(%rbp),%rdx
mov    -0xc8(%rbp),%ecx
lea    0xb4d(%rip),%rsi
lea    0xacc(%rip),%r8
call   10a0 <fprintf@plt>
jmp    153e <write_to_file+0x3ae>
jmp    16b1 <write_to_file+0x521>
cmpl   $0x0,-0x88(%rbp)
je     15e6 <write_to_file+0x456>
cmpl   $0x0,-0x90(%rbp)
jne    15e6 <write_to_file+0x456>
mov    -0x18(%rbp),%eax
mov    %eax,-0x134(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x130(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x134(%rbp),%edi
mov    -0x130(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     15e1 <write_to_file+0x451>
jmp    15a3 <write_to_file+0x413>
lea    -0xe0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2a16(%rip),%rax
mov    (%rax),%edi
mov    -0xe0(%rbp),%rdx
mov    -0xd8(%rbp),%ecx
lea    0xaaa(%rip),%rsi
lea    0xa29(%rip),%r8
call   10a0 <fprintf@plt>
jmp    15e1 <write_to_file+0x451>
jmp    15e6 <write_to_file+0x456>
cmpl   $0x0,-0x84(%rbp)
je     16ac <write_to_file+0x51c>
cmpl   $0x0,-0x8c(%rbp)
jne    16ac <write_to_file+0x51c>
mov    -0x18(%rbp),%eax
mov    %eax,-0x144(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rcx
lea    -0x80(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x140(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
lea    -0x80(%rbp),%rdi
add    %rax,%rdi
call   1040 <strlen@plt>
mov    -0x144(%rbp),%edi
mov    -0x140(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     16a7 <write_to_file+0x517>
jmp    1669 <write_to_file+0x4d9>
lea    -0xf0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x2950(%rip),%rax
mov    (%rax),%edi
mov    -0xf0(%rbp),%rdx
mov    -0xe8(%rbp),%ecx
lea    0x9e4(%rip),%rsi
lea    0x963(%rip),%r8
call   10a0 <fprintf@plt>
jmp    16a7 <write_to_file+0x517>
jmp    16ac <write_to_file+0x51c>
jmp    16b1 <write_to_file+0x521>
jmp    16f9 <write_to_file+0x569>
jmp    16bb <write_to_file+0x52b>
lea    -0x100(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    0x28fe(%rip),%rax
mov    (%rax),%edi
mov    -0x100(%rbp),%rdx
mov    -0xf8(%rbp),%ecx
lea    0x9b8(%rip),%rsi
lea    0x911(%rip),%r8
call   10a0 <fprintf@plt>
jmp    16f9 <write_to_file+0x569>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_file>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %esi,0x1c(%rsp)
mov    %rdi,%r15
mov    0x2e59(%rip),%r13
mov    0x2e3a(%rip),%r12
mov    (%r12),%esi
or     0x0(%r13),%esi
lea    0xe4b(%rip),%rdi
mov    $0x180,%edx
call   10a0 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     124f <write_to_file+0xcf>
lea    0x20(%rsp),%rsi
mov    %ebp,%edi
mov    $0x64,%edx
call   1070 <read@plt>
xor    %r14d,%r14d
test   %eax,%eax
js     125a <write_to_file+0xda>
mov    $0x1,%al
mov    %eax,0x4(%rsp)
cmpb   $0x2f,0x20(%rsp)
jne    1260 <write_to_file+0xe0>
lea    0x20(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     14b7 <write_to_file+0x337>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0x2f,0x1(%rax,%rbx,1)
jne    14b0 <write_to_file+0x330>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rsi
add    $0x1,%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     14ce <write_to_file+0x34e>
xor    %ebx,%ebx
movl   $0x0,0x4(%rsp)
jmp    1262 <write_to_file+0xe2>
mov    $0x1,%al
mov    %eax,0x4(%rsp)
xor    %r14d,%r14d
jmp    1260 <write_to_file+0xe0>
mov    $0x1,%al
mov    %eax,0x4(%rsp)
mov    $0x1,%bl
movl   $0x0,(%rsp)
mov    %ebp,%edi
call   1060 <close@plt>
mov    (%r12),%esi
or     0x0(%r13),%esi
lea    0xd81(%rip),%rdi
mov    $0x180,%edx
call   10a0 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     12ce <write_to_file+0x14e>
lea    0xd7e(%rip),%rsi
mov    %ebp,%edi
mov    $0x64,%edx
call   1030 <write@plt>
test   %eax,%eax
jg     12ff <write_to_file+0x17f>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xdae(%rip),%rsi
jmp    12f3 <write_to_file+0x173>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xdad(%rip),%rsi
lea    0xd06(%rip),%r8
call   1090 <fprintf@plt>
mov    %ebp,%edi
call   1060 <close@plt>
mov    (%r12),%esi
or     0x0(%r13),%esi
lea    0xceb(%rip),%rdi
mov    $0x180,%edx
call   10a0 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1399 <write_to_file+0x219>
cmpl   $0x0,0x1c(%rsp)
je     13c3 <write_to_file+0x243>
test   %bl,%bl
jne    1384 <write_to_file+0x204>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <write@plt>
test   %eax,%eax
jg     1384 <write_to_file+0x204>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xd02(%rip),%rsi
lea    0xc81(%rip),%r8
call   1090 <fprintf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %ebp,%edi
mov    %r15,%rsi
jmp    145b <write_to_file+0x2db>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2c24(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xce2(%rip),%rsi
jmp    1489 <write_to_file+0x309>
test   %r14d,%r14d
setne  %al
or     %al,%bl
jne    141c <write_to_file+0x29c>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <write@plt>
test   %eax,%eax
jg     141c <write_to_file+0x29c>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xc6a(%rip),%rsi
lea    0xbe9(%rip),%r8
call   1090 <fprintf@plt>
mov    0x4(%rsp),%eax
or     (%rsp),%al
jne    1495 <write_to_file+0x315>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%r14
add    $0x1,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rdi
add    $0x1,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edx
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <write@plt>
test   %eax,%eax
jg     1495 <write_to_file+0x315>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x2b59(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%ecx
lea    0xbf1(%rip),%rsi
lea    0xb70(%rip),%r8
call   1090 <fprintf@plt>
mov    %ebp,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    1262 <write_to_file+0xe2>
mov    $0x1,%r14d
mov    $0x1,%eax
cmpl   $0x0,0x1c(%rsp)
jne    149e <write_to_file+0x31e>
jmp    120b <write_to_file+0x8b>
mov    $0x1,%eax
cmpl   $0x0,0x1c(%rsp)
jne    149e <write_to_file+0x31e>
mov    $0x1,%al
mov    %eax,(%rsp)
xor    %ebx,%ebx
movl   $0x0,0x4(%rsp)
jmp    1269 <write_to_file+0xe9>

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

LLVM IR (-O2):
%struct.timeval = type { i8*, i32 }
@.str = [21 x i8] c"/tmp/used_event_list\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@.str.1 = [101 x i8] c" \00"
@stderr = global i32 0
@.str.2 = [38 x i8] c"[%ld.%06ld] E: cant write to file: %s\00"
@.str.3 = [34 x i8] c"[%ld.%06ld] E: cant open file: %s\00"
define i32 @write_to_file(i8* %0, i32 %1) {
%3 = alloca [100 x i8]
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca %struct.timeval
%9 = alloca %struct.timeval
%10 = alloca %struct.timeval
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* @O_CREAT
%13 = load i32, i32* @O_RDWR
%14 = or i32 %13, %12
%15 = tail call i32 @open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %14, i32 384)
%16 = icmp eq i32 %15, -1
br i1 %16, label %45, label %17
17: ; preds = %2
%18 = call i32 @read(i32 %15, i8* %11, i32 100)
%19 = icmp sgt i32 %18, -1
%20 = load i8, i8* %11
%21 = icmp eq i8 %20, 47
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %23, label %45
23: ; preds = %17
%24 = call i64 @strcmp(i8* %0, i8* %11)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = icmp eq i32 %1, 0
br i1 %27, label %28, label %167
28: ; preds = %26, %23
%29 = phi i32 [ 1, %26 ], [ 0, %23 ]
%30 = call i32 @strlen(i8* %11)
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 47
br i1 %35, label %36, label %45
36: ; preds = %28
%37 = call i32 @strlen(i8* %11)
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %39
%41 = call i64 @strcmp(i8* %0, i8* %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = icmp eq i32 %1, 0
br i1 %44, label %45, label %167
45: ; preds = %17, %28, %43, %36, %2
%46 = phi i1 [ true, %17 ], [ false, %28 ], [ false, %43 ], [ false, %36 ], [ true, %2 ]
%47 = phi i1 [ true, %17 ], [ true, %28 ], [ false, %43 ], [ false, %36 ], [ true, %2 ]
%48 = phi i32 [ 0, %17 ], [ %29, %28 ], [ %29, %43 ], [ %29, %36 ], [ 0, %2 ]
%49 = phi i1 [ false, %17 ], [ false, %28 ], [ true, %43 ], [ false, %36 ], [ false, %2 ]
%50 = call i32 @close(i32 %15)
%51 = load i32, i32* @O_CREAT
%52 = load i32, i32* @O_RDWR
%53 = or i32 %52, %51
%54 = call i32 @open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %53, i32 384)
%55 = icmp eq i32 %54, -1
br i1 %55, label %68, label %56
56: ; preds = %45
%57 = call i32 @write(i32 %54, i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.1, i64 0, i64 0), i32 100)
%58 = icmp slt i32 %57, 1
br i1 %58, label %59, label %77
59: ; preds = %56
%60 = bitcast %struct.timeval* %4 to i8*
%61 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%62 = load i32, i32* @stderr
%63 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%64 = load i8*, i8** %63
%65 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%66 = load i32, i32* %65
%67 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %64, i32 %66, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %77
68: ; preds = %45
%69 = bitcast %struct.timeval* %5 to i8*
%70 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%71 = load i32, i32* @stderr
%72 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%73 = load i8*, i8** %72
%74 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%75 = load i32, i32* %74
%76 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %73, i32 %75, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %77
77: ; preds = %56, %59, %68
%78 = call i32 @close(i32 %54)
%79 = load i32, i32* @O_CREAT
%80 = load i32, i32* @O_RDWR
%81 = or i32 %80, %79
%82 = call i32 @open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %81, i32 384)
%83 = icmp eq i32 %82, -1
br i1 %83, label %156, label %84
84: ; preds = %77
%85 = icmp eq i32 %1, 0
br i1 %85, label %115, label %86
86: ; preds = %84
br i1 %46, label %101, label %87
87: ; preds = %86
%88 = call i32 @strlen(i8* %11)
%89 = add nsw i32 %88, 1
%90 = call i32 @write(i32 %82, i8* %11, i32 %89)
%91 = icmp slt i32 %90, 1
br i1 %91, label %92, label %101
92: ; preds = %87
%93 = bitcast %struct.timeval* %6 to i8*
%94 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%95 = load i32, i32* @stderr
%96 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%97 = load i8*, i8** %96
%98 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%99 = load i32, i32* %98
%100 = call i32 @fprintf(i32 %95, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %97, i32 %99, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %101
101: ; preds = %87, %92, %86
%102 = call i32 @strlen(i8* %0)
%103 = add nsw i32 %102, 1
%104 = call i32 @write(i32 %82, i8* %0, i32 %103)
%105 = icmp slt i32 %104, 1
br i1 %105, label %106, label %165
106: ; preds = %101
%107 = bitcast %struct.timeval* %7 to i8*
%108 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%109 = load i32, i32* @stderr
%110 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 0
%111 = load i8*, i8** %110
%112 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i64 0, i32 1
%113 = load i32, i32* %112
%114 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %111, i32 %113, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %165
115: ; preds = %84
%116 = icmp ne i32 %48, 0
%117 = or i1 %46, %116
br i1 %117, label %132, label %118
118: ; preds = %115
%119 = call i32 @strlen(i8* %11)
%120 = add nsw i32 %119, 1
%121 = call i32 @write(i32 %82, i8* %11, i32 %120)
%122 = icmp slt i32 %121, 1
br i1 %122, label %123, label %132
123: ; preds = %118
%124 = bitcast %struct.timeval* %8 to i8*
%125 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
%126 = load i32, i32* @stderr
%127 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 0
%128 = load i8*, i8** %127
%129 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i64 0, i32 1
%130 = load i32, i32* %129
%131 = call i32 @fprintf(i32 %126, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %128, i32 %130, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %132
132: ; preds = %118, %123, %115
%133 = or i1 %47, %49
br i1 %133, label %165, label %134
134: ; preds = %132
%135 = call i32 @strlen(i8* %11)
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %137
%139 = call i32 @strlen(i8* %11)
%140 = add nsw i32 %139, 1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %141
%143 = call i32 @strlen(i8* %142)
%144 = add nsw i32 %143, 1
%145 = call i32 @write(i32 %82, i8* %138, i32 %144)
%146 = icmp slt i32 %145, 1
br i1 %146, label %147, label %165
147: ; preds = %134
%148 = bitcast %struct.timeval* %9 to i8*
%149 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%150 = load i32, i32* @stderr
%151 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 0
%152 = load i8*, i8** %151
%153 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i64 0, i32 1
%154 = load i32, i32* %153
%155 = call i32 @fprintf(i32 %150, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %152, i32 %154, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %165
156: ; preds = %77
%157 = bitcast %struct.timeval* %10 to i8*
%158 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%159 = load i32, i32* @stderr
%160 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 0
%161 = load i8*, i8** %160
%162 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0, i32 1
%163 = load i32, i32* %162
%164 = call i32 @fprintf(i32 %159, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %161, i32 %163, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %165
165: ; preds = %106, %101, %134, %147, %132, %156
%166 = call i32 @close(i32 %82)
br label %167
167: ; preds = %43, %26, %165
%168 = phi i32 [ 0, %165 ], [ 1, %26 ], [ 1, %43 ]
ret i32 %168
}