#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*/ kill(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("Wrong Number of Arguments\n");
    return 0;
  }
  int pid = atoi(argv[2]);
  if (!kill(pid))
    printf("Successfully killed %d\n", pid);
  else
    printf("%d : No such process\n", pid);
  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)
cmpl   $0x3,-0x8(%rbp)
je     116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b9 <main+0x89>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <kill@plt>
cmp    $0x0,%eax
jne    11a1 <main+0x71>
mov    -0x14(%rbp),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b2 <main+0x82>
mov    -0x14(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1165 <main+0x25>
mov    0x10(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1050 <kill@plt>
test   %eax,%eax
je     1173 <main+0x33>
lea    0xeb5(%rip),%rdi
jmp    117a <main+0x3a>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
jmp    1183 <main+0x43>
lea    0xe86(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Wrong Number of Arguments\0A\00"
@.str.1 = [24 x i8] c"Successfully killed %d\0A\00"
@.str.2 = [22 x i8] c"%d : No such process\0A\00"
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, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %26
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @kill(i32 %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %11
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %25
22: ; preds = %11
%23 = load i32, i32* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %19
store i32 0, i32* %3
br label %26
26: ; preds = %25, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"Successfully killed %d\0A\00"
@.str.2 = [22 x i8] c"%d : No such process\0A\00"
@str = [26 x i8] c"Wrong Number of Arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %16
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 @kill(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %16
14: ; preds = %6
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %16
16: ; preds = %12, %14, %4
ret i32 0
}