#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 execve(char *, char **, char **);
int /*<<< orphan*/ memcpy(char **, char **, int);
int main(int argc, char **argv, char **envp) {
  char *newargv[argc + 3];
  newargv[0] = argv[0];
  newargv[1] = "-cpu";
  newargv[2] = "g3";
  memcpy(&newargv[3], &argv[1], sizeof(*argv) * (argc - 1));
  newargv[argc + 2] = NULL;
  return execve("/usr/bin/qemu-ppc-static.real", newargv, envp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,(%rdi)
lea    0xe8b(%rip),%rax
mov    %rax,0x8(%rdi)
lea    0xe85(%rip),%rax
mov    %rax,0x10(%rdi)
add    $0x18,%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%eax
add    $0x2,%eax
cltq
movq   $0x0,(%rsi,%rax,8)
mov    -0x18(%rbp),%rdx
lea    0xe46(%rip),%rdi
call   1030 <execve@plt>
mov    %eax,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %edi,%r15d
lea    0x3(%r15),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rcx,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
neg    %rax
mov    (%rsi),%rdx
mov    %rdx,(%rcx,%rax,1)
lea    0xea3(%rip),%rax
mov    %rax,0x8(%rbx)
lea    0xe9d(%rip),%rax
mov    %rax,0x10(%rbx)
lea    0x18(%rbx),%rdi
add    $0x8,%rsi
lea    -0x8(,%r15,8),%edx
ff
call   1040 <memcpy@plt>
movslq %r15d,%rax
movq   $0x0,0x10(%rbx,%rax,8)
lea    0xe74(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <execve@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"-cpu\00"
@.str.1 = [3 x i8] c"g3\00"
@.str.2 = [30 x i8] c"/usr/bin/qemu-ppc-static.real\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i64
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 3
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %8
%14 = alloca i8*, i64 %12
store i64 %12, i64* %9
%15 = load i8**, i8*** %6
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %14, i64 0
store i8* %17, i8** %18
%19 = getelementptr inbounds i8*, i8** %14, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %19
%20 = getelementptr inbounds i8*, i8** %14, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds i8*, i8** %14, i64 3
%22 = load i8**, i8*** %6
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = mul i64 8, %26
%28 = trunc i64 %27 to i32
%29 = call i32 @memcpy(i8** %21, i8** %23, i32 %28)
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %14, i64 %32
store i8* null, i8** %33
%34 = load i8**, i8*** %7
%35 = call i32 @execve(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8** %14, i8** %34)
store i32 %35, i32* %4
%36 = load i8*, i8** %8
%37 = load i32, i32* %4
ret i32 %37
}

LLVM IR (-O2):
@.str = [5 x i8] c"-cpu\00"
@.str.1 = [3 x i8] c"g3\00"
@.str.2 = [30 x i8] c"/usr/bin/qemu-ppc-static.real\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = add nsw i32 %0, 3
%5 = zext i32 %4 to i64
%6 = alloca i8*, i64 %5
%7 = load i8*, i8** %1
store i8* %7, i8** %6
%8 = getelementptr inbounds i8*, i8** %6, i64 1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds i8*, i8** %6, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds i8*, i8** %6, i64 3
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = shl i32 %0, 3
%13 = add i32 %12, -8
%14 = call i32 @memcpy(i8** %10, i8** %11, i32 %13)
%15 = add nsw i32 %0, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %6, i64 %16
store i8* null, i8** %17
%18 = call i32 @execve(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8** %6, i8** %2)
ret i32 %18
}