#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 */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int queue_insert_multiple_inorder();
int queue_insert_multiple_noorder();
int queue_insert_one();
int queue_insert_resize();
int queue_remove_one();
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int failures = 0;
  {
    int ret = queue_insert_one();
    if (ret != 0) {
      failures++;
      fprintf(stderr, "Test %s FAILED!\n", "queue_insert_one");
    } else {
      printf("Test %s passed.\n", "queue_insert_one");
    }
  };
  {
    int ret = queue_remove_one();
    if (ret != 0) {
      failures++;
      fprintf(stderr, "Test %s FAILED!\n", "queue_remove_one");
    } else {
      printf("Test %s passed.\n", "queue_remove_one");
    }
  };
  {
    int ret = queue_insert_multiple_inorder();
    if (ret != 0) {
      failures++;
      fprintf(stderr, "Test %s FAILED!\n", "queue_insert_multiple_inorder");
    } else {
      printf("Test %s passed.\n", "queue_insert_multiple_inorder");
    }
  };
  {
    int ret = queue_insert_multiple_noorder();
    if (ret != 0) {
      failures++;
      fprintf(stderr, "Test %s FAILED!\n", "queue_insert_multiple_noorder");
    } else {
      printf("Test %s passed.\n", "queue_insert_multiple_noorder");
    }
  };
  {
    int ret = queue_insert_resize();
    if (ret != 0) {
      failures++;
      fprintf(stderr, "Test %s FAILED!\n", "queue_insert_resize");
    } else {
      printf("Test %s passed.\n", "queue_insert_resize");
    }
  };
  return failures;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1090 <queue_insert_one@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11cb <main+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xe46(%rip),%rsi
