#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(char *filename) {
  char *new_argv[] = {filename, NULL};
  char *new_env[] = {"TERM=linux", "DISPLAY=192.168.33.1:0", "HOME=/virt/home",
                     NULL};
  return execve(filename, new_argv, new_env);
}


x86 assembly (clang, -O0):
<run_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2ccd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x28(%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>:
sub    $0x38,%rsp
mov    %rdi,(%rsp)
movq   $0x0,0x8(%rsp)
movaps 0x2ce8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2ccc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rsp,%rsi
lea    0x10(%rsp),%rdx
call   1030 <execve@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"TERM=linux\00"
@.str.1 = [23 x i8] c"DISPLAY=192.168.33.1:0\00"
@.str.2 = [16 x i8] c"HOME=/virt/home\00"
@__const.run_process.new_env = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 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(i8* %0) {
%2 = alloca i8*
%3 = alloca [2 x i8*]
%4 = alloca [4 x i8*]
store i8* %0, i8** %2
%5 = getelementptr inbounds [2 x i8*], [2 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* null, i8** %7
%8 = bitcast [4 x i8*]* %4 to i8*
%9 = load i8*, i8** %2
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
%12 = call i32 @execve(i8* %9, i8** %10, i8** %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"TERM=linux\00"
@.str.1 = [23 x i8] c"DISPLAY=192.168.33.1:0\00"
@.str.2 = [16 x i8] c"HOME=/virt/home\00"
@__const.run_process.new_env = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 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(i8* %0) {
%2 = alloca [2 x i8*]
%3 = alloca [4 x i8*]
%4 = bitcast [2 x i8*]* %2 to i8*
%5 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
store i8* %0, i8** %5
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
store i8* null, i8** %6
%7 = bitcast [4 x i8*]* %3 to i8*
%8 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%9 = call i32 @execve(i8* %0, i8** %5, i8** %8)
ret i32 %9
}