// File: /workspace/github_cpp_makefile_star2_O3/CoinXu[P]reviser-compiler/src/parser.cpp
// Function: reviser::compiler::Parser::ConsumeStruct(reviser::ast::Struct*)
Struct* Parser::ConsumeStruct(Struct* parent) {
    Expect(TOKEN_STRUCT);
    Expect(TOKEN_ID);

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

    Struct* s = new Struct(CloneToken(token));

    Expect(TOKEN_LEFT_BRACE);

    generator->descriptor->PushContextVariable(s);
    generator->descriptor->PushNewContext();

    while (!Accept(TOKEN_RIGHT_BRACE)) {
      if (LookAtType(TOKEN_STRUCT)) {
        s->AddStruct(ConsumeStruct(s));
      } else if (LookAtType(TOKEN_ENUM)) {
        s->AddEnum(ConsumeEnum(s));
      } else {
        StructProperty* p = ConsumeStructProperty();
        if (generator->descriptor->StructIncludeProperty(s, p->declare->id->text)) {
          RuntimeError("duplicate declare property named [" + p->declare->id->text + "]");
        }
        if (generator->descriptor->FindCurrentContextVariableById(p->declare->id->text)) {
          RuntimeError("duplicate declare named [" + p->declare->id->text + "]");
        }
        s->AddProperty(p);
      }
    }

    generator->descriptor->PopBackContext();
    return s;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %r14
movq %rdi, %rbx
movl $0x2, %esi
callq 0x2c3ec
movq %rbx, %rdi
movl $0x4, %esi
callq 0x2c3ec
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r15
leaq -0x128(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq -0x138(%rbp), %r12
movq %r12, %rdi
callq 0x290da
movq %r15, %rdi
movq %r12, %rsi
callq 0x32afe
movb $0x1, %r15b
testq %rax, %rax
je 0x2b9ca
movq -0x138(%rbp), %rdi
cmpq %r13, %rdi
je 0x2b96e
callq 0x24320
testb %r15b, %r15b
je 0x2ba7f
leaq 0x18(%rbx), %rdx
leaq 0x23bc1(%rip), %rsi     # 0x4f543
leaq -0x48(%rbp), %r14
movq %r14, %rdi
callq 0x2b4b3
leaq 0x2508d(%rip), %rsi     # 0x50a22
movq %r14, %rdi
callq 0x24650
leaq -0xc8(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ba2d
movq %rdx, -0xd8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xc8(%rbp)
jmp 0x2ba34
testq %r14, %r14
je 0x2bdb4
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r15
leaq -0x108(%rbp), %r12
movq %r12, -0x10(%r12)
movq 0x18(%rbx), %rsi
movq 0x20(%rbx), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x290da
leaq -0x118(%rbp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x32dca
movl %eax, %r15d
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x2b95d
callq 0x24320
jmp 0x2b95d
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0xd8(%rbp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2c2d2
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2ba6d
callq 0x24320
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ba7f
callq 0x24320
leaq 0x10(%rbx), %r15
movl $0xa0, %edi
callq 0x24340
movq %rax, %r14
movq %r15, %rsi
callq 0x2c258
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x30d34
movq %rbx, %rdi
movl $0x7b, %esi
callq 0x2c3ec
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
movq %r14, %rsi
callq 0x32920
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
callq 0x32824
movq %rbx, %rdi
movl $0x7d, %esi
callq 0x2b86e
testb %al, %al
jne 0x2bd92
leaq -0xa8(%rbp), %r13
movq %r14, -0x50(%rbp)
movq %rbx, -0x58(%rbp)
movq (%rbx), %rdi
callq 0x2f194
cmpl $0x2, (%rax)
jne 0x2bb1b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b8ec
movq %r14, %rdi
movq %rax, %rsi
callq 0x30e98
jmp 0x2bd7d
movq (%rbx), %rdi
callq 0x2f194
cmpl $0x3, (%rax)
jne 0x2bb43
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2be64
movq %r14, %rdi
movq %rax, %rsi
callq 0x30f22
jmp 0x2bd7d
movq %rbx, %rdi
callq 0x2c714
movq 0x8(%rbx), %rcx
movq %r14, %r15
movq 0x50(%rcx), %r12
movq %rax, %rbx
movq 0x48(%rax), %rax
movq 0x8(%rax), %rax
movq %r13, -0xb8(%rbp)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %r14
movq %r14, %rdi
callq 0x290da
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x32dca
movl %eax, %r12d
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2bba4
callq 0x24320
testb %r12b, %r12b
leaq -0x88(%rbp), %r12
leaq -0xe8(%rbp), %r13
movq %rbx, %r15
movq -0x58(%rbp), %rbx
je 0x2bc6f
movq 0x48(%r15), %rax
movq 0x8(%rax), %rdx
addq $0x8, %rdx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
leaq 0x23981(%rip), %rsi     # 0x4f55d
callq 0x2b4b3
movq %r14, %rdi
leaq 0x24e37(%rip), %rsi     # 0x50a22
callq 0x24650
movq %r12, -0x98(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2bc19
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x2bc21
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x90(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
leaq -0x98(%rbp), %rsi
xorl %edx, %edx
callq 0x2c2d2
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
je 0x2bc5d
callq 0x24320
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2bc6f
callq 0x24320
movq 0x8(%rbx), %rax
movq 0x50(%rax), %r12
movq 0x48(%r15), %rax
movq 0x8(%rax), %rax
movq %r13, -0xf8(%rbp)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %r14
movq %r14, %rdi
callq 0x290da
movq %r12, %rdi
movq %r14, %rsi
callq 0x32afe
movq %rax, %r12
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x2bcbf
callq 0x24320
testq %r12, %r12
leaq -0x68(%rbp), %r12
je 0x2bd67
movq 0x48(%r15), %rax
movq 0x8(%rax), %rdx
addq $0x8, %rdx
leaq -0x48(%rbp), %r14
movq %r14, %rdi
leaq 0x2385d(%rip), %rsi     # 0x4f543
callq 0x2b4b3
movq %r14, %rdi
leaq 0x24d2d(%rip), %rsi     # 0x50a22
callq 0x24650
movq %r12, -0x78(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2bd1a
movq %rdx, -0x78(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x68(%rbp)
jmp 0x2bd22
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x70(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
leaq -0x78(%rbp), %rsi
xorl %edx, %edx
callq 0x2c2d2
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x2bd55
callq 0x24320
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2bd67
callq 0x24320
movq -0x50(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x30e0e
leaq -0xa8(%rbp), %r13
movq %rbx, %rdi
movl $0x7d, %esi
callq 0x2b86e
testb %al, %al
je 0x2baf3
movq 0x8(%rbx), %rax
movq 0x50(%rax), %rdi
callq 0x3287c
movq %r14, %rax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
jmp 0x2b95d
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x2bdf8
callq 0x24320
jmp 0x2bdf8
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x2bdeb
callq 0x24320
jmp 0x2bdeb
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
jmp 0x2be35
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x2be5d
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x2be1e
jmp 0x2be2a
movq %rax, %rbx
movq %r14, %rdi
jmp 0x2be3a
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x2be2d
callq 0x24320
jmp 0x2be2d
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2be3f
callq 0x24320
movq %rbx, %rdi
callq 0x245f0
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
jmp 0x2be5d
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
jne 0x2be3a
jmp 0x2be3f