#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*/ execv(char *, char **);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  char a0[] = "add2";
  char a1[2] = "2";
  char a2[2] = "3";
  char *args[4] = {a0, a1, a2, NULL};
  execv("add2", args);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xecf(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xec4(%rip),%ax
mov    %ax,-0x17(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x19(%rbp)
lea    -0x15(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x17(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x19(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x32646461,0x8(%rsp)
32
lea    0xed8(%rip),%rdi
movw   $0x32,0x6(%rsp)
movw   $0x33,0x4(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x6(%rsp),%rax
mov    %rax,0x18(%rsp)
lea    0x4(%rsp),%rax
mov    %rax,0x20(%rsp)
movq   $0x0,0x28(%rsp)
lea    0x10(%rsp),%rsi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.a0 = [5 x i8] c"add2\00"
@__const.main.a1 = [2 x i8] c"2\00"
@__const.main.a2 = [2 x i8] c"3\00"
@.str = [5 x i8] c"add2\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i8]
%7 = alloca [2 x i8]
%8 = alloca [2 x i8]
%9 = alloca [4 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = bitcast [5 x i8]* %6 to i8*
%13 = bitcast [2 x i8]* %7 to i8*
%14 = bitcast [2 x i8]* %8 to i8*
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
store i8* %16, i8** %15
%17 = getelementptr inbounds i8*, i8** %15, i64 1
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8* %18, i8** %17
%19 = getelementptr inbounds i8*, i8** %17, i64 1
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
store i8* %20, i8** %19
%21 = getelementptr inbounds i8*, i8** %19, i64 1
store i8* null, i8** %21
%22 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 0
%23 = call i32 @execv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"add2\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [5 x i8]
%4 = alloca i16
%5 = alloca i16
%6 = alloca [4 x i8*]
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%8 = bitcast i16* %4 to i8*
store i16 50, i16* %4
%9 = bitcast i16* %5 to i8*
store i16 51, i16* %5
%10 = bitcast [4 x i8*]* %6 to i8*
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 0
store i8* %7, i8** %11
%12 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
%13 = bitcast i8** %12 to i16**
store i16* %4, i16** %13
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 2
%15 = bitcast i8** %14 to i16**
store i16* %5, i16** %15
%16 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 3
store i8* null, i8** %16
%17 = call i32 @execv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %11)
ret i32 0
}