// File: /workspace/github_cpp_makefile_star2_O3/CoinXu[P]reviser-compiler/src/parser.cpp
// Function: reviser::compiler::Parser::ConsumeDataTypeDeclare()
Declare* Parser::ConsumeDataTypeDeclare() {
    Token* id = CloneToken(tokenizer->Current());
    string type = PreviousText();

    Expect(TOKEN_ID);

    // TODO
    // value optional support
    Expect(TOKEN_ASSIGN);

    Token* dvt = CloneToken(tokenizer->Current());
    string value = CurrentText();
    DataType data_type = DataTypeValue.at(type);

    switch (data_type) {
      case TYPE_BOOL:
        if (!helper::bool_is_bool(value)) {
          RuntimeError("expect bool value but received", dvt);
        } else {
          generator->descriptor->AddDataTypesOnce(TYPE_BOOL);
          Next();
        }
        break;

      case TYPE_FLOAT:
        if (!helper::numeric_is_float(value)) {
          RuntimeError("exceeds range of float", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_FLOAT);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_DOUBLE:
        if (!helper::numeric_is_double(value)) {
          RuntimeError("exceeds range of double", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_DOUBLE);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_INT32:
        if (!helper::numeric_is_int32(value)) {
          RuntimeError("exceeds range of int32", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_INT32);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_INT64:
        if (!helper::numeric_is_int64(value)) {
          RuntimeError("exceeds range of int64", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_INT64);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_UINT32:
        if (!helper::numeric_is_uint32(value)) {
          RuntimeError("exceeds range of uint32", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_UINT32);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_UINT64:
        if (!helper::numeric_is_uint64(value)) {
          RuntimeError("exceeds range of uint64", dvt);
        }
        generator->descriptor->AddDataTypesOnce(TYPE_UINT64);
        Expect(TOKEN_DIGIT);
        break;

      case TYPE_STRING:
        generator->descriptor->AddDataTypesOnce(TYPE_STRING);
        Expect(TOKEN_LETTER);
        break;

      default:
        RuntimeError("unknow data type [" + type + "]");
        break;
    }

    RightValue* rv = new RightValue(data_type, dvt);
    Declare* declare = new Declare(data_type, id, rv);
    return declare;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rdi, %r15
movq (%rdi), %rdi
callq 0x2f194
movq %rax, %rsi
callq 0x2c258
movq %rax, -0x50(%rbp)
movq (%r15), %rdi
callq 0x2f19e
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x290da
movq %r15, %rdi
movl $0x4, %esi
callq 0x2c3ec
movq %r15, %rdi
movl $0x3d, %esi
callq 0x2c3ec
movq (%r15), %rdi
callq 0x2f194
movq %rax, %rsi
callq 0x2c258
movq %rax, %r14
movq (%r15), %rdi
callq 0x2f194
leaq -0x38(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x290da
leaq 0x338c7(%rip), %rdi     # 0x60950
leaq -0x70(%rbp), %rsi
callq 0x2e53a
movl (%rax), %r12d
cmpq $0x7, %r12
ja 0x2d537
leaq 0x22456(%rip), %rax     # 0x4f4fc
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq -0x240(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x250(%rbp), %rdi
callq 0x290da
leaq -0x250(%rbp), %rdi
callq 0x29fa0
movl %eax, %ebx
movq -0x250(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d0f0
callq 0x24320
testb %bl, %bl
je 0x2d588
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
xorl %esi, %esi
callq 0x32fbc
movq (%r15), %rdi
callq 0x2f6ac
jmp 0x2d4bf
leaq -0x140(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x150(%rbp), %rdi
callq 0x290da
leaq -0x150(%rbp), %rdi
callq 0x29d3a
movl %eax, %ebx
movq -0x150(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d155
callq 0x24320
movl $0x4, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0x120(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x224c7(%rip), %rsi     # 0x4f63c
leaq 0x224d6(%rip), %rdx     # 0x4f652
leaq -0x130(%rbp), %rdi
callq 0x29178
leaq -0x130(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0x130(%rbp), %rdi
jmp 0x2d493
leaq -0x1c0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x1d0(%rbp), %rdi
callq 0x290da
leaq -0x1d0(%rbp), %rdi
callq 0x29c11
movl %eax, %ebx
movq -0x1d0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d1e7
callq 0x24320
movl $0x2, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0x1a0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x22406(%rip), %rsi     # 0x4f60d
leaq 0x22416(%rip), %rdx     # 0x4f624
leaq -0x1b0(%rbp), %rdi
callq 0x29178
leaq -0x1b0(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0x1b0(%rbp), %rdi
jmp 0x2d493
leaq -0x180(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x190(%rbp), %rdi
callq 0x290da
leaq -0x190(%rbp), %rdi
callq 0x29c9e
movl %eax, %ebx
movq -0x190(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d279
callq 0x24320
movl $0x3, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0x160(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x2238c(%rip), %rsi     # 0x4f625
leaq 0x2239b(%rip), %rdx     # 0x4f63b
leaq -0x170(%rbp), %rdi
callq 0x29178
leaq -0x170(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0x170(%rbp), %rdi
jmp 0x2d493
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
movl $0x5, %ebx
movl $0x7, %esi
callq 0x32fbc
jmp 0x2d4b5
leaq -0x200(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x210(%rbp), %rdi
callq 0x290da
leaq -0x210(%rbp), %rdi
callq 0x29b84
movl %eax, %ebx
movq -0x210(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d327
callq 0x24320
movl $0x1, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0x1e0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x222af(%rip), %rsi     # 0x4f5f6
leaq 0x222be(%rip), %rdx     # 0x4f60c
leaq -0x1f0(%rbp), %rdi
callq 0x29178
leaq -0x1f0(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0x1f0(%rbp), %rdi
jmp 0x2d493
leaq -0x100(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x290da
leaq -0x110(%rbp), %rdi
callq 0x29dd6
movl %eax, %ebx
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d3b9
callq 0x24320
movl $0x5, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0xe0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x2227a(%rip), %rsi     # 0x4f653
leaq 0x2228a(%rip), %rdx     # 0x4f66a
leaq -0xf0(%rbp), %rdi
callq 0x29178
leaq -0xf0(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0xf0(%rbp), %rdi
jmp 0x2d493
leaq -0xc0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x290da
leaq -0xd0(%rbp), %rdi
callq 0x29e6e
movl %eax, %ebx
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d44b
callq 0x24320
movl $0x6, %r13d
testb %bl, %bl
jne 0x2d4a0
leaq -0xa0(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x22204(%rip), %rsi     # 0x4f66b
leaq 0x22214(%rip), %rdx     # 0x4f682
leaq -0xb0(%rbp), %rdi
callq 0x29178
leaq -0xb0(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0xb0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x2d4a0
callq 0x24320
movl %r12d, %r13d
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
movl $0x6, %ebx
movl %r13d, %esi
callq 0x32fbc
movq %r15, %rdi
movl %ebx, %esi
callq 0x2c3ec
movl $0x58, %edi
callq 0x24340
movq %rax, %r15
movq %rax, %rdi
movl %r12d, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x309a0
movl $0x20, %edi
callq 0x24340
movq %rax, %r14
movq %rax, %rdi
movl %r12d, %esi
movq -0x50(%rbp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x30a6c
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d510
callq 0x24320
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2d522
callq 0x24320
movq %r14, %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22145(%rip), %rsi     # 0x4f683
leaq -0x270(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x2b4b3
leaq 0x234cd(%rip), %rsi     # 0x50a22
leaq -0x270(%rbp), %rdi
callq 0x24650
leaq -0x80(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2d5d0
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x2d5d8
leaq -0x220(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x2203d(%rip), %rsi     # 0x4f5d7
leaq 0x22054(%rip), %rdx     # 0x4f5f5
leaq -0x230(%rbp), %rdi
callq 0x29178
leaq -0x230(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x2c2d2
movq -0x230(%rbp), %rdi
cmpq %r13, %rdi
jne 0x2d625
jmp 0x2d4bf
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
xorl %edx, %edx
callq 0x2c2d2
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d611
callq 0x24320
leaq -0x260(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d4bf
callq 0x24320
jmp 0x2d4bf
movq %rax, %r12
movq -0xb0(%rbp), %rdi
jmp 0x2d684
movq %rax, %r12
movq -0x230(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0xf0(%rbp), %rdi
jmp 0x2d684
movq %rax, %r12
movq -0x1f0(%rbp), %rdi
jmp 0x2d684
movq %rax, %r12
movq -0x170(%rbp), %rdi
jmp 0x2d684
movq %rax, %r12
movq -0x1b0(%rbp), %rdi
jmp 0x2d684
movq %rax, %r12
movq -0x130(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x2d74e
jmp 0x2d763
jmp 0x2d760
jmp 0x2d760
jmp 0x2d760
jmp 0x2d760
jmp 0x2d760
jmp 0x2d760
jmp 0x2d760
movq %rax, %r12
movq -0x90(%rbp), %rdi
cmpq %r13, %rdi
je 0x2d6ce
callq 0x24320
jmp 0x2d6ce
movq %rax, %r12
leaq -0x260(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2d74e
jmp 0x2d763
movq %rax, %r12
movq -0xd0(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x110(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x210(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x190(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x250(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x1d0(%rbp), %rdi
jmp 0x2d735
movq %rax, %r12
movq -0x150(%rbp), %rdi
cmpq %r13, %rdi
jne 0x2d74e
jmp 0x2d763
jmp 0x2d760
movq %rax, %r12
movq %r14, %rdi
jmp 0x2d74e
jmp 0x2d760
movq %rax, %r12
movq %r15, %rdi
callq 0x24320
jmp 0x2d763
jmp 0x2d760
jmp 0x2d75b
jmp 0x2d75b
movq %rax, %r12
jmp 0x2d775
movq %rax, %r12
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2d775
callq 0x24320
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x2d787
callq 0x24320
movq %r12, %rdi
callq 0x245f0
nop