#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 DeQueue(struct queue *);
int /*<<< orphan*/ EnQueue(struct queue *, int);
struct queue *createQueue(int);
int /*<<< orphan*/ interleavingQueue(struct queue *);
int /*<<< orphan*/ isEmpty(struct queue *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  struct queue *Q = createQueue(11);
  int i;
  for (i = 0; i < 10; i++) {
    EnQueue(Q, (i + 1) * 10);
  }
  interleavingQueue(Q);
  while (!isEmpty(Q)) {
    int d = DeQueue(Q);
    printf(" %d ", d);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xb,%edi
call   1040 <createQueue@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11ae <main+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
add    $0x1,%eax
imul   $0xa,%eax,%esi
call   1050 <EnQueue@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <main+0x24>
mov    -0x10(%rbp),%rdi
call   1030 <interleavingQueue@plt>
mov    -0x10(%rbp),%rdi
call   1080 <isEmpty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11d5 <main+0x75>
jmp    11f5 <main+0x95>
mov    -0x10(%rbp),%rdi
call   1060 <DeQueue@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1070 <printf@plt>
jmp    11b7 <main+0x57>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xb,%edi
call   1040 <createQueue@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x46,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x5a,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <EnQueue@plt>
mov    %rbx,%rdi
call   1030 <interleavingQueue@plt>
mov    %rbx,%rdi
call   1080 <isEmpty@plt>
test   %eax,%eax
jne    122e <main+0xce>
lea    0xdf2(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1060 <DeQueue@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1080 <isEmpty@plt>
test   %eax,%eax
je     1210 <main+0xb0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.queue = type { i32 }
@.str = [5 x i8] c" %d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.queue*
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call %struct.queue* @createQueue(i32 11)
store %struct.queue* %5, %struct.queue** %2
store i32 0, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load %struct.queue*, %struct.queue** %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
%13 = mul nsw i32 %12, 10
%14 = call i32 @EnQueue(%struct.queue* %10, i32 %13)
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = load %struct.queue*, %struct.queue** %2
%20 = call i32 @interleavingQueue(%struct.queue* %19)
br label %21
21: ; preds = %26, %18
%22 = load %struct.queue*, %struct.queue** %2
%23 = call i32 @isEmpty(%struct.queue* %22)
%24 = icmp ne i32 %23, 0
%25 = xor i1 %24, true
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load %struct.queue*, %struct.queue** %2
%28 = call i32 @DeQueue(%struct.queue* %27)
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %21
31: ; preds = %21
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
%struct.queue = type { i32 }
@.str = [5 x i8] c" %d \00"
define i32 @main() {
%1 = tail call %struct.queue* @createQueue(i32 11)
%2 = tail call i32 @EnQueue(%struct.queue* %1, i32 10)
%3 = tail call i32 @EnQueue(%struct.queue* %1, i32 20)
%4 = tail call i32 @EnQueue(%struct.queue* %1, i32 30)
%5 = tail call i32 @EnQueue(%struct.queue* %1, i32 40)
%6 = tail call i32 @EnQueue(%struct.queue* %1, i32 50)
%7 = tail call i32 @EnQueue(%struct.queue* %1, i32 60)
%8 = tail call i32 @EnQueue(%struct.queue* %1, i32 70)
%9 = tail call i32 @EnQueue(%struct.queue* %1, i32 80)
%10 = tail call i32 @EnQueue(%struct.queue* %1, i32 90)
%11 = tail call i32 @EnQueue(%struct.queue* %1, i32 100)
%12 = tail call i32 @interleavingQueue(%struct.queue* %1)
%13 = tail call i32 @isEmpty(%struct.queue* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %0, %15
%16 = tail call i32 @DeQueue(%struct.queue* %1)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = tail call i32 @isEmpty(%struct.queue* %1)
%19 = icmp eq i32 %18, 0
br i1 %19, label %15, label %20
20: ; preds = %15, %0
ret i32 0
}