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

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ logfileLine(int /*<<< orphan*/ *, char *, char *);
scalar_t__ system(char *);
void RunForkedCommand(char *cCommand, FILE *fp) {
  pid_t pidChild;
  pidChild = fork();
  if (pidChild != 0)
    return;
  if (system(cCommand))
    logfileLine(fp, "RunForkedCommand", cCommand);
  else
    logfileLine(fp, "RunForkedCommand Error", cCommand);
}


x86 assembly (clang, -O0):
<RunForkedCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <fork@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115b <RunForkedCommand+0x2b>
jmp    119b <RunForkedCommand+0x6b>
mov    -0x8(%rbp),%rdi
call   1040 <system@plt>
cmp    $0x0,%rax
je     1187 <RunForkedCommand+0x57>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe83(%rip),%rsi
call   1030 <logfileLine@plt>
jmp    119b <RunForkedCommand+0x6b>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe7b(%rip),%rsi
call   1030 <logfileLine@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RunForkedCommand>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <fork@plt>
test   %rax,%rax
je     114e <RunForkedCommand+0x1e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
call   1040 <system@plt>
test   %rax,%rax
lea    0xeb1(%rip),%rax
lea    0xe99(%rip),%rsi
cmove  %rax,%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <logfileLine@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"RunForkedCommand\00"
@.str.1 = [23 x i8] c"RunForkedCommand Error\00"
define void @RunForkedCommand(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i64
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = call i64 (...) @fork()
store i64 %6, i64* %5
%7 = load i64, i64* %5
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
br label %22
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i64 @system(i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32*, i32** %4
%16 = load i8*, i8** %3
%17 = call i32 @logfileLine(i32* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %22
18: ; preds = %10
%19 = load i32*, i32** %4
%20 = load i8*, i8** %3
%21 = call i32 @logfileLine(i32* %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %9, %18, %14
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"RunForkedCommand\00"
@.str.1 = [23 x i8] c"RunForkedCommand Error\00"
define void @RunForkedCommand(i8* %0, i32* %1) {
%3 = tail call i64 (...) @fork()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i64 @system(i8* %0)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 @logfileLine(i32* %1, i8* %8, i8* %0)
br label %10
10: ; preds = %5, %2
ret void
}