#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 amatch(char *, int);
int /*<<< orphan*/ blanks();
int /*<<< orphan*/ declare_local(int, int, int);
int define_struct(char *, int, int);
int find_tag(char *);
int get_type();
int /*<<< orphan*/ illname();
int /*<<< orphan*/ need_semicolon();
scalar_t__ symname(char *);
int do_local_declares(int stclass) {
  int type = 0;
  int otag;
  int sflag;
  char sname[33];
  blanks();
  if ((sflag = amatch("struct", 6)) || amatch("union", 5)) {
    if (symname(sname) == 0) {
      illname();
    }
    if ((otag = find_tag(sname)) == -1) {
      otag = define_struct(sname, stclass, sflag);
    }
    declare_local(2, stclass, otag);
  } else if ((type = get_type()) != -1) {
    declare_local(type, stclass, -1);
  } else if (stclass == 5 || stclass == 6) {
    declare_local((2 << 2), stclass, -1);
  } else {
    return (0);
  }
  need_semicolon();
  return (1);
}


x86 assembly (clang, -O0):
<do_local_declares>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1070 <blanks@plt>
lea    0xe50(%rip),%rdi
mov    $0x6,%esi
call   1080 <amatch@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    11e0 <do_local_declares+0x50>
lea    0xe3a(%rip),%rdi
mov    $0x5,%esi
call   1080 <amatch@plt>
cmp    $0x0,%eax
je     1236 <do_local_declares+0xa6>
lea    -0x40(%rbp),%rdi
call   1060 <symname@plt>
cmp    $0x0,%rax
jne    11fa <do_local_declares+0x6a>
mov    $0x0,%al
call   10b0 <illname@plt>
lea    -0x40(%rbp),%rdi
call   1030 <find_tag@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
jne    1221 <do_local_declares+0x91>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <define_struct@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x2,%edi
call   1090 <declare_local@plt>
jmp    129f <do_local_declares+0x10f>
mov    $0x0,%al
call   10a0 <get_type@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
je     125e <do_local_declares+0xce>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0xffffffff,%edx
call   1090 <declare_local@plt>
jmp    129a <do_local_declares+0x10a>
cmpl   $0x5,-0x8(%rbp)
je     1272 <do_local_declares+0xe2>
cmpl   $0x6,-0x8(%rbp)
jne    1289 <do_local_declares+0xf9>
mov    -0x8(%rbp),%esi
mov    $0x8,%edi
mov    $0xffffffff,%edx
call   1090 <declare_local@plt>
jmp    1295 <do_local_declares+0x105>
movl   $0x0,-0x4(%rbp)
jmp    12ad <do_local_declares+0x11d>
jmp    129a <do_local_declares+0x10a>
jmp    129f <do_local_declares+0x10f>
mov    $0x0,%al
call   1040 <need_semicolon@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_local_declares>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <blanks@plt>
lea    0xe5a(%rip),%rdi
mov    $0x6,%esi
call   1080 <amatch@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11cb <do_local_declares+0x3b>
lea    0xe4a(%rip),%rdi
mov    $0x5,%esi
call   1080 <amatch@plt>
test   %eax,%eax
je     121b <do_local_declares+0x8b>
mov    %rsp,%rdi
call   1060 <symname@plt>
test   %rax,%rax
jne    11df <do_local_declares+0x4f>
xor    %eax,%eax
call   10b0 <illname@plt>
mov    %rsp,%rdi
call   1030 <find_tag@plt>
cmp    $0xffffffff,%eax
jne    11f8 <do_local_declares+0x68>
mov    %rsp,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1050 <define_struct@plt>
mov    $0x2,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1090 <declare_local@plt>
xor    %eax,%eax
call   1040 <need_semicolon@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ebp,%ebp
xor    %eax,%eax
call   10a0 <get_type@plt>
cmp    $0xffffffff,%eax
je     122d <do_local_declares+0x9d>
mov    %eax,%edi
jmp    123a <do_local_declares+0xaa>
lea    -0x5(%rbx),%eax
cmp    $0x1,%eax
ja     1212 <do_local_declares+0x82>
mov    $0x8,%edi
mov    %ebx,%esi
mov    $0xffffffff,%edx
jmp    1201 <do_local_declares+0x71>

LLVM IR (-O0):
@.str = [7 x i8] c"struct\00"
@.str.1 = [6 x i8] c"union\00"
define i32 @do_local_declares(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [33 x i8]
store i32 %0, i32* %3
store i32 0, i32* %4
%8 = call i32 (...) @blanks()
%9 = call i32 @amatch(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
store i32 %9, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %1
%12 = call i32 @amatch(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %11, %1
%15 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%16 = call i64 @symname(i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (...) @illname()
br label %20
20: ; preds = %18, %14
%21 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%22 = call i32 @find_tag(i8* %21)
store i32 %22, i32* %5
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* %3
%27 = load i32, i32* %6
%28 = call i32 @define_struct(i8* %25, i32 %26, i32 %27)
store i32 %28, i32* %5
br label %29
29: ; preds = %24, %20
%30 = load i32, i32* %3
%31 = load i32, i32* %5
%32 = call i32 @declare_local(i32 2, i32 %30, i32 %31)
br label %52
33: ; preds = %11
%34 = call i32 (...) @get_type()
store i32 %34, i32* %4
%35 = icmp ne i32 %34, -1
br i1 %35, label %36, label %40
36: ; preds = %33
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = call i32 @declare_local(i32 %37, i32 %38, i32 -1)
br label %51
40: ; preds = %33
%41 = load i32, i32* %3
%42 = icmp eq i32 %41, 5
br i1 %42, label %46, label %43
43: ; preds = %40
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 6
br i1 %45, label %46, label %49
46: ; preds = %43, %40
%47 = load i32, i32* %3
%48 = call i32 @declare_local(i32 8, i32 %47, i32 -1)
br label %50
49: ; preds = %43
store i32 0, i32* %2
br label %54
50: ; preds = %46
br label %51
51: ; preds = %50, %36
br label %52
52: ; preds = %51, %29
%53 = call i32 (...) @need_semicolon()
store i32 1, i32* %2
br label %54
54: ; preds = %52, %49
%55 = load i32, i32* %2
ret i32 %55
}

LLVM IR (-O2):
@.str = [7 x i8] c"struct\00"
@.str.1 = [6 x i8] c"union\00"
define i32 @do_local_declares(i32 %0) {
%2 = alloca [33 x i8]
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (...) @blanks()
%5 = tail call i32 @amatch(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @amatch(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7, %1
%11 = call i64 @symname(i8* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (...) @illname()
br label %15
15: ; preds = %13, %10
%16 = call i32 @find_tag(i8* %3)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @define_struct(i8* %3, i32 %0, i32 %5)
br label %20
20: ; preds = %18, %15
%21 = phi i32 [ %19, %18 ], [ %16, %15 ]
%22 = call i32 @declare_local(i32 2, i32 %0, i32 %21)
br label %33
23: ; preds = %7
%24 = tail call i32 (...) @get_type()
%25 = icmp eq i32 %24, -1
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @declare_local(i32 %24, i32 %0, i32 -1)
br label %33
28: ; preds = %23
%29 = add i32 %0, -5
%30 = icmp ult i32 %29, 2
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = tail call i32 @declare_local(i32 8, i32 %0, i32 -1)
br label %33
33: ; preds = %26, %31, %20
%34 = call i32 (...) @need_semicolon()
br label %35
35: ; preds = %28, %33
%36 = phi i32 [ 1, %33 ], [ 0, %28 ]
ret i32 %36
}