#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*/ F_GETFL;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ Host_Shutdown();
int O_NONBLOCK;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fcntl(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void Sys_Quit(void) {
  Host_Shutdown();
  fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL, 0) & ~O_NONBLOCK);
  fflush(stdout);
  exit(0);
}


x86 assembly (clang, -O0):
<Sys_Quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <Host_Shutdown@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    %eax,%edx
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%edx
call   1030 <fcntl@plt>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<Sys_Quit>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <Host_Shutdown@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%ebx
mov    0x2e7e(%rip),%rax
mov    (%rax),%ebp
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    0x2e73(%rip),%rcx
mov    (%rcx),%edx
not    %edx
and    %eax,%edx
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <fcntl@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@stdout = global i32 0
define void @Sys_Quit() {
%1 = call i32 (...) @Host_Shutdown()
%2 = load i32, i32* @STDIN_FILENO
%3 = load i32, i32* @F_SETFL
%4 = load i32, i32* @STDIN_FILENO
%5 = load i32, i32* @F_GETFL
%6 = call i32 @fcntl(i32 %4, i32 %5, i32 0)
%7 = load i32, i32* @O_NONBLOCK
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
%10 = call i32 @fcntl(i32 %2, i32 %3, i32 %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@F_SETFL = global i32 0
@F_GETFL = global i32 0
@O_NONBLOCK = global i32 0
@stdout = global i32 0
define void @Sys_Quit() {
%1 = tail call i32 (...) @Host_Shutdown()
%2 = load i32, i32* @STDIN_FILENO
%3 = load i32, i32* @F_SETFL
%4 = load i32, i32* @F_GETFL
%5 = tail call i32 @fcntl(i32 %2, i32 %4, i32 0)
%6 = load i32, i32* @O_NONBLOCK
%7 = xor i32 %6, -1
%8 = and i32 %5, %7
%9 = tail call i32 @fcntl(i32 %2, i32 %3, i32 %8)
%10 = load i32, i32* @stdout
%11 = tail call i32 @fflush(i32 %10)
%12 = tail call i32 @exit(i32 0)
unreachable
}