#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 /*<<< orphan*/ printf(char *, char *, char *);
void do_child(char *args) {
  char *new_argv[3];
  new_argv[0] = "../bcm2835_for_java/bcm2835_for_java";
  new_argv[1] = args;
  new_argv[2] = NULL;
  execv(new_argv[0], new_argv);
  printf("execv failed %s %s\n", new_argv[0], new_argv[1]);
  return;
}


x86 assembly (clang, -O0):
<do_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <execv@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_child>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rax
mov    %rax,(%rsp)
mov    %rdi,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
call   1040 <execv@plt>
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"../bcm2835_for_java/bcm2835_for_java\00"
@.str.1 = [20 x i8] c"execv failed %s %s\0A\00"
define void @do_child(i8* %0) {
%2 = alloca i8*
%3 = alloca [3 x i8*]
store i8* %0, i8** %2
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 1
store i8* %5, i8** %6
%7 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 2
store i8* null, i8** %7
%8 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%9 = load i8*, i8** %8
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%11 = call i32 @execv(i8* %9, i8** %10)
%12 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
%13 = load i8*, i8** %12
%14 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"../bcm2835_for_java/bcm2835_for_java\00"
@.str.1 = [20 x i8] c"execv failed %s %s\0A\00"
define void @do_child(i8* %0) {
%2 = alloca [3 x i8*]
%3 = bitcast [3 x i8*]* %2 to i8*
%4 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 1
store i8* %0, i8** %5
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 2
store i8* null, i8** %6
%7 = call i32 @execv(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8** %4)
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %9)
ret void
}