#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 strlen(char *);
char get_opt(char *string) {
  char opt = ' ';
  if (strlen(string) == 2) {
    if (string[1] == 'l' || string[1] == 'o' || string[1] == 'c' ||
        string[1] == 'f') {
      opt = string[1];
    } else {
      opt = '-';
    }
  }
  return opt;
}


x86 assembly (clang, -O0):
<get_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x20,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jne    118e <get_opt+0x7e>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6c,%eax
je     1176 <get_opt+0x66>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6f,%eax
je     1176 <get_opt+0x66>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x63,%eax
je     1176 <get_opt+0x66>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x66,%eax
jne    1185 <get_opt+0x75>
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
jmp    1189 <get_opt+0x79>
movb   $0x2d,-0x9(%rbp)
jmp    118e <get_opt+0x7e>
movsbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_opt>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0x20,%al
cmp    $0x2,%ecx
jne    113f <get_opt+0x2f>
mov    0x1(%rbx),%cl
mov    $0x2d,%al
lea    -0x63(%rcx),%edx
cmp    $0xc,%dl
ja     113f <get_opt+0x2f>
movzbl %dl,%edx
mov    $0x1209,%esi
bt     %rdx,%rsi
jae    113f <get_opt+0x2f>
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @get_opt(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 32, i8* %3
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %37
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 108
br i1 %12, label %31, label %13
13: ; preds = %7
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 111
br i1 %18, label %31, label %19
19: ; preds = %13
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 99
br i1 %24, label %31, label %25
25: ; preds = %19
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 102
br i1 %30, label %31, label %35
31: ; preds = %25, %19, %13, %7
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i8, i8* %33
store i8 %34, i8* %3
br label %36
35: ; preds = %25
store i8 45, i8* %3
br label %36
36: ; preds = %35, %31
br label %37
37: ; preds = %36, %1
%38 = load i8, i8* %3
ret i8 %38
}

LLVM IR (-O2):
define signext i8 @get_opt(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 2
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %8 [
i8 108, label %7
i8 111, label %7
i8 99, label %7
i8 102, label %7
]
7: ; preds = %4, %4, %4, %4
br label %8
8: ; preds = %4, %7, %1
%9 = phi i8 [ %6, %7 ], [ 32, %1 ], [ 45, %4 ]
ret i8 %9
}