// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/src/api.cc
// Function: API::setStruct(std::shared_ptr<TheHandle>, std::shared_ptr<symbol::Symbol>)
void API::setStruct(Handle h, std::shared_ptr<symbol::Symbol> s) {
  auto str = std::static_pointer_cast<symbol::Struct>(s);
  auto numFields = h->r32();
  for (uint32_t i = 0; i < numFields; i++) {
    auto key = h->rs();
    auto kind = h->r8();
    auto size = h->r32();
    std::shared_ptr<symbol::Symbol> sym = nullptr;
    switch (kind) {
      case symbol::isRef:
        sym = std::make_shared<symbol::Ref>();
        sym->kind = symbol::isRef;
        sym->size = size;
        setRef(h, sym);
        break;
      case symbol::isStruct:
        sym = std::make_shared<symbol::Struct>();
        sym->kind = symbol::isStruct;
        sym->size = size;
        setStruct(h, sym);
        break;
      case symbol::isUnion:
        sym = std::make_shared<symbol::Struct>();
        sym->kind = symbol::isUnion;
        sym->size = size;
        setStruct(h, sym);
        break;
      default:
        std::cerr << "Unknown field type" << std::endl;
        break;
    }
    str->fields.push_back({key, sym});
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq %rdx, -0x158(%rbp)
movq %rsi, %rax
movq -0x158(%rbp), %rsi
movq %rax, -0x148(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x25ab0
movq -0x148(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x13c(%rbp)
jmp 0x22fff
movl -0x13c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x234c5
movq -0x148(%rbp), %rdi
callq 0xd2c0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x11fe0
jmp 0x23035
movq -0x148(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11fc0
movb %al, -0x159(%rbp)
jmp 0x23051
movq -0x148(%rbp), %rdi
movb -0x159(%rbp), %al
movb %al, -0x61(%rbp)
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x160(%rbp)
jmp 0x23076
movl -0x160(%rbp), %eax
movl %eax, -0x68(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0x25380
movzbl -0x61(%rbp), %eax
movl %eax, -0x164(%rbp)
subl $0x3, %eax
je 0x231f4
jmp 0x230a1
movl -0x164(%rbp), %eax
subl $0x4, %eax
je 0x232f3
jmp 0x230b2
movl -0x164(%rbp), %eax
subl $0x5, %eax
je 0x230e4
jmp 0x233ef
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x234d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x234ba
leaq -0x88(%rbp), %rdi
callq 0x25520
jmp 0x230f2
leaq -0x78(%rbp), %rdi
movq %rdi, -0x180(%rbp)
leaq -0x88(%rbp), %rsi
movq %rsi, -0x190(%rbp)
callq 0x25590
movq -0x190(%rbp), %rdi
callq 0x255c0
movq -0x180(%rbp), %rdi
callq 0x7ef0
movq -0x180(%rbp), %rdi
movl $0x5, 0x24(%rax)
movl -0x68(%rbp), %eax
movl %eax, -0x184(%rbp)
callq 0x7ef0
movl -0x184(%rbp), %ecx
movq -0x148(%rbp), %rsi
movl %ecx, 0x20(%rax)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0xb060
movq -0x180(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x8490
movq -0x150(%rbp), %rdi
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
callq 0x22df0
jmp 0x2319d
leaq -0xa8(%rbp), %rdi
callq 0x8770
leaq -0x98(%rbp), %rdi
callq 0x8b80
jmp 0x23422
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x234b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x8770
leaq -0x98(%rbp), %rdi
callq 0x8b80
jmp 0x234b1
leaq -0xb8(%rbp), %rdi
callq 0x255e0
jmp 0x23202
leaq -0x78(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
leaq -0xb8(%rbp), %rsi
movq %rsi, -0x1b8(%rbp)
callq 0x25650
movq -0x1b8(%rbp), %rdi
callq 0x25680
movq -0x1a8(%rbp), %rdi
callq 0x7ef0
movq -0x1a8(%rbp), %rdi
movl $0x3, 0x24(%rax)
movl -0x68(%rbp), %eax
movl %eax, -0x1ac(%rbp)
callq 0x7ef0
movl -0x1ac(%rbp), %ecx
movq -0x148(%rbp), %rsi
movl %ecx, 0x20(%rax)
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x1a0(%rbp)
callq 0xb060
movq -0x1a8(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x8490
movq -0x150(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0x198(%rbp), %rdx
callq 0x22fa0
jmp 0x232ad
leaq -0xd8(%rbp), %rdi
callq 0x8770
leaq -0xc8(%rbp), %rdi
callq 0x8b80
jmp 0x23422
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x8770
leaq -0xc8(%rbp), %rdi
callq 0x8b80
jmp 0x234b1
leaq -0xe8(%rbp), %rdi
callq 0x255e0
jmp 0x23301
leaq -0x78(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
leaq -0xe8(%rbp), %rsi
movq %rsi, -0x1e0(%rbp)
callq 0x25650
movq -0x1e0(%rbp), %rdi
callq 0x25680
movq -0x1d0(%rbp), %rdi
callq 0x7ef0
movq -0x1d0(%rbp), %rdi
movl $0x4, 0x24(%rax)
movl -0x68(%rbp), %eax
movl %eax, -0x1d4(%rbp)
callq 0x7ef0
movl -0x1d4(%rbp), %ecx
movq -0x148(%rbp), %rsi
movl %ecx, 0x20(%rax)
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0xb060
movq -0x1d0(%rbp), %rsi
leaq -0x108(%rbp), %rdi
movq %rdi, -0x1c0(%rbp)
callq 0x8490
movq -0x150(%rbp), %rdi
movq -0x1c8(%rbp), %rsi
movq -0x1c0(%rbp), %rdx
callq 0x22fa0
jmp 0x233ac
leaq -0x108(%rbp), %rdi
callq 0x8770
leaq -0xf8(%rbp), %rdi
callq 0x8b80
jmp 0x23422
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x8770
leaq -0xf8(%rbp), %rdi
callq 0x8b80
jmp 0x234b1
movq 0x33bf2(%rip), %rdi     # 0x56fe8
leaq 0x17792(%rip), %rsi     # 0x3ab8f
callq 0x62f0
movq %rax, -0x1e8(%rbp)
jmp 0x2340b
movq -0x1e8(%rbp), %rdi
movq 0x33b8f(%rip), %rsi     # 0x56fa8
callq 0x6330
jmp 0x23420
jmp 0x23422
leaq -0x28(%rbp), %rdi
callq 0x25b00
addq $0x28, %rax
movq %rax, -0x1f0(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x6170
jmp 0x23448
leaq -0x118(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x8490
movq -0x1f0(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x25b20
jmp 0x2346d
leaq -0x138(%rbp), %rdi
callq 0x25b50
leaq -0x78(%rbp), %rdi
callq 0x8770
leaq -0x60(%rbp), %rdi
callq 0x61e0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x2300f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x25b50
leaq -0x78(%rbp), %rdi
callq 0x8770
leaq -0x60(%rbp), %rdi
callq 0x61e0
jmp 0x234d7
leaq -0x28(%rbp), %rdi
callq 0x25680
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x25680
movq -0x38(%rbp), %rdi
callq 0x6540
nopl (%rax)