#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*/ exit(int);
int /*<<< orphan*/ has_bundle_exec(char **);
int /*<<< orphan*/ has_gemfile_mismatch();
scalar_t__ rvm_exec(int, char **, char **, char *, char *,
                    int /*<<< orphan*/ *);
void bundle_install(char **rvm_params, char **envp) {
  if (!has_bundle_exec(rvm_params))
    return;
  if (!has_gemfile_mismatch())
    return;
  if (rvm_exec(1, envp, rvm_params, "bundle", "check", NULL) == 0)
    return;
  if (rvm_exec(0, envp, rvm_params, "bundle", "install", NULL) != 0) {
    exit(1);
  }
}


x86 assembly (clang, -O0):
<bundle_install>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <has_bundle_exec@plt>
cmp    $0x0,%eax
jne    1167 <bundle_install+0x27>
jmp    11e6 <bundle_install+0xa6>
mov    $0x0,%al
call   1040 <has_gemfile_mismatch@plt>
cmp    $0x0,%eax
jne    117c <bundle_install+0x3c>
jmp    11e6 <bundle_install+0xa6>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xe70(%rip),%rcx
lea    0xe70(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1050 <rvm_exec@plt>
cmp    $0x0,%rax
jne    11b0 <bundle_install+0x70>
jmp    11e6 <bundle_install+0xa6>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
lea    0xe3f(%rip),%rcx
lea    0xe45(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1050 <rvm_exec@plt>
cmp    $0x0,%rax
je     11e6 <bundle_install+0xa6>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bundle_install>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <has_bundle_exec@plt>
test   %eax,%eax
je     11a7 <bundle_install+0x67>
xor    %eax,%eax
call   1040 <has_gemfile_mismatch@plt>
test   %eax,%eax
je     11a7 <bundle_install+0x67>
lea    0xe9b(%rip),%rcx
lea    0xe9b(%rip),%r8
mov    $0x1,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %r9d,%r9d
call   1050 <rvm_exec@plt>
test   %rax,%rax
je     11a7 <bundle_install+0x67>
lea    0xe75(%rip),%rcx
lea    0xe7b(%rip),%r8
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %r9d,%r9d
call   1050 <rvm_exec@plt>
test   %rax,%rax
jne    11af <bundle_install+0x6f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"bundle\00"
@.str.1 = [6 x i8] c"check\00"
@.str.2 = [8 x i8] c"install\00"
define void @bundle_install(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %3
%6 = call i32 @has_bundle_exec(i8** %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %2
br label %26
9: ; preds = %2
%10 = call i32 (...) @has_gemfile_mismatch()
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
br label %26
13: ; preds = %9
%14 = load i8**, i8*** %4
%15 = load i8**, i8*** %3
%16 = call i64 @rvm_exec(i32 1, i8** %14, i8** %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
br label %26
19: ; preds = %13
%20 = load i8**, i8*** %4
%21 = load i8**, i8*** %3
%22 = call i64 @rvm_exec(i32 0, i8** %20, i8** %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* null)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %8, %12, %18, %19
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"bundle\00"
@.str.1 = [6 x i8] c"check\00"
@.str.2 = [8 x i8] c"install\00"
define void @bundle_install(i8** %0, i8** %1) {
%3 = tail call i32 @has_bundle_exec(i8** %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = tail call i32 (...) @has_gemfile_mismatch()
%7 = icmp eq i32 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %5
%9 = tail call i64 @rvm_exec(i32 1, i8** %1, i8** %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* null)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = tail call i64 @rvm_exec(i32 0, i8** %1, i8** %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* null)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %8, %5, %2, %11
ret void
}