#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*/ PR_SET_PDEATHSIG;
int atoi(char *);
int execvp(char *, char **);
int /*<<< orphan*/ perror(char *);
scalar_t__ prctl(int /*<<< orphan*/, int, int /*<<< orphan*/,
                 int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc < 2)
    return 1;
  int cmd = 1;
  int signo = 0;
  if (*argv[1] == '-') {
    signo = atoi(argv[1] + 1);
    if (argc < 3)
      return 1;
    cmd = 2;
  }
  if (!signo)
    signo = 15;
  if (prctl(PR_SET_PDEATHSIG, signo, 0, 0, 0) < 0) {
    perror("prctl");
    return 1;
  }
  return execvp(argv[cmd], &argv[cmd]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    122f <main+0xef>
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11bf <main+0x7f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x1,%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11b8 <main+0x78>
movl   $0x1,-0x4(%rbp)
jmp    122f <main+0xef>
movl   $0x2,-0x14(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11d0 <main+0x90>
movl   $0xf,-0x18(%rbp)
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%esi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <prctl@plt>
cmp    $0x0,%rax
jge    120c <main+0xcc>
lea    0xe05(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    122f <main+0xef>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1050 <execvp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jge    1156 <main+0x16>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rsi,%rbx
mov    %edi,%eax
mov    0x8(%rsi),%rdi
mov    $0x1,%r14d
cmpb   $0x2d,(%rdi)
jne    1184 <main+0x44>
cmp    $0x3,%eax
jb     1149 <main+0x9>
add    $0x1,%rdi
call   1060 <atoi@plt>
mov    %eax,%esi
mov    $0x2,%r14d
test   %eax,%eax
jne    1189 <main+0x49>
mov    $0xf,%esi
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <prctl@plt>
test   %rax,%rax
js     11b7 <main+0x77>
lea    (%rbx,%r14,8),%rsi
mov    (%rbx,%r14,8),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <execvp@plt>
lea    0xe42(%rip),%rdi
call   1040 <perror@plt>
jmp    1149 <main+0x9>

LLVM IR (-O0):
@PR_SET_PDEATHSIG = global i32 0
@.str = [6 x i8] c"prctl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %50
11: ; preds = %2
store i32 1, i32* %6
store i32 0, i32* %7
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 45
br i1 %17, label %18, label %28
18: ; preds = %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %27
26: ; preds = %18
store i32 1, i32* %3
br label %50
27: ; preds = %18
store i32 2, i32* %6
br label %28
28: ; preds = %27, %11
%29 = load i32, i32* %7
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %28
store i32 15, i32* %7
br label %32
32: ; preds = %31, %28
%33 = load i32, i32* @PR_SET_PDEATHSIG
%34 = load i32, i32* %7
%35 = call i64 @prctl(i32 %33, i32 %34, i32 0, i32 0, i32 0)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %50
39: ; preds = %32
%40 = load i8**, i8*** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = call i32 @execvp(i8* %44, i8** %48)
store i32 %49, i32* %3
br label %50
50: ; preds = %39, %37, %26, %10
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@PR_SET_PDEATHSIG = global i32 0
@.str = [6 x i8] c"prctl\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %29, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = icmp ult i32 %0, 3
br i1 %10, label %29, label %11
11: ; preds = %9
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %4, %11
%16 = phi i64 [ 2, %11 ], [ 1, %4 ]
br label %17
17: ; preds = %11, %15
%18 = phi i64 [ %16, %15 ], [ 2, %11 ]
%19 = phi i32 [ 15, %15 ], [ %13, %11 ]
%20 = load i32, i32* @PR_SET_PDEATHSIG
%21 = tail call i64 @prctl(i32 %20, i32 %19, i32 0, i32 0, i32 0)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = tail call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %29
25: ; preds = %17
%26 = getelementptr inbounds i8*, i8** %1, i64 %18
%27 = load i8*, i8** %26
%28 = tail call i32 @execvp(i8* %27, i8** %26)
br label %29
29: ; preds = %23, %25, %9, %2
%30 = phi i32 [ 1, %2 ], [ 1, %23 ], [ %28, %25 ], [ 1, %9 ]
ret i32 %30
}