#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 IF_LINK_MODE_DEFAULT;
int IF_LINK_MODE_DORMANT;
scalar_t__ strcasecmp(char const *, char *);
int get_link_mode(const char *mode) {
  if (strcasecmp(mode, "default") == 0)
    return IF_LINK_MODE_DEFAULT;
  if (strcasecmp(mode, "dormant") == 0)
    return IF_LINK_MODE_DORMANT;
  return -1;
}


x86 assembly (clang, -O0):
<get_link_mode>:
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_link_mode+0x37>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <get_link_mode+0x69>
mov    -0x10(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1172 <get_link_mode+0x62>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1179 <get_link_mode+0x69>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_link_mode>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1144 <get_link_mode+0x34>
lea    0xedc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
mov    0x2ead(%rip),%rcx
neg    %rax
sbb    %eax,%eax
or     (%rcx),%eax
pop    %rbx
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"default\00"
@IF_LINK_MODE_DEFAULT = global i32 0
@.str.1 = [8 x i8] c"dormant\00"
@IF_LINK_MODE_DORMANT = global i32 0
define i32 @get_link_mode(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 ([8 x i8], [8 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* @IF_LINK_MODE_DEFAULT
store i32 %8, i32* %2
br label %16
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcasecmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 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* @IF_LINK_MODE_DORMANT
store i32 %14, i32* %2
br label %16
15: ; preds = %9
store i32 -1, i32* %2
br label %16
16: ; preds = %15, %13, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [8 x i8] c"default\00"
@IF_LINK_MODE_DEFAULT = global i32 0
@.str.1 = [8 x i8] c"dormant\00"
@IF_LINK_MODE_DORMANT = global i32 0
define i32 @get_link_mode(i8* nocapture %0) {
%2 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = load i32, i32* @IF_LINK_MODE_DEFAULT
br label %11
6: ; preds = %1
%7 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* @IF_LINK_MODE_DORMANT
%10 = select i1 %8, i32 %9, i32 -1
br label %11
11: ; preds = %6, %4
%12 = phi i32 [ %5, %4 ], [ %10, %6 ]
ret i32 %12
}