#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;
scalar_t__ access(unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ atoi(unsigned char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int);
int open(unsigned char *);
int /*<<< orphan*/ read(int, unsigned char *, int);
void kill_process(unsigned char *pidFile) {
  if (access(pidFile, F_OK) == 0) {
    unsigned char strPID[1024];
    int fd = open(pidFile);
    read(fd, strPID, 1024);
    close(fd);
    kill(atoi(strPID), 9);
  }
}


x86 assembly (clang, -O0):
<kill_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1070 <access@plt>
cmp    $0x0,%rax
jne    11d4 <kill_process+0x74>
mov    -0x8(%rbp),%rdi
call   1060 <open@plt>
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    -0x414(%rbp),%edi
call   1030 <close@plt>
lea    -0x410(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    $0x9,%esi
call   1050 <kill@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_process>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
call   1070 <access@plt>
test   %rax,%rax
jne    11b7 <kill_process+0x57>
mov    %rbx,%rdi
call   1060 <open@plt>
mov    %eax,%ebx
mov    %rsp,%r14
mov    %eax,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %ebx,%edi
call   1030 <close@plt>
mov    %r14,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    $0x9,%esi
call   1050 <kill@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@F_OK = global i32 0
define void @kill_process(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i32, i32* @F_OK
%7 = call i64 @access(i8* %5, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @open(i8* %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%14 = call i32 @read(i32 %12, i8* %13, i32 1024)
%15 = load i32, i32* %4
%16 = call i32 @close(i32 %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%18 = call i32 @atoi(i8* %17)
%19 = call i32 @kill(i32 %18, i32 9)
br label %20
20: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
@F_OK = global i32 0
define void @kill_process(i8* %0) {
%2 = alloca [1024 x i8]
%3 = load i32, i32* @F_OK
%4 = tail call i64 @access(i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = tail call i32 @open(i8* %0)
%9 = call i32 @read(i32 %8, i8* %7, i32 1024)
%10 = tail call i32 @close(i32 %8)
%11 = call i32 @atoi(i8* %7)
%12 = tail call i32 @kill(i32 %11, i32 9)
br label %13
13: ; preds = %6, %1
ret void
}