// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/marsh.c
// Function: marshal_one_def
static void marshal_one_def(MarshalState *st, JanetFuncDef *def, int flags) {
    MARSH_STACKCHECK;
    for (int32_t i = 0; i < janet_v_count(st->seen_defs); i++) {
        if (st->seen_defs[i] == def) {
            pushbyte(st, LB_FUNCDEF_REF);
            pushint(st, i);
            return;
        }
    }
    /* Add to lookup */
    janet_v_push(st->seen_defs, def);

    pushint(st, def->flags);
    pushint(st, def->slotcount);
    pushint(st, def->arity);
    pushint(st, def->min_arity);
    pushint(st, def->max_arity);
    pushint(st, def->constants_length);
    pushint(st, def->bytecode_length);
    if (def->flags & JANET_FUNCDEF_FLAG_HASENVS)
        pushint(st, def->environments_length);
    if (def->flags & JANET_FUNCDEF_FLAG_HASDEFS)
        pushint(st, def->defs_length);
    if (def->flags & JANET_FUNCDEF_FLAG_HASSYMBOLMAP)
        pushint(st, def->symbolmap_length);
    if (def->flags & JANET_FUNCDEF_FLAG_HASNAME)
        marshal_one(st, janet_wrap_string(def->name), flags);
    if (def->flags & JANET_FUNCDEF_FLAG_HASSOURCE)
        marshal_one(st, janet_wrap_string(def->source), flags);

    /* marshal constants */
    for (int32_t i = 0; i < def->constants_length; i++)
        marshal_one(st, def->constants[i], flags + 1);

    /* Marshal symbol map, if needed */
    for (int32_t i = 0; i < def->symbolmap_length; i++) {
        pushint(st, (int32_t) def->symbolmap[i].birth_pc);
        pushint(st, (int32_t) def->symbolmap[i].death_pc);
        pushint(st, (int32_t) def->symbolmap[i].slot_index);
        marshal_one(st, janet_wrap_symbol(def->symbolmap[i].symbol), flags + 1);
    }

    /* marshal the bytecode */
    janet_marshal_u32s(st, def->bytecode, def->bytecode_length);

    /* marshal the environments if needed */
    for (int32_t i = 0; i < def->environments_length; i++)
        pushint(st, def->environments[i]);

    /* marshal the sub funcdefs if needed */
    for (int32_t i = 0; i < def->defs_length; i++)
        marshal_one_def(st, def->defs[i], flags + 1);

    /* marshal source maps if needed */
    if (def->flags & JANET_FUNCDEF_FLAG_HASSOURCEMAP) {
        int32_t current = 0;
        for (int32_t i = 0; i < def->bytecode_length; i++) {
            JanetSourceMapping map = def->sourcemap[i];
            pushint(st, map.line - current);
            pushint(st, map.column);
            current = map.line;
        }
    }

    /* Marshal closure bitset, if needed */
    if (def->flags & JANET_FUNCDEF_FLAG_HASCLOBITSET) {
        janet_marshal_u32s(st, def->closure_bitset, ((def->slotcount + 31) >> 5));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x400, %eax            # imm = 0x400
jle 0x43c3e
leaq 0x462da(%rip), %rdi     # 0x89f13
callq 0x1ad60
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x43c66
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x4(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x43c6d
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0x43c6d
movl -0x54(%rbp), %eax
movl -0x58(%rbp), %ecx
cmpl %ecx, %eax
jge 0x43cb9
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movslq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x10(%rbp), %rax
jne 0x43cac
movq -0x8(%rbp), %rdi
movl $0xdc, %esi
callq 0x40750
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x405d0
jmp 0x440b0
jmp 0x43cae
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x43c45
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x43cdf
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rcx
cmpl -0x8(%rcx), %eax
jl 0x43d03
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x70760
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
jmp 0x43d05
jmp 0x43d05
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x48(%rcx), %rsi
movl -0x4(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, -0x4(%rsi)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x58(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x5c(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x60(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x64(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x68(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x6c(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x70(%rax), %esi
callq 0x405d0
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x400000, %eax         # imm = 0x400000
cmpl $0x0, %eax
je 0x43dbc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x74(%rax), %esi
callq 0x405d0
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x200000, %eax         # imm = 0x200000
cmpl $0x0, %eax
je 0x43ddd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x78(%rax), %esi
callq 0x405d0
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x40000, %eax          # imm = 0x40000
cmpl $0x0, %eax
je 0x43dfe
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x7c(%rax), %esi
callq 0x405d0
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x80000, %eax          # imm = 0x80000
cmpl $0x0, %eax
je 0x43e42
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x7b550
movq -0x60(%rbp), %rdi
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rsi
callq 0x40840
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x43e86
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x7b550
movq -0x68(%rbp), %rdi
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %edx
movq -0x28(%rbp), %rsi
callq 0x40840
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x6c(%rcx), %eax
jge 0x43ec3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x2c(%rbp), %rcx
movl -0x14(%rbp), %edx
addl $0x1, %edx
movq (%rax,%rcx,8), %rsi
callq 0x40840
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x43e8d
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jge 0x43f89
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0x405d0
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movslq -0x30(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
callq 0x7b550
movq -0x70(%rbp), %rdi
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %edx
addl $0x1, %edx
movq -0x38(%rbp), %rsi
callq 0x40840
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x43eca
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x70(%rax), %edx
callq 0x44670
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x74(%rcx), %eax
jge 0x43fd7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x3c(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x405d0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x43fa8
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x78(%rcx), %eax
jge 0x44014
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x43c10
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x43fde
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x800000, %eax         # imm = 0x800000
cmpl $0x0, %eax
je 0x44081
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x70(%rcx), %eax
jge 0x4407f
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movslq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl -0x50(%rbp), %esi
subl -0x44(%rbp), %esi
callq 0x405d0
movq -0x8(%rbp), %rdi
movl -0x4c(%rbp), %esi
callq 0x405d0
movl -0x50(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x44033
jmp 0x44081
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
je 0x440b0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movl 0x5c(%rax), %edx
addl $0x1f, %edx
sarl $0x5, %edx
callq 0x44670
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)