#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*/ orderjoining();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void garoth() {
  int torc1, torc2;
  printf("After few days of thankfully uneventful walk, you finally approach "
         "the famous Templar Stronghold of Garoth. You've read about it in "
         "books and heard some stories from your father, but none of them did "
         "this magnificent structure justice."
         "As you walk up to the gate, a guard clad in plate armor with a holy "
         "cross striked with two torches signals you to stop with his hand\n"
         "'State your business citizen!'\n1 - 'I want to join the Order.'\n2 - "
         "'I just wanted to see the famous Stronghold for myself.'\n");
  scanf("%d", &torc1);
  switch (torc1) {
  case 1:
    orderjoining();
    break;
  case 2:
    printf("'I'm sorry citizen. As much as we're happy that people are "
           "interested in our headquarters, I'm afraid I can't let you in to "
           "simply wander yourself. Now, if you were to join our Order, that "
           "would be entirely different matter'\n"
           "1 - 'Very well, I will join the Order then'\n");
    scanf("%d", &torc2);
    switch (torc2) {
    case 1:
      orderjoining();
      break;
    }
  }
}


x86 assembly (clang, -O0):
<garoth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0x10a2(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1179 <garoth+0x49>
jmp    1168 <garoth+0x38>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1185 <garoth+0x55>
jmp    11be <garoth+0x8e>
mov    $0x0,%al
call   1030 <orderjoining@plt>
jmp    11be <garoth+0x8e>
lea    0x1064(%rip),%rdi
call   1040 <printf@plt>
lea    0x1055(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
jne    11b9 <garoth+0x89>
jmp    11b2 <garoth+0x82>
mov    $0x0,%al
call   1030 <orderjoining@plt>
jmp    11be <garoth+0x8e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<garoth>:
push   %rax
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     117d <garoth+0x4d>
cmp    $0x2,%eax
jne    1184 <garoth+0x54>
lea    0x108c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpl   $0x1,(%rsp)
jne    1184 <garoth+0x54>
xor    %eax,%eax
call   1040 <orderjoining@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [493 x i8] c"After few days of thankfully uneventful walk, you finally approach the famous Templar Stronghold of Garoth. You've read about it in books and heard some stories from your father, but none of them did this magnificent structure justice.As you walk up to the gate, a guard clad in plate armor with a holy cross striked with two torches signals you to stop with his hand\0A'State your business citizen!'\0A1 - 'I want to join the Order.'\0A2 - 'I just wanted to see the famous Stronghold for myself.'\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [270 x i8] c"'I'm sorry citizen. As much as we're happy that people are interested in our headquarters, I'm afraid I can't let you in to simply wander yourself. Now, if you were to join our Order, that would be entirely different matter'\0A1 - 'Very well, I will join the Order then'\0A\00"
define void @garoth() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @printf(i8* getelementptr inbounds ([493 x i8], [493 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
switch i32 %5, label %15 [
i32 1, label %6
i32 2, label %8
]
6: ; preds = %0
%7 = call i32 (...) @orderjoining()
br label %15
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([270 x i8], [270 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %14 [
i32 1, label %12
]
12: ; preds = %8
%13 = call i32 (...) @orderjoining()
br label %14
14: ; preds = %8, %12
br label %15
15: ; preds = %14, %0, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [492 x i8] c"After few days of thankfully uneventful walk, you finally approach the famous Templar Stronghold of Garoth. You've read about it in books and heard some stories from your father, but none of them did this magnificent structure justice.As you walk up to the gate, a guard clad in plate armor with a holy cross striked with two torches signals you to stop with his hand\0A'State your business citizen!'\0A1 - 'I want to join the Order.'\0A2 - 'I just wanted to see the famous Stronghold for myself.'\00"
@str.3 = [269 x i8] c"'I'm sorry citizen. As much as we're happy that people are interested in our headquarters, I'm afraid I can't let you in to simply wander yourself. Now, if you were to join our Order, that would be entirely different matter'\0A1 - 'Very well, I will join the Order then'\00"
define void @garoth() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([492 x i8], [492 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
switch i32 %7, label %15 [
i32 1, label %13
i32 2, label %8
]
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([269 x i8], [269 x i8]* @str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %8, %0
%14 = call i32 (...) @orderjoining()
br label %15
15: ; preds = %13, %8, %0
ret void
}