#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*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
scalar_t__ remove(char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int remove_pid(void) {
  if (remove("/tmp/snesbot.pid") != 0) {
    fprintf(stderr, "Error removing PID file %s: %s\n", "/tmp/snesbot.pid",
            strerror(errno));
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<remove_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
je     118d <remove_pid+0x5d>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rcx
lea    0xe9c(%rip),%rsi
lea    0xe84(%rip),%rdx
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1194 <remove_pid+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_pid>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <remove@plt>
test   %rax,%rax
je     1178 <remove_pid+0x48>
mov    0x2e97(%rip),%rax
mov    (%rax),%ebx
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb1(%rip),%rsi
lea    0xe99(%rip),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/tmp/snesbot.pid\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Error removing PID file %s: %s\0A\00"
@errno = global i32 0
define i32 @remove_pid() {
%1 = alloca i32
%2 = call i64 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %7)
store i32 1, i32* %1
br label %10
9: ; preds = %0
store i32 0, i32* %1
br label %10
10: ; preds = %9, %4
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [17 x i8] c"/tmp/snesbot.pid\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Error removing PID file %s: %s\0A\00"
@errno = global i32 0
define i32 @remove_pid() {
%1 = tail call i64 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %0, %3
%9 = phi i32 [ 1, %3 ], [ 0, %0 ]
ret i32 %9
}