#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 EXIT_FAILURE;
int EXIT_SUCCESS;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ signal(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int sig;
  if (argc != 2) {
    fprintf(stderr, "Invalid number of arguments, use : escudo1 <signal>\n");
    return EXIT_FAILURE;
  }
  if (strcmp(argv[1], "SIGINT") == 0) {
    sig = 2;
  } else if (strcmp(argv[1], "SIGKILL") == 0) {
    sig = 9;
  } else if (strcmp(argv[1], "SIGSTOP") == 0) {
    sig = 19;
  } else {
    sig = atoi(argv[1]);
  }
  if (sig <= 0) {
    fprintf(stderr, "Invalid signal, or SIGNULL\n");
    return EXIT_FAILURE;
  }
  if (signal(sig, SIG_IGN) == SIG_ERR) {
    fprintf(stderr, "The signal can't be ignored\n");
    return EXIT_FAILURE;
  }
  while (1)
    ;
  return EXIT_SUCCESS;
}


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)
je     1186 <main+0x46>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129f <main+0x15f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b0 <main+0x70>
movl   $0x2,-0x14(%rbp)
jmp    121e <main+0xde>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11da <main+0x9a>
movl   $0x9,-0x14(%rbp)
jmp    1219 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1204 <main+0xc4>
movl   $0x13,-0x14(%rbp)
jmp    1214 <main+0xd4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1219 <main+0xd9>
jmp    121e <main+0xde>
cmpl   $0x0,-0x14(%rbp)
jg     124e <main+0x10e>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
lea    0xe14(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129f <main+0x15f>
mov    -0x14(%rbp),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2d6a(%rip),%rcx
cmp    (%rcx),%rax
jne    1295 <main+0x155>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
lea    0xde9(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129f <main+0x15f>
jmp    129a <main+0x15a>
jmp    129a <main+0x15a>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    11a0 <main+0x60>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xee1(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a9 <main+0x69>
mov    0x8(%rbx),%rdi
lea    0xed3(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    0x8(%rbx),%rdi
lea    0xec6(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11b7 <main+0x77>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
test   %eax,%eax
jg     11bc <main+0x7c>
lea    0xeae(%rip),%rsi
jmp    11dd <main+0x9d>
lea    0xe59(%rip),%rsi
jmp    11dd <main+0x9d>
mov    $0x2,%edi
jmp    11bc <main+0x7c>
mov    $0x9,%edi
jmp    11bc <main+0x7c>
mov    $0x13,%edi
mov    0x2e25(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2dff(%rip),%rcx
cmp    (%rcx),%rax
jne    1200 <main+0xc0>
lea    0xe8b(%rip),%rsi
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1050 <fprintf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret
cs nopw 0x0(%rax,%rax,1)
jmp    1200 <main+0xc0>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"Invalid number of arguments, use : escudo1 <signal>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [7 x i8] c"SIGINT\00"
@.str.2 = [8 x i8] c"SIGKILL\00"
@.str.3 = [8 x i8] c"SIGSTOP\00"
@.str.4 = [28 x i8] c"Invalid signal, or SIGNULL\0A\00"
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.5 = [29 x i8] c"The signal can't be ignored\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %60
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 2, i32* %6
br label %41
20: ; preds = %13
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
store i32 9, i32* %6
br label %40
27: ; preds = %20
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %27
store i32 19, i32* %6
br label %39
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %6
br label %39
39: ; preds = %34, %33
br label %40
40: ; preds = %39, %26
br label %41
41: ; preds = %40, %19
%42 = load i32, i32* %6
%43 = icmp sle i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
store i32 %47, i32* %3
br label %60
48: ; preds = %41
%49 = load i32, i32* %6
%50 = load i32, i32* @SIG_IGN
%51 = call i64 @signal(i32 %49, i32 %50)
%52 = load i64, i64* @SIG_ERR
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %58
54: ; preds = %48
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%57 = load i32, i32* @EXIT_FAILURE
store i32 %57, i32* %3
br label %60
58: ; preds = %48
br label %59
59: ; preds = %58, %59
br label %59
60: ; preds = %54, %44, %9
%61 = load i32, i32* %3
ret i32 %61
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Invalid number of arguments, use : escudo1 <signal>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [7 x i8] c"SIGINT\00"
@.str.2 = [8 x i8] c"SIGKILL\00"
@.str.3 = [8 x i8] c"SIGSTOP\00"
@.str.4 = [28 x i8] c"Invalid signal, or SIGNULL\0A\00"
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.5 = [29 x i8] c"The signal can't be ignored\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %28
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8*, i8** %5
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp slt i32 %19, 1
br i1 %20, label %28, label %21
21: ; preds = %13, %9, %4, %17
%22 = phi i32 [ %19, %17 ], [ 19, %13 ], [ 9, %9 ], [ 2, %4 ]
%23 = load i32, i32* @SIG_IGN
%24 = tail call i64 @signal(i32 %22, i32 %23)
%25 = load i64, i64* @SIG_ERR
%26 = icmp eq i64 %24, %25
br i1 %26, label %28, label %27
27: ; preds = %21, %27
br label %27
28: ; preds = %21, %17, %2
%29 = phi i8* [ getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), %17 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), %21 ]
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* %29)
%32 = load i32, i32* @EXIT_FAILURE
ret i32 %32
}