#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 fast_log_buf {
  int dummy;
};
typedef int /*<<< orphan*/ fname;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
scalar_t__ EINTR;
int O_CREAT;
int O_RDWR;
int O_TRUNC;
int PATH_MAX;
int close(int);
int /*<<< orphan*/ create_some_logs(struct fast_log_buf *, int);
scalar_t__ errno;
struct fast_log_buf *fast_log_create(char *);
int /*<<< orphan*/ fast_log_destroy(struct fast_log_buf *);
int fast_log_dump_all(struct fast_log_buf *, int);
int fast_log_register_buffer(struct fast_log_buf *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ free(char *);
char *linearray_to_str(char const **);
int open(char *, int, int);
scalar_t__ simple_io_read_whole_file_zt(char *, char *, int);
int /*<<< orphan*/ stderr;
int strcmp(char *, char *);
int zsnprintf(char *, int, char *, char const *);
int test_dump_all(const char *tdir) {
  char fname[PATH_MAX];
  char *expected, buf[4096] = {0};
  const char *expected_lines[] = {"*** FASTLOG one",
                                  "foo=0x1, bar=0x2, bar=0x3",
                                  "foo=0x10, bar=0x20, bar=0x30",
                                  "blah blah",
                                  "*** FASTLOG two",
                                  "foo=0x1, bar=0x2, bar=0x3",
                                  "foo=0x10, bar=0x20, bar=0x30",
                                  "blah blah",
                                  "*** FASTLOG three",
                                  "foo=0x1, bar=0x2, bar=0x3",
                                  "foo=0x10, bar=0x20, bar=0x30",
                                  "blah blah",
                                  NULL};
  struct fast_log_buf *scratch, *one, *two, *three;
  int res, fd;
  scratch = fast_log_create("scratch");
  do {
    if (scratch == NULL) {
      fprintf(stderr, "failed on line %d: %s\n", 221, "scratch");
      return 1;
    }
  } while (0);
  ;
  one = fast_log_create("one");
  do {
    if (one == NULL) {
      fprintf(stderr, "failed on line %d: %s\n", 223, "one");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = fast_log_register_buffer(one);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 224,
              "fast_log_register_buffer(one)");
      return __my_ret__;
    }
  } while (0);
  ;
  two = fast_log_create("two");
  do {
    if (two == NULL) {
      fprintf(stderr, "failed on line %d: %s\n", 226, "two");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = fast_log_register_buffer(two);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 227,
              "fast_log_register_buffer(two)");
      return __my_ret__;
    }
  } while (0);
  ;
  three = fast_log_create("three");
  do {
    if (three == NULL) {
      fprintf(stderr, "failed on line %d: %s\n", 229, "three");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = fast_log_register_buffer(three);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 230,
              "fast_log_register_buffer(three)");
      return __my_ret__;
    }
  } while (0);
  ;
  create_some_logs(one, 1);
  create_some_logs(two, 1);
  create_some_logs(three, 1);
  do {
    int __my_ret__ = zsnprintf(fname, sizeof(fname), "%s/all", tdir);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 236,
              "zsnprintf(fname, sizeof(fname), \"%s/all\", tdir)");
      return __my_ret__;
    }
  } while (0);
  ;
  fd = open(fname, O_CREAT | O_TRUNC | O_RDWR, 0644);
  do {
    if (fd < 0) {
      fprintf(stderr, "failed on line %d: %s\n", 238, "fd");
      return 1;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = fast_log_dump_all(scratch, fd);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 239,
              "fast_log_dump_all(scratch, fd)");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    res = close(fd);
  } while ((res == -1) && (errno == EINTR));
  ;
  fast_log_destroy(one);
  fast_log_destroy(two);
  fast_log_destroy(three);
  fast_log_destroy(scratch);
  do {
    if (simple_io_read_whole_file_zt(fname, buf, sizeof(buf)) <= 0) {
      fprintf(stderr, "failed on line %d: %s\n", 246,
              "simple_io_read_whole_file_zt(fname, buf, sizeof(buf))");
      return 1;
    }
  } while (0);
  ;
  expected = linearray_to_str(expected_lines);
  do {
    int __my_ret__ = strcmp(buf, expected);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 249, "strcmp(buf, expected)");
      return __my_ret__;
    }
  } while (0);
  ;
  free(expected);
  return 0;
}


