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

/* Variables and functions */
struct tree *initializeTree();
int /*<<< orphan*/ performActionInTree(int, struct tree *);
int /*<<< orphan*/ printMenu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int selectedAction;
  char wantToContinue;
  struct tree *christmasTree;
  christmasTree = initializeTree();
  do {
    printMenu();
    scanf("%d", &selectedAction);
    performActionInTree(selectedAction, christmasTree);
    printf("\n\nDo you want to continue? (Y/N) :");
    scanf("%s", &wantToContinue);
  } while (wantToContinue == 'Y' || wantToContinue == 'y');
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <initializeTree@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <printMenu@plt>
lea    0xe88(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <performActionInTree@plt>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
lea    0xe84(%rip),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x19(%rbp)
je     11cc <main+0x7c>
movsbl -0x9(%rbp),%eax
cmp    $0x79,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    116a <main+0x1a>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <initializeTree@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe8b(%rip),%r12
lea    0xea7(%rip),%r13
lea    0x3(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <printMenu@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1050 <performActionInTree@plt>
mov    %r12,%rdi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movzbl 0x3(%rsp),%eax
and    $0xdf,%al
cmp    $0x59,%al
je     1190 <main+0x40>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tree = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"\0A\0ADo you want to continue? (Y/N) :\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca %struct.tree*
store i32 0, i32* %1
%5 = call %struct.tree* (...) @initializeTree()
store %struct.tree* %5, %struct.tree** %4
br label %6
6: ; preds = %22, %0
%7 = call i32 (...) @printMenu()
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = load %struct.tree*, %struct.tree** %4
%11 = call i32 @performActionInTree(i32 %9, %struct.tree* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %14
14: ; preds = %6
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 89
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 121
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ true, %14 ], [ %21, %18 ]
br i1 %23, label %6, label %24
24: ; preds = %22
ret i32 1
}

LLVM IR (-O2):
%struct.tree = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [35 x i8] c"\0A\0ADo you want to continue? (Y/N) :\00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call %struct.tree* (...) @initializeTree()
br label %5
5: ; preds = %5, %0
%6 = call i32 (...) @printMenu()
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = call i32 @performActionInTree(i32 %8, %struct.tree* %4)
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%12 = load i8, i8* %2
%13 = and i8 %12, -33
%14 = icmp eq i8 %13, 89
br i1 %14, label %5, label %15
15: ; preds = %5
ret i32 1
}