// File: 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
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x198(%rbp)
movl $0x2, %esi
callq 0xa83a0
movq -0x198(%rbp), %rdi
movl $0x4, %esi
callq 0xa83a0
movq -0x198(%rbp), %rsi
movq 0x8(%rsi), %rax
movq 0x50(%rax), %rax
movq %rax, -0x190(%rbp)
addq $0x18, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x188(%rbp)
callq 0x991c0
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rsi
movb $0x0, -0x61(%rbp)
callq 0xbcde0
movq %rax, -0x180(%rbp)
jmp 0xa7703
movq -0x180(%rbp), %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x199(%rbp)
jne 0xa7794
xorl %eax, %eax
cmpq $0x0, -0x10(%rbp)
movb %al, -0x19a(%rbp)
je 0xa7788
movq -0x198(%rbp), %rsi
movq 0x8(%rsi), %rax
movq 0x50(%rax), %rax
movq %rax, -0x1b0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1a8(%rbp)
addq $0x18, %rsi
leaq -0x60(%rbp), %rdi
callq 0x991c0
jmp 0xa7757
movq -0x1a8(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
movb $0x1, -0x61(%rbp)
leaq -0x60(%rbp), %rdx
callq 0xbd180
movb %al, -0x1b1(%rbp)
jmp 0xa777a
movb -0x1b1(%rbp), %al
movb %al, -0x19a(%rbp)
jmp 0xa7788
movb -0x19a(%rbp), %al
movb %al, -0x199(%rbp)
movb -0x199(%rbp), %al
movb %al, -0x1b2(%rbp)
testb $0x1, -0x61(%rbp)
jne 0xa77a8
jmp 0xa77b1
leaq -0x60(%rbp), %rdi
callq 0x992c0
leaq -0x30(%rbp), %rdi
callq 0x992c0
movb -0x1b2(%rbp), %al
testb $0x1, %al
jne 0xa77c9
jmp 0xa78af
movq -0x198(%rbp), %rdx
addq $0x18, %rdx
leaq 0x57d18(%rip), %rsi     # 0xff4f3
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0xa6e30
movq -0x1c0(%rbp), %rsi
leaq 0x59286(%rip), %rdx     # 0x100a82
leaq -0x88(%rbp), %rdi
callq 0xa10c0
jmp 0xa780a
movq -0x198(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x88(%rbp), %rsi
callq 0xa82a0
jmp 0xa7823
leaq -0x88(%rbp), %rdi
callq 0x992c0
leaq -0xa8(%rbp), %rdi
callq 0x992c0
jmp 0xa78af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa786a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
testb $0x1, -0x61(%rbp)
jne 0xa785f
jmp 0xa7868
leaq -0x60(%rbp), %rdi
callq 0x992c0
jmp 0xa786a
leaq -0x30(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa789e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x992c0
leaq -0xa8(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movl $0xa0, %edi
callq 0x99480
movq -0x198(%rbp), %rdi
movq %rax, -0x1d0(%rbp)
movq %rdi, %rsi
addq $0x10, %rsi
callq 0xa81f0
movq %rax, -0x1c8(%rbp)
jmp 0xa78dc
movq -0x1c8(%rbp), %rsi
movq -0x1d0(%rbp), %rdi
xorl %edx, %edx
callq 0xb41f0
jmp 0xa78f3
movq -0x198(%rbp), %rdi
movq -0x1d0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl $0x7b, %esi
callq 0xa83a0
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
movq -0xb0(%rbp), %rsi
callq 0xbcbe0
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
callq 0xbca80
movq -0x198(%rbp), %rdi
movl $0x7d, %esi
callq 0xa75f0
xorb $-0x1, %al
testb $0x1, %al
jne 0xa795d
jmp 0xa7cd8
movq -0x198(%rbp), %rdi
movl $0x2, %esi
callq 0xa7650
testb $0x1, %al
jne 0xa7974
jmp 0xa79c6
movq -0x198(%rbp), %rdi
movq -0xb0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0xb0(%rbp), %rsi
callq 0xa7680
movq -0x1d8(%rbp), %rdi
movq %rax, %rsi
callq 0xb4380
jmp 0xa7cd3
movq -0x1d0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
callq 0x99440
jmp 0xa7cfc
movq -0x198(%rbp), %rdi
movl $0x3, %esi
callq 0xa7650
testb $0x1, %al
jne 0xa79dd
jmp 0xa7a12
movq -0x198(%rbp), %rdi
movq -0xb0(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0xb0(%rbp), %rsi
callq 0xa7d10
movq -0x1e0(%rbp), %rdi
movq %rax, %rsi
callq 0xb43e0
jmp 0xa7cd1
movq -0x198(%rbp), %rdi
callq 0xa8660
movq %rax, %rcx
movq -0x198(%rbp), %rax
movq %rcx, -0xb8(%rbp)
movq 0x8(%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x200(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0xb8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0x991c0
movq -0x200(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
movq -0x1f0(%rbp), %rdx
callq 0xbd180
movb %al, -0x1e1(%rbp)
jmp 0xa7a94
leaq -0xd8(%rbp), %rdi
callq 0x992c0
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0xa7aaf
jmp 0xa7b7f
movq -0xb8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
addq $0x8, %rdx
leaq 0x57a44(%rip), %rsi     # 0xff50d
leaq -0x118(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0xa6e30
movq -0x208(%rbp), %rsi
leaq 0x58f98(%rip), %rdx     # 0x100a82
leaq -0xf8(%rbp), %rdi
callq 0xa10c0
jmp 0xa7af8
movq -0x198(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0xf8(%rbp), %rsi
callq 0xa82a0
jmp 0xa7b11
leaq -0xf8(%rbp), %rdi
callq 0x992c0
leaq -0x118(%rbp), %rdi
callq 0x992c0
jmp 0xa7b7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa7b6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x992c0
leaq -0x118(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rax
movq %rax, -0x220(%rbp)
movq -0xb8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
leaq -0x138(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x991c0
movq -0x220(%rbp), %rdi
movq -0x218(%rbp), %rsi
callq 0xbcde0
movq %rax, -0x210(%rbp)
jmp 0xa7bd7
leaq -0x138(%rbp), %rdi
callq 0x992c0
movq -0x210(%rbp), %rax
cmpq $0x0, %rax
je 0xa7cbe
movq -0xb8(%rbp), %rax
movq 0x48(%rax), %rax
movq 0x8(%rax), %rdx
addq $0x8, %rdx
leaq 0x578e5(%rip), %rsi     # 0xff4f3
leaq -0x178(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0xa6e30
movq -0x228(%rbp), %rsi
leaq 0x58e53(%rip), %rdx     # 0x100a82
leaq -0x158(%rbp), %rdi
callq 0xa10c0
jmp 0xa7c3d
movq -0x198(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq -0x158(%rbp), %rsi
callq 0xa82a0
jmp 0xa7c56
leaq -0x158(%rbp), %rdi
callq 0x992c0
leaq -0x178(%rbp), %rdi
callq 0x992c0
jmp 0xa7cbe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa7cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x992c0
leaq -0x178(%rbp), %rdi
callq 0x992c0
jmp 0xa7cfc
movq -0xb0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
callq 0xb4320
jmp 0xa7cd3
jmp 0xa7941
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x50(%rax), %rdi
callq 0xbcb30
movq -0xb0(%rbp), %rax
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x99840
nopw %cs:(%rax,%rax)