// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/marsh.c
// Function: unmarshal_one
static const uint8_t *unmarshal_one(
    UnmarshalState *st,
    const uint8_t *data,
    Janet *out,
    int flags) {
    uint8_t lead;
    MARSH_STACKCHECK;
    MARSH_EOS(st, data);
    lead = data[0];
    if (lead < LB_REAL) {
        *out = janet_wrap_integer(readint(st, &data));
        return data;
    }
    switch (lead) {
        case LB_NIL:
            *out = janet_wrap_nil();
            return data + 1;
        case LB_FALSE:
            *out = janet_wrap_false();
            return data + 1;
        case LB_TRUE:
            *out = janet_wrap_true();
            return data + 1;
        case LB_INTEGER:
            /* Long integer */
            MARSH_EOS(st, data + 4);
            uint32_t ui = ((uint32_t)(data[4])) |
                          ((uint32_t)(data[3]) << 8) |
                          ((uint32_t)(data[2]) << 16) |
                          ((uint32_t)(data[1]) << 24);
            int32_t si = (int32_t)ui;
            *out = janet_wrap_integer(si);
            return data + 5;
        case LB_REAL:
            /* Real */
        {
            union {
                double d;
                uint8_t bytes[8];
            } u;
            MARSH_EOS(st, data + 8);
#ifdef JANET_BIG_ENDIAN
            u.bytes[0] = data[8];
            u.bytes[1] = data[7];
            u.bytes[2] = data[6];
            u.bytes[3] = data[5];
            u.bytes[4] = data[4];
            u.bytes[5] = data[3];
            u.bytes[6] = data[2];
            u.bytes[7] = data[1];
#else
            memcpy(&u.bytes, data + 1, sizeof(double));
#endif
            *out = janet_wrap_number_safe(u.d);
            janet_v_push(st->lookup, *out);
            return data + 9;
        }
        case LB_STRING:
        case LB_SYMBOL:
        case LB_BUFFER:
        case LB_KEYWORD:
        case LB_REGISTRY: {
            data++;
            int32_t len = readnat(st, &data);
            MARSH_EOS(st, data - 1 + len);
            if (lead == LB_STRING) {
                const uint8_t *str = janet_string(data, len);
                *out = janet_wrap_string(str);
            } else if (lead == LB_SYMBOL) {
                const uint8_t *str = janet_symbol(data, len);
                *out = janet_wrap_symbol(str);
            } else if (lead == LB_KEYWORD) {
                const uint8_t *str = janet_keyword(data, len);
                *out = janet_wrap_keyword(str);
            } else if (lead == LB_REGISTRY) {
                if (st->reg) {
                    Janet regkey = janet_symbolv(data, len);
                    *out = janet_table_get(st->reg, regkey);
                } else {
                    *out = janet_wrap_nil();
                }
            } else { /* (lead == LB_BUFFER) */
                JanetBuffer *buffer = janet_buffer(len);
                buffer->count = len;
                safe_memcpy(buffer->data, data, len);
                *out = janet_wrap_buffer(buffer);
            }
            janet_v_push(st->lookup, *out);
            return data + len;
        }
        case LB_FIBER: {
            JanetFiber *fiber;
            data = unmarshal_one_fiber(st, data + 1, &fiber, flags + 1);
            *out = janet_wrap_fiber(fiber);
            return data;
        }
        case LB_FUNCTION: {
            JanetFunction *func;
            JanetFuncDef *def;
            data++;
            int32_t len = readnat(st, &data);
            if (len > 255) {
                janet_panicf("invalid function - too many environments (%d)", len);
            }
            func = janet_gcalloc(JANET_MEMORY_FUNCTION, sizeof(JanetFunction) +
                                 len * sizeof(JanetFuncEnv));
            func->def = NULL;
            for (int32_t i = 0; i < len; i++) {
                func->envs[i] = NULL;
            }
            *out = janet_wrap_function(func);
            janet_v_push(st->lookup, *out);
            data = unmarshal_one_def(st, data, &def, flags + 1);
            func->def = def;
            for (int32_t i = 0; i < len; i++) {
                data = unmarshal_one_env(st, data, &(func->envs[i]), flags + 1);
            }
            return data;
        }
        case LB_ABSTRACT: {
            data++;
            return unmarshal_one_abstract(st, data, out, flags);
        }
        case LB_REFERENCE:
        case LB_ARRAY:
        case LB_ARRAY_WEAK:
        case LB_TUPLE:
        case LB_STRUCT:
        case LB_STRUCT_PROTO:
        case LB_TABLE:
        case LB_TABLE_PROTO:
        case LB_TABLE_WEAKK:
        case LB_TABLE_WEAKV:
        case LB_TABLE_WEAKKV:
        case LB_TABLE_WEAKK_PROTO:
        case LB_TABLE_WEAKV_PROTO:
        case LB_TABLE_WEAKKV_PROTO:
            /* Things that open with integers */
        {
            data++;
            int32_t len = readnat(st, &data);
            /* DOS check */
            if (lead != LB_REFERENCE) {
                MARSH_EOS(st, data - 1 + len);
            }
            if (lead == LB_ARRAY || lead == LB_ARRAY_WEAK) {
                /* Array */
                JanetArray *array = (lead == LB_ARRAY_WEAK) ? janet_array_weak(len) : janet_array(len);
                array->count = len;
                *out = janet_wrap_array(array);
                janet_v_push(st->lookup, *out);
                for (int32_t i = 0; i < len; i++) {
                    data = unmarshal_one(st, data, array->data + i, flags + 1);
                }
            } else if (lead == LB_TUPLE) {
                /* Tuple */
                Janet *tup = janet_tuple_begin(len);
                int32_t flag = readint(st, &data);
                janet_tuple_flag(tup) |= flag << 16;
                for (int32_t i = 0; i < len; i++) {
                    data = unmarshal_one(st, data, tup + i, flags + 1);
                }
                *out = janet_wrap_tuple(janet_tuple_end(tup));
                janet_v_push(st->lookup, *out);
            } else if (lead == LB_STRUCT || lead == LB_STRUCT_PROTO) {
                /* Struct */
                JanetKV *struct_ = janet_struct_begin(len);
                if (lead == LB_STRUCT_PROTO) {
                    Janet proto;
                    data = unmarshal_one(st, data, &proto, flags + 1);
                    janet_asserttype(proto, JANET_STRUCT, st);
                    janet_struct_proto(struct_) = janet_unwrap_struct(proto);
                }
                for (int32_t i = 0; i < len; i++) {
                    Janet key, value;
                    data = unmarshal_one(st, data, &key, flags + 1);
                    data = unmarshal_one(st, data, &value, flags + 1);
                    janet_struct_put(struct_, key, value);
                }
                *out = janet_wrap_struct(janet_struct_end(struct_));
                janet_v_push(st->lookup, *out);
            } else if (lead == LB_REFERENCE) {
                if (len >= janet_v_count(st->lookup))
                    janet_panicf("invalid reference %d", len);
                *out = st->lookup[len];
            } else {
                /* Table */
                JanetTable *t;
                if (lead == LB_TABLE_WEAKK_PROTO || lead == LB_TABLE_WEAKK) {
                    t = janet_table_weakk(len);
                } else if (lead == LB_TABLE_WEAKV_PROTO || lead == LB_TABLE_WEAKV) {
                    t = janet_table_weakv(len);
                } else if (lead == LB_TABLE_WEAKKV_PROTO || lead == LB_TABLE_WEAKKV) {
                    t = janet_table_weakkv(len);
                } else {
                    t = janet_table(len);
                }
                *out = janet_wrap_table(t);
                janet_v_push(st->lookup, *out);
                if (lead == LB_TABLE_PROTO || lead == LB_TABLE_WEAKK_PROTO || lead == LB_TABLE_WEAKV_PROTO || lead == LB_TABLE_WEAKKV_PROTO) {
                    Janet proto;
                    data = unmarshal_one(st, data, &proto, flags + 1);
                    janet_asserttype(proto, JANET_TABLE, st);
                    t->proto = janet_unwrap_table(proto);
                }
                for (int32_t i = 0; i < len; i++) {
                    Janet key, value;
                    data = unmarshal_one(st, data, &key, flags + 1);
                    data = unmarshal_one(st, data, &value, flags + 1);
                    janet_table_put(t, key, value);
                }
            }
            return data;
        }
        case LB_UNSAFE_POINTER: {
            MARSH_EOS(st, data + sizeof(void *));
            data++;
            if (!(flags & JANET_MARSHAL_UNSAFE)) {
                janet_panicf("unsafe flag not given, "
                             "will not unmarshal raw pointer at index %d",
                             (int)(data - st->start));
            }
            union {
                void *ptr;
                uint8_t bytes[sizeof(void *)];
            } u;
            memcpy(u.bytes, data, sizeof(void *));
            data += sizeof(void *);
            *out = janet_wrap_pointer(u.ptr);
            janet_v_push(st->lookup, *out);
            return data;
        }
#ifdef JANET_EV
        case LB_POINTER_BUFFER: {
            data++;
            int32_t count = readnat(st, &data);
            int32_t capacity = readnat(st, &data);
            MARSH_EOS(st, data + sizeof(void *));
            union {
                void *ptr;
                uint8_t bytes[sizeof(void *)];
            } u;
            if (!(flags & JANET_MARSHAL_UNSAFE)) {
                janet_panicf("unsafe flag not given, "
                             "will not unmarshal raw pointer at index %d",
                             (int)(data - st->start));
            }
            memcpy(u.bytes, data, sizeof(void *));
            data += sizeof(void *);
            JanetBuffer *buffer = janet_pointer_buffer_unsafe(u.ptr, capacity, count);
            *out = janet_wrap_buffer(buffer);
            janet_v_push(st->lookup, *out);
            return data;
        }
#endif
        case LB_UNSAFE_CFUNCTION: {
            MARSH_EOS(st, data + sizeof(JanetCFunction));
            data++;
            if (!(flags & JANET_MARSHAL_UNSAFE)) {
                janet_panicf("unsafe flag not given, "
                             "will not unmarshal function pointer at index %d",
                             (int)(data - st->start));
            }
            union {
                JanetCFunction ptr;
                uint8_t bytes[sizeof(JanetCFunction)];
            } u;
            memcpy(u.bytes, data, sizeof(JanetCFunction));
            data += sizeof(JanetCFunction);
            *out = janet_wrap_cfunction(u.ptr);
            janet_v_push(st->lookup, *out);
            return data;
        }
#ifdef JANET_EV
        case LB_THREADED_ABSTRACT: {
            MARSH_EOS(st, data + sizeof(void *));
            data++;
            if (!(flags & JANET_MARSHAL_UNSAFE)) {
                janet_panicf("unsafe flag not given, "
                             "will not unmarshal threaded abstract pointer at index %d",
                             (int)(data - st->start));
            }
            union {
                void *ptr;
                uint8_t bytes[sizeof(void *)];
            } u;
            memcpy(u.bytes, data, sizeof(void *));
            data += sizeof(void *);

            if (flags & JANET_MARSHAL_DECREF) {
                /* Decrement immediately and don't bother putting into heap */
                janet_abstract_decref(u.ptr);
                *out = janet_wrap_nil();
            } else {
                *out = janet_wrap_abstract(u.ptr);
                Janet check = janet_table_get(&janet_vm.threaded_abstracts, *out);
                if (janet_checktype(check, JANET_NIL)) {
                    /* Transfers reference from threaded channel buffer to current heap */
                    janet_table_put(&janet_vm.threaded_abstracts, *out, janet_wrap_false());
                } else {
                    /* Heap reference already accounted for, remove threaded channel reference. */
                    janet_abstract_decref(u.ptr);
                }
            }

            janet_v_push(st->lookup, *out);
            return data;
        }
#endif
        default: {
            janet_panicf("unknown byte %x at index %d",
                         *data,
                         (int)(data - st->start));
            return NULL;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movq %rsi, -0x40(%rbp)
movzwl %r12w, %eax
cmpl $0x401, %eax            # imm = 0x401
jae 0x30e25
movq %rsi, %rbx
movq %rdi, %r13
movq 0xf0(%rdi), %rax
cmpq %rsi, %rax
jbe 0x30e19
movq %rdx, %r15
movzbl (%rbx), %r14d
cmpl $0xc7, %r14d
ja 0x30301
leaq -0x40(%rbp), %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3007a
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, (%r15)
movq (%rbx), %rbx
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal -0xc8(%r14), %ecx
cmpl $0x20, %ecx
ja 0x30eac
leaq 0x2f438(%rip), %rdx     # 0x5f750
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
incq %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, (%rsi)
movq %r13, -0x30(%rbp)
movq %r13, %rdi
callq 0x31b3b
movl %eax, %r13d
movl %eax, %edx
cmpl $0xda, %r14d
jne 0x30373
movq -0x30(%rbp), %rax
movq 0xc8(%rax), %rax
testq %rax, %rax
je 0x30e31
cmpl -0x4(%rax), %r13d
jge 0x30e31
movq (%rax,%rdx,8), %rax
movq %rax, (%r15)
movq -0x40(%rbp), %rbx
jmp 0x302ef
movq -0x40(%rbp), %rbx
leaq (%rbx,%rdx), %rax
decq %rax
movq -0x30(%rbp), %rcx
cmpq 0xf0(%rcx), %rax
jae 0x30e19
leal -0xd1(%r14), %eax
cmpl $0x17, %eax
ja 0x30ba0
leaq 0x2f42e(%rip), %rcx     # 0x5f7d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, -0x38(%rbp)
movl %r13d, %edi
callq 0x46574
movq %rax, %r15
cmpl $0xdf, %r14d
jne 0x30415
leal 0x1(%r12), %ecx
leaq -0x48(%rbp), %r14
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x30284
movq %rax, %rbx
movq %rax, -0x40(%rbp)
movq (%r14), %rdx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq %rdx, %rax
movabsq $-0x3000000000000, %rcx # imm = 0xFFFD000000000000
cmpq %rcx, %rax
jne 0x30ec6
movq %rdx, %rdi
callq 0x4ebc4
movq %rax, -0x8(%r15)
testl %r13d, %r13d
je 0x30ce5
incl %r12d
movq -0x30(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
leaq -0x48(%rbp), %rdx
movl %r12d, %ecx
callq 0x30284
movq %r14, %rdi
movq %rax, %rsi
leaq -0x58(%rbp), %rdx
movl %r12d, %ecx
callq 0x30284
movq %rax, %rbx
movq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r15, %rdi
callq 0x468b5
decl %r13d
jne 0x30425
jmp 0x30ce9
movq %r15, -0x38(%rbp)
incq %rbx
leaq -0x40(%rbp), %r12
movq %rbx, (%r12)
movq %r13, %rdi
movq %r12, %rsi
callq 0x31b3b
movl %eax, %r15d
movq (%r12), %rbx
movl %eax, %eax
movq %rax, -0x30(%rbp)
addq %rbx, %rax
decq %rax
cmpq 0xf0(%r13), %rax
jae 0x30e19
movq %r13, %r12
cmpl $0xcf, %r14d
jg 0x304e0
cmpl $0xce, %r14d
je 0x30952
cmpl $0xcf, %r14d
jne 0x3091c
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4709e
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
jmp 0x3097e
cmpl $0xd0, %r14d
je 0x30969
cmpl $0xd8, %r14d
jne 0x3091c
cmpq $0x0, 0xd0(%r12)
je 0x30d4e
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4709e
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq %rax, %rdi
callq 0x4ed39
movq 0xd0(%r12), %rdi
movq %rax, %rsi
callq 0x474e0
jmp 0x30986
movl %r13d, %edi
callq 0x47477
jmp 0x30ba8
movl %r13d, %edi
callq 0x474a0
jmp 0x30ba8
movl %r13d, %edi
callq 0x4744e
jmp 0x30ba8
incq %rbx
incl %r12d
leaq -0x48(%rbp), %r14
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl %r12d, %ecx
callq 0x31b5a
movq %rax, %rbx
movq (%r14), %rdi
movabsq $-0x6800000000000, %rsi # imm = 0xFFF9800000000000
callq 0x4ed7e
movq %rax, (%r15)
jmp 0x302ef
leaq 0x4(%rbx), %rcx
cmpq %rax, %rcx
jae 0x30e19
movl 0x1(%rbx), %eax
bswapl %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, (%r15)
addq $0x5, %rbx
jmp 0x302ef
leaq 0x8(%rbx), %rcx
cmpq %rax, %rcx
jae 0x30e19
movsd 0x1(%rbx), %xmm0
callq 0x4ef0b
movq %rax, (%r15)
movq 0xc8(%r13), %rax
testq %rax, %rax
je 0x305f2
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30611
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r13)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r15), %rdx
movq %rdx, (%rax,%rcx,8)
addq $0x9, %rbx
jmp 0x302ef
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
jmp 0x3064c
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
incq %rdi
jmp 0x3064c
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4ece6
movq %rax, (%r15)
incq %rbx
jmp 0x302ef
incq %rbx
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r12d, %ecx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3291f
movq %r12, %r14
movq %r13, %r12
movq %r15, %r13
incq %rbx
leaq -0x40(%rbp), %r15
movq %rbx, (%r15)
movq %r12, %rdi
movq %r15, %rsi
callq 0x31b3b
movl %eax, -0x30(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x31b3b
movq (%r15), %rsi
leaq 0x8(%rsi), %rbx
cmpq 0xf0(%r12), %rbx
jae 0x30e19
movq %r12, %r15
btl $0x11, %r14d
jae 0x30e61
movq (%rsi), %rdi
movl %eax, %esi
movl -0x30(%rbp), %edx
callq 0x17686
movabsq $-0x2800000000000, %rsi # imm = 0xFFFD800000000000
movq %rax, %rdi
callq 0x4ed7e
movq %rax, (%r13)
movq 0xc8(%r15), %rax
testq %rax, %rax
je 0x30707
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30726
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r15)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r13), %rdx
jmp 0x30e10
leaq 0x8(%rbx), %rcx
cmpq %rax, %rcx
jae 0x30e19
btl $0x11, %r12d
jae 0x30e71
movq 0x1(%rbx), %rdi
movabsq $-0x800000000000, %rsi  # imm = 0xFFFF800000000000
jmp 0x30837
leaq 0x8(%rbx), %rcx
cmpq %rax, %rcx
jae 0x30e19
btl $0x11, %r12d
jae 0x30e84
movq %r15, %r14
movabsq $-0x77fffffffffff, %r15 # imm = 0xFFF8800000000001
movq 0x1(%rbx), %rdi
btl $0x12, %r12d
jb 0x30cd0
movq %r13, -0x30(%rbp)
movabsq $-0x1000000000000, %rsi # imm = 0xFFFF000000000000
movq %rdi, -0x38(%rbp)
callq 0x4ed7e
movq %rax, %r13
movq %rax, (%r14)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq %rax, %r12
addq $0x268, %r12            # imm = 0x268
movq %r12, %rdi
movq %r13, %rsi
callq 0x474e0
movabsq $-0x800000000000, %rcx  # imm = 0xFFFF800000000000
andq %rax, %rcx
decq %r15
cmpq %r15, %rcx
jne 0x30d62
movabsq $-0x7000000000000, %rdi # imm = 0xFFF9000000000000
callq 0x4ece6
movq (%r14), %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x476f0
jmp 0x30d6b
leaq 0x8(%rbx), %rcx
cmpq %rax, %rcx
jae 0x30e19
btl $0x11, %r12d
jae 0x30e97
movq 0x1(%rbx), %rdi
movabsq $-0x1800000000000, %rsi # imm = 0xFFFE800000000000
callq 0x4ed7e
movq %rax, (%r15)
movq 0xc8(%r13), %rax
testq %rax, %rax
je 0x30856
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30875
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r13)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
addq $0x9, %rbx
jmp 0x30d40
movq %r12, -0x30(%rbp)
movq %r13, %rdi
movq %r15, %r13
incq %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, (%rsi)
movq %rdi, %r12
callq 0x31b3b
movl %eax, %r15d
cmpl $0x100, %eax            # imm = 0x100
jae 0x30e55
movl %r15d, %esi
shll $0x5, %esi
orl $0x18, %esi
movl $0x9, %edi
callq 0x2b686
movq %rax, %r14
movq $0x0, 0x10(%rax)
testl %r15d, %r15d
je 0x308de
leaq 0x18(%r14), %rdi
leal (,%r15,8), %edx
xorl %esi, %esi
callq 0x12410
movabsq $-0x2000000000000, %rsi # imm = 0xFFFE000000000000
movq %r14, %rdi
callq 0x4ed7e
movq %rax, (%r13)
movq 0xc8(%r12), %rax
testq %rax, %rax
je 0x309e0
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jge 0x309e0
movq %r12, %rdi
jmp 0x30a03
movl %r15d, %edi
callq 0x176f7
movq %rax, %r14
movl %r15d, 0x10(%rax)
movq 0x18(%rax), %rdi
movq %rbx, %rsi
movq -0x30(%rbp), %r15
movq %r15, %rdx
callq 0x48567
movabsq $-0x2800000000000, %rsi # imm = 0xFFFD800000000000
movq %r14, %rdi
callq 0x4ed7e
jmp 0x3098a
movq %rbx, %rdi
movl %r15d, %esi
callq 0x44754
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
jmp 0x3097e
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4709e
movabsq $-0x5000000000000, %rsi # imm = 0xFFFB000000000000
movq %rax, %rdi
callq 0x4ed39
movq -0x30(%rbp), %r15
movq -0x38(%rbp), %r13
movq %rax, (%r13)
movq 0xc8(%r12), %rax
testq %rax, %rax
je 0x309aa
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x309ca
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r12)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r13), %rdx
movq %rdx, (%rax,%rcx,8)
addq %r15, %rbx
jmp 0x302ef
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %r12, %rdi
movq %rax, 0xc8(%r12)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r13), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rcx
incl %ecx
leaq -0x48(%rbp), %r13
movq %r13, %rdx
movq %rcx, -0x30(%rbp)
callq 0x32092
movq %rax, %rbx
movq (%r13), %rax
movq %rax, 0x10(%r14)
testl %r15d, %r15d
je 0x302ef
addq $0x18, %r14
movl %r15d, %r15d
movq -0x30(%rbp), %r13
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl %r13d, %ecx
callq 0x3270d
movq %rax, %rbx
addq $0x8, %r14
decq %r15
jne 0x30a4a
jmp 0x302ef
movq %rdx, %r14
movl %r13d, %edi
callq 0x1471d
jmp 0x30aeb
movq %rdx, -0x60(%rbp)
movq %r15, -0x38(%rbp)
movl %r13d, %edi
callq 0x47fa0
movq %rax, %r15
leaq -0x40(%rbp), %rbx
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
callq 0x3007a
shll $0x10, %eax
orl %eax, -0x20(%r15)
movq (%rbx), %rbx
testl %r13d, %r13d
movq %r15, -0x50(%rbp)
je 0x30dab
incl %r12d
movq -0x30(%rbp), %r13
movq -0x60(%rbp), %r14
movq %r13, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x30284
movq %rax, %rbx
addq $0x8, %r15
decq %r14
jne 0x30abe
jmp 0x30daf
movq %rdx, %r14
movl %r13d, %edi
callq 0x14690
movl %r13d, 0x10(%rax)
movabsq $-0x4800000000000, %rsi # imm = 0xFFFB800000000000
movq %rax, -0x50(%rbp)
movq %rax, %rdi
callq 0x4ed7e
movq %rax, (%r15)
movq -0x30(%rbp), %rax
movq 0xc8(%rax), %rax
testq %rax, %rax
je 0x30b23
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30b46
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq -0x30(%rbp), %rcx
movq %rax, 0xc8(%rcx)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r15), %rdx
movq %rdx, (%rax,%rcx,8)
testl %r13d, %r13d
je 0x302ef
incl %r12d
leaq (,%r14,8), %rax
movq %rax, -0x38(%rbp)
xorl %r13d, %r13d
movq %r12, %r14
movq -0x30(%rbp), %r12
movq -0x50(%rbp), %r15
movq 0x18(%r15), %rdx
addq %r13, %rdx
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %ecx
callq 0x30284
movq %rax, %rbx
addq $0x8, %r13
cmpq %r13, -0x38(%rbp)
jne 0x30b79
jmp 0x302ef
movl %r13d, %edi
callq 0x47425
movq %rax, %rdi
movabsq $-0x3800000000000, %rsi # imm = 0xFFFC800000000000
movq %rax, -0x38(%rbp)
callq 0x4ed7e
movq %rax, (%r15)
movq -0x30(%rbp), %rax
movq 0xc8(%rax), %rax
testq %rax, %rax
je 0x30bdc
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30bff
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq -0x30(%rbp), %rcx
movq %rax, 0xc8(%rcx)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r15), %rdx
movq %rdx, (%rax,%rcx,8)
addl $0xffffff2c, %r14d      # imm = 0xFFFFFF2C
cmpl $0x13, %r14d
ja 0x30c78
movl $0xe0001, %eax          # imm = 0xE0001
btl %r14d, %eax
jae 0x30c78
leal 0x1(%r12), %ecx
leaq -0x48(%rbp), %r14
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x30284
movq %rax, %rbx
movq %rax, -0x40(%rbp)
movq (%r14), %rdx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq %rdx, %rax
movabsq $-0x3800000000000, %rcx # imm = 0xFFFC800000000000
cmpq %rcx, %rax
jne 0x30e42
movq %rdx, %rdi
callq 0x4ebc4
movq -0x38(%rbp), %r15
movq %rax, 0x28(%r15)
jmp 0x30c7c
movq -0x38(%rbp), %r15
testl %r13d, %r13d
je 0x302ef
incl %r12d
movq %r12, %r14
movq -0x30(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
leaq -0x48(%rbp), %rdx
movl %r14d, %ecx
callq 0x30284
movq %r12, %rdi
movq %rax, %rsi
leaq -0x58(%rbp), %rdx
movl %r14d, %ecx
callq 0x30284
movq %rax, %rbx
movq -0x48(%rbp), %rsi
movq -0x58(%rbp), %rdx
movq %r15, %rdi
callq 0x476f0
decl %r13d
jne 0x30c8f
jmp 0x302ef
callq 0x14681
movq %r15, %rdi
callq 0x4ece6
movq %rax, (%r14)
jmp 0x30d6f
movq -0x30(%rbp), %r14
movq %r15, %rdi
callq 0x468c4
movq %rax, %rdi
movabsq $-0x3000000000000, %rsi # imm = 0xFFFD000000000000
callq 0x4ed39
movq -0x38(%rbp), %r15
movq %rax, (%r15)
movq 0xc8(%r14), %rax
testq %rax, %rax
je 0x30d21
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30d40
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r14)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r15), %rdx
jmp 0x30e10
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
callq 0x4ece6
jmp 0x30986
movq -0x38(%rbp), %rdi
callq 0x14681
movq -0x30(%rbp), %r13
movq 0xc8(%r13), %rax
testq %rax, %rax
je 0x30d86
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30da5
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r13)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
addq $0x9, %rbx
jmp 0x30e07
movq -0x30(%rbp), %r13
movq -0x50(%rbp), %rdi
callq 0x47fd1
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
callq 0x4ed39
movq -0x38(%rbp), %r14
movq %rax, (%r14)
movq 0xc8(%r13), %rax
testq %rax, %rax
je 0x30de8
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
cmpl -0x8(%rax), %edx
jl 0x30e07
movq %rax, %rdi
movl $0x1, %esi
movl $0x8, %edx
callq 0x4b4e8
movq %rax, 0xc8(%r13)
movl -0x4(%rax), %ecx
leal 0x1(%rcx), %edx
movl %edx, -0x4(%rax)
movslq %ecx, %rcx
movq (%r14), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x302ef
leaq 0x2ed6c(%rip), %rdi     # 0x5fb8c
callq 0x191a3
leaq 0x2c0c7(%rip), %rdi     # 0x5cef3
callq 0x191a3
leaq 0x2eeec(%rip), %rdi     # 0x5fd24
movl %r13d, %esi
xorl %eax, %eax
callq 0x190bb
leaq 0x2f1d9(%rip), %rdi     # 0x60022
movl $0x200, %esi            # imm = 0x200
xorl %eax, %eax
callq 0x190bb
leaq 0x2ee9a(%rip), %rdi     # 0x5fcf6
movl %r15d, %esi
jmp 0x30e3b
subl 0xe8(%r15), %esi
leaq 0x2eeca(%rip), %rdi     # 0x5fd39
jmp 0x30e3b
incq %rbx
subl 0xe8(%r13), %ebx
leaq 0x2eeb7(%rip), %rdi     # 0x5fd39
jmp 0x30ea8
incq %rbx
subl 0xe8(%r13), %ebx
leaq 0x2ef2d(%rip), %rdi     # 0x5fdc2
jmp 0x30ea8
incq %rbx
subl 0xe8(%r13), %ebx
leaq 0x2eed3(%rip), %rdi     # 0x5fd7b
movl %ebx, %esi
jmp 0x30e3b
subl 0xe8(%r13), %ebx
leaq 0x2ef58(%rip), %rdi     # 0x5fe12
movl %r14d, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x190bb
leaq 0x2f155(%rip), %rdi     # 0x60022
movl $0x400, %esi            # imm = 0x400
jmp 0x30e4e