// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: g_signature
static s7_pointer g_signature(s7_scheme *sc, s7_pointer args)
                {
                    s7_pointer p;
#define H_signature "(signature obj) returns obj's signature"
#define Q_signature s7_make_signature(sc, 2, s7_make_signature(sc, 2, sc->is_pair_symbol, sc->is_boolean_symbol), sc->T)

                    p = car(args);
                    switch (type(p))
                    {
                        case T_C_FUNCTION:
                        case T_C_FUNCTION_STAR:
                        case T_C_ANY_ARGS_FUNCTION:
                        case T_C_OPT_ARGS_FUNCTION:
                        case T_C_RST_ARGS_FUNCTION:
                        case T_C_MACRO:
                            return((s7_pointer)c_function_signature(p));

                        case T_MACRO:   case T_MACRO_STAR:
                        case T_BACRO:   case T_BACRO_STAR:
                        case T_CLOSURE: case T_CLOSURE_STAR:
                            {
                                s7_pointer func;
                                func = funclet_entry(sc, p, sc->local_signature_symbol);
                                if (func) return(func);
                                func = funclet_entry(sc, p, sc->signature_symbol);
                                if (func) return(s7_apply_function(sc, func, args));
                                return(sc->F);
                            }

                        case T_VECTOR:
                            if (vector_length(p) == 0) return(sc->F); /* sig () is #f so sig #() should be #f */
                            if (!is_typed_vector(p))
                                return(sc->vector_signature);
                            {
                                s7_pointer lst;
                                lst = list_3(sc, typed_vector_typer_symbol(sc, p), sc->is_vector_symbol, sc->is_integer_symbol);
                                cdddr(lst) = cddr(lst);
                                return(lst);
                            }

                        case T_FLOAT_VECTOR: return((vector_length(p) == 0) ? sc->F : sc->float_vector_signature);
                        case T_INT_VECTOR:   return((vector_length(p) == 0) ? sc->F : sc->int_vector_signature);
                        case T_BYTE_VECTOR:  return((vector_length(p) == 0) ? sc->F : sc->byte_vector_signature);
                        case T_PAIR:         return(sc->pair_signature);
                        case T_STRING:       return(sc->string_signature);

                        case T_HASH_TABLE:
                                             if (is_typed_hash_table(p))
                                                 return(list_3(sc,
                                                             hash_table_typer_symbol(sc, hash_table_value_typer(p)),
                                                             sc->is_hash_table_symbol,
                                                             hash_table_typer_symbol(sc, hash_table_key_typer(p))));
                                             return(sc->hash_table_signature);

                        case T_ITERATOR:
                                             p = iterator_sequence(p);
                                             if ((is_hash_table(p)) || (is_let(p)))   /* cons returned -- would be nice to include the car/cdr types if known */
                                                 return(list_1(sc, sc->is_pair_symbol));
                                             p = g_signature(sc, set_plist_1(sc, p));
                                             if (is_pair(p))
                                                 return(list_1(sc, car(p)));
                                             return(list_1(sc, sc->T));

                        case T_C_OBJECT:
                                             check_method(sc, p, sc->signature_symbol, args);
                                             return(sc->c_object_signature);

                        case T_LET:
                                             check_method(sc, p, sc->signature_symbol, args);
                                             return(sc->let_signature);

                        case T_SYMBOL:
                                             /* this used to get the symbol's value and call g_signature on that */
                                             {
                                                 s7_pointer slot;
                                                 slot = symbol_to_slot(sc, p);
                                                 if ((is_slot(slot)) && (slot_has_setter(slot)))
                                                 {
                                                     s7_pointer setter;
                                                     setter = slot_setter(slot);
                                                     p = g_signature(sc, set_plist_1(sc, setter));
                                                     if (is_pair(p))
                                                         return(list_1(sc, car(p)));
                                                 }
                                             }
                                             break;

                        default:
                                             break;
                    }
                    return(sc->F);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rsi), %r15
