#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 *);
page15() {
  printf("You are set upon by a runty robot with a queer looking face and two "
         "pointy\n");
  printf("rubber ears poking from beneath a tattered cap.  \"Hey mister,\" it "
         "says,\n");
  printf("\"you done all your last minute Christmas shopping?  I got some real "
         "neat junk\n");
  printf("here.  You don\'t wanna miss the big day tommorrow, if you know what "
         "I mean.\"\n");
  printf("The robot opens its bag to show you a pile of shoddy Troubleshooter "
         "dolls.  It\n");
  printf("reaches in and pulls out one of them.  \"Look, these Action "
         "Troubleshooter(tm)\n");
  printf("dolls are the neatest thing.  This one\'s got moveable arms and when "
         "you\n");
  printf("squeeze him, his little rifle squirts realistic looking napalm.  "
         "It\'s only\n");
  printf("50 credits.  Oh yeah, Merry Christmas.\"\n");
  printf("\nSelect \'a\', \'b\' or \'c\' :\n");
  printf(" a - You decide to buy the doll.\n");
  printf(" b - You shoot the robot.\n");
  printf(" c - You ignore the robot and keep searching the hall.\n");
  switch (get_char()) {
  case 'a':
    return 16;
  case 'b':
    return 17;
  case 'c':
  default:
    return 22;
  }
}


x86 assembly (clang, -O0):
<page15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
call   1030 <printf@plt>
lea    0xf4e(%rip),%rdi
call   1030 <printf@plt>
lea    0xf91(%rip),%rdi
call   1030 <printf@plt>
lea    0xfd3(%rip),%rdi
call   1030 <printf@plt>
lea    0x1017(%rip),%rdi
call   1030 <printf@plt>
lea    0x105a(%rip),%rdi
call   1030 <printf@plt>
lea    0x1097(%rip),%rdi
call   1030 <printf@plt>
lea    0x10d7(%rip),%rdi
call   1030 <printf@plt>
lea    0x10f4(%rip),%rdi
call   1030 <printf@plt>
lea    0x1103(%rip),%rdi
call   1030 <printf@plt>
lea    0x1119(%rip),%rdi
call   1030 <printf@plt>
lea    0x1128(%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     1200 <page15+0xe0>
jmp    11de <page15+0xbe>
mov    -0x8(%rbp),%eax
sub    $0x62,%eax
je     120c <page15+0xec>
jmp    11ef <page15+0xcf>
mov    -0x8(%rbp),%eax
sub    $0x63,%eax
je     1218 <page15+0xf8>
jmp    121d <page15+0xfd>
movl   $0x10,-0x4(%rbp)
jmp    1224 <page15+0x104>
movl   $0x11,-0x4(%rbp)
jmp    1224 <page15+0x104>
jmp    121d <page15+0xfd>
movl   $0x16,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<page15>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf17(%rip),%rdi
call   1030 <puts@plt>
lea    0xf53(%rip),%rdi
call   1030 <puts@plt>
lea    0xf95(%rip),%rdi
call   1030 <puts@plt>
lea    0xfd6(%rip),%rdi
call   1030 <puts@plt>
lea    0x1019(%rip),%rdi
call   1030 <puts@plt>
lea    0x105b(%rip),%rdi
call   1030 <puts@plt>
lea    0x1097(%rip),%rdi
call   1030 <puts@plt>
lea    0x10d6(%rip),%rdi
call   1030 <puts@plt>
lea    0x10f2(%rip),%rdi
call   1030 <puts@plt>
lea    0x1100(%rip),%rdi
call   1030 <puts@plt>
lea    0x1115(%rip),%rdi
call   1030 <puts@plt>
lea    0x1123(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <get_char@plt>
xor    %ecx,%ecx
cmp    $0x62,%eax
setne  %cl
lea    (%rcx,%rcx,4),%ecx
add    $0x11,%ecx
cmp    $0x61,%eax
mov    $0x10,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [76 x i8] c"You are set upon by a runty robot with a queer looking face and two pointy\0A\00"
@.str.1 = [73 x i8] c"rubber ears poking from beneath a tattered cap. \22Hey mister,\22 it says,\0A\00"
@.str.2 = [79 x i8] c"\22you done all your last minute Christmas shopping? I got some real neat junk\0A\00"
@.str.3 = [78 x i8] c"here. You don't wanna miss the big day tommorrow, if you know what I mean.\22\0A\00"
@.str.4 = [80 x i8] c"The robot opens its bag to show you a pile of shoddy Troubleshooter dolls. It\0A\00"
@.str.5 = [79 x i8] c"reaches in and pulls out one of them. \22Look, these Action Troubleshooter(tm)\0A\00"
@.str.6 = [73 x i8] c"dolls are the neatest thing. This one's got moveable arms and when you\0A\00"
@.str.7 = [76 x i8] c"squeeze him, his little rifle squirts realistic looking napalm. It's only\0A\00"
@.str.8 = [41 x i8] c"50 credits. Oh yeah, Merry Christmas.\22\0A\00"
@.str.9 = [27 x i8] c"\0ASelect 'a', 'b' or 'c' :\0A\00"
@.str.10 = [34 x i8] c" a - You decide to buy the doll.\0A\00"
@.str.11 = [27 x i8] c" b - You shoot the robot.\0A\00"
@.str.12 = [56 x i8] c" c - You ignore the robot and keep searching the hall.\0A\00"
define i32 @page15() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.12, i64 0, i64 0))
%15 = call i32 (...) @get_char()
switch i32 %15, label %19 [
i32 97, label %16
i32 98, label %17
i32 99, label %18
]
16: ; preds = %0
store i32 16, i32* %1
br label %20
17: ; preds = %0
store i32 17, i32* %1
br label %20
18: ; preds = %0
br label %19
19: ; preds = %0, %18
store i32 22, i32* %1
br label %20
20: ; preds = %19, %17, %16
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@str = [75 x i8] c"You are set upon by a runty robot with a queer looking face and two pointy\00"
@str.13 = [72 x i8] c"rubber ears poking from beneath a tattered cap. \22Hey mister,\22 it says,\00"
@str.14 = [78 x i8] c"\22you done all your last minute Christmas shopping? I got some real neat junk\00"
@str.15 = [77 x i8] c"here. You don't wanna miss the big day tommorrow, if you know what I mean.\22\00"
@str.16 = [79 x i8] c"The robot opens its bag to show you a pile of shoddy Troubleshooter dolls. It\00"
@str.17 = [78 x i8] c"reaches in and pulls out one of them. \22Look, these Action Troubleshooter(tm)\00"
@str.18 = [72 x i8] c"dolls are the neatest thing. This one's got moveable arms and when you\00"
@str.19 = [75 x i8] c"squeeze him, his little rifle squirts realistic looking napalm. It's only\00"
@str.20 = [40 x i8] c"50 credits. Oh yeah, Merry Christmas.\22\00"
@str.21 = [26 x i8] c"\0ASelect 'a', 'b' or 'c' :\00"
@str.22 = [33 x i8] c" a - You decide to buy the doll.\00"
@str.23 = [26 x i8] c" b - You shoot the robot.\00"
@str.24 = [55 x i8] c" c - You ignore the robot and keep searching the hall.\00"
define i32 @page15() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.13, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.14, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.15, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.21, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.22, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.23, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.24, i64 0, i64 0))
%14 = tail call i32 (...) @get_char()
%15 = icmp eq i32 %14, 98
%16 = select i1 %15, i32 17, i32 22
%17 = icmp eq i32 %14, 97
%18 = select i1 %17, i32 16, i32 %16
ret i32 %18
}