#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 */
scalar_t__ strcmp(char *, char *);
int icsGetBitsParam(char order[10 + 1][32], int parameters) {
  int i;
  for (i = 0; i < parameters; i++) {
    if (strcmp(order[i], "bits") == 0) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<icsGetBitsParam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1175 <icsGetBitsParam+0x65>
mov    -0x10(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x5,%rax
add    %rax,%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1162 <icsGetBitsParam+0x52>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117c <icsGetBitsParam+0x6c>
jmp    1167 <icsGetBitsParam+0x57>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <icsGetBitsParam+0x16>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icsGetBitsParam>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%r14d
test   %esi,%esi
jle    1162 <icsGetBitsParam+0x52>
mov    %rdi,%rbx
mov    %esi,%r12d
xor    %ebp,%ebp
lea    0xecf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     115f <icsGetBitsParam+0x4f>
add    $0x1,%rbp
add    $0x20,%rbx
cmp    %rbp,%r12
jne    1140 <icsGetBitsParam+0x30>
jmp    1162 <icsGetBitsParam+0x52>
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"bits\00"
define i32 @icsGetBitsParam([32 x i8]* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %0, i64 %7, i64 0
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %11 ]
ret i32 %17
}