#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[] = "add";
  char a1[2] = "2";
  char a2[2] = "3";
  char *args[4] = {a0, a1, a2, NULL};
  execv("add", 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,-0x14(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x16(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x18(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x16(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.a0 = [4 x i8] c"add\00"
@__const.main.a1 = [2 x i8] c"2\00"
@__const.main.a2 = [2 x i8] c"3\00"
@.str = [4 x i8] c"add\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 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 [4 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 [4 x i8], [4 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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i16
%5 = alloca i16
%6 = alloca [4 x i8*]
%7 = bitcast i32* %3 to i8*
store i32 6579297, i32* %3
%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
%12 = bitcast [4 x i8*]* %6 to i32**
store i32* %3, i32** %12
%13 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
%14 = bitcast i8** %13 to i16**
store i16* %4, i16** %14
%15 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 2
%16 = bitcast i8** %15 to i16**
store i16* %5, i16** %16
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 3
store i8* null, i8** %17
%18 = call i32 @execv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %11)
ret i32 0
}