// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/marsh.c
// Function: unmarshal_one_env
static const uint8_t *unmarshal_one_env(
    UnmarshalState *st,
    const uint8_t *data,
    JanetFuncEnv **out,
    int flags) {
    MARSH_EOS(st, data);
    if (*data == LB_FUNCENV_REF) {
        data++;
        int32_t index = readint(st, &data);
        if (index < 0 || index >= janet_v_count(st->lookup_envs))
            janet_panicf("invalid funcenv reference %d", index);
        *out = st->lookup_envs[index];
    } else {
        JanetFuncEnv *env = janet_gcalloc(JANET_MEMORY_FUNCENV, sizeof(JanetFuncEnv));
        env->length = 0;
        env->offset = 0;
        env->as.values = NULL;
        janet_v_push(st->lookup_envs, env);
        int32_t offset = readnat(st, &data);
        int32_t length = readnat(st, &data);
        if (offset > 0) {
            Janet fiberv;
            /* On stack variant */
            data = unmarshal_one(st, data, &fiberv, flags);
            janet_asserttype(fiberv, JANET_FIBER, st);
            env->as.fiber = janet_unwrap_fiber(fiberv);
            /* Negative offset indicates untrusted input */
            env->offset = -offset;
        } else {
            /* Off stack variant */
            if (length == 0) {
                janet_panic("invalid funcenv length");
            }
            env->as.values = janet_malloc(sizeof(Janet) * (size_t) length);
            if (!env->as.values) {
                JANET_OUT_OF_MEMORY;
            }
            env->offset = 0;
            for (int32_t i = 0; i < length; i++)
                data = unmarshal_one(st, data, env->as.values + i, flags);
        }
        env->length = length;
        *out = env;
    }
    return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0xf0(%rcx), %rax
jb 0x458d4
leaq 0x4731d(%rip), %rdi     # 0x8cbec
callq 0x1ad60
jmp 0x458d6
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xdb, %eax
jne 0x45972
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x418c0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jl 0x45942
movl -0x20(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x45931
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movl -0x4(%rax), %eax
movl %eax, -0x44(%rbp)
jmp 0x45938
xorl %eax, %eax
movl %eax, -0x44(%rbp)
jmp 0x45938
movl -0x40(%rbp), %eax
movl -0x44(%rbp), %ecx
cmpl %ecx, %eax
jl 0x45953
movl -0x20(%rbp), %esi
leaq 0x4769b(%rip), %rdi     # 0x8cfe7
movb $0x0, %al
callq 0x1ac40
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x45b6b
movl $0xb, %edi
movl $0x20, %esi
callq 0x39e40
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xd8(%rax)
je 0x459d6
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movl -0x4(%rax), %eax
addl $0x1, %eax
movq -0x8(%rbp), %rcx
movq 0xd8(%rcx), %rcx
cmpl -0x8(%rcx), %eax
jl 0x45a00
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x70760
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd8(%rax)
jmp 0x45a02
jmp 0x45a02
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0xd8(%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
leaq -0x10(%rbp), %rsi
callq 0x447b0
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x447b0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x45aa3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %ecx
leaq -0x38(%rbp), %rdx
callq 0x41d80
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdx
movq -0x38(%rbp), %rdi
movl $0x3, %esi
callq 0x45cb0
movq -0x38(%rbp), %rdi
callq 0x7b260
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
xorl %ecx, %ecx
subl -0x2c(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x45b56
cmpl $0x0, -0x30(%rbp)
jne 0x45ab5
leaq 0x47554(%rip), %rdi     # 0x8d004
callq 0x1ad60
movslq -0x30(%rbp), %rdi
shlq $0x3, %rdi
callq 0x12770
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x45b08
jmp 0x45ada
movq 0x6a50f(%rip), %rax     # 0xafff0
movq (%rax), %rdi
leaq 0x38519(%rip), %rsi     # 0x7e004
leaq 0x4718e(%rip), %rdx     # 0x8cc80
movl $0x35c, %ecx            # imm = 0x35C
movb $0x0, %al
callq 0x125f0
movl $0x1, %edi
callq 0x12a70
movq -0x28(%rbp), %rax
movl $0x0, 0x1c(%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x45b54
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdx
movslq -0x3c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movl -0x1c(%rbp), %ecx
callq 0x41d80
movq %rax, -0x10(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x45b1a
jmp 0x45b56
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)