// File: CoinXu[P]reviser-compiler/src/compiler/typescript/typescript_struct.cpp
// Function: reviser::typescript::TypeScriptStruct::Generate[abi:cxx11]()
string TypeScriptStruct::Generate() {
    string indent = TypeScriptCommon::Indent(node->level);
    string indent_next = TypeScriptCommon::Indent(node->level + 1);

    vector<string> properties;
    string ns =  indent + "namespace Ns" + node->id->text + " {\n";

    for (vector<Struct::ContentStore>::iterator it = begin(node->contents);
      it != end(node->contents); it++) {
      const string new_line = next(it) == end(node->contents) ? "\n" : "\n\n";

      switch ((*it).type) {
        case DeclareProperty: {
          TypeScriptStructProperty g(node->properties.at((*it).index), this);
          properties.push_back(g.Generate() + new_line);
          break;
        }

        case DeclareStruct: {
          TypeScriptStruct g(node->structs.at((*it).index), this);
          ns += g.Generate() + new_line;
          break;
        }

        case DeclareEnum: {
          TypeScriptEnum g(node->enums.at((*it).index), this);
          ns += g.Generate() + new_line;
          break;
        }

        default:
          break;
      }
    }

    ns += indent_next + "export class " + node->id->text + " extends Reviser {\n";
    for (string p: properties) {
      ns += p;
    }
    ns += indent_next + "}\n";
    ns += indent + "}\n";

    return ns;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
movq %rdi, -0x340(%rbp)
movq %rdi, %rax
movq %rax, -0x338(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x330(%rbp)
movq 0x20(%rax), %rax
movl 0x98(%rax), %esi
leaq -0x30(%rbp), %rdi
callq 0xf8390
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
movl 0x98(%rax), %esi
incl %esi
leaq -0x50(%rbp), %rdi
callq 0xf8390
jmp 0xfbbe0
leaq -0x78(%rbp), %rdi
callq 0xa0c50
movb $0x0, -0x79(%rbp)
leaq 0x515d(%rip), %rdx      # 0x100d51
leaq -0xc0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xaaee0
jmp 0xfbc06
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xa1070
jmp 0xfbc2e
movq -0x340(%rbp), %rdi
leaq 0x4faf(%rip), %rdx      # 0x100beb
leaq -0xa0(%rbp), %rsi
callq 0xa10c0
jmp 0xfbc4a
leaq -0xa0(%rbp), %rdi
callq 0x992c0
leaq -0xc0(%rbp), %rdi
callq 0x992c0
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rdi
subq $-0x80, %rdi
callq 0xf6460
movq %rax, -0x348(%rbp)
jmp 0xfbc7f
movq -0x348(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rdi
subq $-0x80, %rdi
callq 0xf64d0
movq %rax, -0x350(%rbp)
jmp 0xfbcaa
movq -0x350(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xf6490
testb $0x1, %al
jne 0xfbcd4
jmp 0xfc1f9
movq -0xc8(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
movl $0x1, %esi
callq 0xf6540
movq %rax, -0x358(%rbp)
jmp 0xfbcfc
movq -0x330(%rbp), %rax
movq -0x358(%rbp), %rcx
movq %rcx, -0xf8(%rbp)
movq 0x20(%rax), %rdi
subq $-0x80, %rdi
callq 0xf64d0
movq %rax, -0x360(%rbp)
jmp 0xfbd27
movq -0x360(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xf6500
movb %al, %dl
leaq 0x4e5d(%rip), %rcx      # 0x100bae
leaq 0x4e55(%rip), %rax      # 0x100bad
testb %dl, %dl
cmovneq %rcx, %rax
movq %rax, -0x370(%rbp)
leaq -0x109(%rbp), %rdi
movq %rdi, -0x368(%rbp)
callq 0x99850
movq -0x370(%rbp), %rsi
movq -0x368(%rbp), %rdx
leaq -0xf0(%rbp), %rdi
callq 0x99640
jmp 0xfbd94
leaq -0x109(%rbp), %rdi
callq 0x994f0
leaq -0xc8(%rbp), %rdi
callq 0xf6570
movl (%rax), %eax
movl %eax, -0x374(%rbp)
testl %eax, %eax
je 0xfbe6a
jmp 0xfbdbe
movl -0x374(%rbp), %eax
subl $0x1, %eax
je 0xfbf92
jmp 0xfbdcf
movl -0x374(%rbp), %eax
subl $0x2, %eax
je 0xfc0ac
jmp 0xfc1c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc49f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc48d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfbe2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x992c0
leaq -0xc0(%rbp), %rdi
callq 0x992c0
jmp 0xfc48d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc481
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x109(%rbp), %rdi
callq 0x994f0
jmp 0xfc481
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x38, %rax
movq %rax, -0x388(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xf6570
movq -0x388(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0xf6590
movq %rax, -0x380(%rbp)
jmp 0xfbea5
movq -0x330(%rbp), %rdx
movq -0x380(%rbp), %rax
movq (%rax), %rsi
leaq -0x138(%rbp), %rdi
callq 0xfd9c0
jmp 0xfbec4
leaq -0x178(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xfc4c0
jmp 0xfbed9
leaq -0x158(%rbp), %rdi
leaq -0x178(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0xa1070
jmp 0xfbef5
leaq -0x78(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0xecae0
jmp 0xfbf07
leaq -0x158(%rbp), %rdi
callq 0x992c0
leaq -0x178(%rbp), %rdi
callq 0x992c0
leaq -0x138(%rbp), %rdi
callq 0xfda20
jmp 0xfc1c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc1e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfbf81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfbf75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x992c0
leaq -0x178(%rbp), %rdi
callq 0x992c0
leaq -0x138(%rbp), %rdi
callq 0xfda20
jmp 0xfc1e8
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x50, %rax
movq %rax, -0x398(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xf6570
movq -0x398(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0xb7530
movq %rax, -0x390(%rbp)
jmp 0xfbfcd
movq -0x330(%rbp), %rdx
movq -0x390(%rbp), %rax
movq (%rax), %rsi
leaq -0x1a0(%rbp), %rdi
callq 0xfbb10
jmp 0xfbfec
leaq -0x1e0(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0xfbb80
jmp 0xfc001
leaq -0x1c0(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0xa1070
jmp 0xfc01d
movq -0x340(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x995d0
jmp 0xfc032
leaq -0x1c0(%rbp), %rdi
callq 0x992c0
leaq -0x1e0(%rbp), %rdi
callq 0x992c0
leaq -0x1a0(%rbp), %rdi
callq 0xfbb70
jmp 0xfc1c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc09b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc08f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x992c0
leaq -0x1e0(%rbp), %rdi
callq 0x992c0
leaq -0x1a0(%rbp), %rdi
callq 0xfbb70
jmp 0xfc1e8
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
addq $0x68, %rax
movq %rax, -0x3a8(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xf6570
movq -0x3a8(%rbp), %rdi
movq 0x8(%rax), %rsi
callq 0xb7570
movq %rax, -0x3a0(%rbp)
jmp 0xfc0e7
movq -0x330(%rbp), %rdx
movq -0x3a0(%rbp), %rax
movq (%rax), %rsi
leaq -0x208(%rbp), %rdi
callq 0xf7cb0
jmp 0xfc106
leaq -0x248(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0xf7d30
jmp 0xfc11b
leaq -0x228(%rbp), %rdi
leaq -0x248(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0xa1070
jmp 0xfc137
movq -0x340(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x995d0
jmp 0xfc14c
leaq -0x228(%rbp), %rdi
callq 0x992c0
leaq -0x248(%rbp), %rdi
callq 0x992c0
leaq -0x208(%rbp), %rdi
callq 0xf7d10
jmp 0xfc1c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc1b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc1a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x992c0
leaq -0x248(%rbp), %rdi
callq 0x992c0
leaq -0x208(%rbp), %rdi
callq 0xf7d10
jmp 0xfc1e8
jmp 0xfc1c2
leaq -0xf0(%rbp), %rdi
callq 0x992c0
leaq -0xc8(%rbp), %rdi
xorl %esi, %esi
callq 0xf65d0
movq %rax, -0x250(%rbp)
jmp 0xfbc8d
leaq -0xf0(%rbp), %rdi
callq 0x992c0
jmp 0xfc481
leaq 0x4b5e(%rip), %rdx      # 0x100d5e
leaq -0x2b0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xaaee0
jmp 0xfc212
movq -0x330(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq -0x290(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0xa1070
jmp 0xfc23a
leaq 0x49ae(%rip), %rdx      # 0x100bef
leaq -0x270(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0xa10c0
jmp 0xfc256
movq -0x340(%rbp), %rdi
leaq -0x270(%rbp), %rsi
callq 0x995d0
jmp 0xfc26b
leaq -0x270(%rbp), %rdi
callq 0x992c0
leaq -0x290(%rbp), %rdi
callq 0x992c0
leaq -0x2b0(%rbp), %rdi
callq 0x992c0
leaq -0x78(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0xa3540
movq %rax, -0x2c0(%rbp)
movq -0x2b8(%rbp), %rdi
callq 0xa33c0
movq %rax, -0x2c8(%rbp)
leaq -0x2c0(%rbp), %rdi
leaq -0x2c8(%rbp), %rsi
callq 0xafc80
testb $0x1, %al
jne 0xfc2dc
jmp 0xfc396
leaq -0x2c0(%rbp), %rdi
callq 0xb3150
movq %rax, %rsi
leaq -0x2e8(%rbp), %rdi
callq 0x991c0
jmp 0xfc2f9
movq -0x340(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x995d0
jmp 0xfc30e
leaq -0x2e8(%rbp), %rdi
callq 0x992c0
leaq -0x2c0(%rbp), %rdi
callq 0xb3130
jmp 0xfc2c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc368
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfc35c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x270(%rbp), %rdi
callq 0x992c0
leaq -0x290(%rbp), %rdi
callq 0x992c0
leaq -0x2b0(%rbp), %rdi
callq 0x992c0
jmp 0xfc481
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2e8(%rbp), %rdi
callq 0x992c0
jmp 0xfc481
leaq 0x4866(%rip), %rdx      # 0x100c03
leaq -0x308(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xaaee0
jmp 0xfc3af
movq -0x340(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x995d0
jmp 0xfc3c4
leaq -0x308(%rbp), %rdi
callq 0x992c0
leaq 0x482c(%rip), %rdx      # 0x100c03
leaq -0x328(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xaaee0
jmp 0xfc3e9
movq -0x340(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x995d0
jmp 0xfc3fe
leaq -0x328(%rbp), %rdi
callq 0x992c0
movb $0x1, -0x79(%rbp)
testb $0x1, -0x79(%rbp)
jne 0xfc456
jmp 0xfc44a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x992c0
jmp 0xfc481
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x992c0
jmp 0xfc481
movq -0x340(%rbp), %rdi
callq 0x992c0
leaq -0x78(%rbp), %rdi
callq 0xa0c70
leaq -0x50(%rbp), %rdi
callq 0x992c0
leaq -0x30(%rbp), %rdi
callq 0x992c0
movq -0x338(%rbp), %rax
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
movq -0x340(%rbp), %rdi
callq 0x992c0
leaq -0x78(%rbp), %rdi
callq 0xa0c70
leaq -0x50(%rbp), %rdi
callq 0x992c0
leaq -0x30(%rbp), %rdi
callq 0x992c0
movq -0x58(%rbp), %rdi
callq 0x99840
nopw %cs:(%rax,%rax)