#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 get_char();
int /*<<< orphan*/ printf(char *);
page29() {
  printf("\"Psst, hey citizen, come here.  Pssfft,\" you hear.  When you peer "
         "around\n");
  printf("you can see someone\'s dim outline in the shadows.  \"I got some "
         "information\n");
  printf("on the Master Retailer.  It\'ll only cost you 30 psst credits.\"\n");
  printf("\nSelect \'a\', \'b\' or \'c\' :\n");
  printf(" a - You pay the 30 credits for the info.\n");
  printf(" b - You would rather threaten him for the information.\n");
  printf(" c - You ignore him and walk away.\n");
  switch (get_char()) {
  case 'a':
    return 30;
  case 'b':
    return 31;
  case 'c':
  default:
    return 22;
  }
}


x86 assembly (clang, -O0):
<page29>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf83(%rip),%rdi
call   1030 <printf@plt>
lea    0xf92(%rip),%rdi
call   1030 <printf@plt>
lea    0xfb1(%rip),%rdi
call   1030 <printf@plt>
lea    0xfde(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <get_char@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0x61,%eax
je     11b8 <page29+0x98>
jmp    1196 <page29+0x76>
mov    -0x8(%rbp),%eax
sub    $0x62,%eax
je     11c4 <page29+0xa4>
jmp    11a7 <page29+0x87>
mov    -0x8(%rbp),%eax
sub    $0x63,%eax
je     11d0 <page29+0xb0>
jmp    11d5 <page29+0xb5>
movl   $0x1e,-0x4(%rbp)
jmp    11dc <page29+0xbc>
movl   $0x1f,-0x4(%rbp)
jmp    11dc <page29+0xbc>
jmp    11d5 <page29+0xb5>
movl   $0x16,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<page29>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
lea    0xf54(%rip),%rdi
call   1030 <puts@plt>
lea    0xf87(%rip),%rdi
call   1030 <puts@plt>
lea    0xf95(%rip),%rdi
call   1030 <puts@plt>
lea    0xfb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xfdf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <get_char@plt>
xor    %ecx,%ecx
cmp    $0x62,%eax
sete   %cl
lea    (%rcx,%rcx,8),%ecx
add    $0x16,%ecx
cmp    $0x61,%eax
mov    $0x1e,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [74 x i8] c"\22Psst, hey citizen, come here. Pssfft,\22 you hear. When you peer around\0A\00"
@.str.1 = [76 x i8] c"you can see someone's dim outline in the shadows. \22I got some information\0A\00"
@.str.2 = [64 x i8] c"on the Master Retailer. It'll only cost you 30 psst credits.\22\0A\00"
@.str.3 = [27 x i8] c"\0ASelect 'a', 'b' or 'c' :\0A\00"
@.str.4 = [43 x i8] c" a - You pay the 30 credits for the info.\0A\00"
@.str.5 = [57 x i8] c" b - You would rather threaten him for the information.\0A\00"
@.str.6 = [36 x i8] c" c - You ignore him and walk away.\0A\00"
define i32 @page29() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 (...) @get_char()
switch i32 %9, label %13 [
i32 97, label %10
i32 98, label %11
i32 99, label %12
]
10: ; preds = %0
store i32 30, i32* %1
br label %14
11: ; preds = %0
store i32 31, i32* %1
br label %14
12: ; preds = %0
br label %13
13: ; preds = %0, %12
store i32 22, i32* %1
br label %14
14: ; preds = %13, %11, %10
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@str = [73 x i8] c"\22Psst, hey citizen, come here. Pssfft,\22 you hear. When you peer around\00"
@str.7 = [75 x i8] c"you can see someone's dim outline in the shadows. \22I got some information\00"
@str.8 = [63 x i8] c"on the Master Retailer. It'll only cost you 30 psst credits.\22\00"
@str.9 = [26 x i8] c"\0ASelect 'a', 'b' or 'c' :\00"
@str.10 = [42 x i8] c" a - You pay the 30 credits for the info.\00"
@str.11 = [56 x i8] c" b - You would rather threaten him for the information.\00"
@str.12 = [35 x i8] c" c - You ignore him and walk away.\00"
define i32 @page29() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.7, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 (...) @get_char()
%9 = icmp eq i32 %8, 98
%10 = select i1 %9, i32 31, i32 22
%11 = icmp eq i32 %8, 97
%12 = select i1 %11, i32 30, i32 %10
ret i32 %12
}