#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 /*<<< orphan*/ execve(char *, char **, char **);
int /*<<< orphan*/ free(char *);
char *malloc(int);
void unaddr_uninit_execve(void) {
  char *argv[] = {malloc(10 * sizeof(char)), NULL};
  free(argv[0]);
  char *envp[] = {malloc(10 * sizeof(char)), NULL};
  execve("", argv, envp);
  free(envp[0]);
}


x86 assembly (clang, -O0):
<unaddr_uninit_execve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xe84(%rip),%rdi
call   1040 <execve@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unaddr_uninit_execve>:
sub    $0x28,%rsp
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,0x10(%rsp)
movq   $0x0,0x18(%rsp)
mov    %rax,%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe8e(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <execve@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @unaddr_uninit_execve() {
%1 = alloca [2 x i8*]
%2 = alloca [2 x i8*]
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%4 = call i8* @malloc(i32 10)
store i8* %4, i8** %3
%5 = getelementptr inbounds i8*, i8** %3, i64 1
store i8* null, i8** %5
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%7 = load i8*, i8** %6
%8 = call i32 @free(i8* %7)
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%10 = call i8* @malloc(i32 10)
store i8* %10, i8** %9
%11 = getelementptr inbounds i8*, i8** %9, i64 1
store i8* null, i8** %11
%12 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%14 = call i32 @execve(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %12, i8** %13)
%15 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @free(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @unaddr_uninit_execve() {
%1 = alloca [2 x i8*]
%2 = alloca [2 x i8*]
%3 = bitcast [2 x i8*]* %1 to i8*
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
%5 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
store i8* %5, i8** %4
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 1
store i8* null, i8** %6
%7 = tail call i32 @free(i8* %5)
%8 = bitcast [2 x i8*]* %2 to i8*
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%10 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
store i8* %10, i8** %9
%11 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
store i8* null, i8** %11
%12 = call i32 @execve(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %4, i8** %9)
%13 = load i8*, i8** %9
%14 = call i32 @free(i8* %13)
ret void
}