#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 q {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct q *create_q();
struct q *dequeue(struct q *);
struct q *enqueue(struct q *, int *);
scalar_t__ front(struct q *);
int main() {
  int k1 = 1;
  int k2 = 2;
  struct q *queue = create_q();
  assert(front(queue) == 0);
  queue = enqueue(queue, &k1);
  assert((int *)front(queue) == &k1);
  queue = enqueue(queue, &k2);
  assert((int *)front(queue) == &k1);
  queue = dequeue(queue);
  assert((int *)front(queue) == &k2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    $0x0,%al
call   1030 <create_q@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <front@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <enqueue@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <front@plt>
lea    -0x8(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <enqueue@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <front@plt>
lea    -0x8(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1050 <dequeue@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <front@plt>
lea    -0xc(%rbp),%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x1,0xc(%rsp)
movl   $0x2,0x8(%rsp)
xor    %eax,%eax
call   1030 <create_q@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <front@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <enqueue@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <front@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   1040 <assert@plt>
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <enqueue@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <front@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1050 <dequeue@plt>
mov    %rax,%rdi
call   1060 <front@plt>
xor    %edi,%edi
cmp    %rax,%r14
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.q = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.q*
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
%5 = call %struct.q* (...) @create_q()
store %struct.q* %5, %struct.q** %4
%6 = load %struct.q*, %struct.q** %4
%7 = call i64 @front(%struct.q* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load %struct.q*, %struct.q** %4
%12 = call %struct.q* @enqueue(%struct.q* %11, i32* %2)
store %struct.q* %12, %struct.q** %4
%13 = load %struct.q*, %struct.q** %4
%14 = call i64 @front(%struct.q* %13)
%15 = inttoptr i64 %14 to i32*
%16 = icmp eq i32* %15, %2
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load %struct.q*, %struct.q** %4
%20 = call %struct.q* @enqueue(%struct.q* %19, i32* %3)
store %struct.q* %20, %struct.q** %4
%21 = load %struct.q*, %struct.q** %4
%22 = call i64 @front(%struct.q* %21)
%23 = inttoptr i64 %22 to i32*
%24 = icmp eq i32* %23, %2
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load %struct.q*, %struct.q** %4
%28 = call %struct.q* @dequeue(%struct.q* %27)
store %struct.q* %28, %struct.q** %4
%29 = load %struct.q*, %struct.q** %4
%30 = call i64 @front(%struct.q* %29)
%31 = inttoptr i64 %30 to i32*
%32 = icmp eq i32* %31, %3
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
ret i32 0
}

LLVM IR (-O2):
%struct.q = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = tail call %struct.q* (...) @create_q()
%6 = tail call i64 @front(%struct.q* %5)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = call %struct.q* @enqueue(%struct.q* %5, i32* %1)
%11 = call i64 @front(%struct.q* %10)
%12 = inttoptr i64 %11 to i32*
%13 = icmp eq i32* %1, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call %struct.q* @enqueue(%struct.q* %10, i32* %2)
%17 = call i64 @front(%struct.q* %16)
%18 = inttoptr i64 %17 to i32*
%19 = icmp eq i32* %1, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call %struct.q* @dequeue(%struct.q* %16)
%23 = call i64 @front(%struct.q* %22)
%24 = inttoptr i64 %23 to i32*
%25 = icmp eq i32* %2, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
ret i32 0
}