#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 /*<<< orphan*/ F_OK;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ SYS_access;
int /*<<< orphan*/ SYS_write;
char *getNum(int const, char const **);
int /*<<< orphan*/ printStatus(char *);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ syscall(int /*<<< orphan*/, char *, char *, ...);
int main(const int argc, char const **argv) {
  const char *PID = getNum(argc, argv);
  if (PID) {
    char path[100];
    strcpy(path, "/proc/");
    strcat(path, PID);
    strcat(path, "/status");
    if (syscall(SYS_access, path, F_OK) != 0) {
      syscall(SYS_write, STDOUT_FILENO, "No Process found having this PID\n",
              strlen("No Process found having this PID\n"));
      return -1;
    } else
      printStatus(path);
  } else {
    syscall(SYS_write, STDOUT_FILENO, "Enter Numbers\n",
            strlen("Enter Numbers\n"));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <getNum@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     124c <main+0xec>
lea    -0x80(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x80(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1070 <strcat@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
lea    -0x80(%rbp),%rsi
mov    0x2deb(%rip),%rax
movslq (%rax),%rdx
mov    $0x0,%al
call   1060 <syscall@plt>
cmp    $0x0,%rax
je     123e <main+0xde>
mov    0x2df0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    0x2df1(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x88(%rbp)
lea    0xdff(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%ecx
lea    0xde4(%rip),%rdx
mov    $0x0,%al
call   1060 <syscall@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    129c <main+0x13c>
lea    -0x80(%rbp),%rdi
call   1040 <printStatus@plt>
jmp    1295 <main+0x135>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    0x2d8e(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x98(%rbp)
lea    0xdbe(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    %eax,%ecx
lea    0xda3(%rip),%rdx
mov    $0x0,%al
call   1060 <syscall@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
call   1080 <getNum@plt>
test   %rax,%rax
je     1205 <main+0xa5>
mov    %rax,%rbx
lea    0xe7e(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcat@plt>
lea    0xe68(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcat@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    0x2e09(%rip),%rax
movslq (%rax),%rdx
xor    %ebx,%ebx
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <syscall@plt>
test   %rax,%rax
je     123e <main+0xde>
mov    0x2e0e(%rip),%rax
mov    (%rax),%ebp
mov    0x2e15(%rip),%rax
movslq (%rax),%rbx
lea    0xe2a(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <syscall@plt>
mov    $0xffffffff,%ebx
jmp    1246 <main+0xe6>
mov    0x2dd4(%rip),%rax
mov    (%rax),%r14d
mov    0x2dda(%rip),%rax
movslq (%rax),%rbp
lea    0xe11(%rip),%r15
mov    %r15,%rdi
call   1050 <strlen@plt>
xor    %ebx,%ebx
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <syscall@plt>
jmp    1246 <main+0xe6>
mov    %rsp,%rdi
call   1040 <printStatus@plt>
mov    %ebx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"/proc/\00"
@.str.1 = [8 x i8] c"/status\00"
@SYS_access = global i32 0
@F_OK = global i32 0
@SYS_write = global i32 0
@STDOUT_FILENO = global i32 0
@.str.2 = [34 x i8] c"No Process found having this PID\0A\00"
@.str.3 = [15 x i8] c"Enter Numbers\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i8* @getNum(i32 %8, i8** %9)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %39
13: ; preds = %2
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%17 = load i8*, i8** %6
%18 = call i32 @strcat(i8* %16, i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @SYS_access
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%23 = load i32, i32* @F_OK
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = call i64 (i32, i8*, i8*, ...) @syscall(i32 %21, i8* %22, i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %13
%29 = load i32, i32* @SYS_write
%30 = load i32, i32* @STDOUT_FILENO
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i8*
%33 = call i32 @strlen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%34 = call i64 (i32, i8*, i8*, ...) @syscall(i32 %29, i8* %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %33)
store i32 -1, i32* %3
br label %47
35: ; preds = %13
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%37 = call i32 @printStatus(i8* %36)
br label %38
38: ; preds = %35
br label %46
39: ; preds = %2
%40 = load i32, i32* @SYS_write
%41 = load i32, i32* @STDOUT_FILENO
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i8*
%44 = call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%45 = call i64 (i32, i8*, i8*, ...) @syscall(i32 %40, i8* %43, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %39, %38
store i32 0, i32* %3
br label %47
47: ; preds = %46, %28
%48 = load i32, i32* %3
ret i32 %48
}

LLVM IR (-O2):
@.str = [7 x i8] c"/proc/\00"
@.str.1 = [8 x i8] c"/status\00"
@SYS_access = global i32 0
@F_OK = global i32 0
@SYS_write = global i32 0
@STDOUT_FILENO = global i32 0
@.str.2 = [34 x i8] c"No Process found having this PID\0A\00"
@.str.3 = [15 x i8] c"Enter Numbers\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8]
%4 = tail call i8* @getNum(i32 %0, i8** %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %26, label %6
6: ; preds = %2
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @strcat(i8* %7, i8* %4)
%10 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @SYS_access
%12 = load i32, i32* @F_OK
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
%15 = call i64 (i32, i8*, i8*, ...) @syscall(i32 %11, i8* %7, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %6
%18 = call i32 @printStatus(i8* %7)
br label %33
19: ; preds = %6
%20 = load i32, i32* @SYS_write
%21 = load i32, i32* @STDOUT_FILENO
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
%24 = call i32 @strlen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%25 = call i64 (i32, i8*, i8*, ...) @syscall(i32 %20, i8* %23, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %33
26: ; preds = %2
%27 = load i32, i32* @SYS_write
%28 = load i32, i32* @STDOUT_FILENO
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i8*
%31 = tail call i32 @strlen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%32 = tail call i64 (i32, i8*, i8*, ...) @syscall(i32 %27, i8* %30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %26, %17, %19
%34 = phi i32 [ -1, %19 ], [ 0, %17 ], [ 0, %26 ]
ret i32 %34
}