// File: /workspace/github_cpp_makefile_star2_O2/CoinXu[P]reviser-compiler/src/compiler/javascript/javascript_struct.cpp
// Function: reviser::javascript::JavaScriptStruct::Generate[abi:cxx11]()
string JavaScriptStruct::Generate() {
    string indent = JavaScriptCommon::Indent(node->level);
    string indent_next = JavaScriptCommon::Indent(node->level + 1);

    vector<string> properties;
    string code = indent + "var " + node->id->text + " = (function() {\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: {
          JavaScriptStructProperty g(node->properties.at((*it).index), this);
          properties.push_back(g.Generate() + new_line);
          break;
        }

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

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

        default:
          break;
      }
    }

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

    return code + indent + "})();" + "\n\n";
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %rbx
movq %rdi, -0xe8(%rbp)
movq 0x20(%rsi), %rax
movl 0x98(%rax), %esi
leaq -0x148(%rbp), %rdi
callq 0x4f628
movq %rbx, -0x30(%rbp)
movq 0x20(%rbx), %rax
movl 0x98(%rax), %esi
incl %esi
leaq -0x128(%rbp), %rdi
callq 0x4f628
xorps %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
andq $0x0, -0xd0(%rbp)
leaq 0x6ab5(%rip), %rdx      # 0x589a2
leaq -0x80(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x3ccf9
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x38ef6
leaq 0x6c4c(%rip), %rdx      # 0x58b6d
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x38f1f
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x35180
leaq -0x80(%rbp), %r12
movq %r12, %rdi
callq 0x35180
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x80(%rax), %r13
movq 0x88(%rax), %rax
cmpq %rax, %r13
je 0x52131
movq %r13, %r15
addq $0x10, %r13
cmpq %rax, %r13
leaq 0x6bc4(%rip), %rsi      # 0x58b3d
leaq 0x6bbe(%rip), %rax      # 0x58b3e
cmoveq %rax, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x35130
movl -0x10(%r13), %eax
testl %eax, %eax
je 0x52098
cmpl $0x1, %eax
je 0x5201f
cmpl $0x2, %eax
jne 0x5211c
movq -0x30(%rbp), %r14
movq 0x20(%r14), %rdi
addq $0x68, %rdi
movq 0x8(%r15), %rsi
callq 0x400dc
movq (%rax), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4f21a
leaq -0x108(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4f252
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x38ef6
leaq -0xc0(%rbp), %rdi
movq %r15, %rsi
callq 0x35670
movq %r15, %rdi
callq 0x35180
movq %r14, %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x4f242
jmp 0x5211c
movq -0x30(%rbp), %r14
movq 0x20(%r14), %rdi
addq $0x50, %rdi
movq 0x8(%r15), %rsi
callq 0x400ba
movq (%rax), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movb $0x0, -0x50(%rbp)
movq %r14, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq 0x20(%r14), %rcx
movl 0x98(%rcx), %ecx
incl %ecx
movl %ecx, 0x98(%rax)
leaq -0x108(%rbp), %r14
movq %r14, %rdi
leaq -0x60(%rbp), %rbx
movq %rbx, %rsi
callq 0x51e84
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x38ef6
leaq -0xc0(%rbp), %rdi
movq %r15, %rsi
callq 0x35670
jmp 0x5210c
movq -0x30(%rbp), %r14
movq 0x20(%r14), %rdi
addq $0x38, %rdi
movq 0x8(%r15), %rsi
callq 0x52fbc
movq (%rax), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movb $0x0, -0x50(%rbp)
movq %r14, -0x48(%rbp)
movq %rax, -0x40(%rbp)
movq 0x20(%r14), %rcx
movl 0x98(%rcx), %ecx
incl %ecx
movl %ecx, 0x8(%rax)
leaq -0x108(%rbp), %r14
movq %r14, %rdi
leaq -0x60(%rbp), %rbx
movq %rbx, %rsi
callq 0x52486
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x38ef6
leaq -0xe0(%rbp), %rdi
movq %r15, %rsi
callq 0x4fe9c
movq %r15, %rdi
callq 0x35180
movq %r14, %rdi
callq 0x35180
movq %r12, %rdi
callq 0x35180
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
jmp 0x51f58
leaq 0x6bbd(%rip), %rdx      # 0x58cf5
leaq -0xa0(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3ccf9
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x38ef6
leaq 0x6a0d(%rip), %rdx      # 0x58b7f
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x38f1f
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x35670
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x35180
leaq -0x80(%rbp), %r15
movq %r15, %rdi
callq 0x35180
leaq -0xa0(%rbp), %rdi
callq 0x35180
movq -0xe0(%rbp), %r12
movq -0xd8(%rbp), %r14
leaq -0xc0(%rbp), %r13
cmpq %r14, %r12
je 0x52207
movq %rbx, %rdi
movq %r12, %rsi
callq 0x35470
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x42892
movq %r13, %rdi
movq %r15, %rsi
callq 0x35400
movq %r15, %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x35180
addq $0x20, %r12
jmp 0x521c8
leaq 0x6985(%rip), %rdx      # 0x58b93
leaq -0x60(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3ccf9
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x35670
leaq -0x60(%rbp), %rdi
callq 0x35180
leaq 0x6958(%rip), %rdx      # 0x58b96
leaq -0xa0(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x3ccf9
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x30(%rax), %rdx
addq $0x8, %rdx
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x38ef6
leaq 0x680e(%rip), %rdx      # 0x58a86
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x38f1f
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x35670
leaq -0x60(%rbp), %rdi
callq 0x35180
leaq -0x80(%rbp), %rdi
callq 0x35180
leaq -0xa0(%rbp), %rdi
callq 0x35180
leaq -0x80(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x148(%rbp), %rdx
callq 0x42892
leaq 0x68cd(%rip), %rdx      # 0x58b9e
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x38f1f
leaq 0x6858(%rip), %rdx      # 0x58b3d
leaq -0x60(%rbp), %rsi
movq -0xe8(%rbp), %rbx
movq %rbx, %rdi
callq 0x38f1f
leaq -0x60(%rbp), %rdi
callq 0x35180
leaq -0x80(%rbp), %rdi
callq 0x35180
leaq -0xc0(%rbp), %rdi
callq 0x35180
leaq -0xe0(%rbp), %rdi
callq 0x38d68
leaq -0x128(%rbp), %rdi
callq 0x35180
leaq -0x148(%rbp), %rdi
callq 0x35180
movq %rbx, %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
jmp 0x52419
jmp 0x52432
jmp 0x5244b
jmp 0x5237a
jmp 0x52388
jmp 0x52396
jmp 0x5244b
jmp 0x5243d
jmp 0x5244b
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x35180
jmp 0x5238b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x35180
jmp 0x52399
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x52444
jmp 0x5244b
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x35180
jmp 0x523bb
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x52455
movq %rax, %rbx
jmp 0x5245a
movq %rax, %rbx
jmp 0x52472
jmp 0x523ed
jmp 0x5240f
jmp 0x52432
jmp 0x52432
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x35180
jmp 0x52401
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x35180
jmp 0x52412
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x35180
jmp 0x52423
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x35180
jmp 0x52435
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x4f242
jmp 0x52435
jmp 0x52432
jmp 0x52432
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x52444
jmp 0x5244b
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x35180
jmp 0x5244e
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x35180
leaq -0xe0(%rbp), %rdi
callq 0x38d68
leaq -0x128(%rbp), %rdi
callq 0x35180
leaq -0x148(%rbp), %rdi
callq 0x35180
movq %rbx, %rdi
callq 0x355f0