#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__ strcasecmp(char *, char *);
scalar_t__ strcmp(char *, char *);
int m_conf_multiple_choice(char *ope, char *opestr, char *val, char **choice,
                           int choice_n, int case_sensitive) {
  int i;
  int (*compare)(const char *, const char *);
  compare = (case_sensitive) ? strcmp : strcasecmp;
  if (strcmp(ope, opestr) == 0) {
    for (i = 0; i < choice_n; i++) {
      if (compare(val, choice[i]) == 0)
        return i + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<m_conf_multiple_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
mov    -0x30(%rbp),%edx
mov    0x2ea6(%rip),%rax
mov    0x2eaf(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <m_conf_multiple_choice+0xab>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11a6 <m_conf_multiple_choice+0xa6>
mov    -0x40(%rbp),%rax
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,8),%rsi
call   *%rax
cmp    $0x0,%eax
jne    1193 <m_conf_multiple_choice+0x93>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <m_conf_multiple_choice+0xb2>
jmp    1198 <m_conf_multiple_choice+0x98>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    115a <m_conf_multiple_choice+0x5a>
jmp    11ab <m_conf_multiple_choice+0xab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_conf_multiple_choice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %rcx,%r14
mov    %rdx,%r15
test   %r9d,%r9d
jne    1122 <m_conf_multiple_choice+0x22>
mov    0x2eb0(%rip),%r13
jmp    1129 <m_conf_multiple_choice+0x29>
mov    0x2eb7(%rip),%r13
call   1030 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    115e <m_conf_multiple_choice+0x5e>
test   %r12d,%r12d
jle    115e <m_conf_multiple_choice+0x5e>
mov    %r12d,%ebp
xor    %ebx,%ebx
nop
mov    (%r14,%rbx,8),%rsi
mov    %r15,%rdi
call   *%r13
test   %eax,%eax
je     115b <m_conf_multiple_choice+0x5b>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <m_conf_multiple_choice+0x40>
xor    %ebx,%ebx
jmp    115e <m_conf_multiple_choice+0x5e>
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @m_conf_multiple_choice(i8* %0, i8* %1, i8* %2, i8** %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8**
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8** %3, i8*** %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%16 = load i32, i32* %13
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i64 (i8*, i8*)* @strcmp, i64 (i8*, i8*)* @strcasecmp
%20 = bitcast i64 (i8*, i8*)* %19 to i32 (i8*, i8*)*
store i32 (i8*, i8*)* %20, i32 (i8*, i8*)** %15
%21 = load i8*, i8** %8
%22 = load i8*, i8** %9
%23 = call i64 @strcmp(i8* %21, i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %48
25: ; preds = %6
store i32 0, i32* %14
br label %26
26: ; preds = %44, %25
%27 = load i32, i32* %14
%28 = load i32, i32* %12
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %15
%32 = load i8*, i8** %10
%33 = load i8**, i8*** %11
%34 = load i32, i32* %14
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 %31(i8* %32, i8* %37)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %30
%41 = load i32, i32* %14
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %49
43: ; preds = %30
br label %44
44: ; preds = %43
%45 = load i32, i32* %14
%46 = add nsw i32 %45, 1
store i32 %46, i32* %14
br label %26
47: ; preds = %26
br label %48
48: ; preds = %47, %6
store i32 0, i32* %7
br label %49
49: ; preds = %48, %40
%50 = load i32, i32* %7
ret i32 %50
}

LLVM IR (-O2):
define i32 @m_conf_multiple_choice(i8* %0, i8* %1, i8* %2, i8** nocapture %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %5, 0
%8 = select i1 %7, i32 (i8*, i8*)* bitcast (i64 (i8*, i8*)* @strcasecmp to i32 (i8*, i8*)*), i32 (i8*, i8*)* bitcast (i64 (i8*, i8*)* @strcmp to i32 (i8*, i8*)*)
%9 = tail call i64 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i64 %9, 0
%11 = icmp sgt i32 %4, 0
%12 = and i1 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %6
%14 = zext i32 %4 to i64
br label %15
15: ; preds = %13, %24
%16 = phi i64 [ 0, %13 ], [ %25, %24 ]
%17 = getelementptr inbounds i8*, i8** %3, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 %8(i8* %2, i8* %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = trunc i64 %16 to i32
%23 = add nuw nsw i32 %22, 1
br label %27
24: ; preds = %15
%25 = add nuw nsw i64 %16, 1
%26 = icmp eq i64 %25, %14
br i1 %26, label %27, label %15
27: ; preds = %24, %6, %21
%28 = phi i32 [ %23, %21 ], [ 0, %6 ], [ 0, %24 ]
ret i32 %28
}