#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_flags;
  int /*<<< orphan*/ sa_mask;
  int /*<<< orphan*/ sa_handler;
};

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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   1040 <sigemptyset@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1030 <sigaction@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
call   1030 <sigaction@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

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