lea    0xe50(%rip),%rdx
call   1070 <fprintf@plt>
jmp    11de <main+0x6e>
lea    0xe50(%rip),%rdi
lea    0xe38(%rip),%rsi
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <queue_remove_one@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     121c <main+0xac>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
lea    0xdf5(%rip),%rsi
lea    0xe21(%rip),%rdx
call   1070 <fprintf@plt>
jmp    122f <main+0xbf>
lea    0xdff(%rip),%rdi
lea    0xe09(%rip),%rsi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <queue_insert_multiple_inorder@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     126d <main+0xfd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    0xda4(%rip),%rsi
lea    0xde1(%rip),%rdx
call   1070 <fprintf@plt>
jmp    1280 <main+0x110>
lea    0xdae(%rip),%rdi
lea    0xdc9(%rip),%rsi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <queue_insert_multiple_noorder@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12be <main+0x14e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd53(%rip),%rsi
lea    0xdae(%rip),%rdx
call   1070 <fprintf@plt>
jmp    12d1 <main+0x161>
lea    0xd5d(%rip),%rdi
lea    0xd96(%rip),%rsi
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <queue_insert_resize@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     130f <main+0x19f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
lea    0xd02(%rip),%rsi
lea    0xd7b(%rip),%rdx
call   1070 <fprintf@plt>
jmp    1322 <main+0x1b2>
lea    0xd0c(%rip),%rdi
lea    0xd63(%rip),%rsi
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1090 <queue_insert_one@plt>
test   %eax,%eax
je     11a1 <main+0x31>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
lea    0xe7c(%rip),%rdx
call   1070 <fprintf@plt>
mov    $0x1,%ebx
jmp    11b4 <main+0x44>
lea    0xe7a(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1080 <queue_remove_one@plt>
test   %eax,%eax
je     11e0 <main+0x70>
add    $0x1,%ebx
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
lea    0xe2e(%rip),%rsi
lea    0xe5a(%rip),%rdx
call   1070 <fprintf@plt>
jmp    11f3 <main+0x83>
lea    0xe3b(%rip),%rdi
lea    0xe45(%rip),%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <queue_insert_multiple_inorder@plt>
test   %eax,%eax
je     121f <main+0xaf>
add    $0x1,%ebx
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
lea    0xdef(%rip),%rsi
lea    0xe2c(%rip),%rdx
call   1070 <fprintf@plt>
jmp    1232 <main+0xc2>
lea    0xdfc(%rip),%rdi
lea    0xe17(%rip),%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <queue_insert_multiple_noorder@plt>
test   %eax,%eax
je     125e <main+0xee>
add    $0x1,%ebx
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
lea    0xe0b(%rip),%rdx
call   1070 <fprintf@plt>
jmp    1271 <main+0x101>
lea    0xdbd(%rip),%rdi
lea    0xdf6(%rip),%rsi
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <queue_insert_resize@plt>
test   %eax,%eax
je     129d <main+0x12d>
add    $0x1,%ebx
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
lea    0xd71(%rip),%rsi
lea    0xdea(%rip),%rdx
call   1070 <fprintf@plt>
jmp    12b0 <main+0x140>
lea    0xd7e(%rip),%rdi
lea    0xdd5(%rip),%rsi
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Test %s FAILED!\0A\00"
@.str.1 = [17 x i8] c"queue_insert_one\00"
@.str.2 = [17 x i8] c"Test %s passed.\0A\00"
@.str.3 = [17 x i8] c"queue_remove_one\00"
@.str.4 = [30 x i8] c"queue_insert_multiple_inorder\00"
@.str.5 = [30 x i8] c"queue_insert_multiple_noorder\00"
@.str.6 = [20 x i8] c"queue_insert_resize\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%12 = call i32 (...) @queue_insert_one()
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = call i32 (...) @queue_remove_one()
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %31, %26
%34 = call i32 (...) @queue_insert_multiple_inorder()
store i32 %34, i32* %9
%35 = load i32, i32* %9
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %33
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %44
42: ; preds = %33
%43 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = call i32 (...) @queue_insert_multiple_noorder()
store i32 %45, i32* %10
%46 = load i32, i32* %10
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %55
53: ; preds = %44
%54 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %55
55: ; preds = %53, %48
%56 = call i32 (...) @queue_insert_resize()
store i32 %56, i32* %11
%57 = load i32, i32* %11
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %55
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %66
64: ; preds = %55
%65 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %66
66: ; preds = %64, %59
%67 = load i32, i32* %6
ret i32 %67
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Test %s FAILED!\0A\00"
@.str.1 = [17 x i8] c"queue_insert_one\00"
@.str.2 = [17 x i8] c"Test %s passed.\0A\00"
@.str.3 = [17 x i8] c"queue_remove_one\00"
@.str.4 = [30 x i8] c"queue_insert_multiple_inorder\00"
@.str.5 = [30 x i8] c"queue_insert_multiple_noorder\00"
@.str.6 = [20 x i8] c"queue_insert_resize\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @queue_insert_one()
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %10
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ 1, %5 ], [ 0, %8 ]
%12 = tail call i32 (...) @queue_remove_one()
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = add nuw nsw i32 %11, 1
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %10
%19 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = phi i32 [ %15, %14 ], [ %11, %18 ]
%22 = tail call i32 (...) @queue_insert_multiple_inorder()
%23 = icmp eq i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = add nuw nsw i32 %21, 1
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %24
%31 = phi i32 [ %25, %24 ], [ %21, %28 ]
%32 = tail call i32 (...) @queue_insert_multiple_noorder()
%33 = icmp eq i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %30
%35 = add nuw nsw i32 %31, 1
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %40
38: ; preds = %30
%39 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %34
%41 = phi i32 [ %35, %34 ], [ %31, %38 ]
%42 = tail call i32 (...) @queue_insert_resize()
%43 = icmp eq i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = add nuw nsw i32 %41, 1
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %50
48: ; preds = %40
%49 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = phi i32 [ %45, %44 ], [ %41, %48 ]
ret i32 %51
}