// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x230(%rbp)
movq %rdi, %rax
movq %rax, -0x238(%rbp)
callq 0x252c0
movq -0x230(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0x228(%rbp)
callq 0x13dd0
movq -0x10(%rbp), %rax
movq %rax, -0x220(%rbp)
movl -0x14(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x218(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x7fc0
movq -0x220(%rbp), %rsi
movq -0x218(%rbp), %rdx
movq -0x210(%rbp), %rcx
leaq -0x40(%rbp), %rdi
callq 0x123d0
jmp 0x2218f
leaq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x11b10
jmp 0x2219e
leaq -0x40(%rbp), %rdi
callq 0x80c0
leaq -0x41(%rbp), %rdi
callq 0x8060
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x23c(%rbp)
jmp 0x221c9
movl -0x23c(%rbp), %eax
movl %eax, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x22603
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x240(%rbp)
jmp 0x221fe
movl -0x240(%rbp), %eax
movl %eax, -0x60(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11fc0
movb %al, -0x241(%rbp)
jmp 0x22220
movb -0x241(%rbp), %al
movb %al, -0x61(%rbp)
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x11fe0
jmp 0x22243
movq -0x238(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x250(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x25320
jmp 0x2226e
movq -0x250(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x252e0
movb %dl, -0x259(%rbp)
movq %rax, -0x258(%rbp)
jmp 0x22290
movb -0x259(%rbp), %al
movq -0x258(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x25360
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0x25380
movzbl -0x61(%rbp), %eax
movq %rax, -0x268(%rbp)
subq $0x6, %rax
ja 0x2254d
movq -0x268(%rbp), %rax
leaq 0x18803(%rip), %rcx     # 0x3aaec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x22315
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x80c0
leaq -0x41(%rbp), %rdi
callq 0x8060
jmp 0x22b02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x22af9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x225f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x25360
jmp 0x225f2
leaq -0xe0(%rbp), %rdi
callq 0x253a0
jmp 0x22370
leaq -0xd0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x25410
leaq -0xe0(%rbp), %rdi
callq 0x25440
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x0, 0x24(%rax)
jmp 0x22580
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x8770
jmp 0x225f2
leaq -0xf0(%rbp), %rdi
callq 0x25460
jmp 0x223d2
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x254d0
leaq -0xf0(%rbp), %rdi
callq 0x25500
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x1, 0x24(%rax)
jmp 0x22580
leaq -0x100(%rbp), %rdi
callq 0x25520
jmp 0x22417
leaq -0xd0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x25590
leaq -0x100(%rbp), %rdi
callq 0x255c0
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x2, 0x24(%rax)
jmp 0x22580
leaq -0x110(%rbp), %rdi
callq 0x255e0
jmp 0x2245c
leaq -0xd0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x25650
leaq -0x110(%rbp), %rdi
callq 0x25680
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x3, 0x24(%rax)
jmp 0x22580
leaq -0x120(%rbp), %rdi
callq 0x255e0
jmp 0x224a1
leaq -0xd0(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x25650
leaq -0x120(%rbp), %rdi
callq 0x25680
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x4, 0x24(%rax)
jmp 0x22580
movq 0x34b09(%rip), %rdi     # 0x56fe8
leaq 0x1867e(%rip), %rsi     # 0x3ab64
callq 0x62f0
movq %rax, -0x270(%rbp)
jmp 0x224f4
movq -0x270(%rbp), %rdi
movq 0x34aa6(%rip), %rsi     # 0x56fa8
callq 0x6330
jmp 0x22509
jmp 0x22580
leaq -0x130(%rbp), %rdi
callq 0x256a0
jmp 0x22519
leaq -0xd0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x25710
leaq -0x130(%rbp), %rdi
callq 0x8120
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movl $0x6, 0x24(%rax)
jmp 0x22580
movq 0x34a94(%rip), %rdi     # 0x56fe8
leaq 0x18618(%rip), %rsi     # 0x3ab73
callq 0x62f0
movq %rax, -0x278(%rbp)
jmp 0x22569
movq -0x278(%rbp), %rdi
movq 0x34a31(%rip), %rsi     # 0x56fa8
callq 0x6330
jmp 0x2257e
jmp 0x22580
leaq -0xd0(%rbp), %rdi
callq 0x7ef0
movq %rax, %rdi
leaq -0x88(%rbp), %rsi
callq 0x6060
jmp 0x2259d
movq -0x238(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x25740
movq %rax, -0x280(%rbp)
jmp 0x225b9
movq -0x280(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x25820
leaq -0xd0(%rbp), %rdi
callq 0x8770
leaq -0x88(%rbp), %rdi
callq 0x61e0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x221d9
leaq -0x88(%rbp), %rdi
callq 0x61e0
jmp 0x22af9
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
cmpl -0x58(%rbp), %eax
jae 0x22ae7
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x284(%rbp)
jmp 0x22635
movq -0x238(%rbp), %rdi
movl -0x284(%rbp), %eax
movl %eax, -0x138(%rbp)
movq %rdi, %rax
movq %rax, -0x298(%rbp)
addq $0x30, %rdi
leaq -0x138(%rbp), %rsi
callq 0x13e60
movq %rax, -0x290(%rbp)
jmp 0x2266b
movq -0x290(%rbp), %rsi
movq -0x298(%rbp), %rdi
callq 0x25740
movq %rax, -0x2a0(%rbp)
jmp 0x22687
movq -0x2a0(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0x8490
leaq -0x28(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x2a4(%rbp)
jmp 0x226b3
leaq -0x148(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x7ef0
movl -0x2a4(%rbp), %ecx
movq -0x2b8(%rbp), %rdi
movl %ecx, 0x20(%rax)
callq 0x7ef0
movl 0x24(%rax), %eax
movq %rax, -0x2b0(%rbp)
subq $0x6, %rax
ja 0x22ab9
movq -0x2b0(%rbp), %rax
leaq 0x183d3(%rip), %rcx     # 0x3aad0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x22ad9
leaq -0x158(%rbp), %rdi
movq %rdi, -0x2c8(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x168(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x2c8(%rbp), %rsi
movq -0x2c0(%rbp), %rdx
callq 0x22b30
jmp 0x22764
leaq -0x168(%rbp), %rdi
callq 0x8770
leaq -0x158(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x8770
leaq -0x158(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
leaq -0x178(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x188(%rbp), %rdi
movq %rdi, -0x2d0(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
callq 0x22c40
jmp 0x227f7
leaq -0x188(%rbp), %rdi
callq 0x8770
leaq -0x178(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x8770
leaq -0x178(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
leaq -0x198(%rbp), %rdi
movq %rdi, -0x2e8(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x1a8(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x2e8(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
callq 0x22df0
jmp 0x2288a
leaq -0x1a8(%rbp), %rdi
callq 0x8770
leaq -0x198(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x8770
leaq -0x198(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
leaq -0x1b8(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x1c8(%rbp), %rdi
movq %rdi, -0x2f0(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x2f8(%rbp), %rsi
movq -0x2f0(%rbp), %rdx
callq 0x22fa0
jmp 0x2291d
leaq -0x1c8(%rbp), %rdi
callq 0x8770
leaq -0x1b8(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x8770
leaq -0x1b8(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
leaq -0x1d8(%rbp), %rdi
movq %rdi, -0x308(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x1e8(%rbp), %rdi
movq %rdi, -0x300(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x308(%rbp), %rsi
movq -0x300(%rbp), %rdx
callq 0x22fa0
jmp 0x229b0
leaq -0x1e8(%rbp), %rdi
callq 0x8770
leaq -0x1d8(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0x8770
leaq -0x1d8(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
movq 0x345eb(%rip), %rdi     # 0x56fe8
leaq 0x1817c(%rip), %rsi     # 0x3ab80
callq 0x62f0
movq %rax, -0x310(%rbp)
jmp 0x22a12
movq -0x310(%rbp), %rdi
movq 0x34588(%rip), %rsi     # 0x56fa8
callq 0x6330
jmp 0x22a27
jmp 0x22ab9
leaq -0x1f8(%rbp), %rdi
movq %rdi, -0x320(%rbp)
leaq -0x28(%rbp), %rsi
callq 0xb060
leaq -0x208(%rbp), %rdi
movq %rdi, -0x318(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x8490
movq -0x238(%rbp), %rdi
movq -0x320(%rbp), %rsi
movq -0x318(%rbp), %rdx
callq 0x234f0
jmp 0x22a79
leaq -0x208(%rbp), %rdi
callq 0x8770
leaq -0x1f8(%rbp), %rdi
callq 0x8b80
jmp 0x22ab9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x8770
leaq -0x1f8(%rbp), %rdi
callq 0x8b80
jmp 0x22ad9
leaq -0x148(%rbp), %rdi
callq 0x8770
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x2260d
leaq -0x148(%rbp), %rdi
callq 0x8770
jmp 0x22af9
leaq -0x28(%rbp), %rdi
callq 0x8b80
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x8b80
movq -0x228(%rbp), %rdi
callq 0x81d0
movq -0x230(%rbp), %rdi
callq 0x8bc0
movq -0x50(%rbp), %rdi
callq 0x6540
nopw %cs:(%rax,%rax)