int collect_bool_from_str(const char *src) {
  int counter;
  const char tab_true[][5] = {"TRUE", "T", "Y", "YES", ""};
  const char tab_false[][6] = {"FALSE", "F", "N", "NO", ""};
  counter = 0;
  while (tab_true[counter][0] != '\0') {
    if (!strcmp_x(src, tab_true[counter]))
      return (1);
    counter++;
  }
  counter = 0;
  while (tab_false[counter][0] != '\0') {
    if (!strcmp_x(src, tab_false[counter]))
      return (0);
    counter++;
  }
  return (-1);
}


x86 assembly (clang, -O0):
<collect_bool_from_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed5(%rip),%al
mov    %al,-0x18(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x34(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11da <collect_bool_from_str+0xca>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    -0x30(%rbp),%rsi
imul   $0x5,%rax,%rax
add    %rax,%rsi
mov    $0x0,%al
call   1030 <strcmp_x@plt>
cmp    $0x0,%eax
jne    11cc <collect_bool_from_str+0xbc>
movl   $0x1,-0x4(%rbp)
jmp    1240 <collect_bool_from_str+0x130>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1182 <collect_bool_from_str+0x72>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x6,%rcx,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1239 <collect_bool_from_str+0x129>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
lea    -0x50(%rbp),%rsi
imul   $0x6,%rax,%rax
add    %rax,%rsi
mov    $0x0,%al
call   1030 <strcmp_x@plt>
cmp    $0x0,%eax
jne    122b <collect_bool_from_str+0x11b>
movl   $0x0,-0x4(%rbp)
jmp    1240 <collect_bool_from_str+0x130>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e1 <collect_bool_from_str+0xd1>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<collect_bool_from_str>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%r14
movups 0xee7(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xef5(%rip),%xmm0
movups %xmm0,0x2e(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %rsp,%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <strcmp_x@plt>
test   %eax,%eax
je     11a2 <collect_bool_from_str+0x92>
cmpb   $0x0,0x5(%rbx)
lea    0x5(%rbx),%rbx
jne    1150 <collect_bool_from_str+0x40>
lea    0x20(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <strcmp_x@plt>
test   %eax,%eax
je     11a7 <collect_bool_from_str+0x97>
cmpb   $0x0,0x6(%rbx)
lea    0x6(%rbx),%rbx
jne    1180 <collect_bool_from_str+0x70>
mov    $0xffffffff,%ebp
jmp    11a7 <collect_bool_from_str+0x97>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.collect_bool_from_str.tab_true = [5 x [5 x i8]] [[5 x i8] c"TRUE\00", [5 x i8] c"T\00\00\00\00", [5 x i8] c"Y\00\00\00\00", [5 x i8] c"YES\00\00", [5 x i8] zeroinitializer]
@__const.collect_bool_from_str.tab_false = [5 x [6 x i8]] [[6 x i8] c"FALSE\00", [6 x i8] c"F\00\00\00\00\00", [6 x i8] c"N\00\00\00\00\00", [6 x i8] c"NO\00\00\00\00", [6 x i8] zeroinitializer]
define i32 @collect_bool_from_str(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [5 x [5 x i8]]
%6 = alloca [5 x [6 x i8]]
store i8* %0, i8** %3
%7 = bitcast [5 x [5 x i8]]* %5 to i8*
%8 = bitcast [5 x [6 x i8]]* %6 to i8*
store i32 0, i32* %4
br label %9
9: ; preds = %26, %1
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [5 x [5 x i8]], [5 x [5 x i8]]* %5, i64 0, i64 %11
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x [5 x i8]], [5 x [5 x i8]]* %5, i64 0, i64 %20
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %21, i64 0, i64 0
%23 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strcmp_x to i32 (i8*, i8*, ...)*)(i8* %18, i8* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %17
store i32 1, i32* %2
br label %51
26: ; preds = %17
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %9
29: ; preds = %9
store i32 0, i32* %4
br label %30
30: ; preds = %47, %29
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x [6 x i8]], [5 x [6 x i8]]* %6, i64 0, i64 %32
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %33, i64 0, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %50
38: ; preds = %30
%39 = load i8*, i8** %3
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x [6 x i8]], [5 x [6 x i8]]* %6, i64 0, i64 %41
%43 = getelementptr inbounds [6 x i8], [6 x i8]* %42, i64 0, i64 0
%44 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strcmp_x to i32 (i8*, i8*, ...)*)(i8* %39, i8* %43)
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %38
store i32 0, i32* %2
br label %51
47: ; preds = %38
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %30
50: ; preds = %30
store i32 -1, i32* %2
br label %51
51: ; preds = %50, %46, %25
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
@__const.collect_bool_from_str.tab_true = [5 x [5 x i8]] [[5 x i8] c"TRUE\00", [5 x i8] c"T\00\00\00\00", [5 x i8] c"Y\00\00\00\00", [5 x i8] c"YES\00\00", [5 x i8] zeroinitializer]
@__const.collect_bool_from_str.tab_false = [5 x [6 x i8]] [[6 x i8] c"FALSE\00", [6 x i8] c"F\00\00\00\00\00", [6 x i8] c"N\00\00\00\00\00", [6 x i8] c"NO\00\00\00\00", [6 x i8] zeroinitializer]
define i32 @collect_bool_from_str(i8* %0) {
%2 = alloca [5 x [5 x i8]]
%3 = alloca [5 x [6 x i8]]
%4 = getelementptr inbounds [5 x [5 x i8]], [5 x [5 x i8]]* %2, i64 0, i64 0, i64 0
%5 = getelementptr inbounds [5 x [6 x i8]], [5 x [6 x i8]]* %3, i64 0, i64 0, i64 0
br label %10
6: ; preds = %10
%7 = getelementptr inbounds [5 x [5 x i8]], [5 x [5 x i8]]* %2, i64 0, i64 %15, i64 0
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %1, %6
%11 = phi i64 [ 0, %1 ], [ %15, %6 ]
%12 = phi i8* [ %4, %1 ], [ %7, %6 ]
%13 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strcmp_x to i32 (i8*, i8*, ...)*)(i8* %0, i8* %12)
%14 = icmp eq i32 %13, 0
%15 = add nuw i64 %11, 1
br i1 %14, label %26, label %6
16: ; preds = %20
%17 = getelementptr inbounds [5 x [6 x i8]], [5 x [6 x i8]]* %3, i64 0, i64 %25, i64 0
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %6, %16
%21 = phi i64 [ %25, %16 ], [ 0, %6 ]
%22 = phi i8* [ %17, %16 ], [ %5, %6 ]
%23 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @strcmp_x to i32 (i8*, i8*, ...)*)(i8* %0, i8* %22)
%24 = icmp eq i32 %23, 0
%25 = add nuw i64 %21, 1
br i1 %24, label %26, label %16
26: ; preds = %10, %20, %16
%27 = phi i32 [ 0, %20 ], [ -1, %16 ], [ 1, %10 ]
ret i32 %27
}