#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 const *, char const *);
const char *old_to_new_ctrl_flag(const char *old) {
  static const char *clist[] = {
      "requisite", "required", "sufficient", "optional", NULL,
  };
  int i;
  for (i = 0; clist[i]; ++i) {
    if (strcasecmp(clist[i], old) == 0) {
      break;
    }
  }
  return clist[i];
}


x86 assembly (clang, -O0):
<old_to_new_ctrl_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2f02(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     1173 <old_to_new_ctrl_flag+0x63>
movslq -0xc(%rbp),%rcx
lea    0x2eec(%rip),%rax
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1160 <old_to_new_ctrl_flag+0x50>
jmp    1173 <old_to_new_ctrl_flag+0x63>
jmp    1165 <old_to_new_ctrl_flag+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <old_to_new_ctrl_flag+0x13>
movslq -0xc(%rbp),%rcx
lea    0x2eb2(%rip),%rax
mov    (%rax,%rcx,8),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_to_new_ctrl_flag>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1178 <old_to_new_ctrl_flag+0x68>
lea    0xedb(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1181 <old_to_new_ctrl_flag+0x71>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     118a <old_to_new_ctrl_flag+0x7a>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0x2c82(%rip),%rax
lea    (%rax,%rcx,8),%rax
add    $0x18,%rax
jmp    1191 <old_to_new_ctrl_flag+0x81>
lea    0x2c71(%rip),%rax
jmp    1191 <old_to_new_ctrl_flag+0x81>
lea    0x2c70(%rip),%rax
jmp    1191 <old_to_new_ctrl_flag+0x81>
lea    0x2c6f(%rip),%rax
mov    (%rax),%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@old_to_new_ctrl_flag.clist = internal unnamed_addr constant [5 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* null]
@.str = [10 x i8] c"requisite\00"
@.str.1 = [9 x i8] c"required\00"
@.str.2 = [11 x i8] c"sufficient\00"
@.str.3 = [9 x i8] c"optional\00"
define i8* @old_to_new_ctrl_flag(i8* nocapture %0) {
%2 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @old_to_new_ctrl_flag.clist, i64 0, i64 3), i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @old_to_new_ctrl_flag.clist, i64 0, i64 4)
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i8** [ getelementptr inbounds ([5 x i8*], [5 x i8*]* @old_to_new_ctrl_flag.clist, i64 0, i64 0), %1 ], [ getelementptr inbounds ([5 x i8*], [5 x i8*]* @old_to_new_ctrl_flag.clist, i64 0, i64 1), %4 ], [ getelementptr inbounds ([5 x i8*], [5 x i8*]* @old_to_new_ctrl_flag.clist, i64 0, i64 2), %7 ], [ %13, %10 ]
%16 = load i8*, i8** %15
ret i8* %16
}