#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 Queue {
  int dummy;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fill15_test(struct Queue *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ henry_push_test(struct Queue *);
int /*<<< orphan*/ int32_push_test(struct Queue *);
int /*<<< orphan*/ logError(char *, char *, int, scalar_t__);
int /*<<< orphan*/ maxEntries(char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ *mkdtemp(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
scalar_t__ queue_close(struct Queue *);
char *queue_get_last_error(struct Queue *);
scalar_t__ queue_is_opened(struct Queue *);
struct Queue *queue_open(char *);
struct Queue *queue_open_with_options(char *, char *, int, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int system(char *);
int /*<<< orphan*/ threadTest(char *);
int main(int argc, char **argv) {
  struct Queue *q;
  puts(argv[0]);
  char template[] = "/tmp/qtest_XXXXXX";
  if (NULL == mkdtemp(template)) {
    puts("failed to create temp dir for running tests");
    return 1;
  }
  q = queue_open(template);
  if (0 == queue_is_opened(q)) {
    fprintf(stderr, "Failed to open the queue:%s", queue_get_last_error(q));
    logError(
        "queue_close(q)",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c",
        170, queue_close(q));
    return EXIT_FAILURE;
  }
  logError("queue_close(q)",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c",
           173, queue_close(q));
  int i;
  for (i = 1; i < 20; i++) {
    q = queue_open_with_options(template, "maxBinLogSize", i, NULL);
    fill15_test(q);
    logError(
        "queue_close(q)",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c",
        178, queue_close(q));
  }
  q = queue_open(template);
  henry_push_test(q);
  int32_push_test(q);
  fill15_test(q);
  maxEntries(template);
  if (queue_close(q) != 0)
    puts("there was an error closing the queue!");
  puts("queue successfully closed!");
  char cmdline[1024];
  sprintf(cmdline, "rm -rf %s", template);
  int resultsOfDelete = system(cmdline);
  if (EXIT_SUCCESS != resultsOfDelete) {
    puts("there was an error running delete of temp dir command ");
    return 1;
  }
  q = queue_open_with_options(template, "failIfMissing", NULL);
  if (NULL == queue_get_last_error(q)) {
    puts("queue was created when it shouldn't have been");
  }
  logError("queue_close(q)",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c",
           204, queue_close(q));
  if (0 != mkdir(template, 0777)) {
    printf("failed to create temp dir (%s) for running tests\n", template);
    return 1;
  }
  threadTest(template);
  printf("done\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <puts@plt>
mov    0xdb4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xdb1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xdae(%rip),%ax
mov    %ax,-0x20(%rbp)
lea    -0x30(%rbp),%rdi
call   1110 <mkdtemp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1295 <main+0x75>
lea    0xd8e(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1511 <main+0x2f1>
lea    -0x30(%rbp),%rdi
call   10f0 <queue_open@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <queue_is_opened@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    131b <main+0xfb>
mov    0x2d20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x448(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <queue_get_last_error@plt>
mov    -0x448(%rbp),%edi
mov    %rax,%rdx
lea    0xd5d(%rip),%rsi
call   10c0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   10e0 <queue_close@plt>
mov    %rax,%rcx
lea    0xd61(%rip),%rdi
lea    0xd69(%rip),%rsi
mov    $0xaa,%edx
call   1090 <logError@plt>
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1511 <main+0x2f1>
mov    -0x18(%rbp),%rdi
call   10e0 <queue_close@plt>
mov    %rax,%rcx
lea    0xd2c(%rip),%rdi
lea    0xd34(%rip),%rsi
mov    $0xad,%edx
call   1090 <logError@plt>
movl   $0x1,-0x34(%rbp)
cmpl   $0x14,-0x34(%rbp)
jge    13a8 <main+0x188>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xd8e(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    $0x0,%al
call   10d0 <queue_open_with_options@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1100 <fill15_test@plt>
mov    -0x18(%rbp),%rdi
call   10e0 <queue_close@plt>
mov    %rax,%rcx
lea    0xcd1(%rip),%rdi
lea    0xcd9(%rip),%rsi
mov    $0xb2,%edx
call   1090 <logError@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1346 <main+0x126>
lea    -0x30(%rbp),%rdi
call   10f0 <queue_open@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10a0 <henry_push_test@plt>
mov    -0x18(%rbp),%rdi
call   1030 <int32_push_test@plt>
mov    -0x18(%rbp),%rdi
call   1100 <fill15_test@plt>
lea    -0x30(%rbp),%rdi
call   1120 <maxEntries@plt>
mov    -0x18(%rbp),%rdi
call   10e0 <queue_close@plt>
cmp    $0x0,%rax
je     13f8 <main+0x1d8>
lea    0xd07(%rip),%rdi
call   1050 <puts@plt>
lea    0xd21(%rip),%rdi
call   1050 <puts@plt>
lea    -0x440(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xd25(%rip),%rsi
call   1130 <sprintf@plt>
lea    -0x440(%rbp),%rdi
call   1060 <system@plt>
mov    %eax,-0x444(%rbp)
mov    0x2b9c(%rip),%rax
mov    (%rax),%eax
cmp    -0x444(%rbp),%eax
je     145a <main+0x23a>
lea    0xcfc(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    1511 <main+0x2f1>
lea    -0x30(%rbp),%rdi
lea    0xd17(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   10d0 <queue_open_with_options@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <queue_get_last_error@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1495 <main+0x275>
lea    0xcfa(%rip),%rdi
call   1050 <puts@plt>
mov    -0x18(%rbp),%rdi
call   10e0 <queue_close@plt>
mov    %rax,%rcx
lea    0xbb2(%rip),%rdi
lea    0xbba(%rip),%rsi
mov    $0xcc,%edx
call   1090 <logError@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     14f3 <main+0x2d3>
lea    -0x30(%rbp),%rsi
lea    0xcd8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1511 <main+0x2f1>
lea    -0x30(%rbp),%rdi
call   1140 <threadTest@plt>
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    (%rsi),%rdi
call   1050 <puts@plt>
movaps 0xdc0(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x58,0x10(%rsp)
mov    %rsp,%rdi
call   1110 <mkdtemp@plt>
test   %rax,%rax
je     13eb <main+0x1cb>
mov    %rsp,%rdi
call   10f0 <queue_open@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10b0 <queue_is_opened@plt>
test   %rax,%rax
je     13f4 <main+0x1d4>
mov    %rbx,%rdi
call   10e0 <queue_close@plt>
lea    0xdd3(%rip),%r14
lea    0xddb(%rip),%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0xad,%edx
mov    %rax,%rcx
call   1090 <logError@plt>
mov    $0x1,%ebp
lea    0xe3f(%rip),%r12
mov    %rsp,%r13
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   10d0 <queue_open_with_options@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1100 <fill15_test@plt>
mov    %rbx,%rdi
call   10e0 <queue_close@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0xb2,%edx
mov    %rax,%rcx
call   1090 <logError@plt>
add    $0x1,%ebp
cmp    $0x14,%ebp
jne    12b0 <main+0x90>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10f0 <queue_open@plt>
mov    %rax,%rbp
mov    %rax,%rdi
call   10a0 <henry_push_test@plt>
mov    %rbp,%rdi
call   1030 <int32_push_test@plt>
mov    %rbp,%rdi
call   1100 <fill15_test@plt>
mov    %rbx,%rdi
call   1120 <maxEntries@plt>
mov    %rbp,%rdi
call   10e0 <queue_close@plt>
test   %rax,%rax
je     1336 <main+0x116>
lea    0xdc9(%rip),%rdi
call   1050 <puts@plt>
lea    0xde3(%rip),%rdi
call   1050 <puts@plt>
lea    0xdf2(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1130 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <system@plt>
mov    0x2c68(%rip),%rcx
cmp    %eax,(%rcx)
jne    1444 <main+0x224>
lea    0xe05(%rip),%rsi
mov    %rsp,%rdi
xor    %edx,%edx
xor    %eax,%eax
call   10d0 <queue_open_with_options@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <queue_get_last_error@plt>
test   %rax,%rax
jne    139f <main+0x17f>
lea    0xdf0(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   10e0 <queue_close@plt>
lea    0xcac(%rip),%rdi
lea    0xcb4(%rip),%rsi
mov    $0xcc,%edx
mov    %rax,%rcx
call   1090 <logError@plt>
mov    %rsp,%rdi
mov    $0x1ff,%esi
call   1040 <mkdir@plt>
test   %rax,%rax
je     1467 <main+0x247>
lea    0xdd9(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1450 <main+0x230>
lea    0xc20(%rip),%rdi
jmp    144b <main+0x22b>
mov    0x2be5(%rip),%rax
mov    (%rax),%ebp
mov    %rbx,%rdi
call   1080 <queue_get_last_error@plt>
lea    0xc32(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
call   10e0 <queue_close@plt>
lea    0xc35(%rip),%rdi
lea    0xc3d(%rip),%rsi
mov    $0xaa,%edx
mov    %rax,%rcx
call   1090 <logError@plt>
mov    0x2b98(%rip),%rax
mov    (%rax),%eax
jmp    1455 <main+0x235>
lea    0xcfa(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%rdi
call   1140 <threadTest@plt>
lea    0xd74(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
jmp    1455 <main+0x235>

LLVM IR (-O0):
%struct.Queue = type { i32 }
@__const.main.template = [18 x i8] c"/tmp/qtest_XXXXXX\00"
@.str = [44 x i8] c"failed to create temp dir for running tests\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Failed to open the queue:%s\00"
@.str.2 = [15 x i8] c"queue_close(q)\00"
@.str.3 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [14 x i8] c"maxBinLogSize\00"
@.str.5 = [38 x i8] c"there was an error closing the queue!\00"
@.str.6 = [27 x i8] c"queue successfully closed!\00"
@.str.7 = [10 x i8] c"rm -rf %s\00"
@EXIT_SUCCESS = global i32 0
@.str.8 = [55 x i8] c"there was an error running delete of temp dir command \00"
@.str.9 = [14 x i8] c"failIfMissing\00"
@.str.10 = [46 x i8] c"queue was created when it shouldn't have been\00"
@.str.11 = [50 x i8] c"failed to create temp dir (%s) for running tests\0A\00"
@.str.12 = [6 x i8] c"done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.Queue*
%7 = alloca [18 x i8]
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @puts(i8* %13)
%15 = bitcast [18 x i8]* %7 to i8*
%16 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%17 = call i32* @mkdtemp(i8* %16)
%18 = icmp eq i32* null, %17
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %105
21: ; preds = %2
%22 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%23 = call %struct.Queue* @queue_open(i8* %22)
store %struct.Queue* %23, %struct.Queue** %6
%24 = load %struct.Queue*, %struct.Queue** %6
%25 = call i64 @queue_is_opened(%struct.Queue* %24)
%26 = icmp eq i64 0, %25
br i1 %26, label %27, label %36
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load %struct.Queue*, %struct.Queue** %6
%30 = call i8* @queue_get_last_error(%struct.Queue* %29)
%31 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load %struct.Queue*, %struct.Queue** %6
%33 = call i64 @queue_close(%struct.Queue* %32)
%34 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 170, i64 %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %105
36: ; preds = %21
%37 = load %struct.Queue*, %struct.Queue** %6
%38 = call i64 @queue_close(%struct.Queue* %37)
%39 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 173, i64 %38)
store i32 1, i32* %8
br label %40
40: ; preds = %52, %36
%41 = load i32, i32* %8
%42 = icmp slt i32 %41, 20
br i1 %42, label %43, label %55
43: ; preds = %40
%44 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%45 = load i32, i32* %8
%46 = call %struct.Queue* (i8*, i8*, i32, ...) @queue_open_with_options(i8* %44, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %45, i8* null)
store %struct.Queue* %46, %struct.Queue** %6
%47 = load %struct.Queue*, %struct.Queue** %6
%48 = call i32 @fill15_test(%struct.Queue* %47)
%49 = load %struct.Queue*, %struct.Queue** %6
%50 = call i64 @queue_close(%struct.Queue* %49)
%51 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 178, i64 %50)
br label %52
52: ; preds = %43
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
store i32 %54, i32* %8
br label %40
55: ; preds = %40
%56 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%57 = call %struct.Queue* @queue_open(i8* %56)
store %struct.Queue* %57, %struct.Queue** %6
%58 = load %struct.Queue*, %struct.Queue** %6
%59 = call i32 @henry_push_test(%struct.Queue* %58)
%60 = load %struct.Queue*, %struct.Queue** %6
%61 = call i32 @int32_push_test(%struct.Queue* %60)
%62 = load %struct.Queue*, %struct.Queue** %6
%63 = call i32 @fill15_test(%struct.Queue* %62)
%64 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%65 = call i32 @maxEntries(i8* %64)
%66 = load %struct.Queue*, %struct.Queue** %6
%67 = call i64 @queue_close(%struct.Queue* %66)
%68 = icmp ne i64 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %55
%70 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
br label %71
71: ; preds = %69, %55
%72 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%74 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%75 = call i32 @sprintf(i8* %73, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%77 = call i32 @system(i8* %76)
store i32 %77, i32* %10
%78 = load i32, i32* @EXIT_SUCCESS
%79 = load i32, i32* %10
%80 = icmp ne i32 %78, %79
br i1 %80, label %81, label %83
81: ; preds = %71
%82 = call i32 @puts(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %105
83: ; preds = %71
%84 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%85 = call %struct.Queue* (i8*, i8*, i32, ...) @queue_open_with_options(i8* %84, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 0)
store %struct.Queue* %85, %struct.Queue** %6
%86 = load %struct.Queue*, %struct.Queue** %6
%87 = call i8* @queue_get_last_error(%struct.Queue* %86)
%88 = icmp eq i8* null, %87
br i1 %88, label %89, label %91
89: ; preds = %83
%90 = call i32 @puts(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
br label %91
91: ; preds = %89, %83
%92 = load %struct.Queue*, %struct.Queue** %6
%93 = call i64 @queue_close(%struct.Queue* %92)
%94 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 204, i64 %93)
%95 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%96 = call i64 @mkdir(i8* %95, i32 511)
%97 = icmp ne i64 0, %96
br i1 %97, label %98, label %101
98: ; preds = %91
%99 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i8* %99)
store i32 1, i32* %3
br label %105
101: ; preds = %91
%102 = getelementptr inbounds [18 x i8], [18 x i8]* %7, i64 0, i64 0
%103 = call i32 @threadTest(i8* %102)
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %3
br label %105
105: ; preds = %101, %98, %81, %27, %19
%106 = load i32, i32* %3
ret i32 %106
}

LLVM IR (-O2):
%struct.Queue = type { i32 }
@__const.main.template = [18 x i8] c"/tmp/qtest_XXXXXX\00"
@.str = [44 x i8] c"failed to create temp dir for running tests\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"Failed to open the queue:%s\00"
@.str.2 = [15 x i8] c"queue_close(q)\00"
@.str.3 = [131 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/acgreek/cqueue/refs/heads/master/qtest.c\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [14 x i8] c"maxBinLogSize\00"
@.str.5 = [38 x i8] c"there was an error closing the queue!\00"
@.str.6 = [27 x i8] c"queue successfully closed!\00"
@.str.7 = [10 x i8] c"rm -rf %s\00"
@EXIT_SUCCESS = global i32 0
@.str.8 = [55 x i8] c"there was an error running delete of temp dir command \00"
@.str.9 = [14 x i8] c"failIfMissing\00"
@.str.10 = [46 x i8] c"queue was created when it shouldn't have been\00"
@.str.11 = [50 x i8] c"failed to create temp dir (%s) for running tests\0A\00"
@str = [5 x i8] c"done\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [18 x i8]
%4 = alloca [1024 x i8]
%5 = load i8*, i8** %1
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%8 = call i32* @mkdtemp(i8* %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %71
12: ; preds = %2
%13 = call %struct.Queue* @queue_open(i8* %7)
%14 = call i64 @queue_is_opened(%struct.Queue* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = call i8* @queue_get_last_error(%struct.Queue* %13)
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i64 @queue_close(%struct.Queue* %13)
%21 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 170, i64 %20)
%22 = load i32, i32* @EXIT_FAILURE
br label %71
23: ; preds = %12
%24 = call i64 @queue_close(%struct.Queue* %13)
%25 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 173, i64 %24)
br label %26
26: ; preds = %23, %26
%27 = phi i32 [ 1, %23 ], [ %32, %26 ]
%28 = call %struct.Queue* (i8*, i8*, i32, ...) @queue_open_with_options(i8* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %27, i8* null)
%29 = call i32 @fill15_test(%struct.Queue* %28)
%30 = call i64 @queue_close(%struct.Queue* %28)
%31 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 178, i64 %30)
%32 = add nuw nsw i32 %27, 1
%33 = icmp eq i32 %32, 20
br i1 %33, label %34, label %26
34: ; preds = %26
%35 = call %struct.Queue* @queue_open(i8* %7)
%36 = call i32 @henry_push_test(%struct.Queue* %35)
%37 = call i32 @int32_push_test(%struct.Queue* %35)
%38 = call i32 @fill15_test(%struct.Queue* %35)
%39 = call i32 @maxEntries(i8* %7)
%40 = call i64 @queue_close(%struct.Queue* %35)
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %34
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %34
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%47 = call i32 @sprintf(i8* %46, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %7)
%48 = call i32 @system(i8* %46)
%49 = load i32, i32* @EXIT_SUCCESS
%50 = icmp eq i32 %49, %48
br i1 %50, label %53, label %51
51: ; preds = %44
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
br label %69
53: ; preds = %44
%54 = call %struct.Queue* (i8*, i8*, i32, ...) @queue_open_with_options(i8* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i32 0)
%55 = call i8* @queue_get_last_error(%struct.Queue* %54)
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.10, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
%60 = call i64 @queue_close(%struct.Queue* %54)
%61 = call i32 @logError(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.3, i64 0, i64 0), i32 204, i64 %60)
%62 = call i64 @mkdir(i8* %7, i32 511)
%63 = icmp eq i64 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %59
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.11, i64 0, i64 0), i8* %7)
br label %69
66: ; preds = %59
%67 = call i32 @threadTest(i8* %7)
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %69
69: ; preds = %66, %64, %51
%70 = phi i32 [ 1, %51 ], [ 1, %64 ], [ 0, %66 ]
br label %71
71: ; preds = %69, %16, %10
%72 = phi i32 [ 1, %10 ], [ %22, %16 ], [ %70, %69 ]
ret i32 %72
}