#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*/ Print(char *);
int /*<<< orphan*/ UlarnBeep();
int /*<<< orphan*/ oteleport(int /*<<< orphan*/);
int /*<<< orphan*/ raiselevel();
int rand();
void odeadthrone(int ans) {
  int k;
  switch (ans) {
  case 's':
    k = ((int)(rand() % (101)) + 1);
    if (k < 5) {
      raiselevel();
    } else if (k < 25) {
      Print("Zaaaappp!  You've been teleported!");
      UlarnBeep();
      oteleport(0);
    } else {
      Print("Nothing happens.");
    }
    break;
  case 'i':
  case '\033':
    break;
  }
}


x86 assembly (clang, -O0):
<odeadthrone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1b,%eax
je     11fb <odeadthrone+0xab>
jmp    116f <odeadthrone+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x69,%eax
je     11fb <odeadthrone+0xab>
jmp    1180 <odeadthrone+0x30>
mov    -0xc(%rbp),%eax
sub    $0x73,%eax
jne    1200 <odeadthrone+0xb0>
jmp    1191 <odeadthrone+0x41>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x65,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11bc <odeadthrone+0x6c>
mov    $0x0,%al
call   1050 <raiselevel@plt>
jmp    11f6 <odeadthrone+0xa6>
cmpl   $0x19,-0x8(%rbp)
jge    11e5 <odeadthrone+0x95>
lea    0xe33(%rip),%rdi
call   1060 <Print@plt>
mov    $0x0,%al
call   1030 <UlarnBeep@plt>
xor    %edi,%edi
call   1040 <oteleport@plt>
jmp    11f1 <odeadthrone+0xa1>
lea    0xe37(%rip),%rdi
call   1060 <Print@plt>
jmp    11f6 <odeadthrone+0xa6>
jmp    1200 <odeadthrone+0xb0>
jmp    1200 <odeadthrone+0xb0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odeadthrone>:
push   %rax
cmp    $0x73,%edi
jne    1185 <odeadthrone+0x35>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x288df0cb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x65,%ecx,%ecx
sub    %ecx,%eax
cmp    $0x3,%eax
jg     1187 <odeadthrone+0x37>
xor    %eax,%eax
pop    %rcx
jmp    1050 <raiselevel@plt>
pop    %rax
ret
cmp    $0x17,%eax
ja     11a7 <odeadthrone+0x57>
lea    0xe6d(%rip),%rdi
call   1060 <Print@plt>
xor    %eax,%eax
call   1030 <UlarnBeep@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <oteleport@plt>
lea    0xe75(%rip),%rdi
pop    %rax
jmp    1060 <Print@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Zaaaappp! You've been teleported!\00"
@.str.1 = [17 x i8] c"Nothing happens.\00"
define void @odeadthrone(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %25 [
i32 115, label %5
i32 105, label %24
i32 27, label %24
]
5: ; preds = %1
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 101
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 5
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = call i32 (...) @raiselevel()
br label %23
13: ; preds = %5
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 25
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = call i32 @Print(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (...) @UlarnBeep()
%19 = call i32 @oteleport(i32 0)
br label %22
20: ; preds = %13
%21 = call i32 @Print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22, %11
br label %25
24: ; preds = %1, %1
br label %25
25: ; preds = %1, %24, %23
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"Zaaaappp! You've been teleported!\00"
@.str.1 = [17 x i8] c"Nothing happens.\00"
define void @odeadthrone(i32 %0) {
%2 = icmp eq i32 %0, 115
br i1 %2, label %3, label %17
3: ; preds = %1
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 101
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (...) @raiselevel()
br label %17
9: ; preds = %3
%10 = icmp ult i32 %5, 24
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = tail call i32 @Print(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 (...) @UlarnBeep()
%14 = tail call i32 @oteleport(i32 0)
br label %17
15: ; preds = %9
%16 = tail call i32 @Print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %1, %7, %15, %11
ret void
}