#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int stack[n];
  int top = -1;
  int i = 0;
  for (i = 0; i < n; i++)
    stack[i] = 0;
  for (i = 0; i < n; i++) {
    int query;
    scanf("%d", &query);
    if (query == 1) {
      if (top < 0)
        printf("No Food\n");
      else
        printf("%d\n", stack[top--]);
    } else {
      int package_cost;
      scanf("%d\n", &package_cost);
      stack[++top] = package_cost;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a4 <main+0x84>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117b <main+0x5b>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124f <main+0x12f>
lea    0xe42(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x24(%rbp)
jne    1216 <main+0xf6>
cmpl   $0x0,-0x1c(%rbp)
jge    11ee <main+0xce>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1211 <main+0xf1>
mov    -0x30(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123c <main+0x11c>
lea    0xdef(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%edx
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1241 <main+0x121>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ab <main+0x8b>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x2c(%rbp),%edx
test   %edx,%edx
jle    1216 <main+0xd6>
shl    $0x2,%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    $0xffffffff,%r12d
lea    0xe5d(%rip),%r14
lea    -0x34(%rbp),%r15
xor    %r13d,%r13d
jmp    11d8 <main+0x98>
nopl   0x0(%rax)
lea    0xe4c(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x30(%rbp),%eax
movslq %r12d,%rcx
add    $0x1,%r12d
mov    %eax,0x4(%rbx,%rcx,4)
add    $0x1,%r13d
cmp    -0x2c(%rbp),%r13d
jge    1216 <main+0xd6>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
cmpl   $0x1,-0x34(%rbp)
jne    11b0 <main+0x70>
test   %r12d,%r12d
js     1208 <main+0xc8>
mov    %r12d,%eax
add    $0xffffffff,%r12d
mov    (%rbx,%rax,4),%esi
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ce <main+0x8e>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
jmp    11ce <main+0x8e>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"No Food\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i32, i64 %11
store i64 %11, i64* %4
store i32 -1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %14
14: ; preds = %22, %0
%15 = load i32, i32* %6
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %13, i64 %20
store i32 0, i32* %21
br label %22
22: ; preds = %18
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %14
25: ; preds = %14
store i32 0, i32* %6
br label %26
26: ; preds = %55, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %58
30: ; preds = %26
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%32 = load i32, i32* %7
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %47
34: ; preds = %30
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %46
39: ; preds = %34
%40 = load i32, i32* %5
%41 = add nsw i32 %40, -1
store i32 %41, i32* %5
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i32, i32* %13, i64 %42
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %39, %37
br label %54
47: ; preds = %30
%48 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%49 = load i32, i32* %8
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %13, i64 %52
store i32 %49, i32* %53
br label %54
54: ; preds = %47, %46
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %26
58: ; preds = %26
%59 = load i8*, i8** %3
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [8 x i8] c"No Food\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i32, i64 %7
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %45
12: ; preds = %0
%13 = bitcast i32* %9 to i8*
%14 = zext i32 %10 to i64
%15 = shl nuw nsw i64 %14, 2
%16 = bitcast i32* %2 to i8*
%17 = bitcast i32* %3 to i8*
br label %18
18: ; preds = %12, %40
%19 = phi i32 [ 0, %12 ], [ %42, %40 ]
%20 = phi i32 [ -1, %12 ], [ %41, %40 ]
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %34
24: ; preds = %18
%25 = icmp slt i32 %20, 0
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %40
28: ; preds = %24
%29 = add nsw i32 %20, -1
%30 = zext i32 %20 to i64
%31 = getelementptr inbounds i32, i32* %9, i64 %30
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %40
34: ; preds = %18
%35 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%36 = load i32, i32* %3
%37 = add nsw i32 %20, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %9, i64 %38
store i32 %36, i32* %39
br label %40
40: ; preds = %26, %28, %34
%41 = phi i32 [ %20, %26 ], [ %29, %28 ], [ %37, %34 ]
%42 = add nuw nsw i32 %19, 1
%43 = load i32, i32* %1
%44 = icmp slt i32 %42, %43
br i1 %44, label %18, label %45
45: ; preds = %40, %0
ret i32 0
}