#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 /*<<< orphan*/ deq(struct queue *, int *);
int /*<<< orphan*/ enq(struct queue *, int);
int /*<<< orphan*/ queue_free(struct queue *);
struct queue *queue_init();
int /*<<< orphan*/ queue_print(struct queue *);
int strtol(char const *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  int N, n, i;
  struct queue *q;
  N = argc - 1;
  if (N < 1)
    return -1;
  q = queue_init();
  argv++;
  for (i = 0; i < N; i++) {
    n = strtol(argv[i], NULL, 0);
    enq(q, n);
  }
  queue_print(q);
  for (i = 0; i < N - 1; i++) {
    n = strtol(argv[i], NULL, 0);
    deq(q, &n);
    queue_print(q);
  }
  queue_free(q);
  return 0;
}


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)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    1195 <main+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1262 <main+0x102>
mov    $0x0,%al
call   1080 <queue_init@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f3 <main+0x93>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1070 <enq@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b3 <main+0x53>
mov    -0x28(%rbp),%rdi
call   1030 <queue_print@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1252 <main+0xf2>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <deq@plt>
mov    -0x28(%rbp),%rdi
call   1030 <queue_print@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1203 <main+0xa3>
mov    -0x28(%rbp),%rdi
call   1060 <queue_free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffff,%eax
cmp    $0x2,%edi
jl     1216 <main+0xb6>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
lea    -0x1(%r14),%r12d
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <queue_init@plt>
mov    %rax,%r13
nop
mov    0x8(%r15,%rbx,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %eax,%esi
call   1070 <enq@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1190 <main+0x30>
mov    %ebp,0x4(%rsp)
mov    %r13,%rdi
call   1030 <queue_print@plt>
cmp    $0x3,%r14d
jl     11fe <main+0x9e>
add    $0xfffffffe,%r14d
xor    %ebx,%ebx
lea    0x4(%rsp),%r12
mov    0x8(%r15,%rbx,8),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,0x4(%rsp)
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <deq@plt>
mov    %r13,%rdi
call   1030 <queue_print@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    11d0 <main+0x70>
mov    %r13,%rdi
call   1060 <queue_free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.queue = type { i32 }
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 %struct.queue*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 -1, i32* %3
br label %61
15: ; preds = %2
%16 = call %struct.queue* (...) @queue_init()
store %struct.queue* %16, %struct.queue** %9
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %5
store i32 0, i32* %8
br label %19
19: ; preds = %33, %15
%20 = load i32, i32* %8
%21 = load i32, i32* %6
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %36
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strtol(i8* %28, i32* null, i32 0)
store i32 %29, i32* %7
%30 = load %struct.queue*, %struct.queue** %9
%31 = load i32, i32* %7
%32 = call i32 @enq(%struct.queue* %30, i32 %31)
br label %33
33: ; preds = %23
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %19
36: ; preds = %19
%37 = load %struct.queue*, %struct.queue** %9
%38 = call i32 @queue_print(%struct.queue* %37)
store i32 0, i32* %8
br label %39
39: ; preds = %55, %36
%40 = load i32, i32* %8
%41 = load i32, i32* %6
%42 = sub nsw i32 %41, 1
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %58
44: ; preds = %39
%45 = load i8**, i8*** %5
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @strtol(i8* %49, i32* null, i32 0)
store i32 %50, i32* %7
%51 = load %struct.queue*, %struct.queue** %9
%52 = call i32 @deq(%struct.queue* %51, i32* %7)
%53 = load %struct.queue*, %struct.queue** %9
%54 = call i32 @queue_print(%struct.queue* %53)
br label %55
55: ; preds = %44
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %39
58: ; preds = %39
%59 = load %struct.queue*, %struct.queue** %9
%60 = call i32 @queue_free(%struct.queue* %59)
store i32 0, i32* %3
br label %61
61: ; preds = %58, %14
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
%struct.queue = type { i32 }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %36, label %6
6: ; preds = %2
%7 = add i32 %0, -1
%8 = tail call %struct.queue* (...) @queue_init()
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %6, %11
%12 = phi i64 [ 0, %6 ], [ %17, %11 ]
%13 = getelementptr inbounds i8*, i8** %9, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strtol(i8* nocapture %14, i32* null, i32 0)
%16 = tail call i32 @enq(%struct.queue* %8, i32 %15)
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11
store i32 %15, i32* %3
%20 = tail call i32 @queue_print(%struct.queue* %8)
%21 = icmp sgt i32 %0, 2
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = add nsw i32 %0, -2
%24 = zext i32 %23 to i64
br label %25
25: ; preds = %22, %25
%26 = phi i64 [ 0, %22 ], [ %32, %25 ]
%27 = getelementptr inbounds i8*, i8** %9, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strtol(i8* nocapture %28, i32* null, i32 0)
store i32 %29, i32* %3
%30 = call i32 @deq(%struct.queue* %8, i32* %3)
%31 = call i32 @queue_print(%struct.queue* %8)
%32 = add nuw nsw i64 %26, 1
%33 = icmp eq i64 %32, %24
br i1 %33, label %34, label %25
34: ; preds = %25, %19
%35 = call i32 @queue_free(%struct.queue* %8)
br label %36
36: ; preds = %2, %34
%37 = phi i32 [ 0, %34 ], [ -1, %2 ]
ret i32 %37
}