#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 atoi(char *);
int /*<<< orphan*/ send_sig(int, int);
int str2sig(char *);
int main(int argc, char **argv) {
  int pid = -1;
  int i;
  if (argc <= 1)
    return -1;
  for (i = 1; i < argc; ++i) {
    if (i == 1) {
      pid = atoi(argv[i]);
      continue;
    }
    int sig = str2sig(argv[i]);
    send_sig(pid, sig);
  }
  return 0;
}


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)
movl   $0xffffffff,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1163 <main+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cd <main+0x9d>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11c6 <main+0x96>
cmpl   $0x1,-0x18(%rbp)
jne    1199 <main+0x69>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11b8 <main+0x88>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <str2sig@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <send_sig@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116a <main+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xffffffff,%r14d
cmp    $0x2,%edi
jl     118c <main+0x5c>
mov    %rsi,%r12
mov    %edi,%r15d
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
xor    %r14d,%r14d
cmp    $0x2,%r15d
je     118c <main+0x5c>
mov    %eax,%r13d
mov    %r15d,%ebx
mov    $0x2,%ebp
nopl   0x0(%rax)
mov    (%r12,%rbp,8),%rdi
call   1030 <str2sig@plt>
mov    %r13d,%edi
mov    %eax,%esi
call   1040 <send_sig@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <main+0x40>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %41
12: ; preds = %2
store i32 1, i32* %7
br label %13
13: ; preds = %37, %12
%14 = load i32, i32* %7
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %40
17: ; preds = %13
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %6
br label %37
27: ; preds = %17
%28 = load i8**, i8*** %5
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @str2sig(i8* %32)
store i32 %33, i32* %8
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = call i32 @send_sig(i32 %34, i32 %35)
br label %37
37: ; preds = %27, %20
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
br label %13
40: ; preds = %13
store i32 0, i32* %3
br label %41
41: ; preds = %40, %11
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = icmp eq i32 %0, 2
br i1 %9, label %18, label %10
10: ; preds = %4, %10
%11 = phi i64 [ %16, %10 ], [ 2, %4 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @str2sig(i8* %13)
%15 = tail call i32 @send_sig(i32 %8, i32 %14)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %5
br i1 %17, label %18, label %10
18: ; preds = %10, %4, %2
%19 = phi i32 [ -1, %2 ], [ 0, %4 ], [ 0, %10 ]
ret i32 %19
}