// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/src/api.cc
// Function: API::setFunction(std::shared_ptr<TheHandle>, std::shared_ptr<symbol::Symbol>)
void API::setFunction(Handle h, std::shared_ptr<symbol::Symbol> s) {
  auto f = std::static_pointer_cast<symbol::Function>(s);
  auto numArgs = h->r32();
  for (uint32_t i = 0; i < numArgs; i++) {
    auto key = h->rs();
    auto ref = std::make_shared<symbol::Ref>();
    setRef(h, ref);
    f->arguments.push_back({key, ref});
  }
  f->returnType = std::make_shared<symbol::Ref>();
  setRef(h, f->returnType);
  auto numSig = h->r32();
  for (uint32_t i = 0; i < numSig; i++) {
    f->signature.push_back(static_cast<int32_t>(h->r32()));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdx, -0x118(%rbp)
movq %rsi, %rax
movq -0x118(%rbp), %rsi
movq %rax, -0x108(%rbp)
movq %rdi, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x110(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x7f10
movq -0x108(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x100(%rbp)
jmp 0x2354f
movl -0x100(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x236e5
movq -0x108(%rbp), %rdi
callq 0xd2c0
movq %rax, %rsi
leaq -0x60(%rbp), %rdi
callq 0x11fe0
jmp 0x23585
leaq -0x70(%rbp), %rdi
callq 0x25520
jmp 0x23590
movq -0x108(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0xb060
leaq -0x90(%rbp), %rdi
movq %rdi, -0x120(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x25b80
movq -0x110(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
callq 0x22df0
jmp 0x235da
leaq -0x90(%rbp), %rdi
callq 0x8770
leaq -0x80(%rbp), %rdi
callq 0x8b80
leaq -0x28(%rbp), %rdi
callq 0x7f60
addq $0x28, %rax
movq %rax, -0x130(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x6170
jmp 0x23615
leaq -0xa0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x25be0
movq -0x130(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x25bb0
jmp 0x2363a
leaq -0xc0(%rbp), %rdi
callq 0x25c10
leaq -0x70(%rbp), %rdi
callq 0x255c0
leaq -0x60(%rbp), %rdi
callq 0x61e0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x2355f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2387d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x236d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8770
leaq -0x80(%rbp), %rdi
callq 0x8b80
jmp 0x236ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x236ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x25c10
leaq -0x70(%rbp), %rdi
callq 0x255c0
leaq -0x60(%rbp), %rdi
callq 0x61e0
jmp 0x2387d
leaq -0xd0(%rbp), %rdi
callq 0x25520
jmp 0x236f3
leaq -0x28(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x7f60
movq %rax, %rdi
addq $0x40, %rdi
leaq -0xd0(%rbp), %rsi
movq %rsi, -0x150(%rbp)
callq 0x25c40
movq -0x150(%rbp), %rdi
callq 0x255c0
movq -0x108(%rbp), %rsi
leaq -0xe0(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0xb060
movq -0x148(%rbp), %rdi
callq 0x7f60
movq %rax, %rsi
addq $0x40, %rsi
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x25b80
movq -0x110(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq -0x138(%rbp), %rdx
callq 0x22df0
jmp 0x23785
leaq -0xf0(%rbp), %rdi
callq 0x8770
leaq -0xe0(%rbp), %rdi
callq 0x8b80
movq -0x108(%rbp), %rdi
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x154(%rbp)
jmp 0x237b9
movl -0x154(%rbp), %eax
movl %eax, -0xf4(%rbp)
movl $0x0, -0xf8(%rbp)
movl -0xf8(%rbp), %eax
cmpl -0xf4(%rbp), %eax
jae 0x2386b
leaq -0x28(%rbp), %rdi
callq 0x7f60
movq -0x108(%rbp), %rdi
addq $0x50, %rax
movq %rax, -0x160(%rbp)
callq 0xd2c0
movq %rax, %rdi
callq 0x11e90
movl %eax, -0x158(%rbp)
jmp 0x23811
movq -0x160(%rbp), %rdi
movl -0x158(%rbp), %eax
movl %eax, -0xfc(%rbp)
leaq -0xfc(%rbp), %rsi
callq 0x25c70
jmp 0x23832
jmp 0x23834
movl -0xf8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf8(%rbp)
jmp 0x237cf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x8770
leaq -0xe0(%rbp), %rdi
callq 0x8b80
jmp 0x2387d
leaq -0x28(%rbp), %rdi
callq 0x8120
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x8120
movq -0x38(%rbp), %rdi
callq 0x6540
nop