x86 assembly (clang, -O0):
<test_dump_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1100,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x10f8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x10f0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
lea    -0x10a0(%rbp),%rdi
lea    0x2b2a(%rip),%rsi
mov    $0x68,%edx
call   10e0 <memcpy@plt>
lea    0xe0c(%rip),%rdi
call   1060 <fast_log_create@plt>
mov    %rax,-0x10a8(%rbp)
cmpq   $0x0,-0x10a8(%rbp)
jne    12b8 <test_dump_all+0xc8>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
mov    $0xdd,%edx
lea    0xdd6(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    12bd <test_dump_all+0xcd>
jmp    12c2 <test_dump_all+0xd2>
lea    0xd43(%rip),%rdi
call   1060 <fast_log_create@plt>
mov    %rax,-0x10b0(%rbp)
cmpq   $0x0,-0x10b0(%rbp)
jne    131a <test_dump_all+0x12a>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
lea    0xd88(%rip),%rsi
mov    $0xdf,%edx
lea    0xd0d(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    131f <test_dump_all+0x12f>
jmp    1324 <test_dump_all+0x134>
jmp    1329 <test_dump_all+0x139>
mov    -0x10b0(%rbp),%rdi
call   1040 <fast_log_register_buffer@plt>
mov    %eax,-0x10d0(%rbp)
cmpl   $0x0,-0x10d0(%rbp)
je     1381 <test_dump_all+0x191>
mov    0x2c71(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
mov    $0xe0,%edx
lea    0xd2e(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10d0(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    1386 <test_dump_all+0x196>
jmp    138b <test_dump_all+0x19b>
lea    0xccb(%rip),%rdi
call   1060 <fast_log_create@plt>
mov    %rax,-0x10b8(%rbp)
cmpq   $0x0,-0x10b8(%rbp)
jne    13e3 <test_dump_all+0x1f3>
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xcbf(%rip),%rsi
mov    $0xe2,%edx
lea    0xc95(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    13e8 <test_dump_all+0x1f8>
jmp    13ed <test_dump_all+0x1fd>
jmp    13f2 <test_dump_all+0x202>
mov    -0x10b8(%rbp),%rdi
call   1040 <fast_log_register_buffer@plt>
mov    %eax,-0x10d4(%rbp)
cmpl   $0x0,-0x10d4(%rbp)
je     144a <test_dump_all+0x25a>
mov    0x2ba8(%rip),%rax
mov    (%rax),%edi
lea    0xc5a(%rip),%rsi
mov    $0xe3,%edx
lea    0xc83(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10d4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    144f <test_dump_all+0x25f>
jmp    1454 <test_dump_all+0x264>
lea    0xc12(%rip),%rdi
call   1060 <fast_log_create@plt>
mov    %rax,-0x10c0(%rbp)
cmpq   $0x0,-0x10c0(%rbp)
jne    14ac <test_dump_all+0x2bc>
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
lea    0xbf6(%rip),%rsi
mov    $0xe5,%edx
lea    0xbdc(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    14b1 <test_dump_all+0x2c1>
jmp    14b6 <test_dump_all+0x2c6>
jmp    14bb <test_dump_all+0x2cb>
mov    -0x10c0(%rbp),%rdi
call   1040 <fast_log_register_buffer@plt>
mov    %eax,-0x10d8(%rbp)
cmpl   $0x0,-0x10d8(%rbp)
je     1513 <test_dump_all+0x323>
mov    0x2adf(%rip),%rax
mov    (%rax),%edi
lea    0xb91(%rip),%rsi
mov    $0xe6,%edx
lea    0xbd8(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10d8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    1518 <test_dump_all+0x328>
jmp    151d <test_dump_all+0x32d>
mov    -0x10b0(%rbp),%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
mov    -0x10b8(%rbp),%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
mov    -0x10c0(%rbp),%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
mov    -0x10f0(%rbp),%rdi
mov    -0x10f8(%rbp),%rax
mov    %eax,%esi
mov    -0x10(%rbp),%rcx
lea    0xb83(%rip),%rdx
call   10f0 <zsnprintf@plt>
mov    %eax,-0x10dc(%rbp)
cmpl   $0x0,-0x10dc(%rbp)
je     15bc <test_dump_all+0x3cc>
mov    0x2a36(%rip),%rax
mov    (%rax),%edi
lea    0xae8(%rip),%rsi
mov    $0xec,%edx
lea    0xb56(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10dc(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    15c1 <test_dump_all+0x3d1>
jmp    15c6 <test_dump_all+0x3d6>
mov    -0x10f0(%rbp),%rdi
mov    0x2a24(%rip),%rax
mov    (%rax),%esi
mov    0x2a13(%rip),%rax
or     (%rax),%esi
mov    0x29ea(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   1100 <open@plt>
mov    %eax,-0x10c8(%rbp)
cmpl   $0x0,-0x10c8(%rbp)
jge    163c <test_dump_all+0x44c>
mov    0x29b4(%rip),%rax
mov    (%rax),%edi
lea    0xa66(%rip),%rsi
mov    $0xee,%edx
lea    0xb04(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    1641 <test_dump_all+0x451>
jmp    1646 <test_dump_all+0x456>
jmp    164b <test_dump_all+0x45b>
mov    -0x10a8(%rbp),%rdi
mov    -0x10c8(%rbp),%esi
call   1070 <fast_log_dump_all@plt>
mov    %eax,-0x10e0(%rbp)
cmpl   $0x0,-0x10e0(%rbp)
je     16a9 <test_dump_all+0x4b9>
mov    0x2949(%rip),%rax
mov    (%rax),%edi
lea    0x9fb(%rip),%rsi
mov    $0xef,%edx
lea    0xa9c(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10e0(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    16ae <test_dump_all+0x4be>
jmp    16b3 <test_dump_all+0x4c3>
jmp    16b8 <test_dump_all+0x4c8>
mov    -0x10c8(%rbp),%edi
call   10b0 <close@plt>
mov    %eax,-0x10c4(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0x10c4(%rbp)
mov    %al,-0x10f9(%rbp)
jne    16fb <test_dump_all+0x50b>
mov    0x28d3(%rip),%rax
mov    (%rax),%rax
mov    0x28c1(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x10f9(%rbp)
mov    -0x10f9(%rbp),%al
test   $0x1,%al
jne    16b8 <test_dump_all+0x4c8>
mov    -0x10b0(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x10b8(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x10c0(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x10a8(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x10f0(%rbp),%rdi
lea    -0x1030(%rbp),%rsi
mov    $0x1000,%edx
call   1090 <simple_io_read_whole_file_zt@plt>
cmp    $0x0,%rax
jg     1792 <test_dump_all+0x5a2>
mov    0x285e(%rip),%rax
mov    (%rax),%edi
lea    0x910(%rip),%rsi
mov    $0xf6,%edx
lea    0x9d0(%rip),%rcx
call   10d0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    1797 <test_dump_all+0x5a7>
jmp    179c <test_dump_all+0x5ac>
lea    -0x10a0(%rbp),%rdi
call   1110 <linearray_to_str@plt>
mov    %rax,-0x28(%rbp)
lea    -0x1030(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10c0 <strcmp@plt>
mov    %eax,-0x10e4(%rbp)
cmpl   $0x0,-0x10e4(%rbp)
je     1808 <test_dump_all+0x618>
mov    0x27ea(%rip),%rax
mov    (%rax),%edi
lea    0x89c(%rip),%rsi
mov    $0xf9,%edx
lea    0x992(%rip),%rcx
call   10d0 <fprintf@plt>
mov    -0x10e4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
jmp    182c <test_dump_all+0x63c>
jmp    180d <test_dump_all+0x61d>
jmp    1812 <test_dump_all+0x622>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10cc(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dump_all>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1088,%rsp
mov    %rdi,%r15
mov    0x2de2(%rip),%rax
mov    (%rax),%r13d
mov    %rsp,%rbx
lea    0xf(%r13),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x10b0(%rbp),%rdi
mov    $0x1000,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
mov    0x2bb4(%rip),%rax
mov    %rax,-0x50(%rbp)
movaps 0x2b99(%rip),%xmm0
movaps %xmm0,-0x60(%rbp)
movaps 0x2b7e(%rip),%xmm0
movaps %xmm0,-0x70(%rbp)
movaps 0x2b63(%rip),%xmm0
movaps %xmm0,-0x80(%rbp)
movaps 0x2b48(%rip),%xmm0
movaps %xmm0,-0x90(%rbp)
movaps 0x2b2a(%rip),%xmm0
movaps %xmm0,-0xa0(%rbp)
movaps 0x2b0c(%rip),%xmm0
movaps %xmm0,-0xb0(%rbp)
lea    0xdf1(%rip),%rdi
call   1060 <fast_log_create@plt>
test   %rax,%rax
je     12d9 <test_dump_all+0xf9>
mov    %rax,%r14
lea    0xd76(%rip),%rdi
call   1060 <fast_log_create@plt>
test   %rax,%rax
je     12f7 <test_dump_all+0x117>
mov    %rax,%r12
mov    %r15,-0x40(%rbp)
mov    %rax,%rdi
call   1040 <fast_log_register_buffer@plt>
test   %eax,%eax
je     1330 <test_dump_all+0x150>
mov    %eax,%r15d
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
lea    0xdc5(%rip),%rcx
mov    $0xe0,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
lea    0xd83(%rip),%rcx
mov    $0xdd,%edx
jmp    1313 <test_dump_all+0x133>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
lea    0xd74(%rip),%rsi
lea    0xcfe(%rip),%rcx
mov    $0xdf,%edx
call   10d0 <fprintf@plt>
mov    $0x1,%r15d
mov    %r15d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd26(%rip),%rdi
call   1060 <fast_log_create@plt>
test   %rax,%rax
je     1377 <test_dump_all+0x197>
mov    %rax,%rdi
mov    %rax,-0x38(%rbp)
call   1040 <fast_log_register_buffer@plt>
test   %eax,%eax
je     1398 <test_dump_all+0x1b8>
mov    %eax,%r15d
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
lea    0xd17(%rip),%rsi
lea    0xd45(%rip),%rcx
mov    $0xe3,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    0xcf4(%rip),%rsi
lea    0xccf(%rip),%rcx
mov    $0xe2,%edx
jmp    1313 <test_dump_all+0x133>
lea    0xcce(%rip),%rdi
call   1060 <fast_log_create@plt>
test   %rax,%rax
je     13e2 <test_dump_all+0x202>
mov    %rax,%rdi
mov    %rax,-0x30(%rbp)
call   1040 <fast_log_register_buffer@plt>
test   %eax,%eax
je     1403 <test_dump_all+0x223>
mov    %eax,%r15d
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
lea    0xcaf(%rip),%rsi
lea    0xcfb(%rip),%rcx
mov    $0xe6,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
lea    0xc89(%rip),%rsi
lea    0xc74(%rip),%rcx
mov    $0xe5,%edx
jmp    1313 <test_dump_all+0x133>
mov    %r12,%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
mov    -0x30(%rbp),%rdi
mov    $0x1,%esi
call   1080 <create_some_logs@plt>
lea    0xcbb(%rip),%rdx
mov    %rbx,%rdi
mov    %r13d,%esi
mov    -0x40(%rbp),%rcx
call   10e0 <zsnprintf@plt>
test   %eax,%eax
je     146f <test_dump_all+0x28f>
mov    %eax,%r15d
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
lea    0xc22(%rip),%rsi
lea    0xc95(%rip),%rcx
mov    $0xec,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2b82(%rip),%rax
mov    0x2b73(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2b48(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
mov    $0x1a4,%edx
call   10f0 <open@plt>
test   %eax,%eax
js     14d5 <test_dump_all+0x2f5>
mov    %eax,%r13d
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <fast_log_dump_all@plt>
test   %eax,%eax
je     14f6 <test_dump_all+0x316>
mov    %eax,%r15d
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
lea    0xbbc(%rip),%rsi
lea    0xc62(%rip),%rcx
mov    $0xef,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2ae4(%rip),%rax
mov    (%rax),%edi
lea    0xb96(%rip),%rsi
lea    0xc39(%rip),%rcx
mov    $0xee,%edx
jmp    1313 <test_dump_all+0x133>
mov    0x2ab3(%rip),%r15
mov    %r13d,%edi
call   10b0 <close@plt>
cmp    $0xffffffff,%eax
jne    1519 <test_dump_all+0x339>
mov    (%r15),%rax
mov    0x2aa4(%rip),%rcx
cmp    %rax,(%rcx)
je     14fd <test_dump_all+0x31d>
mov    %r12,%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x38(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    -0x30(%rbp),%rdi
call   1050 <fast_log_destroy@plt>
mov    %r14,%rdi
call   1050 <fast_log_destroy@plt>
lea    -0x10b0(%rbp),%rsi
mov    %rbx,%rdi
mov    $0x1000,%edx
call   1090 <simple_io_read_whole_file_zt@plt>
test   %rax,%rax
jle    159f <test_dump_all+0x3bf>
lea    -0xb0(%rbp),%rdi
call   1100 <linearray_to_str@plt>
mov    %rax,%rbx
lea    -0x10b0(%rbp),%rdi
mov    %rax,%rsi
call   10c0 <strcmp@plt>
test   %eax,%eax
je     15c0 <test_dump_all+0x3e0>
mov    %eax,%r15d
mov    0x2a40(%rip),%rax
mov    (%rax),%edi
lea    0xaf2(%rip),%rsi
lea    0xbed(%rip),%rcx
mov    $0xf9,%edx
call   10d0 <fprintf@plt>
jmp    131e <test_dump_all+0x13e>
mov    0x2a1a(%rip),%rax
mov    (%rax),%edi
lea    0xacc(%rip),%rsi
lea    0xb91(%rip),%rcx
mov    $0xf6,%edx
jmp    1313 <test_dump_all+0x133>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %r15d,%r15d
jmp    131e <test_dump_all+0x13e>

LLVM IR (-O0):
%struct.fast_log_buf = type { i32 }
@PATH_MAX = global i32 0
@.str = [16 x i8] c"*** FASTLOG one\00"
@.str.1 = [26 x i8] c"foo=0x1, bar=0x2, bar=0x3\00"
@.str.2 = [29 x i8] c"foo=0x10, bar=0x20, bar=0x30\00"
@.str.3 = [10 x i8] c"blah blah\00"
@.str.4 = [16 x i8] c"*** FASTLOG two\00"
@.str.5 = [18 x i8] c"*** FASTLOG three\00"
@__const.test_dump_all.expected_lines = [13 x i8*] [i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* null]
@.str.6 = [8 x i8] c"scratch\00"
@stderr = global i32 0
@.str.7 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.8 = [4 x i8] c"one\00"
@.str.9 = [30 x i8] c"fast_log_register_buffer(one)\00"
@.str.10 = [4 x i8] c"two\00"
@.str.11 = [30 x i8] c"fast_log_register_buffer(two)\00"
@.str.12 = [6 x i8] c"three\00"
@.str.13 = [32 x i8] c"fast_log_register_buffer(three)\00"
@.str.14 = [7 x i8] c"%s/all\00"
@.str.15 = [48 x i8] c"zsnprintf(fname, sizeof(fname), \22%s/all\22, tdir)\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_RDWR = global i32 0
@.str.16 = [3 x i8] c"fd\00"
@.str.17 = [31 x i8] c"fast_log_dump_all(scratch, fd)\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.18 = [54 x i8] c"simple_io_read_whole_file_zt(fname, buf, sizeof(buf))\00"
@.str.19 = [22 x i8] c"strcmp(buf, expected)\00"
define i32 @test_dump_all(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca [4096 x i8]
%8 = alloca [13 x i8*]
%9 = alloca %struct.fast_log_buf*
%10 = alloca %struct.fast_log_buf*
%11 = alloca %struct.fast_log_buf*
%12 = alloca %struct.fast_log_buf*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i8* %0, i8** %3
%22 = load i32, i32* @PATH_MAX
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %4
%25 = alloca i8, i64 %23
store i64 %23, i64* %5
%26 = bitcast [4096 x i8]* %7 to i8*
%27 = bitcast [13 x i8*]* %8 to i8*
%28 = call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store %struct.fast_log_buf* %28, %struct.fast_log_buf** %9
br label %29
29: ; preds = %1
%30 = load %struct.fast_log_buf*, %struct.fast_log_buf** %9
%31 = icmp eq %struct.fast_log_buf* %30, null
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 221, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
35: ; preds = %29
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
%38 = call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
store %struct.fast_log_buf* %38, %struct.fast_log_buf** %10
br label %39
39: ; preds = %37
%40 = load %struct.fast_log_buf*, %struct.fast_log_buf** %10
%41 = icmp eq %struct.fast_log_buf* %40, null
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 223, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
45: ; preds = %39
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47
%49 = load %struct.fast_log_buf*, %struct.fast_log_buf** %10
%50 = call i32 @fast_log_register_buffer(%struct.fast_log_buf* %49)
store i32 %50, i32* %16
%51 = load i32, i32* %16
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 224, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
%56 = load i32, i32* %16
store i32 %56, i32* %2
store i32 1, i32* %15
br label %199
57: ; preds = %48
br label %58
58: ; preds = %57
br label %59
59: ; preds = %58
%60 = call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
store %struct.fast_log_buf* %60, %struct.fast_log_buf** %11
br label %61
61: ; preds = %59
%62 = load %struct.fast_log_buf*, %struct.fast_log_buf** %11
%63 = icmp eq %struct.fast_log_buf* %62, null
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* @stderr
%66 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 226, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
67: ; preds = %61
br label %68
68: ; preds = %67
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
%71 = load %struct.fast_log_buf*, %struct.fast_log_buf** %11
%72 = call i32 @fast_log_register_buffer(%struct.fast_log_buf* %71)
store i32 %72, i32* %17
%73 = load i32, i32* %17
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %70
%76 = load i32, i32* @stderr
%77 = call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 227, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
%78 = load i32, i32* %17
store i32 %78, i32* %2
store i32 1, i32* %15
br label %199
79: ; preds = %70
br label %80
80: ; preds = %79
br label %81
81: ; preds = %80
%82 = call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
store %struct.fast_log_buf* %82, %struct.fast_log_buf** %12
br label %83
83: ; preds = %81
%84 = load %struct.fast_log_buf*, %struct.fast_log_buf** %12
%85 = icmp eq %struct.fast_log_buf* %84, null
br i1 %85, label %86, label %89
86: ; preds = %83
%87 = load i32, i32* @stderr
%88 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 229, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
89: ; preds = %83
br label %90
90: ; preds = %89
br label %91
91: ; preds = %90
br label %92
92: ; preds = %91
%93 = load %struct.fast_log_buf*, %struct.fast_log_buf** %12
%94 = call i32 @fast_log_register_buffer(%struct.fast_log_buf* %93)
store i32 %94, i32* %18
%95 = load i32, i32* %18
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %92
%98 = load i32, i32* @stderr
%99 = call i32 @fprintf(i32 %98, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 230, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%100 = load i32, i32* %18
store i32 %100, i32* %2
store i32 1, i32* %15
br label %199
101: ; preds = %92
br label %102
102: ; preds = %101
br label %103
103: ; preds = %102
%104 = load %struct.fast_log_buf*, %struct.fast_log_buf** %10
%105 = call i32 @create_some_logs(%struct.fast_log_buf* %104, i32 1)
%106 = load %struct.fast_log_buf*, %struct.fast_log_buf** %11
%107 = call i32 @create_some_logs(%struct.fast_log_buf* %106, i32 1)
%108 = load %struct.fast_log_buf*, %struct.fast_log_buf** %12
%109 = call i32 @create_some_logs(%struct.fast_log_buf* %108, i32 1)
br label %110
110: ; preds = %103
%111 = trunc i64 %23 to i32
%112 = load i8*, i8** %3
%113 = call i32 @zsnprintf(i8* %25, i32 %111, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %112)
store i32 %113, i32* %19
%114 = load i32, i32* %19
%115 = icmp ne i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %110
%117 = load i32, i32* @stderr
%118 = call i32 @fprintf(i32 %117, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 236, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.15, i64 0, i64 0))
%119 = load i32, i32* %19
store i32 %119, i32* %2
store i32 1, i32* %15
br label %199
120: ; preds = %110
br label %121
121: ; preds = %120
br label %122
122: ; preds = %121
%123 = load i32, i32* @O_CREAT
%124 = load i32, i32* @O_TRUNC
%125 = or i32 %123, %124
%126 = load i32, i32* @O_RDWR
%127 = or i32 %125, %126
%128 = call i32 @open(i8* %25, i32 %127, i32 420)
store i32 %128, i32* %14
br label %129
129: ; preds = %122
%130 = load i32, i32* %14
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %135
132: ; preds = %129
%133 = load i32, i32* @stderr
%134 = call i32 @fprintf(i32 %133, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 238, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
135: ; preds = %129
br label %136
136: ; preds = %135
br label %137
137: ; preds = %136
br label %138
138: ; preds = %137
%139 = load %struct.fast_log_buf*, %struct.fast_log_buf** %9
%140 = load i32, i32* %14
%141 = call i32 @fast_log_dump_all(%struct.fast_log_buf* %139, i32 %140)
store i32 %141, i32* %20
%142 = load i32, i32* %20
%143 = icmp ne i32 %142, 0
br i1 %143, label %144, label %148
144: ; preds = %138
%145 = load i32, i32* @stderr
%146 = call i32 @fprintf(i32 %145, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 239, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0))
%147 = load i32, i32* %20
store i32 %147, i32* %2
store i32 1, i32* %15
br label %199
148: ; preds = %138
br label %149
149: ; preds = %148
br label %150
150: ; preds = %149
br label %151
151: ; preds = %161, %150
%152 = load i32, i32* %14
%153 = call i32 @close(i32 %152)
store i32 %153, i32* %13
br label %154
154: ; preds = %151
%155 = load i32, i32* %13
%156 = icmp eq i32 %155, -1
br i1 %156, label %157, label %161
157: ; preds = %154
%158 = load i64, i64* @errno
%159 = load i64, i64* @EINTR
%160 = icmp eq i64 %158, %159
br label %161
161: ; preds = %157, %154
%162 = phi i1 [ false, %154 ], [ %160, %157 ]
br i1 %162, label %151, label %163
163: ; preds = %161
%164 = load %struct.fast_log_buf*, %struct.fast_log_buf** %10
%165 = call i32 @fast_log_destroy(%struct.fast_log_buf* %164)
%166 = load %struct.fast_log_buf*, %struct.fast_log_buf** %11
%167 = call i32 @fast_log_destroy(%struct.fast_log_buf* %166)
%168 = load %struct.fast_log_buf*, %struct.fast_log_buf** %12
%169 = call i32 @fast_log_destroy(%struct.fast_log_buf* %168)
%170 = load %struct.fast_log_buf*, %struct.fast_log_buf** %9
%171 = call i32 @fast_log_destroy(%struct.fast_log_buf* %170)
br label %172
172: ; preds = %163
%173 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%174 = call i64 @simple_io_read_whole_file_zt(i8* %25, i8* %173, i32 4096)
%175 = icmp sle i64 %174, 0
br i1 %175, label %176, label %179
176: ; preds = %172
%177 = load i32, i32* @stderr
%178 = call i32 @fprintf(i32 %177, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 246, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.18, i64 0, i64 0))
store i32 1, i32* %2
store i32 1, i32* %15
br label %199
179: ; preds = %172
br label %180
180: ; preds = %179
br label %181
181: ; preds = %180
%182 = getelementptr inbounds [13 x i8*], [13 x i8*]* %8, i64 0, i64 0
%183 = call i8* @linearray_to_str(i8** %182)
store i8* %183, i8** %6
br label %184
184: ; preds = %181
%185 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%186 = load i8*, i8** %6
%187 = call i32 @strcmp(i8* %185, i8* %186)
store i32 %187, i32* %21
%188 = load i32, i32* %21
%189 = icmp ne i32 %188, 0
br i1 %189, label %190, label %194
190: ; preds = %184
%191 = load i32, i32* @stderr
%192 = call i32 @fprintf(i32 %191, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 249, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0))
%193 = load i32, i32* %21
store i32 %193, i32* %2
store i32 1, i32* %15
br label %199
194: ; preds = %184
br label %195
195: ; preds = %194
br label %196
196: ; preds = %195
%197 = load i8*, i8** %6
%198 = call i32 @free(i8* %197)
store i32 0, i32* %2
store i32 1, i32* %15
br label %199
199: ; preds = %196, %190, %176, %144, %132, %116, %97, %86, %75, %64, %53, %42, %32
%200 = load i8*, i8** %4
%201 = load i32, i32* %2
ret i32 %201
}

LLVM IR (-O2):
%struct.fast_log_buf = type { i32 }
@PATH_MAX = global i32 0
@.str = [16 x i8] c"*** FASTLOG one\00"
@.str.1 = [26 x i8] c"foo=0x1, bar=0x2, bar=0x3\00"
@.str.2 = [29 x i8] c"foo=0x10, bar=0x20, bar=0x30\00"
@.str.3 = [10 x i8] c"blah blah\00"
@.str.4 = [16 x i8] c"*** FASTLOG two\00"
@.str.5 = [18 x i8] c"*** FASTLOG three\00"
@__const.test_dump_all.expected_lines = [13 x i8*] [i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* null]
@.str.6 = [8 x i8] c"scratch\00"
@stderr = global i32 0
@.str.7 = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.8 = [4 x i8] c"one\00"
@.str.9 = [30 x i8] c"fast_log_register_buffer(one)\00"
@.str.10 = [4 x i8] c"two\00"
@.str.11 = [30 x i8] c"fast_log_register_buffer(two)\00"
@.str.12 = [6 x i8] c"three\00"
@.str.13 = [32 x i8] c"fast_log_register_buffer(three)\00"
@.str.14 = [7 x i8] c"%s/all\00"
@.str.15 = [48 x i8] c"zsnprintf(fname, sizeof(fname), \22%s/all\22, tdir)\00"
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@O_RDWR = global i32 0
@.str.16 = [3 x i8] c"fd\00"
@.str.17 = [31 x i8] c"fast_log_dump_all(scratch, fd)\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.18 = [54 x i8] c"simple_io_read_whole_file_zt(fname, buf, sizeof(buf))\00"
@.str.19 = [22 x i8] c"strcmp(buf, expected)\00"
define i32 @test_dump_all(i8* %0) {
%2 = alloca [4096 x i8]
%3 = alloca [13 x i8*]
%4 = load i32, i32* @PATH_MAX
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%8 = bitcast [13 x i8*]* %3 to i8*
%9 = tail call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%10 = icmp eq %struct.fast_log_buf* %9, null
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 221, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %103
14: ; preds = %1
%15 = tail call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%16 = icmp eq %struct.fast_log_buf* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 223, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %103
20: ; preds = %14
%21 = tail call i32 @fast_log_register_buffer(%struct.fast_log_buf* %15)
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = tail call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 224, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %103
26: ; preds = %20
%27 = tail call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%28 = icmp eq %struct.fast_log_buf* %27, null
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 226, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %103
32: ; preds = %26
%33 = tail call i32 @fast_log_register_buffer(%struct.fast_log_buf* %27)
%34 = icmp eq i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 227, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
br label %103
38: ; preds = %32
%39 = tail call %struct.fast_log_buf* @fast_log_create(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%40 = icmp eq %struct.fast_log_buf* %39, null
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* @stderr
%43 = tail call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 229, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
br label %103
44: ; preds = %38
%45 = tail call i32 @fast_log_register_buffer(%struct.fast_log_buf* %39)
%46 = icmp eq i32 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* @stderr
%49 = tail call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 230, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
br label %103
50: ; preds = %44
%51 = tail call i32 @create_some_logs(%struct.fast_log_buf* %15, i32 1)
%52 = tail call i32 @create_some_logs(%struct.fast_log_buf* %27, i32 1)
%53 = tail call i32 @create_some_logs(%struct.fast_log_buf* %39, i32 1)
%54 = call i32 @zsnprintf(i8* %6, i32 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* %0)
%55 = icmp eq i32 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %50
%57 = load i32, i32* @stderr
%58 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 236, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.15, i64 0, i64 0))
br label %103
59: ; preds = %50
%60 = load i32, i32* @O_CREAT
%61 = load i32, i32* @O_TRUNC
%62 = or i32 %61, %60
%63 = load i32, i32* @O_RDWR
%64 = or i32 %62, %63
%65 = call i32 @open(i8* %6, i32 %64, i32 420)
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %59
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 238, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
br label %103
70: ; preds = %59
%71 = call i32 @fast_log_dump_all(%struct.fast_log_buf* %9, i32 %65)
%72 = icmp eq i32 %71, 0
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = load i32, i32* @stderr
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 239, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0))
br label %103
76: ; preds = %70, %76
%77 = call i32 @close(i32 %65)
%78 = icmp eq i32 %77, -1
%79 = load i64, i64* @errno
%80 = load i64, i64* @EINTR
%81 = icmp eq i64 %79, %80
%82 = select i1 %78, i1 %81, i1 false
br i1 %82, label %76, label %83
83: ; preds = %76
%84 = call i32 @fast_log_destroy(%struct.fast_log_buf* %15)
%85 = call i32 @fast_log_destroy(%struct.fast_log_buf* %27)
%86 = call i32 @fast_log_destroy(%struct.fast_log_buf* %39)
%87 = call i32 @fast_log_destroy(%struct.fast_log_buf* %9)
%88 = call i64 @simple_io_read_whole_file_zt(i8* %6, i8* %7, i32 4096)
%89 = icmp slt i64 %88, 1
br i1 %89, label %90, label %93
90: ; preds = %83
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 246, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.18, i64 0, i64 0))
br label %103
93: ; preds = %83
%94 = getelementptr inbounds [13 x i8*], [13 x i8*]* %3, i64 0, i64 0
%95 = call i8* @linearray_to_str(i8** %94)
%96 = call i32 @strcmp(i8* %7, i8* dereferenceable(1) %95)
%97 = icmp eq i32 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %93
%99 = load i32, i32* @stderr
%100 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 249, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0))
br label %103
101: ; preds = %93
%102 = call i32 @free(i8* %95)
br label %103
103: ; preds = %98, %73, %56, %47, %35, %23, %101, %90, %67, %41, %29, %17, %11
%104 = phi i32 [ 1, %11 ], [ 1, %17 ], [ 1, %29 ], [ 1, %41 ], [ 1, %67 ], [ 1, %90 ], [ 0, %101 ], [ %96, %98 ], [ %54, %56 ], [ %45, %47 ], [ %33, %35 ], [ %21, %23 ], [ %71, %73 ]
ret i32 %104
}