#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 dice_roll(int, int);
int /*<<< orphan*/ more();
int /*<<< orphan*/ printf(char *);
page40() {
  printf("You breathe a sigh of relief as Plato-B-PHI picks on the other "
         "Troubleshooter.\n");
  printf("\"You down here in the front,\" says the instructor pointing at the "
         "other\n");
  printf("Troubleshooter, \"you\'ll make a good volunteer.  Please step "
         "forward.\"\n");
  printf("The Troubleshooter looks around with a \`who me?\' expression on his "
         "face, but\n");
  printf("since he is the only one visible in the audience he figures his "
         "number is up.\n");
  printf("He walks down to the podium clutching his Action Troubleshooter(tm) "
         "doll before\n");
  printf("him like a weapon.  \"Here,\" says Plato-B-PHI, \"take the mutant "
         "detection ray\n");
  printf("and point it at the audience.  If there are any mutants out there "
         "we\'ll know\n");
  printf("soon enough.\"  Suddenly your skin prickles with static electricity "
         "as a bright\n");
  printf("purple nimbus surrounds your body.  \"Ha Ha, got one,\" says the "
         "instructor.\n");
  printf("\"Stun him before he gets away.\"\n");
  more();
  while (1) {
    if (dice_roll(1, 100) <= 30) {
      printf("His shot hits you.  You feel numb all over.\n");
      return 49;
    } else
      printf("His shot just missed.\n");
    if (dice_roll(1, 100) <= 40) {
      printf("You just blew his head off.  His lifeless hand drops the mutant "
             "detector ray.\n");
      return 50;
    } else
      printf("You burnt a hole in the podium.  He sights the mutant detector "
             "ray on you.\n");
  }
}


