// File: /workspace/github_c_makefile_star2_O1/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 0x9aec
movq %rsp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x9792
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xfc28
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5230
movq (%rsp), %rdi
callq 0x9904
movl %eax, %r14d
testl %eax, %eax
je 0x104e4
leaq 0x108(%rsp), %r15
movl %r14d, %ebp
movq (%rsp), %rdi
callq 0x9904
movl %eax, %r12d
movq (%rsp), %rdi
callq 0x999c
movl %eax, %r13d
movq (%rsp), %rsi
movq %r15, %rdi
callq 0x99ac
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 0x68c2
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x124f8
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xfcc2
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5230
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
cmpb $0x6, %r13b
ja 0xfeaf
movzbl %r13b, %eax
leaq 0x7e31(%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 0x10ec9(%rip), %rcx     # 0x20bd0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movq %rax, %rdx
addq $0x20, %rdx
movq %rdx, 0x10(%rax)
movq $0x0, 0x18(%rax)
movb $0x0, 0x20(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
jmp 0x1001d
movl $0x50, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10f56(%rip), %rcx     # 0x20cc0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movq %rax, %rdx
addq $0x20, %rdx
movq %rdx, 0x10(%rax)
xorl %edx, %edx
movq %rdx, 0x18(%rax)
movb $0x0, 0x20(%rax)
movq %rdx, 0x48(%rax)
movups %xmm0, 0x38(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x4, %r12d
jmp 0x1001d
movl $0x70, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10e96(%rip), %rcx     # 0x20c70
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x60(%rax)
leaq 0x20(%rax), %rdx
movq %rdx, 0x10(%rax)
xorl %esi, %esi
movq %rsi, 0x18(%rax)
movb %sil, 0x20(%rax)
movups %xmm0, 0x38(%rax)
movq %rax, %rdx
addq $0x60, %rdx
movq %rdx, 0x50(%rax)
movq %rsi, 0x58(%rax)
movb %sil, 0x60(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x2, %r12d
jmp 0x1001d
movl $0x50, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10e62(%rip), %rcx     # 0x20cc0
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movq %rax, %rdx
addq $0x20, %rdx
movq %rdx, 0x10(%rax)
xorl %edx, %edx
movq %rdx, 0x18(%rax)
movb $0x0, 0x20(%rax)
movq %rdx, 0x48(%rax)
movups %xmm0, 0x38(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x3, %r12d
jmp 0x1001d
movl $0xc, %edx
leaq 0x7ce0(%rip), %rsi      # 0x17b9b
jmp 0xff5b
movl $0x78, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10d41(%rip), %rcx     # 0x20c20
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x60(%rax)
leaq 0x20(%rax), %rdx
movq %rdx, 0x10(%rax)
xorl %esi, %esi
movq %rsi, 0x18(%rax)
movb $0x0, 0x20(%rax)
movups %xmm0, 0x38(%rax)
movq %rax, %rdx
addq $0x50, %rdx
movl $0x0, 0x50(%rax)
movq %rsi, 0x58(%rax)
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 0x1001d
movl $0xe, %edx
leaq 0x7c31(%rip), %rsi      # 0x17b8c
movq 0x1108e(%rip), %rdi     # 0x20ff0
callq 0x5260
movq 0x11082(%rip), %rcx     # 0x20ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5210
movsbl %al, %esi
movq 0x11064(%rip), %rdi     # 0x20ff0
callq 0x5040
movq %rax, %rdi
callq 0x5190
jmp 0x10030
movl $0x78, %edi
callq 0x5220
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x8(%rax)
leaq 0x10d53(%rip), %rcx     # 0x20d10
movq %rcx, (%rax)
leaq 0x10(%rax), %rcx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x30(%rax)
xorl %esi, %esi
movq %rsi, 0x70(%rax)
movq %rax, %rdx
addq $0x20, %rdx
movq %rdx, 0x10(%rax)
movq %rsi, 0x18(%rax)
movb $0x0, 0x20(%rax)
movups %xmm0, 0x48(%rax)
movups %xmm0, 0x58(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x68(%rax)
movq %rcx, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rax, 0x18(%rsp)
movl $0x6, %r12d
testq %rdi, %rdi
je 0x10027
callq 0x6752
movq 0x10(%rsp), %rax
movl %r12d, 0x24(%rax)
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x5170
movq %rbx, %rdi
movq %r15, %rsi
callq 0x11ff6
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
addq $0x8, %rax
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x7f60
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x10070
callq 0x6752
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x10095
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x5230
decl %ebp
jne 0xfc47
leaq 0x7a88(%rip), %r15      # 0x17b2c
movq 0x10f1d(%rip), %r13     # 0x20fc8
movq (%rsp), %rdi
callq 0x9904
movl %eax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xa9ae
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11ff6
movq (%rax), %rbp
movq 0x8(%rax), %r12
testq %r12, %r12
je 0x100f2
cmpb $0x0, (%r13)
je 0x100ec
incl 0x8(%r12)
jmp 0x100f2
lock
incl 0x8(%r12)
movq (%rsp), %rdi
callq 0x9904
movl %eax, 0x20(%rbp)
movl 0x24(%rbp), %eax
cmpq $0x6, %rax
ja 0x104ce
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 0x103b9
cmpb $0x0, (%r13)
je 0x103b5
incl 0x8(%rax)
jmp 0x103b9
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x78(%rsp)
movq %rax, 0x80(%rsp)
testq %rax, %rax
je 0x1029c
cmpb $0x0, (%r13)
je 0x10298
incl 0x8(%rax)
jmp 0x1029c
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
testq %rax, %rax
je 0x102f1
cmpb $0x0, (%r13)
je 0x102ed
incl 0x8(%rax)
jmp 0x102f1
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
testq %rax, %rax
je 0x10355
cmpb $0x0, (%r13)
je 0x10351
incl 0x8(%rax)
jmp 0x10355
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0xd8(%rsp)
movq %rax, 0xe0(%rsp)
testq %rax, %rax
je 0x103e0
cmpb $0x0, (%r13)
je 0x103dc
incl 0x8(%rax)
jmp 0x103e0
movl $0xe, %edx
movq 0x10dca(%rip), %rdi     # 0x20ff0
leaq 0x797b(%rip), %rsi      # 0x17ba8
callq 0x5260
movq 0x10db7(%rip), %rcx     # 0x20ff0
movq (%rcx), %rax
movq -0x18(%rax), %rdi
addq %rcx, %rdi
movl $0xa, %esi
callq 0x5210
movsbl %al, %esi
movq 0x10d99(%rip), %rdi     # 0x20ff0
callq 0x5040
movq %rax, %rdi
callq 0x5190
jmp 0x104ce
movq (%rsp), %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x58(%rsp)
movq %rax, 0x60(%rsp)
testq %rax, %rax
je 0x1047b
cmpb $0x0, (%r13)
je 0x10477
incl 0x8(%rax)
jmp 0x1047b
lock
incl 0x8(%rax)
movq %rbp, 0x68(%rsp)
movq %r12, 0x70(%rsp)
testq %r12, %r12
je 0x102bf
cmpb $0x0, (%r13)
je 0x102b9
incl 0x8(%r12)
jmp 0x102bf
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x78(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x10960
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x102e0
callq 0x6752
movq 0x80(%rsp), %rdi
jmp 0x104c4
lock
incl 0x8(%rax)
movq %rbp, 0xa8(%rsp)
movq %r12, 0xb0(%rsp)
testq %r12, %r12
je 0x1031a
cmpb $0x0, (%r13)
je 0x10314
incl 0x8(%r12)
jmp 0x1031a
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0xb8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x10848
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x10344
callq 0x6752
movq 0xc0(%rsp), %rdi
jmp 0x104c4
lock
incl 0x8(%rax)
movq %rbp, 0x88(%rsp)
movq %r12, 0x90(%rsp)
testq %r12, %r12
je 0x1037e
cmpb $0x0, (%r13)
je 0x10378
incl 0x8(%r12)
jmp 0x1037e
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x98(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x10960
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x103a8
callq 0x6752
movq 0xa0(%rsp), %rdi
jmp 0x104c4
lock
incl 0x8(%rax)
movq %rbp, 0xe8(%rsp)
movq %r12, 0xf0(%rsp)
testq %r12, %r12
je 0x10409
cmpb $0x0, (%r13)
je 0x10403
incl 0x8(%r12)
jmp 0x10409
lock
incl 0x8(%rax)
movq %rbp, 0xc8(%rsp)
movq %r12, 0xd0(%rsp)
testq %r12, %r12
je 0x10443
cmpb $0x0, (%r13)
je 0x1043d
incl 0x8(%r12)
jmp 0x10443
lock
incl 0x8(%r12)
leaq 0xf8(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x106a4
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x10430
callq 0x6752
movq 0x100(%rsp), %rdi
jmp 0x104c4
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0xd8(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x10710
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x1046d
callq 0x6752
movq 0xe0(%rsp), %rdi
jmp 0x104c4
lock
incl 0x8(%rax)
movq %rbp, 0x48(%rsp)
movq %r12, 0x50(%rsp)
testq %r12, %r12
je 0x1049e
cmpb $0x0, (%r13)
je 0x10498
incl 0x8(%r12)
jmp 0x1049e
lock
incl 0x8(%r12)
movq %rbx, %rdi
leaq 0x58(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x10efe
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x104bf
callq 0x6752
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x104ce
callq 0x6752
testq %r12, %r12
je 0x104db
movq %r12, %rdi
callq 0x6752
decl %r14d
jne 0x100ab
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x104f3
callq 0x6752
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1063f
movq %rax, %r15
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1068a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5230
jmp 0x1068a
movq %rax, %r15
jmp 0x1068a
movq %rax, %r15
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x10547
callq 0x6752
movq 0x60(%rsp), %rdi
jmp 0x105e7
movq %rax, %r15
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x10566
callq 0x6752
movq 0x100(%rsp), %rdi
jmp 0x105e7
movq %rax, %r15
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x10585
callq 0x6752
movq 0xe0(%rsp), %rdi
jmp 0x105e7
movq %rax, %r15
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x105a4
callq 0x6752
movq 0xc0(%rsp), %rdi
jmp 0x105e7
movq %rax, %r15
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x105c3
callq 0x6752
movq 0xa0(%rsp), %rdi
jmp 0x105e7
movq %rax, %r15
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x105df
callq 0x6752
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x10630
callq 0x6752
jmp 0x10630
jmp 0x10644
jmp 0x10644
jmp 0x10644
jmp 0x10644
jmp 0x10644
jmp 0x10644
jmp 0x1063f
jmp 0x1063f
jmp 0x1063f
jmp 0x1063f
movq %rax, %r15
jmp 0x10656
movq %rax, %r15
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x10656
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5230
jmp 0x10656
movq %rax, %r15
testq %r12, %r12
je 0x1067b
movq %r12, %rdi
callq 0x6752
jmp 0x1067b
movq %rax, %r15
jmp 0x1067b
movq %rax, %r15
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x10656
callq 0x6752
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x1067b
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x5230
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1068a
callq 0x6752
movq 0x40(%rsp), %rdi
callq 0x67c2
movq %rbx, %rdi
callq 0x683a
movq %r15, %rdi
callq 0x53e0