#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 SCHED_FIFO;
int SCHED_OTHER;
int SCHED_RR;
scalar_t__ strcasecmp(char *, char *);
int get_sched(char *str) {
  if (strcasecmp(str, "RR") == 0)
    return SCHED_RR;
  else if (strcasecmp(str, "FIFO") == 0)
    return SCHED_FIFO;
  else if (strcasecmp(str, "NORMAL") == 0)
    return SCHED_OTHER;
  else if (strcasecmp(str, "OTHER") == 0)
    return SCHED_OTHER;
  return SCHED_RR;
}


x86 assembly (clang, -O0):
<get_sched>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1147 <get_sched+0x37>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <get_sched+0xd3>
mov    -0x10(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1172 <get_sched+0x62>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <get_sched+0xd3>
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    119d <get_sched+0x8d>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <get_sched+0xd3>
mov    -0x10(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11c8 <get_sched+0xb8>
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11e3 <get_sched+0xd3>
jmp    11cd <get_sched+0xbd>
jmp    11d2 <get_sched+0xc2>
jmp    11d7 <get_sched+0xc7>
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sched>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     116a <get_sched+0x5a>
lea    0xed7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1173 <get_sched+0x63>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1161 <get_sched+0x51>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    116a <get_sched+0x5a>
mov    0x2e70(%rip),%rax
jmp    117a <get_sched+0x6a>
mov    0x2e57(%rip),%rax
jmp    117a <get_sched+0x6a>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"RR\00"
@SCHED_RR = global i32 0
@.str.1 = [5 x i8] c"FIFO\00"
@SCHED_FIFO = global i32 0
@.str.2 = [7 x i8] c"NORMAL\00"
@SCHED_OTHER = global i32 0
@.str.3 = [6 x i8] c"OTHER\00"
define i32 @get_sched(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strcasecmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* @SCHED_RR
store i32 %8, i32* %2
br label %32
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* @SCHED_FIFO
store i32 %14, i32* %2
br label %32
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = call i64 @strcasecmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i32, i32* @SCHED_OTHER
store i32 %20, i32* %2
br label %32
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = call i64 @strcasecmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* @SCHED_OTHER
store i32 %26, i32* %2
br label %32
27: ; preds = %21
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
%31 = load i32, i32* @SCHED_RR
store i32 %31, i32* %2
br label %32
32: ; preds = %30, %25, %19, %13, %7
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"RR\00"
@SCHED_RR = global i32 0
@.str.1 = [5 x i8] c"FIFO\00"
@SCHED_FIFO = global i32 0
@.str.2 = [7 x i8] c"NORMAL\00"
@SCHED_OTHER = global i32 0
@.str.3 = [6 x i8] c"OTHER\00"
define i32 @get_sched(i8* nocapture %0) {
%2 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %14, 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 %14, label %7
7: ; preds = %4
%8 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32* @SCHED_OTHER, i32* @SCHED_RR
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i32* [ @SCHED_RR, %1 ], [ @SCHED_FIFO, %4 ], [ @SCHED_OTHER, %7 ], [ %13, %10 ]
%16 = load i32, i32* %15
ret i32 %16
}