#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 get_code(char const *);
int /*<<< orphan*/ invalid_encoder(char const *);
scalar_t__ strcasecmp(char const *, char const *);
int check_encoder(const char *encoder) {
  const char *encoders[] = {"mp3", "ao"};
  int i = 0;
  for (i = 0; i < 2; i++) {
    if (strcasecmp(encoder, encoders[i]) == 0)
      break;
    if (i == 2 - 1 && strcasecmp(encoder, encoders[i]) != 0)
      invalid_encoder(encoder);
  }
  return get_code(encoder);
}


x86 assembly (clang, -O0):
<check_encoder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ccd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    11cd <check_encoder+0x9d>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    118b <check_encoder+0x5b>
jmp    11cd <check_encoder+0x9d>
cmpl   $0x1,-0x24(%rbp)
jne    11ba <check_encoder+0x8a>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11ba <check_encoder+0x8a>
mov    -0x8(%rbp),%rdi
call   1040 <invalid_encoder@plt>
jmp    11bf <check_encoder+0x8f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1160 <check_encoder+0x30>
mov    -0x8(%rbp),%rdi
call   1050 <get_code@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_encoder>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1161 <check_encoder+0x31>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1161 <check_encoder+0x31>
mov    %rbx,%rdi
call   1040 <invalid_encoder@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <get_code@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"mp3\00"
@.str.1 = [3 x i8] c"ao\00"
define i32 @check_encoder(i8* %0) {
%2 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @invalid_encoder(i8* %0)
br label %9
9: ; preds = %7, %4, %1
%10 = tail call i32 @get_code(i8* %0)
ret i32 %10
}