#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*/ printf(char *, ...);
int *queue_back(void *);
void *queue_create();
int /*<<< orphan*/ queue_destroy(void *);
int *queue_front(void *);
int /*<<< orphan*/ queue_pop(void *);
int /*<<< orphan*/ queue_push(void *, int);
int main(void) {
  int val;
  void *instance;
  int *tmp;
  instance = queue_create();
  if (instance == NULL) {
    printf("creating queue failed\n");
    return -1;
  }
  queue_pop(instance);
  val = 5;
  queue_push(instance, val);
  printf("push '%d' into queue\n", val);
  tmp = queue_front(instance);
  printf("front of the queue is %d\n", *tmp);
  tmp = queue_back(instance);
  printf("back of the queue is %d\n", *tmp);
  val = 9;
  queue_push(instance, val);
  printf("push '%d' into queue\n", val);
  tmp = queue_front(instance);
  printf("front of the queue is %d\n", *tmp);
  tmp = queue_back(instance);
  printf("back of the queue is %d\n", *tmp);
  val = 3;
  queue_push(instance, val);
  printf("push '%d' into queue\n", val);
  tmp = queue_front(instance);
  printf("front of the queue is %d\n", *tmp);
  tmp = queue_back(instance);
  printf("back of the queue is %d\n", *tmp);
  queue_pop(instance);
  printf("pop the front item of the queue\n");
  tmp = queue_front(instance);
  printf("front of the queue is %d\n", *tmp);
  tmp = queue_back(instance);
  printf("back of the queue is %d\n", *tmp);
  queue_destroy(instance);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <queue_create@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11af <main+0x3f>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1353 <main+0x1e3>
mov    -0x10(%rbp),%rdi
call   1080 <queue_pop@plt>
movl   $0x5,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <queue_push@plt>
mov    -0x8(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <queue_front@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <queue_back@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x9,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <queue_push@plt>
mov    -0x8(%rbp),%esi
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <queue_front@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <queue_back@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x3,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <queue_push@plt>
mov    -0x8(%rbp),%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <queue_front@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <queue_back@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <queue_pop@plt>
lea    0xd66(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <queue_front@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <queue_back@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <queue_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r12d,%r12d
xor    %eax,%eax
call   1040 <queue_create@plt>
test   %rax,%rax
je     12cd <main+0x14d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <queue_pop@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <queue_push@plt>
lea    0xe46(%rip),%rbp
mov    %rbp,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1030 <queue_front@plt>
mov    (%rax),%esi
lea    0xe3c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <queue_back@plt>
mov    (%rax),%esi
lea    0xe3b(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1070 <queue_push@plt>
mov    %rbp,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1030 <queue_front@plt>
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <queue_back@plt>
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1070 <queue_push@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1030 <queue_front@plt>
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <queue_back@plt>
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1090 <queue_pop@plt>
lea    0xdb3(%rip),%rdi
call   1060 <puts@plt>
mov    %rbx,%rdi
call   1030 <queue_front@plt>
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <queue_back@plt>
mov    (%rax),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   10a0 <queue_destroy@plt>
jmp    12df <main+0x15f>
lea    0xd95(%rip),%rdi
call   1060 <puts@plt>
mov    $0xffffffff,%r12d
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"creating queue failed\0A\00"
@.str.1 = [22 x i8] c"push '%d' into queue\0A\00"
@.str.2 = [26 x i8] c"front of the queue is %d\0A\00"
@.str.3 = [25 x i8] c"back of the queue is %d\0A\00"
@.str.4 = [33 x i8] c"pop the front item of the queue\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i8* (...) @queue_create()
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %73
10: ; preds = %0
%11 = load i8*, i8** %3
%12 = call i32 @queue_pop(i8* %11)
store i32 5, i32* %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %2
%15 = call i32 @queue_push(i8* %13, i32 %14)
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i8*, i8** %3
%19 = call i32* @queue_front(i8* %18)
store i32* %19, i32** %4
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %3
%24 = call i32* @queue_back(i8* %23)
store i32* %24, i32** %4
%25 = load i32*, i32** %4
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %26)
store i32 9, i32* %2
%28 = load i8*, i8** %3
%29 = load i32, i32* %2
%30 = call i32 @queue_push(i8* %28, i32 %29)
%31 = load i32, i32* %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i8*, i8** %3
%34 = call i32* @queue_front(i8* %33)
store i32* %34, i32** %4
%35 = load i32*, i32** %4
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i8*, i8** %3
%39 = call i32* @queue_back(i8* %38)
store i32* %39, i32** %4
%40 = load i32*, i32** %4
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %41)
store i32 3, i32* %2
%43 = load i8*, i8** %3
%44 = load i32, i32* %2
%45 = call i32 @queue_push(i8* %43, i32 %44)
%46 = load i32, i32* %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i8*, i8** %3
%49 = call i32* @queue_front(i8* %48)
store i32* %49, i32** %4
%50 = load i32*, i32** %4
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%53 = load i8*, i8** %3
%54 = call i32* @queue_back(i8* %53)
store i32* %54, i32** %4
%55 = load i32*, i32** %4
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = load i8*, i8** %3
%59 = call i32 @queue_pop(i8* %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%61 = load i8*, i8** %3
%62 = call i32* @queue_front(i8* %61)
store i32* %62, i32** %4
%63 = load i32*, i32** %4
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %64)
%66 = load i8*, i8** %3
%67 = call i32* @queue_back(i8* %66)
store i32* %67, i32** %4
%68 = load i32*, i32** %4
%69 = load i32, i32* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = load i8*, i8** %3
%72 = call i32 @queue_destroy(i8* %71)
store i32 0, i32* %1
br label %73
73: ; preds = %10, %8
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"push '%d' into queue\0A\00"
@.str.2 = [26 x i8] c"front of the queue is %d\0A\00"
@.str.3 = [25 x i8] c"back of the queue is %d\0A\00"
@str = [32 x i8] c"pop the front item of the queue\00"
@str.5 = [22 x i8] c"creating queue failed\00"
define i32 @main() {
%1 = tail call i8* (...) @queue_create()
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
br label %40
5: ; preds = %0
%6 = tail call i32 @queue_pop(i8* %1)
%7 = tail call i32 @queue_push(i8* %1, i32 5)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 5)
%9 = tail call i32* @queue_front(i8* %1)
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = tail call i32* @queue_back(i8* %1)
%13 = load i32, i32* %12
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = tail call i32 @queue_push(i8* %1, i32 9)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 9)
%17 = tail call i32* @queue_front(i8* %1)
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = tail call i32* @queue_back(i8* %1)
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = tail call i32 @queue_push(i8* %1, i32 3)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 3)
%25 = tail call i32* @queue_front(i8* %1)
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = tail call i32* @queue_back(i8* %1)
%29 = load i32, i32* %28
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = tail call i32 @queue_pop(i8* %1)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%33 = tail call i32* @queue_front(i8* %1)
%34 = load i32, i32* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = tail call i32* @queue_back(i8* %1)
%37 = load i32, i32* %36
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = tail call i32 @queue_destroy(i8* %1)
br label %40
40: ; preds = %5, %3
%41 = phi i32 [ -1, %3 ], [ 0, %5 ]
ret i32 %41
}