#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*/ SIGHUP;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int killit(int pid) {
  kill(pid, SIGHUP);
  sleep(20);
  if (!kill(pid, 0)) {
    kill(pid, SIGKILL);
    sleep(20);
    if (!kill(pid, 0))
      return (0);
    else
      return (1);
  } else
    return (1);
}


x86 assembly (clang, -O0):
<killit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <kill@plt>
cmp    $0x0,%eax
jne    119f <killit+0x7f>
mov    -0x8(%rbp),%edi
mov    0x2e75(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <kill@plt>
cmp    $0x0,%eax
jne    1193 <killit+0x73>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <killit+0x86>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <killit+0x86>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<killit>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <kill@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1151 <killit+0x31>
pop    %rbx
ret
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <kill@plt>
mov    $0x14,%edi
call   1040 <sleep@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <kill@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@SIGHUP = global i32 0
@SIGKILL = global i32 0
define i32 @killit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @SIGHUP
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = call i32 @sleep(i32 20)
%8 = load i32, i32* %3
%9 = call i32 @kill(i32 %8, i32 0)
%10 = icmp ne i32 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %1
%12 = load i32, i32* %3
%13 = load i32, i32* @SIGKILL
%14 = call i32 @kill(i32 %12, i32 %13)
%15 = call i32 @sleep(i32 20)
%16 = load i32, i32* %3
%17 = call i32 @kill(i32 %16, i32 0)
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %11
store i32 0, i32* %2
br label %22
20: ; preds = %11
store i32 1, i32* %2
br label %22
21: ; preds = %1
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %19
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@SIGKILL = global i32 0
define i32 @killit(i32 %0) {
%2 = load i32, i32* @SIGHUP
%3 = tail call i32 @kill(i32 %0, i32 %2)
%4 = tail call i32 @sleep(i32 20)
%5 = tail call i32 @kill(i32 %0, i32 0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32, i32* @SIGKILL
%9 = tail call i32 @kill(i32 %0, i32 %8)
%10 = tail call i32 @sleep(i32 20)
%11 = tail call i32 @kill(i32 %0, i32 0)
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %1, %7
%15 = phi i32 [ %13, %7 ], [ 1, %1 ]
ret i32 %15
}