#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 */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGILL;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIGTTIN;
int /*<<< orphan*/ SIGTTOU;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  signal(SIGTTOU, SIG_IGN);
  signal(SIGSEGV, SIG_IGN);
  signal(SIGINT, SIG_IGN);
  sigset_t set;
  sigemptyset(&set);
  sigaddset(&set, SIGTTIN);
  sigaddset(&set, SIGILL);
  sigaddset(&set, SIGTERM);
  sigprocmask(SIG_BLOCK, &set, NULL);
  execvp(argv[1], argv + 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
lea    -0x14(%rbp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1060 <execvp@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    0x2e59(%rip),%r14
mov    (%r14),%esi
call   1040 <signal@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%esi
call   1040 <signal@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%esi
call   1040 <signal@plt>
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <sigemptyset@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1070 <sigaddset@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1070 <sigaddset@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1070 <sigaddset@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
mov    %rbx,%rsi
call   1060 <execvp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIGTTOU = global i32 0
@SIG_IGN = global i32 0
@SIGSEGV = global i32 0
@SIGINT = global i32 0
@SIGTTIN = global i32 0
@SIGILL = global i32 0
@SIGTERM = global i32 0
@SIG_BLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* @SIGTTOU
%7 = load i32, i32* @SIG_IGN
%8 = call i32 @signal(i32 %6, i32 %7)
%9 = load i32, i32* @SIGSEGV
%10 = load i32, i32* @SIG_IGN
%11 = call i32 @signal(i32 %9, i32 %10)
%12 = load i32, i32* @SIGINT
%13 = load i32, i32* @SIG_IGN
%14 = call i32 @signal(i32 %12, i32 %13)
%15 = call i32 @sigemptyset(i32* %5)
%16 = load i32, i32* @SIGTTIN
%17 = call i32 @sigaddset(i32* %5, i32 %16)
%18 = load i32, i32* @SIGILL
%19 = call i32 @sigaddset(i32* %5, i32 %18)
%20 = load i32, i32* @SIGTERM
%21 = call i32 @sigaddset(i32* %5, i32 %20)
%22 = load i32, i32* @SIG_BLOCK
%23 = call i32 @sigprocmask(i32 %22, i32* %5, i32* null)
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = call i32 @execvp(i8* %26, i8** %28)
ret i32 0
}

LLVM IR (-O2):
@SIGTTOU = global i32 0
@SIG_IGN = global i32 0
@SIGSEGV = global i32 0
@SIGINT = global i32 0
@SIGTTIN = global i32 0
@SIGILL = global i32 0
@SIGTERM = global i32 0
@SIG_BLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = load i32, i32* @SIGTTOU
%5 = load i32, i32* @SIG_IGN
%6 = tail call i32 @signal(i32 %4, i32 %5)
%7 = load i32, i32* @SIGSEGV
%8 = load i32, i32* @SIG_IGN
%9 = tail call i32 @signal(i32 %7, i32 %8)
%10 = load i32, i32* @SIGINT
%11 = load i32, i32* @SIG_IGN
%12 = tail call i32 @signal(i32 %10, i32 %11)
%13 = bitcast i32* %3 to i8*
%14 = call i32 @sigemptyset(i32* %3)
%15 = load i32, i32* @SIGTTIN
%16 = call i32 @sigaddset(i32* %3, i32 %15)
%17 = load i32, i32* @SIGILL
%18 = call i32 @sigaddset(i32* %3, i32 %17)
%19 = load i32, i32* @SIGTERM
%20 = call i32 @sigaddset(i32* %3, i32 %19)
%21 = load i32, i32* @SIG_BLOCK
%22 = call i32 @sigprocmask(i32 %21, i32* %3, i32* null)
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @execvp(i8* %24, i8** %23)
ret i32 0
}