#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*/ xlBreak();
int /*<<< orphan*/ xlTopLevel();
int /*<<< orphan*/ xlWrapUp();
char xlosConsoleCheck();
int /*<<< orphan*/ xlosConsoleFlush();
int /*<<< orphan*/ xlosInfo();
void xlosCheck(void) {
  switch (xlosConsoleCheck()) {
  case '\002':
    xlosConsoleFlush();
    xlBreak();
    break;
  case '\003':
    xlosConsoleFlush();
    xlTopLevel();
    break;
  case '\024':
    xlosInfo();
    break;
  case '\023':
    while (xlosConsoleCheck() != '\021')
      ;
    break;
  case '\034':
    xlWrapUp();
    break;
  }
}


x86 assembly (clang, -O0):
<xlosCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <xlosConsoleCheck@plt>
movsbl %al,%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0x1a,%eax
ja     11f3 <xlosCheck+0x93>
mov    -0x8(%rbp),%rax
lea    0xe71(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <xlosConsoleFlush@plt>
mov    $0x0,%al
call   1070 <xlBreak@plt>
jmp    11f3 <xlosCheck+0x93>
mov    $0x0,%al
call   1040 <xlosConsoleFlush@plt>
mov    $0x0,%al
call   1050 <xlTopLevel@plt>
jmp    11f3 <xlosCheck+0x93>
mov    $0x0,%al
call   1080 <xlosInfo@plt>
jmp    11f3 <xlosCheck+0x93>
jmp    11cf <xlosCheck+0x6f>
mov    $0x0,%al
call   1030 <xlosConsoleCheck@plt>
movsbl %al,%eax
cmp    $0x11,%eax
je     11e7 <xlosCheck+0x87>
jmp    11cf <xlosCheck+0x6f>
jmp    11f3 <xlosCheck+0x93>
mov    $0x0,%al
call   1060 <xlWrapUp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlosCheck>:
push   %rax
xor    %eax,%eax
call   1030 <xlosConsoleCheck@plt>
movsbl %al,%eax
add    $0xfffffffe,%eax
cmp    $0x1a,%eax
ja     11ab <xlosCheck+0x4b>
lea    0xe86(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <xlosConsoleFlush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <xlBreak@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <xlosConsoleCheck@plt>
cmp    $0x11,%al
jne    11a0 <xlosCheck+0x40>
pop    %rax
ret
xor    %eax,%eax
call   1040 <xlosConsoleFlush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <xlTopLevel@plt>
xor    %eax,%eax
pop    %rcx
jmp    1080 <xlosInfo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <xlWrapUp@plt>

LLVM IR (-O0):
define void @xlosCheck() {
%1 = call signext i8 (...) @xlosConsoleCheck()
%2 = sext i8 %1 to i32
switch i32 %2, label %20 [
i32 2, label %3
i32 3, label %6
i32 20, label %9
i32 19, label %11
i32 28, label %18
]
3: ; preds = %0
%4 = call i32 (...) @xlosConsoleFlush()
%5 = call i32 (...) @xlBreak()
br label %20
6: ; preds = %0
%7 = call i32 (...) @xlosConsoleFlush()
%8 = call i32 (...) @xlTopLevel()
br label %20
9: ; preds = %0
%10 = call i32 (...) @xlosInfo()
br label %20
11: ; preds = %0
br label %12
12: ; preds = %16, %11
%13 = call signext i8 (...) @xlosConsoleCheck()
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 17
br i1 %15, label %16, label %17
16: ; preds = %12
br label %12
17: ; preds = %12
br label %20
18: ; preds = %0
%19 = call i32 (...) @xlWrapUp()
br label %20
20: ; preds = %0, %18, %17, %9, %6, %3
ret void
}

LLVM IR (-O2):
define void @xlosCheck() {
%1 = tail call signext i8 (...) @xlosConsoleCheck()
%2 = sext i8 %1 to i32
switch i32 %2, label %16 [
i32 2, label %3
i32 3, label %6
i32 20, label %9
i32 19, label %11
i32 28, label %14
]
3: ; preds = %0
%4 = tail call i32 (...) @xlosConsoleFlush()
%5 = tail call i32 (...) @xlBreak()
br label %16
6: ; preds = %0
%7 = tail call i32 (...) @xlosConsoleFlush()
%8 = tail call i32 (...) @xlTopLevel()
br label %16
9: ; preds = %0
%10 = tail call i32 (...) @xlosInfo()
br label %16
11: ; preds = %0, %11
%12 = tail call signext i8 (...) @xlosConsoleCheck()
%13 = icmp eq i8 %12, 17
br i1 %13, label %16, label %11
14: ; preds = %0
%15 = tail call i32 (...) @xlWrapUp()
br label %16
16: ; preds = %11, %0, %14, %9, %6, %3
ret void
}