// File: /workspace/github_cpp_makefile_star2_O2/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 0x3da3c
movq %rax, %rsi
callq 0x3b480
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
movq %r15, %rsi
callq 0x3b724
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x3b58a
pushq $0x3d
popq %rsi
movq %r15, %rdi
callq 0x3b58a
movq (%r15), %rdi
callq 0x3da3c
movq %rax, %rsi
callq 0x3b480
movq %rax, %r14
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x3b6dc
leaq 0x30b51(%rip), %rdi     # 0x6c960
leaq -0x88(%rbp), %rsi
callq 0x3cda8
movl (%rax), %r12d
cmpq $0x7, %r12
ja 0x3c18d
leaq 0x1b6cd(%rip), %rax     # 0x574fc
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq -0x268(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x268(%rbp), %rdi
callq 0x39bd6
movl %eax, %r13d
leaq -0x268(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
je 0x3c1de
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
xorl %esi, %esi
callq 0x415b6
movq %r15, %rdi
callq 0x3b472
jmp 0x3c129
leaq -0x168(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x168(%rbp), %rdi
callq 0x39afb
movl %eax, %r13d
leaq -0x168(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b779(%rip), %rsi     # 0x5763c
leaq -0x148(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x148(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x148(%rbp), %rdi
jmp 0x3c109
leaq -0x1e8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x1e8(%rbp), %rdi
callq 0x39ab4
movl %eax, %r13d
leaq -0x1e8(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b6e1(%rip), %rsi     # 0x5760d
leaq -0x1c8(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x1c8(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x1c8(%rbp), %rdi
jmp 0x3c109
leaq -0x1a8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x1a8(%rbp), %rdi
callq 0x39ad0
movl %eax, %r13d
leaq -0x1a8(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b690(%rip), %rsi     # 0x57625
leaq -0x188(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x188(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x188(%rbp), %rdi
jmp 0x3c109
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
pushq $0x7
popq %rsi
callq 0x415b6
pushq $0x5
jmp 0x3c120
leaq -0x228(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x228(%rbp), %rdi
callq 0x39a98
movl %eax, %r13d
leaq -0x228(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b5e1(%rip), %rsi     # 0x575f6
leaq -0x208(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x208(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x208(%rbp), %rdi
jmp 0x3c109
leaq -0x128(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0x128(%rbp), %rdi
callq 0x39b26
movl %eax, %r13d
leaq -0x128(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b5d5(%rip), %rsi     # 0x57653
leaq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x108(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x108(%rbp), %rdi
jmp 0x3c109
leaq -0xe8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x35470
leaq -0xe8(%rbp), %rdi
callq 0x39b4d
movl %eax, %r13d
leaq -0xe8(%rbp), %rdi
callq 0x35180
testb %r13b, %r13b
jne 0x3c10e
leaq 0x1b58b(%rip), %rsi     # 0x5766b
leaq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0xc8(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0xc8(%rbp), %rdi
callq 0x35180
movq 0x8(%r15), %rax
movq 0x50(%rax), %rdi
movl %r12d, %esi
callq 0x415b6
pushq $0x6
popq %rsi
movq %r15, %rdi
callq 0x3b58a
pushq $0x58
popq %rdi
callq 0x35330
movq %rax, %r15
movq %rax, %rdi
movl %r12d, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x3f210
pushq $0x20
popq %rdi
callq 0x35330
movq %rax, %r14
movq %rax, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x3f2d2
leaq -0x68(%rbp), %rdi
callq 0x35180
leaq -0x88(%rbp), %rdi
callq 0x35180
movq %r14, %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b4ef(%rip), %rsi     # 0x57683
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x3aa1e
leaq 0x1c867(%rip), %rdx     # 0x58a12
leaq -0xa8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x38f1f
leaq -0xa8(%rbp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x3b4e8
leaq -0xa8(%rbp), %rdi
callq 0x35180
leaq -0x48(%rbp), %rdi
jmp 0x3c20e
leaq 0x1b3f2(%rip), %rsi     # 0x575d7
leaq -0x248(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x35130
leaq -0x248(%rbp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x3b4e8
leaq -0x248(%rbp), %rdi
callq 0x35180
jmp 0x3c129
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x208(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x1c8(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
jmp 0x3c310
jmp 0x3c33b
jmp 0x3c33b
jmp 0x3c33b
jmp 0x3c33b
jmp 0x3c33b
jmp 0x3c33b
jmp 0x3c33b
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
callq 0x35180
jmp 0x3c2b8
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x1a8(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
jmp 0x3c310
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
callq 0x35180
jmp 0x3c33e
jmp 0x3c33b
movq %rax, %rbx
movq %r14, %rdi
jmp 0x3c329
jmp 0x3c33b
movq %rax, %rbx
movq %r15, %rdi
callq 0x35310
jmp 0x3c33e
jmp 0x3c33b
jmp 0x3c336
jmp 0x3c336
movq %rax, %rbx
jmp 0x3c347
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
callq 0x35180
leaq -0x88(%rbp), %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x355f0
nop