#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 scalar_t__ pid_t;

/* Variables and functions */
int EXIT_FAILURE;
int atoi(char *);
scalar_t__ atol(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int kill(scalar_t__, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, long);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "Usage: %s PID SIGNUMBER\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  pid_t pid = atol(argv[1]);
  int signal = atoi(argv[2]);
  printf("Send the signal %d to %ld.\n", signal, (long)pid);
  int kill_result = kill(pid, signal);
  if (kill_result != 0) {
    perror("KILL FAILURE");
  }
  exit(kill_result);
}


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   $0x3,-0x8(%rbp)
je     11ba <main+0x4a>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe59(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <kill@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     1213 <main+0xa3>
lea    0xe27(%rip),%rdi
call   1070 <perror@plt>
mov    -0x20(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11c7 <main+0x57>
mov    0x8(%rbx),%rdi
call   1060 <atol@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
lea    0xe7f(%rip),%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <kill@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11c0 <main+0x50>
lea    0xe7a(%rip),%rdi
call   1070 <perror@plt>
mov    %ebx,%edi
call   1090 <exit@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe26(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Usage: %s PID SIGNUMBER\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"Send the signal %d to %ld.\0A\00"
@.str.2 = [13 x i8] c"KILL FAILURE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i64 @atol(i8* %22)
store i64 %23, i64* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = load i64, i64* %6
%30 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %28, i64 %29)
%31 = load i64, i64* %6
%32 = load i32, i32* %7
%33 = call i32 @kill(i64 %31, i32 %32)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %19
%37 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %19
%39 = load i32, i32* %8
%40 = call i32 @exit(i32 %39)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Usage: %s PID SIGNUMBER\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"Send the signal %d to %ld.\0A\00"
@.str.2 = [13 x i8] c"KILL FAILURE\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i64 @atol(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %16, i64 %13)
%18 = tail call i32 @kill(i64 %13, i32 %16)
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %10
%21 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %10
%23 = tail call i32 @exit(i32 %18)
unreachable
}