#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 QUEUEget();
int /*<<< orphan*/ QUEUEinit(int);
int /*<<< orphan*/ QUEUEput(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int i, t;
  srand(time(NULL));
  QUEUEinit(10);
  QUEUEput(1);
  QUEUEput(2);
  QUEUEput(3);
  QUEUEput(2);
  QUEUEput(4);
  for (i = 0; i < 4; ++i) {
    t = QUEUEget();
    printf("Getting: %i\n", t);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0xa,%edi
call   1030 <QUEUEinit@plt>
mov    $0x1,%edi
call   1080 <QUEUEput@plt>
mov    $0x2,%edi
call   1080 <QUEUEput@plt>
mov    $0x3,%edi
call   1080 <QUEUEput@plt>
mov    $0x2,%edi
call   1080 <QUEUEput@plt>
mov    $0x4,%edi
call   1080 <QUEUEput@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    11f3 <main+0x93>
mov    $0x0,%al
call   1070 <QUEUEget@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c2 <main+0x62>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0xa,%edi
call   1030 <QUEUEinit@plt>
mov    $0x1,%edi
call   1080 <QUEUEput@plt>
mov    $0x2,%edi
call   1080 <QUEUEput@plt>
mov    $0x3,%edi
call   1080 <QUEUEput@plt>
mov    $0x2,%edi
call   1080 <QUEUEput@plt>
mov    $0x4,%edi
call   1080 <QUEUEput@plt>
xor    %eax,%eax
call   1070 <QUEUEget@plt>
lea    0xe47(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <QUEUEget@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <QUEUEget@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <QUEUEget@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Getting: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 @QUEUEinit(i32 10)
%7 = call i32 @QUEUEput(i32 1)
%8 = call i32 @QUEUEput(i32 2)
%9 = call i32 @QUEUEput(i32 3)
%10 = call i32 @QUEUEput(i32 2)
%11 = call i32 @QUEUEput(i32 4)
store i32 0, i32* %2
br label %12
12: ; preds = %19, %0
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = call i32 (...) @QUEUEget()
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %15
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %12
22: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Getting: %i\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 @QUEUEinit(i32 10)
%4 = tail call i32 @QUEUEput(i32 1)
%5 = tail call i32 @QUEUEput(i32 2)
%6 = tail call i32 @QUEUEput(i32 3)
%7 = tail call i32 @QUEUEput(i32 2)
%8 = tail call i32 @QUEUEput(i32 4)
%9 = tail call i32 (...) @QUEUEget()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 (...) @QUEUEget()
%12 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = tail call i32 (...) @QUEUEget()
%14 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = tail call i32 (...) @QUEUEget()
%16 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}