#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*/ memset(char *, char, int);
void parse_access_type(const char *in, char out[7 + 1]) {
  int i;
  memset(out, '-', 7);
  out[7] = '\0';
  for (i = 0; in[i] != '\0'; i++)
    switch (in[i]) {
    case 'r':
    case 'R':
      out[0] = 'r';
      break;
    case 'w':
    case 'W':
      out[1] = 'w';
      break;
    case 'x':
    case 'X':
      out[2] = 'x';
      break;
    case 'a':
    case 'A':
      out[3] = 'a';
      break;
    case 't':
    case 'T':
      out[4] = 't';
      break;
    case 'l':
    case 'L':
      out[5] = 'l';
      break;
    case 'b':
    case 'B':
      out[6] = 'b';
      break;
    default:
      break;
    }
}


x86 assembly (clang, -O0):
<parse_access_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2d,%esi
mov    $0x7,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,0x7(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11fb <parse_access_type+0xeb>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x37,%eax
ja     11e3 <parse_access_type+0xd3>
mov    -0x20(%rbp),%rax
lea    0xe80(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movb   $0x72,(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x77,0x1(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x78,0x2(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x61,0x3(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x74,0x4(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x6c,0x5(%rax)
jmp    11e8 <parse_access_type+0xd8>
mov    -0x10(%rbp),%rax
movb   $0x62,0x6(%rax)
jmp    11e8 <parse_access_type+0xd8>
jmp    11e8 <parse_access_type+0xd8>
jmp    11ed <parse_access_type+0xdd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <parse_access_type+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_access_type>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    $0x2d,%esi
mov    $0x7,%edx
call   1030 <memset@plt>
movb   $0x0,0x7(%r14)
mov    (%rbx),%cl
test   %cl,%cl
je     1198 <parse_access_type+0x88>
add    $0x1,%rbx
lea    0xebe(%rip),%rax
jmp    115b <parse_access_type+0x4b>
movb   $0x62,0x6(%r14)
nopl   0x0(%rax)
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
je     1198 <parse_access_type+0x88>
movsbl %cl,%ecx
add    $0xffffffbf,%ecx
cmp    $0x37,%ecx
ja     1150 <parse_access_type+0x40>
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movb   $0x61,0x3(%r14)
jmp    1150 <parse_access_type+0x40>
movb   $0x6c,0x5(%r14)
jmp    1150 <parse_access_type+0x40>
movb   $0x72,(%r14)
jmp    1150 <parse_access_type+0x40>
movb   $0x74,0x4(%r14)
jmp    1150 <parse_access_type+0x40>
movb   $0x77,0x1(%r14)
jmp    1150 <parse_access_type+0x40>
movb   $0x78,0x2(%r14)
jmp    1150 <parse_access_type+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @parse_access_type(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @memset(i8* %6, i8 signext 45, i32 7)
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 7
store i8 0, i8* %9
store i32 0, i32* %5
br label %10
10: ; preds = %48, %2
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %51
18: ; preds = %10
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
switch i32 %24, label %46 [
i32 114, label %25
i32 82, label %25
i32 119, label %28
i32 87, label %28
i32 120, label %31
i32 88, label %31
i32 97, label %34
i32 65, label %34
i32 116, label %37
i32 84, label %37
i32 108, label %40
i32 76, label %40
i32 98, label %43
i32 66, label %43
]
25: ; preds = %18, %18
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 0
store i8 114, i8* %27
br label %47
28: ; preds = %18, %18
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i64 1
store i8 119, i8* %30
br label %47
31: ; preds = %18, %18
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 2
store i8 120, i8* %33
br label %47
34: ; preds = %18, %18
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i64 3
store i8 97, i8* %36
br label %47
37: ; preds = %18, %18
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i64 4
store i8 116, i8* %39
br label %47
40: ; preds = %18, %18
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i64 5
store i8 108, i8* %42
br label %47
43: ; preds = %18, %18
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i64 6
store i8 98, i8* %45
br label %47
46: ; preds = %18
br label %47
47: ; preds = %46, %43, %40, %37, %34, %31, %28, %25
br label %48
48: ; preds = %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %10
51: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @parse_access_type(i8* nocapture %0, i8* %1) {
%3 = tail call i32 @memset(i8* %1, i8 signext 45, i32 7)
%4 = getelementptr inbounds i8, i8* %1, i64 7
store i8 0, i8* %4
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %30, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %1, i64 6
%9 = getelementptr inbounds i8, i8* %1, i64 5
%10 = getelementptr inbounds i8, i8* %1, i64 4
%11 = getelementptr inbounds i8, i8* %1, i64 3
%12 = getelementptr inbounds i8, i8* %1, i64 2
%13 = getelementptr inbounds i8, i8* %1, i64 1
br label %14
14: ; preds = %7, %25
%15 = phi i64 [ 0, %7 ], [ %26, %25 ]
%16 = phi i8 [ %5, %7 ], [ %28, %25 ]
%17 = sext i8 %16 to i32
switch i32 %17, label %25 [
i32 114, label %18
i32 82, label %18
i32 119, label %19
i32 87, label %19
i32 120, label %20
i32 88, label %20
i32 97, label %21
i32 65, label %21
i32 116, label %22
i32 84, label %22
i32 108, label %23
i32 76, label %23
i32 98, label %24
i32 66, label %24
]
18: ; preds = %14, %14
store i8 114, i8* %1
br label %25
19: ; preds = %14, %14
store i8 119, i8* %13
br label %25
20: ; preds = %14, %14
store i8 120, i8* %12
br label %25
21: ; preds = %14, %14
store i8 97, i8* %11
br label %25
22: ; preds = %14, %14
store i8 116, i8* %10
br label %25
23: ; preds = %14, %14
store i8 108, i8* %9
br label %25
24: ; preds = %14, %14
store i8 98, i8* %8
br label %25
25: ; preds = %18, %19, %20, %21, %22, %23, %24, %14
%26 = add nuw i64 %15, 1
%27 = getelementptr inbounds i8, i8* %0, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %14
30: ; preds = %25, %2
ret void
}