#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 syscall(int, long);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc != 2)
    usage();
  long pid = atol(argv[1]);
  if (pid) {
    if (syscall(286, pid) == -1)
      printf("pid doesn't exist!\n");
  } else
    usage();
}


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     1167 <main+0x27>
mov    $0x0,%al
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atol@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11ab <main+0x6b>
mov    -0x18(%rbp),%rsi
mov    $0x11e,%edi
call   1040 <syscall@plt>
cmp    $0xffffffff,%eax
jne    11a6 <main+0x66>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <main+0x72>
mov    $0x0,%al
call   1050 <usage@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1150 <main+0x10>
xor    %eax,%eax
call   1050 <usage@plt>
mov    0x8(%rbx),%rdi
call   1060 <atol@plt>
test   %rax,%rax
je     117e <main+0x3e>
mov    $0x11e,%edi
mov    %rax,%rsi
call   1040 <syscall@plt>
cmp    $0xffffffff,%eax
jne    1185 <main+0x45>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
jmp    1185 <main+0x45>
xor    %eax,%eax
call   1050 <usage@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"pid doesn't exist!\0A\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 (...) @usage()
br label %11
11: ; preds = %9, %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 ne i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %11
%19 = load i64, i64* %6
%20 = call i32 @syscall(i32 286, i64 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
br label %27
25: ; preds = %11
%26 = call i32 (...) @usage()
br label %27
27: ; preds = %25, %24
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@str = [19 x i8] c"pid doesn't exist!\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 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atol(i8* %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = tail call i32 @syscall(i32 286, i64 %9)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %18
16: ; preds = %6
%17 = tail call i32 (...) @usage()
br label %18
18: ; preds = %11, %14, %16
ret i32 0
}