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

/* Variables and functions */
int INT_MIN;
int /*<<< orphan*/ assert(int);
int pop(struct node **);
int /*<<< orphan*/ push(struct node **, int);
void test() {
  struct node *stack = NULL;
  push(&stack, 1);
  push(&stack, 2);
  assert(2 == pop(&stack));
  assert(1 == pop(&stack));
  assert(INT_MIN == pop(&stack));
  push(&stack, 3);
  assert(3 == pop(&stack));
  assert(INT_MIN == pop(&stack));
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
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>
lea    -0x8(%rbp),%rdi
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    0x2e47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <pop@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1050 <push@plt>
lea    -0x8(%rbp),%rdi
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    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <pop@plt>
mov    %eax,%ecx
mov    -0xc(%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   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x2e55(%rip),%r14
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1030 <pop@plt>
xor    %edi,%edi
cmp    %eax,%ebp
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1050 <push@plt>
mov    %rbx,%rdi
call   1030 <pop@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1030 <pop@plt>
xor    %edi,%edi
cmp    %eax,%ebp
sete   %dil
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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