#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 */
char **build_rvm_params(char *, char **);
int /*<<< orphan*/ bundle_install(char **, char **);
int /*<<< orphan*/ execve(char *, char **, char **);
char *find_rvm();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[], char **envp) {
  char *rvm = find_rvm();
  char **rvm_params = build_rvm_params(rvm, argv);
  if (rvm == NULL) {
    fprintf(stderr, "I can't find an RVM installation anywhere!\n\n");
    return (1);
  }
  bundle_install(rvm_params, envp);
  execve(rvm, rvm_params, envp);
  return 0;
}


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    $0x0,%al
call   1060 <find_rvm@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <build_rvm_params@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11b2 <main+0x62>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d7 <main+0x87>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <bundle_install@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <execve@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <find_rvm@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %rbx,%rsi
call   1070 <build_rvm_params@plt>
test   %rbp,%rbp
je     1198 <main+0x48>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <bundle_install@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <execve@plt>
jmp    11b3 <main+0x63>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xe58(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [45 x i8] c"I can't find an RVM installation anywhere!\0A\0A\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 i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = call i8* (...) @find_rvm()
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = load i8**, i8*** %6
%13 = call i8** @build_rvm_params(i8* %11, i8** %12)
store i8** %13, i8*** %9
%14 = load i8*, i8** %8
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %3
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %27
19: ; preds = %3
%20 = load i8**, i8*** %9
%21 = load i8**, i8*** %7
%22 = call i32 @bundle_install(i8** %20, i8** %21)
%23 = load i8*, i8** %8
%24 = load i8**, i8*** %9
%25 = load i8**, i8*** %7
%26 = call i32 @execve(i8* %23, i8** %24, i8** %25)
store i32 0, i32* %4
br label %27
27: ; preds = %19, %16
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [45 x i8] c"I can't find an RVM installation anywhere!\0A\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = tail call i8* (...) @find_rvm()
%5 = tail call i8** @build_rvm_params(i8* %4, i8** %1)
%6 = icmp eq i8* %4, null
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %3
%11 = tail call i32 @bundle_install(i8** %5, i8** %2)
%12 = tail call i32 @execve(i8* %4, i8** %5, i8** %2)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ 1, %7 ], [ 0, %10 ]
ret i32 %14
}