#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 /*<<< orphan*/ strcmp(char *, char *);
int xps_parse_line_cap(char *attr) {
  if (attr) {
    if (!strcmp(attr, "Flat"))
      return 0;
    if (!strcmp(attr, "Round"))
      return 1;
    if (!strcmp(attr, "Square"))
      return 2;
    if (!strcmp(attr, "Triangle"))
      return 3;
  }
  return 0;
}


x86 assembly (clang, -O0):
<xps_parse_line_cap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11c0 <xps_parse_line_cap+0xb0>
mov    -0x10(%rbp),%rdi
lea    0xece(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    114c <xps_parse_line_cap+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <xps_parse_line_cap+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1171 <xps_parse_line_cap+0x61>
movl   $0x1,-0x4(%rbp)
jmp    11c7 <xps_parse_line_cap+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1196 <xps_parse_line_cap+0x86>
movl   $0x2,-0x4(%rbp)
jmp    11c7 <xps_parse_line_cap+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11bb <xps_parse_line_cap+0xab>
movl   $0x3,-0x4(%rbp)
jmp    11c7 <xps_parse_line_cap+0xb7>
jmp    11c0 <xps_parse_line_cap+0xb0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xps_parse_line_cap>:
push   %rbx
test   %rdi,%rdi
je     1162 <xps_parse_line_cap+0x52>
mov    %rdi,%rbx
lea    0xee0(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1162 <xps_parse_line_cap+0x52>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1166 <xps_parse_line_cap+0x56>
lea    0xec8(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     116d <xps_parse_line_cap+0x5d>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1174 <xps_parse_line_cap+0x64>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Flat\00"
@.str.1 = [6 x i8] c"Round\00"
@.str.2 = [7 x i8] c"Square\00"
@.str.3 = [9 x i8] c"Triangle\00"
define i32 @xps_parse_line_cap(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %27
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %6
store i32 0, i32* %2
br label %28
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i32 1, i32* %2
br label %28
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i32 2, i32* %2
br label %28
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21
store i32 3, i32* %2
br label %28
26: ; preds = %21
br label %27
27: ; preds = %26, %1
store i32 0, i32* %2
br label %28
28: ; preds = %27, %25, %20, %15, %10
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
@.str = [5 x i8] c"Flat\00"
@.str.1 = [6 x i8] c"Round\00"
@.str.2 = [7 x i8] c"Square\00"
@.str.3 = [9 x i8] c"Triangle\00"
define i32 @xps_parse_line_cap(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %12, %1
br label %16
16: ; preds = %12, %9, %6, %3, %15
%17 = phi i32 [ 0, %15 ], [ 0, %3 ], [ 1, %6 ], [ 2, %9 ], [ 3, %12 ]
ret i32 %17
}