#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 */
unsigned int attrib(struct compile_state *, unsigned int);
int /*<<< orphan*/ eat(struct compile_state *, int);
int peek(struct compile_state *);
unsigned int attribute_list(struct compile_state *state, unsigned type) {
  type = attrib(state, type);
  while (peek(state) == 5) {
    eat(state, 5);
    type = attrib(state, type);
  }
  return type;
}


x86 assembly (clang, -O0):
<attribute_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <attrib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <peek@plt>
cmp    $0x5,%eax
jne    1182 <attribute_list+0x52>
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
call   1040 <eat@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <attrib@plt>
mov    %eax,-0xc(%rbp)
jmp    114e <attribute_list+0x1e>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<attribute_list>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
call   1050 <attrib@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <peek@plt>
cmp    $0x5,%eax
jne    1168 <attribute_list+0x38>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <eat@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
jmp    1140 <attribute_list+0x10>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
define i32 @attribute_list(%struct.compile_state* %0, i32 %1) {
%3 = alloca %struct.compile_state*
%4 = alloca i32
store %struct.compile_state* %0, %struct.compile_state** %3
store i32 %1, i32* %4
%5 = load %struct.compile_state*, %struct.compile_state** %3
%6 = load i32, i32* %4
%7 = call i32 @attrib(%struct.compile_state* %5, i32 %6)
store i32 %7, i32* %4
br label %8
8: ; preds = %12, %2
%9 = load %struct.compile_state*, %struct.compile_state** %3
%10 = call i32 @peek(%struct.compile_state* %9)
%11 = icmp eq i32 %10, 5
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load %struct.compile_state*, %struct.compile_state** %3
%14 = call i32 @eat(%struct.compile_state* %13, i32 5)
%15 = load %struct.compile_state*, %struct.compile_state** %3
%16 = load i32, i32* %4
%17 = call i32 @attrib(%struct.compile_state* %15, i32 %16)
store i32 %17, i32* %4
br label %8
18: ; preds = %8
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
define i32 @attribute_list(%struct.compile_state* %0, i32 %1) {
%3 = tail call i32 @attrib(%struct.compile_state* %0, i32 %1)
%4 = tail call i32 @peek(%struct.compile_state* %0)
%5 = icmp eq i32 %4, 5
br i1 %5, label %6, label %12
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %3, %2 ]
%8 = tail call i32 @eat(%struct.compile_state* %0, i32 5)
%9 = tail call i32 @attrib(%struct.compile_state* %0, i32 %7)
%10 = tail call i32 @peek(%struct.compile_state* %0)
%11 = icmp eq i32 %10, 5
br i1 %11, label %6, label %12
12: ; preds = %6, %2
%13 = phi i32 [ %3, %2 ], [ %9, %6 ]
ret i32 %13
}