#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_SETFL;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ fcntl(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ pause();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void dumpcore() {
  fcntl(fileno(stdin), F_SETFL, 0);
  endwin();
  signal(SIGQUIT, SIG_DFL);
  kill(getpid(), SIGQUIT);
  pause();
}


x86 assembly (clang, -O0):
<dumpcore>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1070 <fileno@plt>
mov    %eax,%edi
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
mov    $0x0,%al
call   1090 <endwin@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
mov    0x2e1e(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
mov    $0x0,%al
call   1080 <pause@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpcore>:
push   %rbx
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1070 <fileno@plt>
mov    0x2e4a(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
xor    %eax,%eax
call   1090 <endwin@plt>
mov    0x2e41(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e20(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    (%rbx),%esi
mov    %eax,%edi
call   1060 <kill@plt>
xor    %eax,%eax
pop    %rbx
jmp    1080 <pause@plt>

LLVM IR (-O0):
@stdin = global i32 0
@F_SETFL = global i32 0
@SIGQUIT = global i32 0
@SIG_DFL = global i32 0
define void @dumpcore() {
%1 = load i32, i32* @stdin
%2 = call i32 @fileno(i32 %1)
%3 = load i32, i32* @F_SETFL
%4 = call i32 @fcntl(i32 %2, i32 %3, i32 0)
%5 = call i32 (...) @endwin()
%6 = load i32, i32* @SIGQUIT
%7 = load i32, i32* @SIG_DFL
%8 = call i32 @signal(i32 %6, i32 %7)
%9 = call i32 (...) @getpid()
%10 = load i32, i32* @SIGQUIT
%11 = call i32 @kill(i32 %9, i32 %10)
%12 = call i32 (...) @pause()
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@F_SETFL = global i32 0
@SIGQUIT = global i32 0
@SIG_DFL = global i32 0
define void @dumpcore() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fileno(i32 %1)
%3 = load i32, i32* @F_SETFL
%4 = tail call i32 @fcntl(i32 %2, i32 %3, i32 0)
%5 = tail call i32 (...) @endwin()
%6 = load i32, i32* @SIGQUIT
%7 = load i32, i32* @SIG_DFL
%8 = tail call i32 @signal(i32 %6, i32 %7)
%9 = tail call i32 (...) @getpid()
%10 = load i32, i32* @SIGQUIT
%11 = tail call i32 @kill(i32 %9, i32 %10)
%12 = tail call i32 (...) @pause()
ret void
}