#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*/ SIGKILL;
scalar_t__ execvp(char *, char **);
scalar_t__ fork();
int /*<<< orphan*/ kill(scalar_t__, int /*<<< orphan*/);
scalar_t__ wait(int *);
int runRun(char **args) {
  pid_t pid;
  int status;
  pid = fork();
  if (pid < 0) {
    kill(pid, SIGKILL);
    return 0;
  } else if (pid == 0) {
    if (execvp(*args, args) < 0)
      return 0;
  } else {
    while (wait(&status) != pid)
      ;
  }
}


x86 assembly (clang, -O0):
<runRun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1180 <runRun+0x40>
mov    -0x18(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
movl   $0x0,-0x4(%rbp)
jmp    11dd <runRun+0x9d>
cmpq   $0x0,-0x18(%rbp)
jne    11b6 <runRun+0x76>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <execvp@plt>
cmp    $0x0,%rax
jge    11b1 <runRun+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11dd <runRun+0x9d>
jmp    11d8 <runRun+0x98>
jmp    11bb <runRun+0x7b>
lea    -0x1c(%rbp),%rdi
call   1050 <wait@plt>
cmp    -0x18(%rbp),%rax
je     11d3 <runRun+0x93>
jmp    11bb <runRun+0x7b>
jmp    11d8 <runRun+0x98>
jmp    11dd <runRun+0x9d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runRun>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <fork@plt>
mov    %rax,%rbx
test   %rax,%rax
js     116f <runRun+0x2f>
je     1182 <runRun+0x42>
lea    0x4(%rsp),%r14
nopl   (%rax)
mov    %r14,%rdi
call   1050 <wait@plt>
cmp    %rbx,%rax
jne    1160 <runRun+0x20>
jmp    118d <runRun+0x4d>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <kill@plt>
jmp    118d <runRun+0x4d>
mov    (%r14),%rdi
mov    %r14,%rsi
call   1040 <execvp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIGKILL = global i32 0
define i32 @runRun(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i64
%5 = alloca i32
store i8** %0, i8*** %3
%6 = call i64 (...) @fork()
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i64, i64* %4
%11 = load i32, i32* @SIGKILL
%12 = call i32 @kill(i64 %10, i32 %11)
store i32 0, i32* %2
br label %32
13: ; preds = %1
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %3
%20 = call i64 @execvp(i8* %18, i8** %19)
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 0, i32* %2
br label %32
23: ; preds = %16
br label %31
24: ; preds = %13
br label %25
25: ; preds = %29, %24
%26 = call i64 @wait(i32* %5)
%27 = load i64, i64* %4
%28 = icmp ne i64 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %25
br label %25
30: ; preds = %25
br label %31
31: ; preds = %30, %23
br label %32
32: ; preds = %9, %22, %31
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define i32 @runRun(i8** %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i64 (...) @fork()
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @SIGKILL
%8 = tail call i32 @kill(i64 %4, i32 %7)
br label %17
9: ; preds = %1
%10 = icmp eq i64 %4, 0
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = load i8*, i8** %0
%13 = tail call i64 @execvp(i8* %12, i8** %0)
br label %17
14: ; preds = %9, %14
%15 = call i64 @wait(i32* %2)
%16 = icmp eq i64 %15, %4
br i1 %16, label %17, label %14
17: ; preds = %14, %11, %6
ret i32 0
}