#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 execve(char *, char **, char **);
int run_process_sandbox(char *filename) {
  char *new_argv[] = {filename, "/virt/sandbox.sh", NULL};
  char *new_env[] = {"TERM=linux", "HOME=/virt/home", NULL};
  return execve(filename, new_argv, new_env);
}


x86 assembly (clang, -O0):
<run_process_sandbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xed5(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2cc2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cbf(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cbc(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1030 <execve@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_process_sandbox>:
sub    $0x38,%rsp
mov    %rdi,(%rsp)
lea    0xee1(%rip),%rax
mov    %rax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2cdc(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0x2cc0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rsi
lea    0x20(%rsp),%rdx
call   1030 <execve@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/virt/sandbox.sh\00"
@.str.1 = [11 x i8] c"TERM=linux\00"
@.str.2 = [16 x i8] c"HOME=/virt/home\00"
@__const.run_process_sandbox.new_env = [3 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8* null]
define i32 @run_process_sandbox(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8*]
%4 = alloca [3 x i8*]
store i8* %0, i8** %2
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
store i8* %6, i8** %5
%7 = getelementptr inbounds i8*, i8** %5, i64 1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds i8*, i8** %7, i64 1
store i8* null, i8** %8
%9 = bitcast [3 x i8*]* %4 to i8*
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
%13 = call i32 @execve(i8* %10, i8** %11, i8** %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [17 x i8] c"/virt/sandbox.sh\00"
@.str.1 = [11 x i8] c"TERM=linux\00"
@.str.2 = [16 x i8] c"HOME=/virt/home\00"
@__const.run_process_sandbox.new_env = [3 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8* null]
define i32 @run_process_sandbox(i8* %0) {
%2 = alloca [3 x i8*]
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %2 to i8*
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
store i8* %0, i8** %5
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 2
store i8* null, i8** %7
%8 = bitcast [3 x i8*]* %3 to i8*
%9 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%10 = call i32 @execve(i8* %0, i8** %5, i8** %9)
ret i32 %10
}