// File: /workspace/github_c_makefile_star2_O3/mrkite[P]regs/src/api.cc
// Function: API::API(unsigned char*, unsigned int)
API::API(unsigned char *dat, unsigned int len) {
  auto h = TheHandle::createFromArray(std::vector<uint8_t>(dat, dat + len));
  auto numSymbols = h->r32();
  for (uint32_t i = 0; i < numSymbols; i++) {
    auto id = h->r32();
    auto kind = h->r8();
    auto name = h->rs();
    ids.insert(std::pair<uint32_t, std::string>(id, name));
    std::shared_ptr<symbol::Symbol> s = nullptr;
    switch (kind) {
      case symbol::isIntrinsic:
        s = std::make_shared<symbol::Intrinsic>();
        s->kind = symbol::isIntrinsic;
        break;
      case symbol::isEnum:
        s = std::make_shared<symbol::Enum>();
        s->kind = symbol::isEnum;
        break;
      case symbol::isAlias:
        s = std::make_shared<symbol::Ref>();
        s->kind = symbol::isAlias;
        break;
      case symbol::isStruct:
        s = std::make_shared<symbol::Struct>();
        s->kind = symbol::isStruct;
        break;
      case symbol::isUnion:
        s = std::make_shared<symbol::Struct>();
        s->kind = symbol::isUnion;
        break;
      case symbol::isRef:
        std::cerr << "isRef on root!" << std::endl;
        break;
      case symbol::isFunction:
        s = std::make_shared<symbol::Function>();
        s->kind = symbol::isFunction;
        break;
      default:
        std::cerr << "Unknown type" << std::endl;
        break;
    }
    s->name = name;
    symbols[name] = s;
  }

  for (uint32_t i = 0; i < numSymbols; i++) {
    auto id = h->r32();
    auto s = symbols[ids[id]];
    s->size = h->r32();
    switch (s->kind) {
      case symbol::isIntrinsic:
        setIntrinsic(h, s);
        break;
      case symbol::isEnum:
        setEnum(h, s);
        break;
      case symbol::isAlias:
        setRef(h, s);
        break;
      case symbol::isStruct:
        setStruct(h, s);
        break;
      case symbol::isUnion:
        setStruct(h, s);
        break;
      case symbol::isRef:
        std::cerr << "base level ref" << std::endl;
        break;
      case symbol::isFunction:
        setFunction(h, s);
        break;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x8(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x8(%rdi)
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rcx, 0x28(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, 0x40(%rsp)
leaq 0x38(%rdi), %rax
movl %ecx, 0x38(%rdi)
movq %rcx, 0x40(%rdi)
movq %rax, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movq %rcx, 0x58(%rdi)
movl %edx, %edx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
leaq 0x108(%rsp), %rcx
callq 0x98d0
movq %rsp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x9576
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xf9f2
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5230
movq (%rsp), %rdi
callq 0x96e8
movl %eax, %r14d
testl %eax, %eax
je 0x1024e
leaq 0x108(%rsp), %r15
movl %r14d, %ebp
movq (%rsp), %rdi
callq 0x96e8
movl %eax, %r12d
movq (%rsp), %rdi
callq 0x9780
movl %eax, %r13d
movq (%rsp), %rsi
movq %r15, %rdi
callq 0x9790
movl %r12d, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x688a
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x122aa
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfa8c
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5230
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
cmpb $0x6, %r13b
ja 0xfc4b
movzbl %r13b, %eax
leaq 0x8067(%rip), %rcx      # 0x17b10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x40, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x110ff(%rip), %rcx     # 0x20bd0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movq %rax, %rdx
addq $0x20, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movq %rdx, 0x10(%rax)
movq $0x0, 0x18(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
jmp 0xfd87
movl $0x50, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x11194(%rip), %rcx     # 0x20cc0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movq %rax, %rdx
addq $0x20, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %esi, %esi
movq %rsi, 0x30(%rax)
movq %rdx, 0x10(%rax)
movq %rsi, 0x18(%rax)
movups %xmm0, 0x38(%rax)
movq %rsi, 0x48(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x4, %r12d
jmp 0xfd87
movl $0x70, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x110e0(%rip), %rcx     # 0x20c70
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
leaq 0x20(%rax), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x60(%rax)
movq %rdx, 0x10(%rax)
movq $0x0, 0x18(%rax)
movups %xmm0, 0x38(%rax)
movq %rax, %rdx
addq $0x60, %rdx
movq %rdx, 0x50(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x2, %r12d
jmp 0xfd87
movl $0x50, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x110ba(%rip), %rcx     # 0x20cc0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movq %rax, %rdx
addq $0x20, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %esi, %esi
movq %rsi, 0x30(%rax)
movq %rdx, 0x10(%rax)
movq %rsi, 0x18(%rax)
movups %xmm0, 0x38(%rax)
movq %rsi, 0x48(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x3, %r12d
jmp 0xfd87
movl $0xc, %edx
leaq 0x7f44(%rip), %rsi      # 0x17b9b
jmp 0xfce0
movl $0x78, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10fa5(%rip), %rcx     # 0x20c20
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
leaq 0x20(%rax), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x50(%rax)
movq %rdx, 0x10(%rax)
xorl %esi, %esi
movq %rsi, 0x18(%rax)
movups %xmm0, 0x38(%rax)
movq %rax, %rdx
addq $0x50, %rdx
movq %rdx, 0x60(%rax)
movq %rdx, 0x68(%rax)
movq %rsi, 0x70(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x1, %r12d
jmp 0xfd87
movl $0xe, %edx
leaq 0x7eac(%rip), %rsi      # 0x17b8c
movq 0x11309(%rip), %rdi     # 0x20ff0
callq 0x5260
movq 0x112fd(%rip), %rcx     # 0x20ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5210
movsbl %al, %esi
movq 0x112df(%rip), %rdi     # 0x20ff0
callq 0x5040
movq %rax, %rdi
callq 0x5190
jmp 0xfd9a
movl $0x78, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10fd1(%rip), %rcx     # 0x20d10
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
movq %rax, %rdx
addq $0x20, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rax)
xorl %esi, %esi
movq %rsi, 0x30(%rax)
movq %rdx, 0x10(%rax)
movq %rsi, 0x18(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x48(%rax)
movups %xmm0, 0x58(%rax)
movups %xmm0, 0x68(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x6, %r12d
testq %rdi, %rdi
je 0xfd96
callq 0x671a
movq 0x10(%rsp), %rcx
movl %r12d, 0x24(%rcx)
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x5170
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11dba
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x7dd0
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0xfdda
callq 0x671a
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0xfdff
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x5230
decl %ebp
jne 0xfa11
leaq 0x7d1e(%rip), %r15      # 0x17b2c
movq 0x111b3(%rip), %r13     # 0x20fc8
movq (%rsp), %rdi
callq 0x96e8
movl %eax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa7a6
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11dba
movq (%rax), %rbp
movq 0x8(%rax), %r12
testq %r12, %r12
je 0xfe5c
cmpb $0x0, (%r13)
je 0xfe56
incl 0x8(%r12)
jmp 0xfe5c
lock
incl 0x8(%r12)
movq (%rsp), %rdi
callq 0x96e8
movl %eax, 0x20(%rbp)
movl 0x24(%rbp), %eax
cmpq $0x6, %rax
ja 0x10238
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xf8(%rsp)
movq %rax, 0x100(%rsp)
testq %rax, %rax
je 0x10123
cmpb $0x0, (%r13)
je 0x1011f
incl 0x8(%rax)
jmp 0x10123
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x10006
cmpb $0x0, (%r13)
je 0x10002
incl 0x8(%rax)
jmp 0x10006
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x1005b
cmpb $0x0, (%r13)
je 0x10057
incl 0x8(%rax)
jmp 0x1005b
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x100bf
cmpb $0x0, (%r13)
je 0x100bb
incl 0x8(%rax)
jmp 0x100bf
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xd8(%rsp)
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x1014a
cmpb $0x0, (%r13)
je 0x10146
incl 0x8(%rax)
jmp 0x1014a
movl $0xe, %edx
movq 0x11060(%rip), %rdi     # 0x20ff0
leaq 0x7c11(%rip), %rsi      # 0x17ba8
callq 0x5260
movq 0x1104d(%rip), %rcx     # 0x20ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5210
movsbl %al, %esi
movq 0x1102f(%rip), %rdi     # 0x20ff0
callq 0x5040
movq %rax, %rdi
callq 0x5190
jmp 0x10238
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x58(%rsp)
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x101e5
cmpb $0x0, (%r13)
je 0x101e1
incl 0x8(%rax)
jmp 0x101e5
lock
incl 0x8(%rax)
movq %rbp, 0x68(%rsp)
movq %r12, 0x70(%rsp)
testq %r12, %r12
je 0x10029
cmpb $0x0, (%r13)
je 0x10023
incl 0x8(%r12)
jmp 0x10029
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x78(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x1069a
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1004a
callq 0x671a
movq 0x80(%rsp), %rdi
jmp 0x1022e
lock
incl 0x8(%rax)
movq %rbp, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
testq %r12, %r12
je 0x10084
cmpb $0x0, (%r13)
je 0x1007e
incl 0x8(%r12)
jmp 0x10084
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0xb8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x1059c
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x100ae
callq 0x671a
movq 0xc0(%rsp), %rdi
jmp 0x1022e
lock
incl 0x8(%rax)
movq %rbp, 0x88(%rsp)
movq %r12, 0x90(%rsp)
testq %r12, %r12
je 0x100e8
cmpb $0x0, (%r13)
je 0x100e2
incl 0x8(%r12)
jmp 0x100e8
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x98(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x1069a
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x10112
callq 0x671a
movq 0xa0(%rsp), %rdi
jmp 0x1022e
lock
incl 0x8(%rax)
movq %rbp, 0xe8(%rsp)
movq %r12, 0xf0(%rsp)
testq %r12, %r12
je 0x10173
cmpb $0x0, (%r13)
je 0x1016d
incl 0x8(%r12)
jmp 0x10173
lock
incl 0x8(%rax)
movq %rbp, 0xc8(%rsp)
movq %r12, 0xd0(%rsp)
testq %r12, %r12
je 0x101ad
cmpb $0x0, (%r13)
je 0x101a7
incl 0x8(%r12)
jmp 0x101ad
lock
incl 0x8(%r12)
leaq 0xf8(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x1040e
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x1019a
callq 0x671a
movq 0x100(%rsp), %rdi
jmp 0x1022e
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x1047a
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x101d7
callq 0x671a
movq 0xe0(%rsp), %rdi
jmp 0x1022e
lock
incl 0x8(%rax)
movq %rbp, 0x48(%rsp)
movq %r12, 0x50(%rsp)
testq %r12, %r12
je 0x10208
cmpb $0x0, (%r13)
je 0x10202
incl 0x8(%r12)
jmp 0x10208
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x10c28
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x10229
callq 0x671a
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x10238
callq 0x671a
testq %r12, %r12
je 0x10245
movq %r12, %rdi
callq 0x671a
decl %r14d
jne 0xfe15
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1025d
callq 0x671a
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x103a9
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x103f4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5230
jmp 0x103f4
movq %rax, %r15
jmp 0x103f4
movq %rax, %r15
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x102b1
callq 0x671a
movq 0x60(%rsp), %rdi
jmp 0x10351
movq %rax, %r15
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x102d0
callq 0x671a
movq 0x100(%rsp), %rdi
jmp 0x10351
movq %rax, %r15
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x102ef
callq 0x671a
movq 0xe0(%rsp), %rdi
jmp 0x10351
movq %rax, %r15
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1030e
callq 0x671a
movq 0xc0(%rsp), %rdi
jmp 0x10351
movq %rax, %r15
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x1032d
callq 0x671a
movq 0xa0(%rsp), %rdi
jmp 0x10351
movq %rax, %r15
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x10349
callq 0x671a
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x1039a
callq 0x671a
jmp 0x1039a
jmp 0x103ae
jmp 0x103ae
jmp 0x103ae
jmp 0x103ae
jmp 0x103ae
jmp 0x103ae
jmp 0x103a9
jmp 0x103a9
jmp 0x103a9
jmp 0x103a9
movq %rax, %r15
jmp 0x103c0
movq %rax, %r15
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x103c0
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5230
jmp 0x103c0
movq %rax, %r15
testq %r12, %r12
je 0x103e5
movq %r12, %rdi
callq 0x671a
jmp 0x103e5
movq %rax, %r15
jmp 0x103e5
movq %rax, %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x103c0
callq 0x671a
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x103e5
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x5230
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x103f4
callq 0x671a
movq 0x40(%rsp), %rdi
callq 0x678a
movq %rbx, %rdi
callq 0x6802
movq %r15, %rdi
callq 0x53e0