#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 */
struct compile_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ eat(struct compile_state *, int);
int peek(struct compile_state *);
unsigned int type_qualifiers(struct compile_state *state) {
  unsigned int specifiers;
  int done;
  done = 0;
  specifiers = 0x0000;
  do {
    switch (peek(state)) {
    case 62:
      eat(state, 62);
      specifiers |= 0x0020;
      break;
    case 90:
      eat(state, 90);
      specifiers |= 0x0040;
      break;
    case 78:
      eat(state, 78);
      specifiers |= 0x0080;
      break;
    default:
      done = 1;
      break;
    }
  } while (!done);
  return specifiers;
}


x86 assembly (clang, -O0):
<type_qualifiers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x3e,%eax
je     1178 <type_qualifiers+0x58>
jmp    1156 <type_qualifiers+0x36>
mov    -0x14(%rbp),%eax
sub    $0x4e,%eax
je     11b0 <type_qualifiers+0x90>
jmp    1167 <type_qualifiers+0x47>
mov    -0x14(%rbp),%eax
sub    $0x5a,%eax
je     1194 <type_qualifiers+0x74>
jmp    11ce <type_qualifiers+0xae>
mov    -0x8(%rbp),%rdi
mov    $0x3e,%esi
call   1040 <eat@plt>
mov    -0xc(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0xc(%rbp)
jmp    11d5 <type_qualifiers+0xb5>
mov    -0x8(%rbp),%rdi
mov    $0x5a,%esi
call   1040 <eat@plt>
mov    -0xc(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0xc(%rbp)
jmp    11d5 <type_qualifiers+0xb5>
mov    -0x8(%rbp),%rdi
mov    $0x4e,%esi
call   1040 <eat@plt>
mov    -0xc(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0xc(%rbp)
jmp    11d5 <type_qualifiers+0xb5>
movl   $0x1,-0x10(%rbp)
jmp    11da <type_qualifiers+0xba>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    113a <type_qualifiers+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_qualifiers>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %r14d,%r14d
jmp    1142 <type_qualifiers+0x22>
nopl   0x0(%rax)
mov    $0x80,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <eat@plt>
or     %ebp,%r14d
mov    %rbx,%rdi
call   1030 <peek@plt>
cmp    $0x3e,%eax
je     1160 <type_qualifiers+0x40>
cmp    $0x4e,%eax
je     1130 <type_qualifiers+0x10>
cmp    $0x5a,%eax
jne    1167 <type_qualifiers+0x47>
mov    $0x40,%ebp
jmp    1135 <type_qualifiers+0x15>
mov    $0x20,%ebp
jmp    1135 <type_qualifiers+0x15>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
define i32 @type_qualifiers(%struct.compile_state* %0) {
%2 = alloca %struct.compile_state*
%3 = alloca i32
%4 = alloca i32
store %struct.compile_state* %0, %struct.compile_state** %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %25, %1
%6 = load %struct.compile_state*, %struct.compile_state** %2
%7 = call i32 @peek(%struct.compile_state* %6)
switch i32 %7, label %23 [
i32 62, label %8
i32 90, label %13
i32 78, label %18
]
8: ; preds = %5
%9 = load %struct.compile_state*, %struct.compile_state** %2
%10 = call i32 @eat(%struct.compile_state* %9, i32 62)
%11 = load i32, i32* %3
%12 = or i32 %11, 32
store i32 %12, i32* %3
br label %24
13: ; preds = %5
%14 = load %struct.compile_state*, %struct.compile_state** %2
%15 = call i32 @eat(%struct.compile_state* %14, i32 90)
%16 = load i32, i32* %3
%17 = or i32 %16, 64
store i32 %17, i32* %3
br label %24
18: ; preds = %5
%19 = load %struct.compile_state*, %struct.compile_state** %2
%20 = call i32 @eat(%struct.compile_state* %19, i32 78)
%21 = load i32, i32* %3
%22 = or i32 %21, 128
store i32 %22, i32* %3
br label %24
23: ; preds = %5
store i32 1, i32* %4
br label %24
24: ; preds = %23, %18, %13, %8
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
br i1 %28, label %5, label %29
29: ; preds = %25
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
define i32 @type_qualifiers(%struct.compile_state* %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i32 [ 0, %1 ], [ %10, %7 ]
%4 = tail call i32 @peek(%struct.compile_state* %0)
switch i32 %4, label %11 [
i32 62, label %7
i32 90, label %5
i32 78, label %6
]
5: ; preds = %2
br label %7
6: ; preds = %2
br label %7
7: ; preds = %2, %5, %6
%8 = phi i32 [ 64, %5 ], [ 128, %6 ], [ 32, %2 ]
%9 = tail call i32 @eat(%struct.compile_state* %0, i32 %4)
%10 = or i32 %3, %8
br label %2
11: ; preds = %2
ret i32 %3
}