#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*/ cleanStack(int **);
int /*<<< orphan*/ free(int **);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ pop(int **);
int /*<<< orphan*/ print_stack(int **);
int /*<<< orphan*/ push(int **, int);
int main(void) {
  int **new_stack = NULL;
  new_stack = (int **)malloc(sizeof(int *) * 200);
  memset(new_stack, 0, 200 * sizeof(int *));
  push(new_stack, 10);
  push(new_stack, 20);
  push(new_stack, 30);
  push(new_stack, 40);
  push(new_stack, 50);
  push(new_stack, 60);
  print_stack(new_stack);
  pop(new_stack);
  pop(new_stack);
  cleanStack(new_stack);
  free(new_stack);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x640,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x640,%edx
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x1e,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x28,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x32,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
mov    $0x3c,%esi
call   1090 <push@plt>
mov    -0x10(%rbp),%rdi
call   1080 <print_stack@plt>
mov    -0x10(%rbp),%rdi
call   1060 <pop@plt>
mov    -0x10(%rbp),%rdi
call   1060 <pop@plt>
mov    -0x10(%rbp),%rdi
call   1040 <cleanStack@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x640,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x640,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
mov    $0x14,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
mov    $0x28,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
mov    $0x32,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
mov    $0x3c,%esi
call   1090 <push@plt>
mov    %rbx,%rdi
call   1080 <print_stack@plt>
mov    %rbx,%rdi
call   1060 <pop@plt>
mov    %rbx,%rdi
call   1060 <pop@plt>
mov    %rbx,%rdi
call   1040 <cleanStack@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
store i32 0, i32* %1
store i32** null, i32*** %2
%3 = call i64 @malloc(i32 1600)
%4 = inttoptr i64 %3 to i32**
store i32** %4, i32*** %2
%5 = load i32**, i32*** %2
%6 = call i32 @memset(i32** %5, i32 0, i32 1600)
%7 = load i32**, i32*** %2
%8 = call i32 @push(i32** %7, i32 10)
%9 = load i32**, i32*** %2
%10 = call i32 @push(i32** %9, i32 20)
%11 = load i32**, i32*** %2
%12 = call i32 @push(i32** %11, i32 30)
%13 = load i32**, i32*** %2
%14 = call i32 @push(i32** %13, i32 40)
%15 = load i32**, i32*** %2
%16 = call i32 @push(i32** %15, i32 50)
%17 = load i32**, i32*** %2
%18 = call i32 @push(i32** %17, i32 60)
%19 = load i32**, i32*** %2
%20 = call i32 @print_stack(i32** %19)
%21 = load i32**, i32*** %2
%22 = call i32 @pop(i32** %21)
%23 = load i32**, i32*** %2
%24 = call i32 @pop(i32** %23)
%25 = load i32**, i32*** %2
%26 = call i32 @cleanStack(i32** %25)
%27 = load i32**, i32*** %2
%28 = call i32 @free(i32** %27)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 1600)
%2 = inttoptr i64 %1 to i32**
%3 = tail call i32 @memset(i32** %2, i32 0, i32 1600)
%4 = tail call i32 @push(i32** %2, i32 10)
%5 = tail call i32 @push(i32** %2, i32 20)
%6 = tail call i32 @push(i32** %2, i32 30)
%7 = tail call i32 @push(i32** %2, i32 40)
%8 = tail call i32 @push(i32** %2, i32 50)
%9 = tail call i32 @push(i32** %2, i32 60)
%10 = tail call i32 @print_stack(i32** %2)
%11 = tail call i32 @pop(i32** %2)
%12 = tail call i32 @pop(i32** %2)
%13 = tail call i32 @cleanStack(i32** %2)
%14 = tail call i32 @free(i32** %2)
ret i32 0
}