#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*/ EXIT_FAILURE;
int /*<<< orphan*/ execve(char *, char **, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[], char *envp[]) {
  if (argc < 2) {
    puts("not enough parameter: filename argv[0] argv[1] ... argv[n]");
    exit(EXIT_FAILURE);
  }
  execve(argv[1], &argv[2], envp);
  perror("execve");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117e <main+0x3e>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
mov    -0x18(%rbp),%rdx
call   1040 <execve@plt>
lea    0xe9d(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     1154 <main+0x14>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
jmp    116d <main+0x2d>
mov    0x8(%rsi),%rdi
add    $0x10,%rsi
call   1040 <execve@plt>
lea    0xed3(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [59 x i8] c"not enough parameter: filename argv[0] argv[1] ... argv[n]\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [7 x i8] c"execve\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %3
%15 = load i8**, i8*** %6
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %6
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8**, i8*** %7
%21 = call i32 @execve(i8* %17, i8** %19, i8** %20)
%22 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
}

LLVM IR (-O2):
@.str = [59 x i8] c"not enough parameter: filename argv[0] argv[1] ... argv[n]\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [7 x i8] c"execve\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %3
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = tail call i32 @execve(i8* %11, i8** %12, i8** %2)
%14 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
}