#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 */
scalar_t__ isEmpty();
int pop();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(int);
int /*<<< orphan*/ stack_print();
int main() {
  int i;
  printf("is stack empty? \n");
  printf("%s\n", (isEmpty()) ? "true" : "false");
  push(10);
  push(11);
  push(12);
  push(15);
  i = pop();
  printf("Popped data is %d\n", i);
  stack_print();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <isEmpty@plt>
mov    %rax,%rcx
lea    0xe9d(%rip),%rsi
lea    0xe91(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xa,%edi
call   1070 <push@plt>
mov    $0xb,%edi
call   1070 <push@plt>
mov    $0xc,%edi
call   1070 <push@plt>
mov    $0xf,%edi
call   1070 <push@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <stack_print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <isEmpty@plt>
test   %rax,%rax
lea    0xe87(%rip),%rax
lea    0xe7b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1080 <push@plt>
mov    $0xb,%edi
call   1080 <push@plt>
mov    $0xc,%edi
call   1080 <push@plt>
mov    $0xf,%edi
call   1080 <push@plt>
xor    %eax,%eax
call   1050 <pop@plt>
lea    0xe47(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <stack_print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"is stack empty? \0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [6 x i8] c"false\00"
@.str.4 = [19 x i8] c"Popped data is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i64 (...) @isEmpty()
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 @push(i32 10)
%10 = call i32 @push(i32 11)
%11 = call i32 @push(i32 12)
%12 = call i32 @push(i32 15)
%13 = call i32 (...) @pop()
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = call i32 (...) @stack_print()
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"true\00"
@.str.3 = [6 x i8] c"false\00"
@.str.4 = [19 x i8] c"Popped data is %d\0A\00"
@str = [17 x i8] c"is stack empty? \00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @isEmpty()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
%6 = tail call i32 @push(i32 10)
%7 = tail call i32 @push(i32 11)
%8 = tail call i32 @push(i32 12)
%9 = tail call i32 @push(i32 15)
%10 = tail call i32 (...) @pop()
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = tail call i32 (...) @stack_print()
ret i32 0
}