#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 */
struct sigaction {
  int /*<<< orphan*/ sa_mask;
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_handler;
};

/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sigaction(int /*<<< orphan*/, struct sigaction *,
                             int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int main() {
  struct sigaction act;
  act.sa_handler = SIG_DFL;
  act.sa_flags = 0;
  sigemptyset(&act.sa_mask);
  sigaction(SIGINT, &act, 0);
  kill(getpid(), SIGINT);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sigemptyset@plt>
mov    0x2e79(%rip),%r14
mov    (%r14),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    (%r14),%esi
mov    %eax,%edi
call   1060 <kill@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sigaction = type { i32, i64, i32 }
@SIG_DFL = global i32 0
@SIGINT = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sigaction
store i32 0, i32* %1
%3 = load i32, i32* @SIG_DFL
%4 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
store i32 %3, i32* %4
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 0
%7 = call i32 @sigemptyset(i32* %6)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaction(i32 %8, %struct.sigaction* %2, i32 0)
%10 = call i32 (...) @getpid()
%11 = load i32, i32* @SIGINT
%12 = call i32 @kill(i32 %10, i32 %11)
ret i32 0
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i64, i32 }
@SIG_DFL = global i32 0
@SIGINT = global i32 0
define i32 @main() {
%1 = alloca %struct.sigaction
%2 = bitcast %struct.sigaction* %1 to i8*
%3 = load i32, i32* @SIG_DFL
%4 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 2
store i32 %3, i32* %4
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 0
%7 = call i32 @sigemptyset(i32* %6)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaction(i32 %8, %struct.sigaction* %1, i32 0)
%10 = call i32 (...) @getpid()
%11 = load i32, i32* @SIGINT
%12 = call i32 @kill(i32 %10, i32 %11)
ret i32 0
}