#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*/ LOG_ERR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int unlink(char *);
int kill_server(void) {
  int link;
  if ((link = unlink("/var/run/hearts_syn-ack.pid")) == -1) {
    syslog(LOG_ERR, "unable to unlink file, code %d (%s)", errno,
           strerror(errno));
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<kill_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    11a4 <kill_server+0x64>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    %eax,%ecx
lea    0xe87(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_server>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
call   1030 <unlink@plt>
cmp    $0xffffffff,%eax
je     115d <kill_server+0x1d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e6c(%rip),%rax
mov    (%rax),%ebx
mov    0x2e73(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1060 <strerror@plt>
lea    0xe9f(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %eax,%ecx
call   1040 <syslog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"/var/run/hearts_syn-ack.pid\00"
@LOG_ERR = global i32 0
@.str.1 = [36 x i8] c"unable to unlink file, code %d (%s)\00"
@errno = global i32 0
define i32 @kill_server() {
%1 = alloca i32
%2 = call i32 @unlink(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %11
4: ; preds = %0
%5 = load i32, i32* @LOG_ERR
%6 = load i32, i32* @errno
%7 = load i32, i32* @errno
%8 = call i32 @strerror(i32 %7)
%9 = call i32 @syslog(i32 %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"/var/run/hearts_syn-ack.pid\00"
@LOG_ERR = global i32 0
@.str.1 = [36 x i8] c"unable to unlink file, code %d (%s)\00"
@errno = global i32 0
define i32 @kill_server() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = load i32, i32* @LOG_ERR
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @syslog(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %0
ret i32 0
}