x86 assembly (clang, -O0):
<page40>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
call   1030 <printf@plt>
lea    0xf42(%rip),%rdi
call   1030 <printf@plt>
lea    0xf7d(%rip),%rdi
call   1030 <printf@plt>
lea    0xfbf(%rip),%rdi
call   1030 <printf@plt>
lea    0x1002(%rip),%rdi
call   1030 <printf@plt>
lea    0x1047(%rip),%rdi
call   1030 <printf@plt>
lea    0x1089(%rip),%rdi
call   1030 <printf@plt>
lea    0x10cb(%rip),%rdi
call   1030 <printf@plt>
lea    0x110f(%rip),%rdi
call   1030 <printf@plt>
lea    0x114f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <more@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1050 <dice_roll@plt>
cmp    $0x1e,%eax
jg     11f3 <page40+0xc3>
lea    0x1145(%rip),%rdi
call   1030 <printf@plt>
movl   $0x31,-0x4(%rbp)
jmp    1240 <page40+0x110>
lea    0x115a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1050 <dice_roll@plt>
cmp    $0x28,%eax
jg     122f <page40+0xff>
lea    0x114d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x32,-0x4(%rbp)
jmp    1240 <page40+0x110>
lea    0x1184(%rip),%rdi
call   1030 <printf@plt>
jmp    11c3 <page40+0x93>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<page40>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf40(%rip),%rdi
call   1030 <puts@plt>
lea    0xf7a(%rip),%rdi
call   1030 <puts@plt>
lea    0xfbb(%rip),%rdi
call   1030 <puts@plt>
lea    0xffd(%rip),%rdi
call   1030 <puts@plt>
lea    0x1041(%rip),%rdi
call   1030 <puts@plt>
lea    0x1082(%rip),%rdi
call   1030 <puts@plt>
lea    0x10c3(%rip),%rdi
call   1030 <puts@plt>
lea    0x1106(%rip),%rdi
call   1030 <puts@plt>
lea    0x1145(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <more@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1050 <dice_roll@plt>
mov    $0x31,%r14d
lea    0x11ec(%rip),%r12
cmp    $0x1f,%eax
jl     1238 <page40+0x108>
lea    0x1131(%rip),%rbp
lea    0x118b(%rip),%r15
lea    0x1139(%rip),%rbx
nopl   0x0(%rax)
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1050 <dice_roll@plt>
cmp    $0x29,%eax
jl     123d <page40+0x10d>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1050 <dice_roll@plt>
cmp    $0x1e,%eax
jg     1200 <page40+0xd0>
mov    %r12,%r15
jmp    1243 <page40+0x113>
mov    $0x32,%r14d
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [80 x i8] c"You breathe a sigh of relief as Plato-B-PHI picks on the other Troubleshooter.\0A\00"
@.str.1 = [73 x i8] c"\22You down here in the front,\22 says the instructor pointing at the other\0A\00"
@.str.2 = [71 x i8] c"Troubleshooter, \22you'll make a good volunteer. Please step forward.\22\0A\00"
@.str.3 = [78 x i8] c"The Troubleshooter looks around with a `who me?' expression on his face, but\0A\00"
@.str.4 = [79 x i8] c"since he is the only one visible in the audience he figures his number is up.\0A\00"
@.str.5 = [81 x i8] c"He walks down to the podium clutching his Action Troubleshooter(tm) doll before\0A\00"
@.str.6 = [78 x i8] c"him like a weapon. \22Here,\22 says Plato-B-PHI, \22take the mutant detection ray\0A\00"
@.str.7 = [78 x i8] c"and point it at the audience. If there are any mutants out there we'll know\0A\00"
@.str.8 = [80 x i8] c"soon enough.\22 Suddenly your skin prickles with static electricity as a bright\0A\00"
@.str.9 = [76 x i8] c"purple nimbus surrounds your body. \22Ha Ha, got one,\22 says the instructor.\0A\00"
@.str.10 = [33 x i8] c"\22Stun him before he gets away.\22\0A\00"
@.str.11 = [45 x i8] c"His shot hits you. You feel numb all over.\0A\00"
@.str.12 = [23 x i8] c"His shot just missed.\0A\00"
@.str.13 = [79 x i8] c"You just blew his head off. His lifeless hand drops the mutant detector ray.\0A\00"
@.str.14 = [76 x i8] c"You burnt a hole in the podium. He sights the mutant detector ray on you.\0A\00"
define i32 @page40() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 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 ([71 x i8], [71 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 ([79 x i8], [79 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.7, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.9, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%13 = call i32 (...) @more()
br label %14
14: ; preds = %0, %28
%15 = call i32 @dice_roll(i32 1, i32 100)
%16 = icmp sle i32 %15, 30
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
store i32 49, i32* %1
br label %29
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %21
21: ; preds = %19
%22 = call i32 @dice_roll(i32 1, i32 100)
%23 = icmp sle i32 %22, 40
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.13, i64 0, i64 0))
store i32 50, i32* %1
br label %29
26: ; preds = %21
%27 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.14, i64 0, i64 0))
br label %28
28: ; preds = %26
br label %14
29: ; preds = %24, %17
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@str = [79 x i8] c"You breathe a sigh of relief as Plato-B-PHI picks on the other Troubleshooter.\00"
@str.15 = [72 x i8] c"\22You down here in the front,\22 says the instructor pointing at the other\00"
@str.16 = [70 x i8] c"Troubleshooter, \22you'll make a good volunteer. Please step forward.\22\00"
@str.17 = [77 x i8] c"The Troubleshooter looks around with a `who me?' expression on his face, but\00"
@str.18 = [78 x i8] c"since he is the only one visible in the audience he figures his number is up.\00"
@str.19 = [80 x i8] c"He walks down to the podium clutching his Action Troubleshooter(tm) doll before\00"
@str.20 = [77 x i8] c"him like a weapon. \22Here,\22 says Plato-B-PHI, \22take the mutant detection ray\00"
@str.21 = [77 x i8] c"and point it at the audience. If there are any mutants out there we'll know\00"
@str.22 = [79 x i8] c"soon enough.\22 Suddenly your skin prickles with static electricity as a bright\00"
@str.23 = [75 x i8] c"purple nimbus surrounds your body. \22Ha Ha, got one,\22 says the instructor.\00"
@str.24 = [32 x i8] c"\22Stun him before he gets away.\22\00"
@str.25 = [22 x i8] c"His shot just missed.\00"
@str.26 = [75 x i8] c"You burnt a hole in the podium. He sights the mutant detector ray on you.\00"
@str.27 = [78 x i8] c"You just blew his head off. His lifeless hand drops the mutant detector ray.\00"
@str.28 = [44 x i8] c"His shot hits you. You feel numb all over.\00"
define i32 @page40() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.15, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str.16, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.17, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.18, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str.19, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.20, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.21, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str.22, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.23, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.24, i64 0, i64 0))
%12 = tail call i32 (...) @more()
%13 = tail call i32 @dice_roll(i32 1, i32 100)
%14 = icmp slt i32 %13, 31
br i1 %14, label %23, label %15
15: ; preds = %0, %19
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.25, i64 0, i64 0))
%17 = tail call i32 @dice_roll(i32 1, i32 100)
%18 = icmp slt i32 %17, 41
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str.26, i64 0, i64 0))
%21 = tail call i32 @dice_roll(i32 1, i32 100)
%22 = icmp slt i32 %21, 31
br i1 %22, label %23, label %15
23: ; preds = %15, %19, %0
%24 = phi i8* [ getelementptr inbounds ([44 x i8], [44 x i8]* @str.28, i64 0, i64 0), %0 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @str.28, i64 0, i64 0), %19 ], [ getelementptr inbounds ([78 x i8], [78 x i8]* @str.27, i64 0, i64 0), %15 ]
%25 = phi i32 [ 49, %0 ], [ 49, %19 ], [ 50, %15 ]
%26 = tail call i32 @puts(i8* dereferenceable(1) %24)
ret i32 %25
}