#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*/ SIGTERM;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ get_output_file(int *);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void c_kill_job() {
  int pid = 0;
  get_output_file(&pid);
  if (pid == -1 || pid == 0) {
    fprintf(stderr, "Error: strange PID received: %i\n", pid);
    exit(-1);
  }
  kill(-pid, SIGTERM);
}


x86 assembly (clang, -O0):
<c_kill_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1050 <get_output_file@plt>
cmpl   $0xffffffff,-0x4(%rbp)
je     116c <c_kill_job+0x2c>
cmpl   $0x0,-0x4(%rbp)
jne    118e <c_kill_job+0x4e>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe81(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
xor    %edi,%edi
sub    -0x4(%rbp),%edi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_kill_job>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1050 <get_output_file@plt>
mov    0x4(%rsp),%edx
lea    0x1(%rdx),%eax
cmp    $0x1,%eax
jbe    1173 <c_kill_job+0x33>
neg    %edx
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
mov    %edx,%edi
call   1040 <kill@plt>
pop    %rax
ret
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Error: strange PID received: %i\0A\00"
@SIGTERM = global i32 0
define void @c_kill_job() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @get_output_file(i32* %1)
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5, %0
%9 = load i32, i32* @stderr
%10 = load i32, i32* %1
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %5
%14 = load i32, i32* %1
%15 = sub nsw i32 0, %14
%16 = load i32, i32* @SIGTERM
%17 = call i32 @kill(i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Error: strange PID received: %i\0A\00"
@SIGTERM = global i32 0
define void @c_kill_job() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @get_output_file(i32* %1)
%4 = load i32, i32* %1
%5 = add i32 %4, 1
%6 = icmp ult i32 %5, 2
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %4)
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %0
%12 = sub nsw i32 0, %4
%13 = load i32, i32* @SIGTERM
%14 = call i32 @kill(i32 %12, i32 %13)
ret void
}