#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 /*<<< orphan*/ invalid_encoder(char const *);
scalar_t__ strcasecmp(char const *, char const *);
int check_decoder(const char *decoder) {
  const char *decoders[] = {"ogg", "flac"};
  int i = 0;
  for (i = 0; i < 2; i++) {
    if (strcasecmp(decoder, decoders[i]) == 0)
      break;
    if (i == 2 - 1 && strcasecmp(decoder, decoders[i]) != 0)
      invalid_encoder(decoder);
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_decoder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2cdd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    11bd <check_decoder+0x9d>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    117b <check_decoder+0x5b>
jmp    11bd <check_decoder+0x9d>
cmpl   $0x1,-0x24(%rbp)
jne    11aa <check_decoder+0x8a>
mov    -0x8(%rbp),%rdi
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11aa <check_decoder+0x8a>
mov    -0x8(%rbp),%rdi
call   1040 <invalid_encoder@plt>
jmp    11af <check_decoder+0x8f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <check_decoder+0x30>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_decoder>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1151 <check_decoder+0x31>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1151 <check_decoder+0x31>
mov    %rbx,%rdi
call   1040 <invalid_encoder@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"ogg\00"
@.str.1 = [5 x i8] c"flac\00"
@__const.check_decoder.decoders = [2 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0)]
define i32 @check_decoder(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
ret i32 1
}

LLVM IR (-O2):
@.str = [4 x i8] c"ogg\00"
@.str.1 = [5 x i8] c"flac\00"
define i32 @check_decoder(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 ([5 x i8], [5 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
ret i32 1
}