#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 int /*<<< orphan*/ pid_t;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ SIGKILL;
scalar_t__ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ sscanf(char *, char *, int /*<<< orphan*/ *);
int runMurder(char **args) {
  if (args[0] == NULL) {
    printf("you need an argument to murder\n");
    return 0;
  }
  pid_t target;
  if (sscanf(args[0], "%d", &target) == EOF) {
    printf("%s is not a valid argument to murder\n", args[0]);
    return 0;
  } else {
    if (kill(target, SIGKILL) == 0) {
      printf("it is done. %s is dead.\n", args[0]);
      return 1;
    } else {
      printf("there were... complications. %s is not dead.\n", args[0]);
      return 0;
    }
  }
}


x86 assembly (clang, -O0):
<runMurder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1164 <runMurder+0x34>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1204 <runMurder+0xd4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeae(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1050 <sscanf@plt>
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%rax
jne    11ac <runMurder+0x7c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1204 <runMurder+0xd4>
mov    -0x14(%rbp),%edi
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
call   1040 <kill@plt>
cmp    $0x0,%rax
jne    11e8 <runMurder+0xb8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1204 <runMurder+0xd4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runMurder>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1179 <runMurder+0x39>
lea    0xea9(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%rax
jne    1189 <runMurder+0x49>
mov    (%rbx),%rsi
lea    0xe8c(%rip),%rdi
jmp    11aa <runMurder+0x6a>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
jmp    11c8 <runMurder+0x88>
mov    0xc(%rsp),%edi
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
mov    (%rbx),%rsi
test   %rax,%rax
je     11b5 <runMurder+0x75>
lea    0xe98(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c8 <runMurder+0x88>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"you need an argument to murder\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.2 = [38 x i8] c"%s is not a valid argument to murder\0A\00"
@SIGKILL = global i32 0
@.str.3 = [25 x i8] c"it is done. %s is dead.\0A\00"
@.str.4 = [46 x i8] c"there were... complications. %s is not dead.\0A\00"
define i32 @runMurder(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
%5 = load i8**, i8*** %3
%6 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %38
11: ; preds = %1
%12 = load i8**, i8*** %3
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i64 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = load i64, i64* @EOF
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load i8**, i8*** %3
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %21)
store i32 0, i32* %2
br label %38
23: ; preds = %11
%24 = load i32, i32* %4
%25 = load i32, i32* @SIGKILL
%26 = call i64 @kill(i32 %24, i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i8**, i8*** %3
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %31)
store i32 1, i32* %2
br label %38
33: ; preds = %23
%34 = load i8**, i8*** %3
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %36)
store i32 0, i32* %2
br label %38
38: ; preds = %33, %28, %18, %9
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.2 = [38 x i8] c"%s is not a valid argument to murder\0A\00"
@SIGKILL = global i32 0
@.str.3 = [25 x i8] c"it is done. %s is dead.\0A\00"
@.str.4 = [46 x i8] c"there were... complications. %s is not dead.\0A\00"
@str = [31 x i8] c"you need an argument to murder\00"
define i32 @runMurder(i8** nocapture %0) {
%2 = alloca i32
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %27
7: ; preds = %1
%8 = bitcast i32* %2 to i8*
%9 = call i64 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %0
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %25
15: ; preds = %7
%16 = load i32, i32* %2
%17 = load i32, i32* @SIGKILL
%18 = call i64 @kill(i32 %16, i32 %17)
%19 = icmp eq i64 %18, 0
%20 = load i8*, i8** %0
br i1 %19, label %21, label %23
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %25
23: ; preds = %15
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %20)
br label %25
25: ; preds = %23, %21, %12
%26 = phi i32 [ 0, %12 ], [ 1, %21 ], [ 0, %23 ]
br label %27
27: ; preds = %25, %5
%28 = phi i32 [ 0, %5 ], [ %26, %25 ]
ret i32 %28
}