#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 */
long atol(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ syscall(int, long);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Not enough arguments...specify PID\n");
    return -1;
  }
  long tpid = atol(argv[1]);
  if (tpid <= 1 || tpid == 0) {
    printf("Invalid PID specified...");
    return -1;
  }
  syscall(288, tpid);
  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   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <main+0x8c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jle    118f <main+0x5f>
cmpq   $0x0,-0x18(%rbp)
jne    11a7 <main+0x77>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <main+0x8c>
mov    -0x18(%rbp),%rsi
mov    $0x120,%edi
call   1040 <syscall@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1163 <main+0x23>
mov    0x8(%rsi),%rdi
call   1060 <atol@plt>
cmp    $0x1,%rax
jg     1176 <main+0x36>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
jmp    116f <main+0x2f>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    $0x120,%edi
mov    %rax,%rsi
call   1050 <syscall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Not enough arguments...specify PID\0A\00"
@.str.1 = [25 x i8] c"Invalid PID specified...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
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 %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %26
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @atol(i8* %14)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = icmp sle i64 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %11
%19 = load i64, i64* %6
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18, %11
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %26
23: ; preds = %18
%24 = load i64, i64* %6
%25 = call i32 @syscall(i32 288, i64 %24)
store i32 0, i32* %3
br label %26
26: ; preds = %23, %21, %9
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"Invalid PID specified...\00"
@str = [35 x i8] c"Not enough arguments...specify PID\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %15
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atol(i8* %8)
%10 = icmp slt i64 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %6
%14 = tail call i32 @syscall(i32 288, i64 %9)
br label %15
15: ; preds = %11, %13, %4
%16 = phi i32 [ -1, %4 ], [ -1, %11 ], [ 0, %13 ]
ret i32 %16
}