#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 */
typedef scalar_t__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGALRM;
scalar_t__ kill(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int net_renew_dhcpcd(pid_t pid) {
  if (pid > 0) {
    if (kill(pid, SIGALRM) == 0)
      return 0;
    perror("net_disable_dhcpcd, kill error");
  }
  printf("net_disable_dhcpcd, pid error\n");
  return -1;
}


x86 assembly (clang, -O0):
<net_renew_dhcpcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    117b <net_renew_dhcpcd+0x4b>
mov    -0x10(%rbp),%rdi
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
cmp    $0x0,%rax
jne    116f <net_renew_dhcpcd+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    118e <net_renew_dhcpcd+0x5e>
lea    0xe8a(%rip),%rdi
call   1050 <perror@plt>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_renew_dhcpcd>:
push   %rax
test   %rdi,%rdi
jle    115c <net_renew_dhcpcd+0x2c>
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1150 <net_renew_dhcpcd+0x20>
pop    %rcx
ret
lea    0xea9(%rip),%rdi
call   1050 <perror@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGALRM = global i32 0
@.str = [31 x i8] c"net_disable_dhcpcd, kill error\00"
@.str.1 = [31 x i8] c"net_disable_dhcpcd, pid error\0A\00"
define i32 @net_renew_dhcpcd(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i64, i64* %3
%8 = load i32, i32* @SIGALRM
%9 = call i64 @kill(i64 %7, i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %6
store i32 0, i32* %2
br label %16
12: ; preds = %6
%13 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
%15 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %16
16: ; preds = %14, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@SIGALRM = global i32 0
@.str = [31 x i8] c"net_disable_dhcpcd, kill error\00"
@str = [30 x i8] c"net_disable_dhcpcd, pid error\00"
define i32 @net_renew_dhcpcd(i64 %0) {
%2 = icmp sgt i64 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = load i32, i32* @SIGALRM
%5 = tail call i64 @kill(i64 %0, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %3, %9
%12 = phi i32 [ -1, %9 ], [ 0, %3 ]
ret i32 %12
}