// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: g_procedure_source
static s7_pointer g_procedure_source(s7_scheme *sc, s7_pointer args)
                {
                    /* make it look like a scheme-level lambda */
                    s7_pointer p;
#define H_procedure_source "(procedure-source func) tries to return the definition of func"
#define Q_procedure_source s7_make_signature(sc, 2, sc->is_list_symbol, s7_make_signature(sc, 2, sc->is_procedure_symbol, sc->is_macro_symbol))

                    p = car(args);
                    if (is_symbol(p))
                    {
                        p = s7_symbol_value(sc, p);
                        if (p == sc->undefined)
                            return(s7_error(sc, sc->wrong_type_arg_symbol,
                                        set_elist_2(sc, wrap_string(sc, "procedure-source arg, '~S, is unbound", 37), p)));
                    }

                    if ((is_c_function(p)) || (is_c_macro(p)))
                        return(sc->nil);

                    check_method_uncopied(sc, p, sc->procedure_source_symbol, list_1(sc, p));
                    if (has_closure_let(p))
                    {
                        s7_pointer body;
                        body = closure_body(p);
                        /* perhaps if this function has been removed from the heap, it would be better to use copy_body (as in s7_copy)? */
                        if (is_safe_closure_body(body))
                            clear_safe_closure_body(body);
                        return(append_in_place(sc,
                                    list_2(sc, ((is_closure_star(p)) || (is_macro_star(p)) || (is_bacro_star(p))) ? sc->lambda_star_symbol : sc->lambda_symbol, closure_args(p)),
                                    body));
                    }

                    if (!is_procedure(p))
                        return(simple_wrong_type_argument_with_type(sc, sc->procedure_source_symbol, p,
                                    wrap_string(sc, "a procedure or a macro", 22)));
                    return(sc->nil);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %r14
movb (%r14), %al
cmpb $0xa, %al
jne 0x7f1ef
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9a93
movq %rax, %r14
cmpq 0x128(%rbx), %rax
je 0x7f389
movb (%r14), %al
cmpb $0x30, %al
setb %cl
cmpb $0x2e, %al
setne %al
testb %al, %cl
jne 0x7f209
movq 0x110(%rbx), %r15
jmp 0x7f474
movq (%r14), %r13
btl $0x1e, %r13d
jae 0x7f2a5
cmpb $0x1, 0x24c(%rbx)
jne 0x7f2a5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8a63
movq 0x1408(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x89ff
cmpq 0x128(%rbx), %rax
je 0x7f2a5
movq %rax, %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x7f273
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rdx
movq $0x200001, (%rdx)       # imm = 0x200001
movq %r14, 0x8(%rdx)
movq %r12, 0x10(%rdx)
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xaee6
movzbl %r13b, %eax
leaq 0xc7660(%rip), %rcx     # 0x146910
cmpb $0x1, (%rax,%rcx)
jne 0x7f3f1
movq 0x10(%r14), %r12
movl (%r12), %eax
btl $0xc, %eax
jae 0x7f2d5
andl $0xefff, %eax           # imm = 0xEFFF
movw %ax, (%r12)
movb (%r14), %r13b
addb $-0x29, %r13b
movl $0x1798, %eax           # imm = 0x1798
cmpb $0x4, %r13b
ja 0x7f2f3
movzbl %r13b, %eax
leaq 0x8ab89(%rip), %rcx     # 0x109e78
movq (%rcx,%rax,8), %rax
movq (%rbx,%rax), %r13
movq 0x8(%r14), %r14
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r15
cmpq 0x98(%rbx), %rax
ja 0x7f321
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movl $0x200001, %ecx         # imm = 0x200001
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
movq 0x90(%rbx), %rdx
leaq -0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rdx), %r15
movq %rcx, (%r15)
movq %r13, 0x8(%r15)
movq %rax, 0x10(%r15)
movq 0x110(%rbx), %rax
cmpq %r15, %rax
je 0x7f471
movq %r15, %rdx
movq %rdx, %rcx
movq 0x10(%rdx), %rdx
cmpq %rax, %rdx
jne 0x7f374
movq %r12, 0x10(%rcx)
jmp 0x7f474
movq 0x1940(%rbx), %r15
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x9caef(%rip), %rcx     # 0x11bea3
movq %rcx, 0x10(%rax)
movq $0x25, 0x8(%rax)
movq 0x6e0(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6e0(%rbx), %rax
movq 0x10(%rax), %rax
movq %r14, 0x8(%rax)
movq 0x6e0(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x38dfa
jmp 0x7f474
leaq 0xccf38(%rip), %rcx     # 0x14c330
cmpb $0x0, (%rax,%rcx)
jne 0x7f1fd
cmpb $0x14, %r13b
sete %al
shrl $0x15, %r13d
andl $0x1, %r13d
testb %r13b, %al
jne 0x7f1fd
movq 0x1408(%rbx), %rax
movq 0x8(%rax), %rsi
movq 0x140(%rbx), %rcx
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rdx
movq (%rax,%rdx,8), %r8
leal 0x1(%rdx), %eax
andl $0x7, %eax
movl %eax, 0x7dc(%rbx)
leaq 0x9ca78(%rip), %rax     # 0x11bec9
movq %rax, 0x10(%r8)
movq $0x16, 0x8(%r8)
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xed2a
movq %r12, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq