#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 flag_get_type(char *string) {
  if (strncmp(string + 1, "U.", 2) == 0) {
    return 1;
  }
  if (strncmp(string + 1, "C.", 2) == 0) {
    return 2;
  }
  if (strncmp(string + 1, "D.", 2) == 0) {
    return 4;
  }
  if (strncmp(string + 1, "N.", 2) == 0) {
    return 8;
  }
  if (strncmp(string + 1, "P.", 2) == 0) {
    return 16;
  }
  if (strncmp(string + 1, "R.", 2) == 0) {
    return 32;
  }
  if (strncmp(string + 1, "E.", 2) == 0) {
    return 64;
  }
  return 0;
}


x86 assembly (clang, -O0):
<flag_get_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xed5(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    114b <flag_get_type+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xea9(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117a <flag_get_type+0x6a>
movl   $0x2,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe7d(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a9 <flag_get_type+0x99>
movl   $0x4,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe51(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11d8 <flag_get_type+0xc8>
movl   $0x8,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xe25(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1207 <flag_get_type+0xf7>
movl   $0x10,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xdf9(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1236 <flag_get_type+0x126>
movl   $0x20,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
lea    0xdcd(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1265 <flag_get_type+0x155>
movl   $0x40,-0x4(%rbp)
jmp    126c <flag_get_type+0x15c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_get_type>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
add    $0x1,%rbx
lea    0xedf(%rip),%rsi
mov    $0x2,%ebp
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11df <flag_get_type+0xcf>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1200 <flag_get_type+0xf0>
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11e6 <flag_get_type+0xd6>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11ed <flag_get_type+0xdd>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f4 <flag_get_type+0xe4>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11fb <flag_get_type+0xeb>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
shl    $0x6,%ebp
jmp    1200 <flag_get_type+0xf0>
mov    $0x1,%ebp
jmp    1200 <flag_get_type+0xf0>
mov    $0x4,%ebp
jmp    1200 <flag_get_type+0xf0>
mov    $0x8,%ebp
jmp    1200 <flag_get_type+0xf0>
mov    $0x10,%ebp
jmp    1200 <flag_get_type+0xf0>
mov    $0x20,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"U.\00"
@.str.1 = [3 x i8] c"C.\00"
@.str.2 = [3 x i8] c"D.\00"
@.str.3 = [3 x i8] c"N.\00"
@.str.4 = [3 x i8] c"P.\00"
@.str.5 = [3 x i8] c"R.\00"
@.str.6 = [3 x i8] c"E.\00"
define i32 @flag_get_type(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %46
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = call i64 @strncmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 2, i32* %2
br label %46
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i64 @strncmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 4, i32* %2
br label %46
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = call i64 @strncmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 8, i32* %2
br label %46
27: ; preds = %21
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 1
%30 = call i64 @strncmp(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %27
store i32 16, i32* %2
br label %46
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = call i64 @strncmp(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 32, i32* %2
br label %46
39: ; preds = %33
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = call i64 @strncmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %39
store i32 64, i32* %2
br label %46
45: ; preds = %39
store i32 0, i32* %2
br label %46
46: ; preds = %45, %44, %38, %32, %26, %20, %14, %8
%47 = load i32, i32* %2
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"U.\00"
@.str.1 = [3 x i8] c"C.\00"
@.str.2 = [3 x i8] c"D.\00"
@.str.3 = [3 x i8] c"N.\00"
@.str.4 = [3 x i8] c"P.\00"
@.str.5 = [3 x i8] c"R.\00"
@.str.6 = [3 x i8] c"E.\00"
define i32 @flag_get_type(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %24, label %5
5: ; preds = %1
%6 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %24, label %8
8: ; preds = %5
%9 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%10 = icmp eq i64 %9, 0
br i1 %10, label %24, label %11
11: ; preds = %8
%12 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %11
%15 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = tail call i64 @strncmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i32 64, i32 0
br label %24
24: ; preds = %20, %17, %14, %11, %8, %5, %1
%25 = phi i32 [ 1, %1 ], [ 2, %5 ], [ 4, %8 ], [ 8, %11 ], [ 16, %14 ], [ 32, %17 ], [ %23, %20 ]
ret i32 %25
}