#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*/ EXIT_FAILURE;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
int /*<<< orphan*/ errx(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getpid();
scalar_t__ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  if (kill(getpid(), SIGTERM) < 0)
    err(EXIT_FAILURE, "kill");
  sleep(1);
  errx(EXIT_FAILURE, "expected a signal");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
cmp    $0x0,%rax
jge    119c <main+0x4c>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1060 <err@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
call   1040 <errx@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    0x2e89(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
test   %rax,%rax
jns    1182 <main+0x32>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1060 <err@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe69(%rip),%rsi
call   1040 <errx@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGTERM = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [5 x i8] c"kill\00"
@.str.1 = [18 x i8] c"expected a signal\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @getpid()
%7 = load i32, i32* @SIGTERM
%8 = call i64 @kill(i32 %6, i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @err(i32 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %2
%14 = call i32 @sleep(i32 1)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @errx(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [5 x i8] c"kill\00"
@.str.1 = [18 x i8] c"expected a signal\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = load i32, i32* @SIGTERM
%5 = tail call i64 @kill(i32 %3, i32 %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @err(i32 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %2
%11 = tail call i32 @sleep(i32 1)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @errx(i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}