movzbl (%r15), %eax
decl %eax
cmpl $0x32, %eax
ja 0x3183b
movq %rsi, %r14
leaq 0xa1c7c(%rip), %rcx     # 0xd3324
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x16c8(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31541
testq %rax, %rax
jne 0x31ac0
movq 0x14d0(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x31541
testq %rax, %rax
je 0x3183b
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xa34c
movq 0x8(%r15), %rax
movq 0x38(%rax), %rax
jmp 0x31ac0
movq 0x8(%r15), %rax
movb (%rax), %cl
addb $-0x1b, %cl
cmpb $0x1, %cl
ja 0x318e0
movq 0x1140(%rbx), %r14
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r15
cmpq 0x98(%rbx), %rax
ja 0x3174a
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
jmp 0x31ac0
movq 0x1970(%rbx), %rax
jmp 0x31ac0
cmpq $0x0, 0x8(%r15)
je 0x3183b
testb $0x2, 0x6(%r15)
jne 0x319da
movq 0x1978(%rbx), %rax
jmp 0x31ac0
leaq 0x1988(%rbx), %rax
jmp 0x31857
movq 0x19b0(%rbx), %rax
jmp 0x31ac0
testb $0x40, 0x3(%r15)
je 0x317ed
cmpb $0x1, 0x24c(%rbx)
jne 0x317ed
movq %rbx, %rdi
movq %r15, %rsi
callq 0x88f3
movq 0x14d0(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x888f
cmpq 0x128(%rbx), %rax
jne 0x318a5
movq 0x1998(%rbx), %rax
jmp 0x31ac0
movq %rbx, %rdi
movq %r15, %rsi
callq 0xb00b
cmpb $0x20, (%rax)
jne 0x3183b
testb $0x4, 0x2(%rax)
je 0x3183b
movq 0x28(%rax), %rax
movq 0x700(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x700(%rbx), %rsi
movq %rbx, %rdi
callq 0x3167f
cmpb $0x1, (%rax)
jne 0x3183b
movq 0x8(%rax), %r14
jmp 0x31724
movq 0x120(%rbx), %rax
jmp 0x31ac0
leaq 0x1980(%rbx), %rax
jmp 0x31857
leaq 0x1990(%rbx), %rax
addq $0x120, %rbx            # imm = 0x120
cmpq $0x0, 0x8(%r15)
cmovneq %rax, %rbx
movq (%rbx), %rax
jmp 0x31ac0
testb $0x40, 0x3(%r15)
je 0x318d4
cmpb $0x1, 0x24c(%rbx)
jne 0x318d4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x88f3
movq 0x14d0(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x888f
cmpq 0x128(%rbx), %rax
je 0x318d4
movq %rax, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x35492
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
jmp 0x316f0
testb $0x2, 0x6(%r15)
jne 0x31921
movq 0x19a8(%rbx), %rax
jmp 0x31ac0
movq 0x19a0(%rbx), %rax
jmp 0x31ac0
movq 0x700(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x700(%rbx), %rsi
movq %rbx, %rdi
callq 0x3167f
cmpb $0x1, (%rax)
movq 0x110(%rbx), %r14
movq 0x90(%rbx), %rcx
movq 0x98(%rbx), %rdx
jne 0x31a87
movq 0x8(%rax), %r15
jmp 0x31a8e
movq 0x28(%r15), %rax
movq 0x20(%rax), %r15
movq 0x20(%r15), %rsi
movq %rbx, %rdi
callq 0x7b57e
movq %rax, %r14
movq 0x10a0(%rbx), %r12
movq 0x18(%r15), %rsi
movq %rbx, %rdi
callq 0x7b57e
movq %rax, %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r13
cmpq 0x98(%rbx), %rax
ja 0x31974
movq %rbx, %rdi
callq 0x9c27
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 %r15, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rdx
leaq -0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rdx), %rdx
movq %rcx, (%rdx)
movq %r12, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rax), %rax
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq %rdx, 0x10(%rax)
jmp 0x31ac0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7b13b
movq %rax, %r14
movq 0x11b0(%rbx), %r15
movq 0x10d0(%rbx), %r12
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r13
cmpq 0x98(%rbx), %rax
ja 0x31a1c
movq %rbx, %rdi
callq 0x9c27
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 %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
movq 0x90(%rbx), %rdx
leaq -0x8(%rdx), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rdx), %rdx
movq %rcx, (%rdx)
movq %r15, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rsi
movq %rsi, 0x90(%rbx)
movq -0x8(%rax), %rax
movq %rcx, (%rax)
movq %r14, 0x8(%rax)
movq %rdx, 0x10(%rax)
movq 0x10(%rdx), %rcx
movq %rcx, 0x10(%rcx)
jmp 0x31ac0
movq 0x118(%rbx), %r15
cmpq %rdx, %rcx
ja 0x31aa2
movq %rbx, %rdi
callq 0x9c27
movq 0x90(%rbx), %rcx
leaq -0x8(%rcx), %rax
movq %rax, 0x90(%rbx)
movq -0x8(%rcx), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq