#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*/ beep();
int /*<<< orphan*/ ignore();
int /*<<< orphan*/ iopts();
int /*<<< orphan*/ lprcat(char *);
int /*<<< orphan*/ oteleport(int /*<<< orphan*/);
int rnd(int);
int ttgetch();
void odeadthrone(void) {
  int k;
  lprcat("\nDo you (s) sit down");
  iopts();
  while (1) {
    while (1)
      switch (ttgetch()) {
      case 's':
        lprcat(" sit down");
        k = rnd(101);
        if (k < 35) {
          lprcat("\nZaaaappp!  You've been teleported!\n");
          beep();
          oteleport(0);
        } else
          lprcat("\nnothing happens");
        return;
      case 'i':
      case '\33':
        ignore();
        return;
      };
  }
}


x86 assembly (clang, -O0):
<odeadthrone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
call   1080 <lprcat@plt>
mov    $0x0,%al
call   1060 <iopts@plt>
jmp    1190 <odeadthrone+0x20>
xor    %eax,%eax
call   1090 <ttgetch@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0x1b,%eax
je     121f <odeadthrone+0xaf>
jmp    11aa <odeadthrone+0x3a>
mov    -0x8(%rbp),%eax
sub    $0x69,%eax
je     121f <odeadthrone+0xaf>
jmp    11bb <odeadthrone+0x4b>
mov    -0x8(%rbp),%eax
sub    $0x73,%eax
jne    122b <odeadthrone+0xbb>
jmp    11cc <odeadthrone+0x5c>
lea    0xe38(%rip),%rdi
call   1080 <lprcat@plt>
mov    $0x65,%edi
call   1040 <rnd@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x23,-0x4(%rbp)
jge    120e <odeadthrone+0x9e>
lea    0xe1f(%rip),%rdi
call   1080 <lprcat@plt>
mov    $0x0,%al
call   1050 <beep@plt>
xor    %edi,%edi
call   1070 <oteleport@plt>
jmp    121a <odeadthrone+0xaa>
lea    0xe25(%rip),%rdi
call   1080 <lprcat@plt>
jmp    1230 <odeadthrone+0xc0>
mov    $0x0,%al
call   1030 <ignore@plt>
jmp    1230 <odeadthrone+0xc0>
jmp    1190 <odeadthrone+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odeadthrone>:
push   %rax
lea    0xe88(%rip),%rdi
call   1080 <lprcat@plt>
xor    %eax,%eax
call   1060 <iopts@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1090 <ttgetch@plt>
cmp    $0x1b,%eax
je     11dc <odeadthrone+0x6c>
cmp    $0x69,%eax
je     11dc <odeadthrone+0x6c>
cmp    $0x73,%eax
jne    1190 <odeadthrone+0x20>
lea    0xe5e(%rip),%rdi
call   1080 <lprcat@plt>
mov    $0x65,%edi
call   1040 <rnd@plt>
cmp    $0x22,%eax
jg     11e4 <odeadthrone+0x74>
lea    0xe4d(%rip),%rdi
call   1080 <lprcat@plt>
xor    %eax,%eax
call   1050 <beep@plt>
xor    %edi,%edi
pop    %rax
jmp    1070 <oteleport@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ignore@plt>
lea    0xe4f(%rip),%rdi
pop    %rax
jmp    1080 <lprcat@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"\0ADo you (s) sit down\00"
@.str.1 = [10 x i8] c" sit down\00"
@.str.2 = [37 x i8] c"\0AZaaaappp! You've been teleported!\0A\00"
@.str.3 = [17 x i8] c"\0Anothing happens\00"
define void @odeadthrone() {
%1 = alloca i32
%2 = call i32 @lprcat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @iopts()
br label %4
4: ; preds = %0
br label %5
5: ; preds = %4, %21
%6 = call i32 (...) @ttgetch()
switch i32 %6, label %21 [
i32 115, label %7
i32 105, label %19
i32 27, label %19
]
7: ; preds = %5
%8 = call i32 @lprcat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @rnd(i32 101)
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 35
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = call i32 @lprcat(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (...) @beep()
%15 = call i32 @oteleport(i32 0)
br label %18
16: ; preds = %7
%17 = call i32 @lprcat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
br label %22
19: ; preds = %5, %5
%20 = call i32 (...) @ignore()
br label %22
21: ; preds = %5
br label %5
22: ; preds = %19, %18
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0ADo you (s) sit down\00"
@.str.1 = [10 x i8] c" sit down\00"
@.str.2 = [37 x i8] c"\0AZaaaappp! You've been teleported!\0A\00"
@.str.3 = [17 x i8] c"\0Anothing happens\00"
define void @odeadthrone() {
%1 = tail call i32 @lprcat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @iopts()
br label %3
3: ; preds = %3, %0
%4 = tail call i32 (...) @ttgetch()
switch i32 %4, label %3 [
i32 115, label %5
i32 105, label %15
i32 27, label %15
]
5: ; preds = %3
%6 = tail call i32 @lprcat(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @rnd(i32 101)
%8 = icmp slt i32 %7, 35
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = tail call i32 @lprcat(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 (...) @beep()
%12 = tail call i32 @oteleport(i32 0)
br label %17
13: ; preds = %5
%14 = tail call i32 @lprcat(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %17
15: ; preds = %3, %3
%16 = tail call i32 (...) @ignore()
br label %17
17: ; preds = %9, %13, %15
ret void
}