// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/util.c
// Function: janet_text_substitution
JanetByteView janet_text_substitution(
    Janet *subst,
    const uint8_t *bytes,
    uint32_t len,
    JanetArray *extra_argv) {
    int32_t extra_argc = extra_argv == NULL ? 0 : extra_argv->count;
    JanetType type = janet_type(*subst);
    switch (type) {
        case JANET_FUNCTION:
        case JANET_CFUNCTION: {
            int32_t argc = 1 + extra_argc;
            Janet *argv = janet_tuple_begin(argc);
            argv[0] = janet_stringv(bytes, len);
            for (int32_t i = 0; i < extra_argc; i++) {
                argv[i + 1] = extra_argv->data[i];
            }
            janet_tuple_end(argv);
            if (type == JANET_FUNCTION) {
                return to_byte_view(janet_call(janet_unwrap_function(*subst), argc, argv));
            } else {
                return to_byte_view(janet_unwrap_cfunction(*subst)(argc, argv));
            }
        }
        default:
            return memoize_byte_view(subst);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movl %edx, -0x24(%rbp)
movq %rcx, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x6cd28
xorl %eax, %eax
movl %eax, -0x6c(%rbp)
jmp 0x6cd32
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x18(%rbp), %rax
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x6cd4d
jmp 0x6cd61
movq -0x18(%rbp), %rax
movq (%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x70(%rbp)
jmp 0x6cd68
xorl %eax, %eax
movl %eax, -0x70(%rbp)
jmp 0x6cd68
movl -0x70(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
addl $-0xc, %eax
subl $0x1, %eax
ja 0x6ce72
jmp 0x6cd7f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edi
callq 0x6a740
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x64880
movq %rax, %rdi
movabsq $-0x6000000000000, %rsi # imm = 0xFFFA000000000000
callq 0x7b550
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x50(%rbp)
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x6ce07
movq -0x48(%rbp), %rax
movl -0x54(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq -0x30(%rbp), %rdx
movq 0x18(%rdx), %rdx
movslq -0x54(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x6cdd3
movq -0x48(%rbp), %rdi
callq 0x6a7a0
cmpl $0xc, -0x38(%rbp)
jne 0x6ce47
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x7b260
movq %rax, %rdi
movl -0x3c(%rbp), %esi
movq -0x48(%rbp), %rdx
callq 0x70ae0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
callq 0x6cea0
movq %rax, -0x10(%rbp)
movl %edx, -0x8(%rbp)
jmp 0x6ce82
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x7b260
movl -0x3c(%rbp), %edi
movq -0x48(%rbp), %rsi
callq *%rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x6cea0
movq %rax, -0x10(%rbp)
movl %edx, -0x8(%rbp)
jmp 0x6ce82
movq -0x18(%rbp), %rdi
callq 0x6cf00
movq %rax, -0x10(%rbp)
movl %edx, -0x8(%rbp)
movq -0x10(%rbp), %rax
movl -0x8(%rbp), %edx
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)