// File: /workspace/github_cpp_makefile_star2_O2/CoinXu[P]reviser-compiler/src/parser.cpp
// Function: reviser::compiler::Parser::ConsumeEnumDeclare()
Declare* Parser::ConsumeEnumDeclare() {
    Token* eid = CloneToken(tokenizer->Previous());

    // enum type id
    if (!generator->descriptor->FindEnumContextVariableById(eid->text)) {
      RuntimeError("undefined enum [" + eid->text + "] in current scope");
    }

    Expect(TOKEN_ID);
    Token* id = CloneToken(token);
    Expect(TOKEN_ASSIGN);
    Expect(TOKEN_ID);
    Token* ei = CloneToken(token);

    // value must match type
    if (eid->text != ei->text) {
      RuntimeError("enum type [" + eid->text + "] not match value [" + ei->text + "]");
    }

    // enum variable id
    Enum* def = generator->descriptor->FindEnumContextVariableById(ei->text);
    if (!def) {
      RuntimeError("undefined enum [" + ei->text + "] in current scope");
    }

    Expect(TOKEN_CONNECTION);
    Expect(TOKEN_ID);
    if (!generator->descriptor->EnumInlcudeProperty(def, token.text)) {
      RuntimeError("undefined property [" + token.text + "] in enum [" + ei->text + "]");
    }

    Token* ep = CloneToken(token);
    EnumValue* ev = new EnumValue(ei, ep);
    RightValue* rv = new RightValue(ev);
    Declare* declare = new Declare(TYPE_ENUM, id, eid, rv);
    return declare;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x3da46
movq %rax, %rsi
callq 0x3b480
movq %rax, %r13
movq 0x8(%r14), %rax
movq 0x50(%rax), %r15
leaq 0x8(%r13), %rbx
leaq -0x190(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x35470
movq %r15, %rdi
movq %r12, %rsi
callq 0x4132c
movq %rax, %r15
leaq -0x190(%rbp), %rdi
callq 0x35180
testq %r15, %r15
jne 0x3c819
leaq 0x1af16(%rip), %rsi     # 0x576e4
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rdx
callq 0x3aa1e
leaq 0x1aec5(%rip), %rdx     # 0x576a9
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
callq 0x38f1f
leaq -0x130(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0x130(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
movq %r13, -0x70(%rbp)
pushq $0x4
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x3b58a
leaq 0x10(%r14), %r12
movq %r12, %rsi
callq 0x3b480
movq %rax, -0x60(%rbp)
pushq $0x3d
popq %rsi
movq %r14, %rdi
callq 0x3b58a
movq %r14, %rdi
movl %r15d, %esi
callq 0x3b58a
movq %r12, %rsi
callq 0x3b480
movq %rax, %r15
leaq 0x8(%rax), %rsi
movq %rbx, %rdi
movq %rsi, -0x30(%rbp)
callq 0x3cdf7
testb %al, %al
je 0x3c90d
leaq 0x1ae79(%rip), %rsi     # 0x576f5
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rdx
callq 0x3aa1e
leaq 0x1ae6c(%rip), %rdx     # 0x57701
leaq -0x90(%rbp), %rdi
movq %r13, %rsi
callq 0x38f1f
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x38ef6
leaq 0x1c153(%rip), %rdx     # 0x58a12
leaq -0x110(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x38f1f
leaq -0x110(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0x110(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
leaq -0x90(%rbp), %rdi
callq 0x35180
leaq -0xb0(%rbp), %rdi
callq 0x35180
movq 0x8(%r14), %rax
movq 0x50(%rax), %rbx
leaq -0x170(%rbp), %r13
movq %r13, %rdi
movq -0x30(%rbp), %rsi
callq 0x35470
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4132c
movq %rax, %rbx
movq %r12, -0x68(%rbp)
leaq -0x170(%rbp), %rdi
callq 0x35180
testq %rbx, %rbx
jne 0x3c99e
leaq 0x1ad92(%rip), %rsi     # 0x576e4
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movq -0x30(%rbp), %rdx
callq 0x3aa1e
leaq 0x1ad40(%rip), %rdx     # 0x576a9
leaq -0xf0(%rbp), %rdi
movq %r13, %rsi
callq 0x38f1f
leaq -0xf0(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0xf0(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
movq %r15, -0x58(%rbp)
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x3b58a
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x3b58a
movq 0x8(%r14), %rax
movq 0x50(%rax), %r12
leaq 0x18(%r14), %r13
leaq -0x150(%rbp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x35470
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x4138e
movl %eax, %ebx
leaq -0x150(%rbp), %rdi
callq 0x35180
testb %bl, %bl
movq -0x68(%rbp), %r15
jne 0x3ca96
leaq 0x1ad10(%rip), %rsi     # 0x57715
leaq -0xb0(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x3aa1e
leaq 0x1ad0c(%rip), %rdx     # 0x5772a
leaq -0x90(%rbp), %rdi
movq %rbx, %rsi
callq 0x38f1f
leaq -0x50(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x38ef6
leaq 0x1bfca(%rip), %rdx     # 0x58a12
leaq -0xd0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x38f1f
leaq -0xd0(%rbp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0xd0(%rbp), %rdi
callq 0x35180
leaq -0x50(%rbp), %rdi
callq 0x35180
leaq -0x90(%rbp), %rdi
callq 0x35180
leaq -0xb0(%rbp), %rdi
callq 0x35180
movq %r15, %rsi
callq 0x3b480
movq %rax, %rbx
pushq $0x10
popq %rdi
callq 0x35330
movq %rax, %r15
movq %rax, %rdi
movq -0x58(%rbp), %rsi
movq %rbx, %rdx
callq 0x3f2aa
pushq $0x58
popq %rdi
callq 0x35330
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3f250
movq -0x70(%rbp), %rbx
pushq $0x20
popq %rdi
callq 0x35330
movq %rax, %r15
pushq $0x9
popq %rsi
movq %rax, %rdi
movq -0x60(%rbp), %rdx
movq %rbx, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x3f2ec
movq %r15, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
jmp 0x3cb27
jmp 0x3cb2e
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x35180
jmp 0x3cb31
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
jmp 0x3cbc1
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
jmp 0x3cb56
jmp 0x3cb5d
jmp 0x3cb6b
jmp 0x3cb7c
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
callq 0x35180
jmp 0x3cb60
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x35180
jmp 0x3cb6e
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x35180
jmp 0x3cb7f
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
jmp 0x3cbc1
jmp 0x3cb92
movq %rax, %rbx
movq %r14, %rdi
jmp 0x3cb98
movq %rax, %rbx
movq %r15, %rdi
callq 0x35310
jmp 0x3cbc6
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
jmp 0x3cbc1
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
jmp 0x3cbc1
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x355f0