#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*/ except_throw(int, int, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char toupper(char);
void bottom_level(void) {
  char buf[256];
  printf("throw exception? ");
  fflush(stdout);
  fgets(buf, sizeof buf, stdin);
  if (buf[0] >= 0 && toupper(buf[0]) == 'Y')
    except_throw(1, 1, "nasty exception");
}


x86 assembly (clang, -O0):
<bottom_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
lea    -0x100(%rbp),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1050 <fgets@plt>
movsbl -0x100(%rbp),%eax
cmp    $0x0,%eax
jl     11ca <bottom_level+0x7a>
movsbl -0x100(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
cmp    $0x59,%eax
jne    11ca <bottom_level+0x7a>
mov    $0x1,%esi
lea    0xe4f(%rip),%rdx
mov    %esi,%edi
call   1070 <except_throw@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bottom_level>:
sub    $0x108,%rsp
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x100,%esi
call   1050 <fgets@plt>
mov    (%rsp),%al
test   %al,%al
js     11b0 <bottom_level+0x60>
movsbl %al,%edi
call   1030 <toupper@plt>
cmp    $0x59,%al
jne    11b0 <bottom_level+0x60>
lea    0xe71(%rip),%rdx
mov    $0x1,%edi
mov    $0x1,%esi
call   1070 <except_throw@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"throw exception? \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [16 x i8] c"nasty exception\00"
define void @bottom_level() {
%1 = alloca [256 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %5, i32 256, i32 %6)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%14 = load i8, i8* %13
%15 = call signext i8 @toupper(i8 signext %14)
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 89
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @except_throw(i32 1, i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %12, %0
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"throw exception? \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.1 = [16 x i8] c"nasty exception\00"
define void @bottom_level() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
%6 = load i32, i32* @stdin
%7 = call i32 @fgets(i8* %2, i32 256, i32 %6)
%8 = load i8, i8* %2
%9 = icmp sgt i8 %8, -1
br i1 %9, label %10, label %15
10: ; preds = %0
%11 = call signext i8 @toupper(i8 signext %8)
%12 = icmp eq i8 %11, 89
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @except_throw(i32 1, i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10, %0
ret void
}