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


x86 assembly (clang, -O0):
<get_textopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114b <get_textopt+0x3b>
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1157 <get_textopt+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1195 <get_textopt+0x85>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a1 <get_textopt+0x91>
movl   $0x1,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11df <get_textopt+0xcf>
mov    -0x10(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11eb <get_textopt+0xdb>
movl   $0x2,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
mov    -0x10(%rbp),%rdi
lea    0xe2e(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1216 <get_textopt+0x106>
movl   $0x3,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
mov    -0x10(%rbp),%rdi
lea    0xe0a(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1241 <get_textopt+0x131>
movl   $0x4,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
mov    -0x10(%rbp),%rdi
lea    0xde4(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    126c <get_textopt+0x15c>
movl   $0x5,-0x4(%rbp)
jmp    1273 <get_textopt+0x163>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%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 i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%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** %3
%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
store i32 0, i32* %2
br label %47
13: ; preds = %8
%14 = load i8*, i8** %3
%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** %3
%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* %2
br label %47
22: ; preds = %17
%23 = load i8*, i8** %3
%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** %3
%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* %2
br label %47
31: ; preds = %26
%32 = load i8*, i8** %3
%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* %2
br label %47
36: ; preds = %31
%37 = load i8*, i8** %3
%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* %2
br label %47
41: ; preds = %36
%42 = load i8*, i8** %3
%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* %2
br label %47
46: ; preds = %41
store i32 -1, i32* %2
br label %47
47: ; preds = %46, %45, %40, %35, %30, %21, %12
%48 = load i32, i32* %2
ret i32 %48
}

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, %4 ], [ 0, %1 ], [ 1, %10 ], [ 1, %7 ], [ 2, %16 ], [ 2, %13 ], [ 3, %19 ], [ 4, %22 ], [ %28, %25 ]
ret i32 %30
}