// File: /workspace/github_c_makefile_star2_O3/BernardTatin[P]s7sh/s7.c
// Function: s7_arity
s7_pointer s7_arity(s7_scheme *sc, s7_pointer x)
                {
                    switch (type(x))
                    {
                        case T_C_OPT_ARGS_FUNCTION:
                        case T_C_RST_ARGS_FUNCTION:
                        case T_C_FUNCTION:
                            return(s7_cons(sc, s7_make_integer(sc, c_function_required_args(x)), s7_make_integer(sc, c_function_all_args(x))));

                        case T_C_ANY_ARGS_FUNCTION:
                        case T_C_FUNCTION_STAR:
                            return(s7_cons(sc, small_int(0), s7_make_integer(sc, c_function_all_args(x)))); /* should this be *2? */

                        case T_MACRO:
                        case T_BACRO:
                        case T_CLOSURE:
                            return(closure_arity_to_cons(sc, x, closure_args(x)));

                        case T_MACRO_STAR:
                        case T_BACRO_STAR:
                        case T_CLOSURE_STAR:
                            return(closure_star_arity_to_cons(sc, x, closure_args(x)));

                        case T_C_MACRO:
                            return(s7_cons(sc, s7_make_integer(sc, c_macro_required_args(x)), s7_make_integer(sc, c_macro_all_args(x))));

                        case T_GOTO:
                        case T_CONTINUATION:
                            return(s7_cons(sc, small_int(0), max_arity));

                        case T_STRING:
                            if (string_length(x) == 0) return(sc->F);
                            return(s7_cons(sc, small_int(1), small_int(1)));

                        case T_LET:
                            return(s7_cons(sc, small_int(1), small_int(1)));

                        case T_C_OBJECT:
                            check_method_uncopied(sc, x, sc->arity_symbol, list_1(sc, x));
                            if (is_safe_procedure(x))
                                return(s7_cons(sc, small_int(0), max_arity));
                            return(sc->F);

                        case T_VECTOR:
                            if (vector_length(x) == 0) return(sc->F);
                            if (has_simple_elements(x)) return(s7_cons(sc, small_int(1), make_integer(sc, vector_rank(x))));
                            return(s7_cons(sc, small_int(1), max_arity));

                        case T_INT_VECTOR:
                        case T_FLOAT_VECTOR:
                        case T_BYTE_VECTOR:
                            if (vector_length(x) == 0) return(sc->F);
                            return(s7_cons(sc, small_int(1), make_integer(sc, vector_rank(x))));

                        case T_PAIR:
                        case T_HASH_TABLE:
                            return(s7_cons(sc, small_int(1), max_arity));

                        case T_ITERATOR:
                            return(s7_cons(sc, small_int(0), small_int(0)));

                        case T_SYNTAX:
                            return(s7_cons(sc, small_int(syntax_min_args(x)), (syntax_max_args(x) == -1) ? max_arity : small_int(syntax_max_args(x))));
                    }
                    return(sc->F);
                }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl (%rsi), %eax
decl %eax
cmpl $0x32, %eax
ja 0x3f784
movq %rsi, %r14
leaq 0xc7f2c(%rip), %rcx     # 0x1073d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r14), %rsi
movq %rbx, %rdi
callq 0xd27e
movq %rax, %r15
jmp 0x3f555
movq 0x8(%r14), %rsi
cmpb $0xa, (%rsi)
jne 0x3f59f
movq 0x10747b(%rip), %r14    # 0x146950
jmp 0x3f81b
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9a1d8
movslq 0x28(%r14), %rsi
movq 0x10745c(%rip), %r15    # 0x146950
cmpq $-0x1, %rsi
je 0x3f5e2
movq %rbx, %rdi
callq 0xd27e
movq %rax, %r14
jmp 0x3f5e9
cmpq $0x0, 0x8(%r14)
je 0x3f784
movq 0x107438(%rip), %r15    # 0x146958
movq 0x18(%r14), %rax
movq 0x20(%rax), %rax
movq %r15, %r14
testq %rax, %rax
je 0x3f564
movq 0x10(%rax), %r12
cmpq $0x7ff, %r12            # imm = 0x7FF
ja 0x3f7cd
leaq 0x107408(%rip), %rax    # 0x146950
movq (%rax,%r12,8), %r14
jmp 0x3f564
movq 0x1073fb(%rip), %r15    # 0x146950
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0xd27e
movq %rax, %r14
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f583
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
jmp 0x3f617
movq 0x1073be(%rip), %r14    # 0x146958
jmp 0x3f797
movl 0x28(%r14), %eax
cmpl $0x40000000, %eax       # imm = 0x40000000
jne 0x3f5b6
movq %rbx, %rdi
callq 0x39d0d
movl %eax, 0x28(%r14)
testl %eax, %eax
js 0x3f80b
movl %eax, %r15d
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd27e
movq %rax, %r14
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd27e
movq %rax, %r15
jmp 0x3f822
movq 0x10cdbf(%rip), %r14    # 0x14c3a8
leaq 0x90(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f60f
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, (%r12)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
jmp 0x3f863
movq 0x10731a(%rip), %r14    # 0x146950
jmp 0x3f678
movslq 0x18(%r14), %rax
leaq 0x10730d(%rip), %rcx    # 0x146950
movq (%rcx,%rax,8), %r15
movslq 0x1c(%r14), %rax
cmpq $-0x1, %rax
leaq (%rcx,%rax,8), %rax
leaq 0x10cd4e(%rip), %rcx    # 0x14c3a8
cmovneq %rax, %rcx
movq (%rcx), %r14
jmp 0x3f564
cmpq $0x0, 0x8(%r14)
je 0x3f784
movq 0x1072e0(%rip), %r14    # 0x146958
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f697
movq %rbx, %rdi
callq 0xa550
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)
jmp 0x3f626
movq (%r14), %r12
btl $0x1e, %r12d
jae 0x3f77d
cmpb $0x1, 0x24c(%rbx)
jne 0x3f77d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8a63
movq 0xbd0(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x89ff
cmpq 0x128(%rbx), %rax
je 0x3f77d
movq %rax, %r15
movq 0x90(%rbx), %rax
movq 0x110(%rbx), %r12
cmpq 0x98(%rbx), %rax
ja 0x3f724
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
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xaee6
cmpq $0x0, 0x8(%r14)
je 0x3f784
testb $0x1, 0x7(%r14)
movq 0x1071ed(%rip), %r15    # 0x146958
jne 0x3f520
movq 0x10cc30(%rip), %r14    # 0x14c3a8
jmp 0x3f564
btl $0x15, %r12d
jb 0x3f790
movq 0x120(%rbx), %rax
jmp 0x3f863
movq 0x1071b9(%rip), %r14    # 0x146950
movq 0x10cc0a(%rip), %r15    # 0x14c3a8
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f7bd
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
jmp 0x3f850
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f7ec
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, 0x90(%rbx)
movq -0x8(%rax), %r14
movq $0xb, (%r14)
movq %r12, 0x8(%r14)
jmp 0x3f564
negl %eax
movq %rbx, %rdi
movq %rax, %rsi
callq 0xd27e
movq %rax, %r14
movq 0x10cb86(%rip), %r15    # 0x14c3a8
leaq 0x90(%rbx), %r12
movq 0x90(%rbx), %rax
cmpq 0x98(%rbx), %rax
ja 0x3f848
movq %rbx, %rdi
callq 0xa550
movq 0x90(%rbx), %rax
leaq -0x8(%rax), %rcx
movq %rcx, (%r12)
movq -0x8(%rax), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq