#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 /*<<< orphan*/ STACK_empty();
int /*<<< orphan*/ STACK_init();
int STACK_pop();
int /*<<< orphan*/ STACK_push(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  STACK_init();
  STACK_push(4);
  STACK_push(3);
  STACK_push(2);
  STACK_push(1);
  while (!STACK_empty()) {
    printf("%d\n", STACK_pop());
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <STACK_init@plt>
mov    $0x4,%edi
call   1070 <STACK_push@plt>
mov    $0x3,%edi
call   1070 <STACK_push@plt>
mov    $0x2,%edi
call   1070 <STACK_push@plt>
mov    $0x1,%edi
call   1070 <STACK_push@plt>
mov    $0x0,%al
call   1030 <STACK_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11aa <main+0x5a>
jmp    11c4 <main+0x74>
mov    $0x0,%al
call   1050 <STACK_pop@plt>
mov    %eax,%esi
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    118e <main+0x3e>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <STACK_init@plt>
mov    $0x4,%edi
call   1070 <STACK_push@plt>
mov    $0x3,%edi
call   1070 <STACK_push@plt>
mov    $0x2,%edi
call   1070 <STACK_push@plt>
mov    $0x1,%edi
call   1070 <STACK_push@plt>
xor    %eax,%eax
call   1030 <STACK_empty@plt>
test   %eax,%eax
jne    11bc <main+0x6c>
lea    0xe6e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <STACK_pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <STACK_empty@plt>
test   %eax,%eax
je     11a0 <main+0x50>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @STACK_init()
%3 = call i32 @STACK_push(i32 4)
%4 = call i32 @STACK_push(i32 3)
%5 = call i32 @STACK_push(i32 2)
%6 = call i32 @STACK_push(i32 1)
br label %7
7: ; preds = %11, %0
%8 = call i32 (...) @STACK_empty()
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i32 (...) @STACK_pop()
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %7
14: ; preds = %7
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @STACK_init()
%2 = tail call i32 @STACK_push(i32 4)
%3 = tail call i32 @STACK_push(i32 3)
%4 = tail call i32 @STACK_push(i32 2)
%5 = tail call i32 @STACK_push(i32 1)
%6 = tail call i32 (...) @STACK_empty()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0, %8
%9 = tail call i32 (...) @STACK_pop()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = tail call i32 (...) @STACK_empty()
%12 = icmp eq i32 %11, 0
br i1 %12, label %8, label %13
13: ; preds = %8, %0
ret i32 0
}