#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 */
char *getCommand(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
void *doTest(char *file) {
  char *cmd_f = getCommand("-f", file);
  char *cmd_r = getCommand("-r", file);
  char *cmd_w = getCommand("-w", file);
  printf("Whoami:\r\n");
  system("whoami");
  printf("File \"%s\": \r\n", file);
  system(cmd_f);
  system(cmd_r);
  system(cmd_w);
}


x86 assembly (clang, -O0):
<doTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <getCommand@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <getCommand@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1030 <getCommand@plt>
mov    %rax,-0x28(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
call   1040 <system@plt>
mov    -0x10(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
mov    -0x20(%rbp),%rdi
call   1040 <system@plt>
mov    -0x28(%rbp),%rdi
call   1040 <system@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doTest>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1040 <getCommand@plt>
mov    %rax,%r14
lea    0xe9f(%rip),%rdi
mov    %rbx,%rsi
call   1040 <getCommand@plt>
mov    %rax,%r15
lea    0xe90(%rip),%rdi
mov    %rbx,%rsi
call   1040 <getCommand@plt>
mov    %rax,%r12
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1050 <system@plt>
lea    0xe70(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1050 <system@plt>
mov    %r15,%rdi
call   1050 <system@plt>
mov    %r12,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <system@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-f\00"
@.str.1 = [3 x i8] c"-r\00"
@.str.2 = [3 x i8] c"-w\00"
@.str.3 = [10 x i8] c"Whoami:\0D\0A\00"
@.str.4 = [7 x i8] c"whoami\00"
@.str.5 = [14 x i8] c"File \22%s\22: \0D\0A\00"
define i8* @doTest(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %3
%12 = call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
store i8* %12, i8** %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%15 = load i8*, i8** %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %4
%18 = call i32 @system(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @system(i8* %19)
%21 = load i8*, i8** %6
%22 = call i32 @system(i8* %21)
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"-f\00"
@.str.1 = [3 x i8] c"-r\00"
@.str.2 = [3 x i8] c"-w\00"
@.str.4 = [7 x i8] c"whoami\00"
@.str.5 = [14 x i8] c"File \22%s\22: \0D\0A\00"
@str = [9 x i8] c"Whoami:\0D\00"
define noalias i8* @doTest(i8* %0) {
%2 = tail call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i8* @getCommand(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%8 = tail call i32 @system(i8* %2)
%9 = tail call i32 @system(i8* %3)
%10 = tail call i32 @system(i8* %4)
ret i8* undef
}