// File: /workspace/github_cpp_makefile_star2_O1/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 0x30392
movq %rax, %rsi
callq 0x2d484
movq %rax, %r13
movq 0x8(%r14), %rax
movq 0x50(%rax), %r15
leaq -0x178(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %r12
movq %r12, %rdi
callq 0x2a264
movq %r15, %rdi
movq %r12, %rsi
callq 0x33ec6
movq %rax, %r12
movq -0x188(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2ef06
callq 0x25320
leaq 0x8(%r13), %r15
testq %r12, %r12
jne 0x2efb9
leaq 0x217ca(%rip), %rsi     # 0x506e4
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq %r15, %rdx
callq 0x2c6b4
leaq 0x21779(%rip), %rsi     # 0x506a9
movq %r12, %rdi
callq 0x25650
leaq -0x138(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ef66
movq %rdx, -0x148(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x138(%rbp)
jmp 0x2ef6e
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x148(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
xorl %edx, %edx
callq 0x2d4fe
movq -0x148(%rbp), %rdi
cmpq %r12, %rdi
je 0x2efa7
callq 0x25320
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2efb9
callq 0x25320
movq %r14, %rdi
movl $0x4, %esi
callq 0x2d618
leaq 0x10(%r14), %rbx
movq %rbx, %rsi
callq 0x2d484
movq %rax, -0x80(%rbp)
movq %r14, %rdi
movl $0x3d, %esi
callq 0x2d618
movq %r14, %rdi
movl $0x4, %esi
callq 0x2d618
movq %rbx, -0x88(%rbp)
movq %rbx, %rsi
callq 0x2d484
leaq 0x8(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq 0x10(%r13), %rdx
movq %rax, -0x30(%rbp)
cmpq 0x10(%rax), %rdx
jne 0x2f035
testq %rdx, %rdx
je 0x2f1a5
movq -0x58(%rbp), %rax
movq (%rax), %rsi
movq (%r15), %rdi
callq 0x25360
testl %eax, %eax
je 0x2f1a5
leaq 0x216b9(%rip), %rsi     # 0x506f5
leaq -0x108(%rbp), %r12
movq %r12, %rdi
movq %r15, %rdx
callq 0x2c6b4
leaq 0x216ac(%rip), %rsi     # 0x50701
movq %r12, %rdi
callq 0x25650
leaq -0x68(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f081
movq %rdx, -0x78(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x68(%rbp)
jmp 0x2f088
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x78(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x250f0
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f0d9
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2f0e1
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x2291f(%rip), %rsi     # 0x51a22
callq 0x25650
leaq -0x118(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f135
movq %rdx, -0x128(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x118(%rbp)
jmp 0x2f13b
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0x128(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
xorl %edx, %edx
callq 0x2d4fe
movq -0x128(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f174
callq 0x25320
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2f182
callq 0x25320
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f190
callq 0x25320
leaq -0xf8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f1a5
callq 0x25320
movq 0x8(%r14), %rax
movq 0x50(%rax), %r15
leaq -0x158(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %r12
movq %r12, %rdi
callq 0x2a264
movq %r15, %rdi
movq %r12, %rsi
callq 0x33ec6
movq %rax, %r15
movq -0x168(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f1f5
callq 0x25320
testq %r15, %r15
jne 0x2f2a2
leaq 0x214df(%rip), %rsi     # 0x506e4
leaq -0x50(%rbp), %r12
movq %r12, %rdi
movq -0x58(%rbp), %rdx
callq 0x2c6b4
leaq 0x2148d(%rip), %rsi     # 0x506a9
movq %r12, %rdi
callq 0x25650
leaq -0xd8(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f251
movq %rdx, -0xe8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xd8(%rbp)
jmp 0x2f257
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0xe8(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
xorl %edx, %edx
callq 0x2d4fe
movq -0xe8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f290
callq 0x25320
leaq -0x40(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f2a2
callq 0x25320
movq %r14, %rdi
movl $0x2e, %esi
callq 0x2d618
movq %r14, %rdi
movl $0x4, %esi
callq 0x2d618
movq 0x8(%r14), %rax
movq 0x50(%rax), %r12
leaq -0xb8(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x18(%r14), %rsi
movq 0x20(%r14), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rbx
movq %rbx, %rdi
callq 0x2a264
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x33f4a
movl %eax, %r15d
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x2f312
callq 0x25320
testb %r15b, %r15b
jne 0x2f48c
leaq 0x18(%r14), %rdx
leaq 0x213ef(%rip), %rsi     # 0x50715
leaq -0x108(%rbp), %rbx
movq %rbx, %rdi
callq 0x2c6b4
leaq 0x213ee(%rip), %rsi     # 0x5072a
movq %rbx, %rdi
callq 0x25650
leaq -0x68(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f368
movq %rdx, -0x78(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x68(%rbp)
jmp 0x2f36f
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
leaq -0x78(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x250f0
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f3c0
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x2f3c8
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x22638(%rip), %rsi     # 0x51a22
callq 0x25650
leaq -0x98(%rbp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2f41c
movq %rdx, -0xa8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x98(%rbp)
jmp 0x2f422
movups (%rcx), %xmm0
movups %xmm0, (%rbx)
movq 0x8(%rax), %rdx
leaq -0xa8(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r14, %rdi
xorl %edx, %edx
callq 0x2d4fe
movq -0xa8(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f45b
callq 0x25320
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2f469
callq 0x25320
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f477
callq 0x25320
leaq -0xf8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2f48c
callq 0x25320
movq -0x88(%rbp), %rsi
callq 0x2d484
movq %rax, %rbx
movl $0x10, %edi
callq 0x25340
movq %rax, %r15
movq %rax, %rdi
movq -0x30(%rbp), %rsi
movq %rbx, %rdx
callq 0x31c44
movl $0x58, %edi
callq 0x25340
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x31be0
movl $0x20, %edi
callq 0x25340
movq %rax, %r15
movq %rax, %rdi
movl $0x9, %esi
movq -0x80(%rbp), %rdx
movq %r13, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0x31c88
movq %r15, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r13
movq -0xe8(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x2f52f
jmp 0x2f539
jmp 0x2f536
movq %rax, %r13
movq -0x148(%rbp), %rdi
cmpq %r12, %rdi
je 0x2f539
callq 0x25320
jmp 0x2f539
movq %rax, %r13
leaq -0x40(%rbp), %rax
jmp 0x2f597
movq %rax, %r13
movq -0xa8(%rbp), %rdi
jmp 0x2f55b
jmp 0x2f567
jmp 0x2f57a
jmp 0x2f58d
movq %rax, %r13
movq -0x128(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f56a
callq 0x25320
jmp 0x2f56a
movq %rax, %r13
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x2f57d
callq 0x25320
jmp 0x2f57d
movq %rax, %r13
movq -0x78(%rbp), %rdi
cmpq %r15, %rdi
je 0x2f590
callq 0x25320
jmp 0x2f590
movq %rax, %r13
leaq -0xf8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2f5e2
jmp 0x2f5e7
jmp 0x2f5ac
movq %rax, %r13
movq %r14, %rdi
jmp 0x2f5e2
movq %rax, %r13
movq %r15, %rdi
jmp 0x2f5e2
movq %rax, %r13
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
jmp 0x2f59b
movq %rax, %r13
movq -0x168(%rbp), %rdi
jmp 0x2f5dd
movq %rax, %r13
movq -0x188(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2f5e7
callq 0x25320
movq %r13, %rdi
callq 0x255f0
nop