#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 INT_MIN;
int /*<<< orphan*/ assert(int);
int pop();
int /*<<< orphan*/ push(int);
void test() {
  push(1);
  push(2);
  assert(2 == pop());
  assert(1 == pop());
  assert(INT_MIN == pop());
  push(3);
  assert(3 == pop());
  assert(INT_MIN == pop());
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1050 <push@plt>
mov    $0x2,%edi
call   1050 <push@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x3,%edi
call   1050 <push@plt>
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%edi
call   1050 <push@plt>
mov    $0x2,%edi
call   1050 <push@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x2e70(%rip),%rbx
mov    (%rbx),%ebp
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
cmp    %eax,%ebp
sete   %dil
call   1040 <assert@plt>
mov    $0x3,%edi
call   1050 <push@plt>
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%rbx),%ebx
xor    %eax,%eax
call   1030 <pop@plt>
xor    %edi,%edi
cmp    %eax,%ebx
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <assert@plt>

LLVM IR (-O0):
@INT_MIN = global i32 0
define void @test() {
%1 = call i32 @push(i32 1)
%2 = call i32 @push(i32 2)
%3 = call i32 (...) @pop()
%4 = icmp eq i32 2, %3
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32 (...) @pop()
%8 = icmp eq i32 1, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* @INT_MIN
%12 = call i32 (...) @pop()
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i32 @push(i32 3)
%17 = call i32 (...) @pop()
%18 = icmp eq i32 3, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* @INT_MIN
%22 = call i32 (...) @pop()
%23 = icmp eq i32 %21, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
ret void
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define void @test() {
%1 = tail call i32 @push(i32 1)
%2 = tail call i32 @push(i32 2)
%3 = tail call i32 (...) @pop()
%4 = icmp eq i32 %3, 2
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 (...) @pop()
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = load i32, i32* @INT_MIN
%12 = tail call i32 (...) @pop()
%13 = icmp eq i32 %11, %12
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32 @push(i32 3)
%17 = tail call i32 (...) @pop()
%18 = icmp eq i32 %17, 3
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = load i32, i32* @INT_MIN
%22 = tail call i32 (...) @pop()
%23 = icmp eq i32 %21, %22
%24 = zext i1 %23 to i32
%25 = tail call i32 @assert(i32 %24)
ret void
}