#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 */
scalar_t__ strncmp(char *, char *, int);
int get_textopt(char *p) {
  int option;
  option = 0;
  if (*p == '\0' || strncmp(p, "obeylines", 9) == 0)
    ;
  else if (strncmp(p, "align", 5) == 0 || strncmp(p, "justify", 7) == 0)
    option = 1;
  else if (strncmp(p, "ragged", 6) == 0 || strncmp(p, "fill", 4) == 0)
    option = 2;
  else if (strncmp(p, "center", 6) == 0)
    option = 3;
  else if (strncmp(p, "skip", 4) == 0)
    option = 4;
  else if (strncmp(p, "right", 5) == 0)
    option = 5;
  else
    option = -1;
  return option;
}


x86 assembly (clang, -O0):
<get_textopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1152 <get_textopt+0x42>
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1157 <get_textopt+0x47>
jmp    128c <get_textopt+0x17c>
mov    -0x8(%rbp),%rdi
lea    0xea8(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1195 <get_textopt+0x85>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a1 <get_textopt+0x91>
movl   $0x1,-0xc(%rbp)
jmp    1287 <get_textopt+0x177>
mov    -0x8(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11df <get_textopt+0xcf>
mov    -0x8(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11eb <get_textopt+0xdb>
movl   $0x2,-0xc(%rbp)
jmp    1282 <get_textopt+0x172>
mov    -0x8(%rbp),%rdi
lea    0xe2e(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1216 <get_textopt+0x106>
movl   $0x3,-0xc(%rbp)
jmp    127d <get_textopt+0x16d>
mov    -0x8(%rbp),%rdi
lea    0xe0a(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1241 <get_textopt+0x131>
movl   $0x4,-0xc(%rbp)
jmp    1278 <get_textopt+0x168>
mov    -0x8(%rbp),%rdi
lea    0xde4(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    126c <get_textopt+0x15c>
movl   $0x5,-0xc(%rbp)
jmp    1273 <get_textopt+0x163>
movl   $0xffffffff,-0xc(%rbp)
jmp    1278 <get_textopt+0x168>
jmp    127d <get_textopt+0x16d>
jmp    1282 <get_textopt+0x172>
jmp    1287 <get_textopt+0x177>
jmp    128c <get_textopt+0x17c>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_textopt>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmpb   $0x0,(%rdi)
je     120b <get_textopt+0xfb>
mov    %rdi,%rbx
lea    0xed8(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
mov    $0x1,%ebp
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    $0x2,%ebp
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1206 <get_textopt+0xf6>
lea    0xe5a(%rip),%rsi
mov    $0x4,%ebp
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120b <get_textopt+0xfb>
lea    0xe41(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
neg    %rax
sbb    %ebp,%ebp
or     $0x5,%ebp
jmp    120b <get_textopt+0xfb>
mov    $0x3,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"obeylines\00"
@.str.1 = [6 x i8] c"align\00"
@.str.2 = [8 x i8] c"justify\00"
@.str.3 = [7 x i8] c"ragged\00"
@.str.4 = [5 x i8] c"fill\00"
@.str.5 = [7 x i8] c"center\00"
@.str.6 = [5 x i8] c"skip\00"
@.str.7 = [6 x i8] c"right\00"
define i32 @get_textopt(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8, %1
br label %52
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8*, i8** %2
%19 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %17, %13
store i32 1, i32* %3
br label %51
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i8*, i8** %2
%28 = call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26, %22
store i32 2, i32* %3
br label %50
31: ; preds = %26
%32 = load i8*, i8** %2
%33 = call i64 @strncmp(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 3, i32* %3
br label %49
36: ; preds = %31
%37 = load i8*, i8** %2
%38 = call i64 @strncmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 4, i32* %3
br label %48
41: ; preds = %36
%42 = load i8*, i8** %2
%43 = call i64 @strncmp(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %46
45: ; preds = %41
store i32 5, i32* %3
br label %47
46: ; preds = %41
store i32 -1, i32* %3
br label %47
47: ; preds = %46, %45
br label %48
48: ; preds = %47, %40
br label %49
49: ; preds = %48, %35
br label %50
50: ; preds = %49, %30
br label %51
51: ; preds = %50, %21
br label %52
52: ; preds = %51, %12
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [10 x i8] c"obeylines\00"
@.str.1 = [6 x i8] c"align\00"
@.str.2 = [8 x i8] c"justify\00"
@.str.3 = [7 x i8] c"ragged\00"
@.str.4 = [5 x i8] c"fill\00"
@.str.5 = [7 x i8] c"center\00"
@.str.6 = [5 x i8] c"skip\00"
@.str.7 = [6 x i8] c"right\00"
define i32 @get_textopt(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %29, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%6 = icmp eq i64 %5, 0
br i1 %6, label %29, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %7
%11 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %29, label %13
13: ; preds = %10
%14 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %29, label %16
16: ; preds = %13
%17 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%18 = icmp eq i64 %17, 0
br i1 %18, label %29, label %19
19: ; preds = %16
%20 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%21 = icmp eq i64 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %19
%23 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%27 = icmp eq i64 %26, 0
%28 = select i1 %27, i32 5, i32 -1
br label %29
29: ; preds = %25, %22, %19, %13, %16, %7, %10, %1, %4
%30 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %10 ], [ 1, %7 ], [ 2, %16 ], [ 2, %13 ], [ 3, %19 ], [ 4, %22 ], [ %28, %25 ]
ret i32 %30
}