// File: /workspace/github_cpp_makefile_star2_O2/CoinXu[P]reviser-compiler/src/parser.cpp
// Function: reviser::compiler::Parser::ConsumeEnum(reviser::ast::Struct*)
Enum* Parser::ConsumeEnum(Struct* parent) {
    Expect(TOKEN_ENUM);
    Expect(TOKEN_ID);

    if (generator->descriptor->FindCurrentContextVariableById(token.text)
      || (parent && generator->descriptor->StructIncludeProperty(parent, token.text))) {
      RuntimeError("duplicate declare named [" + token.text + "]");
    }

    Token* id = CloneToken(token);
    Enum* e = new Enum(id);
    generator->descriptor->PushContextVariable(e);

    Expect(TOKEN_LEFT_BRACE);

    // no property enum
    if (Accept(TOKEN_RIGHT_BRACE)) {
      return e;
    }

    do {
      EnumProperty* property = ConsumeEnumProperty();
      if (generator->descriptor->EnumInlcudeProperty(e, property->id->text)) {
        RuntimeError("duplicate declare enum property named [" + property->id->text + "]");
        break;
      }
      e->properties.push_back(property);
    } while (Accept(TOKEN_COMMA));

    Expect(TOKEN_RIGHT_BRACE);
    return e;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %r15
movq %rdi, %rbx
pushq $0x3
popq %rsi
callq 0x3b58a
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x3b58a
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r12
leaq 0x18(%rbx), %r14
leaq -0x70(%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x35470
movq %r12, %rdi
movq %r13, %rsi
callq 0x41216
testq %rax, %rax
je 0x3b32f
leaq -0x70(%rbp), %rdi
callq 0x35180
leaq 0x1c31f(%rip), %rsi     # 0x57543
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %r14, %rdx
callq 0x3aa1e
leaq 0x1d7d8(%rip), %rdx     # 0x58a12
leaq -0xb0(%rbp), %rdi
movq %r15, %rsi
callq 0x38f1f
leaq -0xb0(%rbp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0xb0(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
leaq 0x10(%rbx), %rsi
callq 0x3b480
movq %rax, %r15
pushq $0x50
popq %rdi
callq 0x35330
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x3f402
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
movq %r14, %rsi
callq 0x4104e
pushq $0x7b
popq %rsi
movq %rbx, %rdi
callq 0x3b58a
pushq $0x7d
popq %rsi
movq %rbx, %rdi
callq 0x3ada2
testb %al, %al
jne 0x3b3ed
movq %r14, %r15
addq $0x38, %r15
leaq -0xf0(%rbp), %r12
movq %rbx, %rdi
callq 0x3cbce
movq %rax, -0x30(%rbp)
movq 0x8(%rbx), %rcx
movq 0x50(%rcx), %r13
movq 0x30(%rax), %rsi
addq $0x8, %rsi
movq %r12, %rdi
callq 0x35470
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x4138e
movl %eax, %r13d
movq %r12, %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3b387
movq %r15, %rdi
leaq -0x30(%rbp), %rsi
callq 0x3ce04
movq %rbx, %rdi
pushq $0x2c
popq %rsi
callq 0x3ada2
testb %al, %al
jne 0x3b2cd
jmp 0x3b3e2
testq %r15, %r15
je 0x3b402
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r12
leaq -0xd0(%rbp), %rdi
movq %r14, %rsi
callq 0x35470
leaq -0xd0(%rbp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x41440
movl %eax, %r15d
leaq -0xd0(%rbp), %rdi
callq 0x35180
leaq -0x70(%rbp), %rdi
callq 0x35180
testb %r15b, %r15b
jne 0x3b21d
jmp 0x3b26f
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq 0x1c3be(%rip), %rsi     # 0x57758
leaq -0x50(%rbp), %r15
movq %r15, %rdi
callq 0x3aa1e
leaq 0x1d665(%rip), %rdx     # 0x58a12
leaq -0x90(%rbp), %rdi
movq %r15, %rsi
callq 0x38f1f
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0x90(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
pushq $0x7d
popq %rsi
movq %rbx, %rdi
callq 0x3b58a
movq %r14, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x70(%rbp), %rdi
jmp 0x3b26a
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x35180
jmp 0x3b454
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
jmp 0x3b434
jmp 0x3b43b
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x35180
jmp 0x3b43e
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x3b464
movq %rax, %rbx
movq %r14, %rdi
callq 0x35310
jmp 0x3b469
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
jmp 0x3b464
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x355f0
nop