#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 count_params(char **);
int /*<<< orphan*/ strcmp(char *, char *);
int has_bundle_exec(char **rvm_params) {
  int i;
  for (i = 0; i < count_params(rvm_params); i++) {
    if (!strcmp(rvm_params[i], "bundle") && !strcmp(rvm_params[i + 1], "exec"))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<has_bundle_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <count_params@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11b5 <has_bundle_exec+0x95>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe9e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <has_bundle_exec+0x82>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <has_bundle_exec+0x82>
movl   $0x1,-0x4(%rbp)
jmp    11bc <has_bundle_exec+0x9c>
jmp    11a7 <has_bundle_exec+0x87>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <has_bundle_exec+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_bundle_exec>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
call   1040 <count_params@plt>
test   %eax,%eax
jle    118b <has_bundle_exec+0x6b>
xor    %ebx,%ebx
lea    0xec3(%rip),%r14
lea    0xec3(%rip),%r15
jmp    1163 <has_bundle_exec+0x43>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1040 <count_params@plt>
cltq
cmp    %rax,%rbx
jge    118b <has_bundle_exec+0x6b>
mov    (%r12,%rbx,8),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1150 <has_bundle_exec+0x30>
mov    0x8(%r12,%rbx,8),%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1150 <has_bundle_exec+0x30>
mov    $0x1,%eax
jmp    118d <has_bundle_exec+0x6d>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"bundle\00"
@.str.1 = [5 x i8] c"exec\00"
define i32 @has_bundle_exec(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 0, i32* %4
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %4
%7 = load i8**, i8*** %3
%8 = call i32 @count_params(i8** %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %32
10: ; preds = %5
%11 = load i8**, i8*** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %28, label %18
18: ; preds = %10
%19 = load i8**, i8*** %3
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %19, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %18
store i32 1, i32* %2
br label %33
28: ; preds = %18, %10
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
store i32 0, i32* %2
br label %33
33: ; preds = %32, %27
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [7 x i8] c"bundle\00"
@.str.1 = [5 x i8] c"exec\00"
define i32 @has_bundle_exec(i8** %0) {
%2 = tail call i32 @count_params(i8** %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %20
4: ; preds = %1, %16
%5 = phi i64 [ %10, %16 ], [ 0, %1 ]
%6 = getelementptr inbounds i8*, i8** %0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %7, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
%10 = add nuw nsw i64 %5, 1
br i1 %9, label %11, label %16
11: ; preds = %4
%12 = getelementptr inbounds i8*, i8** %0, i64 %10
%13 = load i8*, i8** %12
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %13, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %4, %11
%17 = tail call i32 @count_params(i8** %0)
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %10, %18
br i1 %19, label %4, label %20
20: ; preds = %11, %16, %1
%21 = phi i32 [ 0, %1 ], [ 0, %16 ], [ 1, %11 ]
ret i32 %21
}