// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: optimize_func_one_arg
static opt_t optimize_func_one_arg(s7_scheme *sc, s7_pointer expr, s7_pointer func,
                        int32_t hop, int32_t pairs, int32_t symbols, int32_t quotes, int32_t bad_pairs, s7_pointer e)
                {
                    s7_pointer arg1;
                    /* very often, expr is already optimized, quoted stuff is counted under "bad_pairs"! as well as quotes */
#if OPTIMIZE_PRINT
                    fprintf(stderr, "%s expr: %s, func: %s, hop: %d, pairs: %d, symbols: %d, quotes: %d, bad: %d\n", __func__, DISPLAY_80(expr), DISPLAY(func), hop, pairs, symbols, quotes, bad_pairs);
#endif
                    if (quotes > 0)
                    {
                        if (direct_memq(sc->quote_symbol, e))
                            return(OPT_OOPS);
                        if ((bad_pairs == quotes) &&
                                (is_constant_symbol(sc, car(expr))))
                            hop = 1;
                    }

                    arg1 = cadr(expr);
                    /* need in_with_let -> search only rootlet not find_symbol */
                    if ((symbols == 1) &&
                            (!arg_findable(sc, arg1, e)))
                    {
                        /* wrap the bad arg in a check symbol lookup */
                        if (s7_is_aritable(sc, func, 1))
                        {
                            set_c_call_direct(cdr(expr), fx_unsafe_s);
                            return(wrap_bad_args(sc, func, expr, 1, hop));
                        }
                        return(OPT_F);
                    }

                    if (((is_c_function(func)) &&
                                (c_function_required_args(func) <= 1) &&
                                (c_function_all_args(func) >= 1)) ||
                            ((is_c_function_star(func)) &&
                             (c_function_all_args(func) == 1))) /* surely no need to check key here? */
                        return(optimize_c_function_one_arg(sc, expr, func, hop, pairs, symbols, quotes, bad_pairs, e));

                    if (is_closure(func))
                        return(optimize_closure_one_arg(sc, expr, func, hop, pairs, symbols, quotes, bad_pairs, e));

                    if (is_closure_star(func))
                    {
                        if (is_null(closure_args(func)))
                            return(OPT_F);
                        if (fx_count(sc, expr) == 1)
                        {
                            bool safe_case;
                            safe_case = is_safe_closure(func);
                            if (is_immutable(func)) hop = 1;
                            annotate_arg(sc, cdr(expr), e);
                            set_opt1_lambda(expr, func);
                            set_opt3_arglen(expr, small_int(1));
                            set_unsafely_optimized(expr);
                            if (lambda_has_simple_defaults(closure_body(func)))
                            {
                                if (arglist_has_rest(sc, closure_args(func)))
                                    set_optimize_op(expr, hop + ((safe_case) ? OP_SAFE_CLOSURE_STAR_FX_1 : OP_CLOSURE_STAR_FX));
                                else set_optimize_op(expr, hop + ((safe_case) ? OP_SAFE_CLOSURE_STAR_A : OP_CLOSURE_STAR_A));
                            }
                            else
                            {
                                if (safe_case)
                                    set_optimize_op(expr, hop + OP_SAFE_CLOSURE_STAR_FX_1);
                            }
                            return(OPT_F);
                        }
                        return(OPT_F);
                    }

                    if ((is_c_function_star(func)) &&  /* we checked above for c_function_all_args == 1 */
                            (fx_count(sc, expr) == 1))
                    {
                        if ((hop == 0) && (symbol_id(car(expr)) == 0)) hop = 1;
                        set_safe_optimize_op(expr, hop + OP_SAFE_C_FUNCTION_STAR_A); /* if one arg passed, it's obviously not a keyword-as-parameter-name */
                        annotate_arg(sc, cdr(expr), e);
                        set_opt3_arglen(expr, small_int(1));
                        set_c_function(expr, func);
                        return(OPT_T);
                    }

                    if ((is_any_vector(func)) &&
                            (is_fxable(sc, arg1)))
                    {
                        set_unsafe_optimize_op(expr, OP_IMPLICIT_VECTOR_REF_A);
                        annotate_arg(sc, cdr(expr), e);
                        set_opt3_arglen(expr, small_int(1));
                        return(OPT_T);
                    }

                    if ((func == sc->s7_let) &&
                            (((quotes == 1) && (is_symbol(cadr(arg1)))) ||
                             (is_keyword(arg1))))
                    {
                        /* (*s7* ...) */
                        set_safe_optimize_op(expr, OP_IMPLICIT_S7_LET_REF);
                        return(OPT_F);
                    }
                    /* unknown_* is set later */

                    return((is_optimized(expr)) ? OPT_T : OPT_F);
                }

// Assembly:
subq $0x58, %rsp
movq 0x70(%rsp), %rax
movl 0x68(%rsp), %eax
movl 0x60(%rsp), %eax
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq %rdx, 0x38(%rsp)
movl %ecx, 0x34(%rsp)
movl %r8d, 0x30(%rsp)
movl %r9d, 0x2c(%rsp)
cmpl $0x0, 0x60(%rsp)
jle 0x178f1b
movq 0x48(%rsp), %rax
movq 0x17b0(%rax), %rdi
movq 0x70(%rsp), %rsi
callq 0xde1a0
testb $0x1, %al
jne 0x178ee1
jmp 0x178eee
movl $0x2, 0x54(%rsp)
jmp 0x179473
movl 0x68(%rsp), %eax
cmpl 0x60(%rsp), %eax
jne 0x178f19
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0xc57c0
testb $0x1, %al
jne 0x178f11
jmp 0x178f19
movl $0x1, 0x34(%rsp)
jmp 0x178f1b
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
cmpl $0x1, 0x2c(%rsp)
jne 0x178fc8
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq 0x180030
testb $0x1, %al
jne 0x178fc8
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movl $0x1, %edx
callq 0x3cbf0
testb $0x1, %al
jne 0x178f6a
jmp 0x178fbb
jmp 0x178f6c
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
leaq -0x7320c(%rip), %rcx    # 0x105d70
movq %rcx, 0x20(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movzwl 0x6(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x6(%rax)
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movl 0x34(%rsp), %r8d
movl $0x1, %ecx
callq 0x1800b0
movl %eax, 0x54(%rsp)
jmp 0x179473
movl $0x0, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x30, %eax
jl 0x178fed
movq 0x38(%rsp), %rax
cmpq $0x1, 0x18(%rax)
jg 0x178fed
movq 0x38(%rsp), %rax
cmpq $0x1, 0x28(%rax)
jge 0x179006
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x17904e
movq 0x38(%rsp), %rax
cmpq $0x1, 0x28(%rax)
jne 0x17904e
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl 0x34(%rsp), %ecx
movl 0x30(%rsp), %r8d
movl 0x2c(%rsp), %r9d
movl 0x60(%rsp), %r11d
movl 0x68(%rsp), %r10d
movq 0x70(%rsp), %rax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x180470
movl %eax, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jne 0x1790a3
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl 0x34(%rsp), %ecx
movl 0x30(%rsp), %r8d
movl 0x2c(%rsp), %r9d
movl 0x60(%rsp), %r11d
movl 0x68(%rsp), %r10d
movq 0x70(%rsp), %rax
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1810d0
movl %eax, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x29, %eax
jne 0x179250
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x110(%rcx), %rax
jne 0x1790d8
movl $0x0, 0x54(%rsp)
jmp 0x179473
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x17fae0
cmpl $0x1, %eax
jne 0x179243
movq 0x38(%rsp), %rax
movzwl (%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x1f(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x179125
movl $0x1, 0x34(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x9d336(%rip), %rcx     # 0x216488
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
andq $-0x40001, %rcx         # imm = 0xFFFBFFFF
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
movq (%rax), %rcx
orq $0x800000, %rcx         # imm = 0x800000
orq $0x800, %rcx            # imm = 0x800
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
andq $0x400, %rax            # imm = 0x400
cmpq $0x0, %rax
je 0x179218
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x15d270
testb $0x1, %al
jne 0x1791c4
jmp 0x1791ee
movl 0x34(%rsp), %eax
movb 0x1f(%rsp), %sil
movl $0x11a, %ecx            # imm = 0x11A
movl $0x124, %edx            # imm = 0x124
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x179216
movl 0x34(%rsp), %eax
movb 0x1f(%rsp), %sil
movl $0x118, %ecx            # imm = 0x118
movl $0x11c, %edx            # imm = 0x11C
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x179236
testb $0x1, 0x1f(%rsp)
je 0x179234
movl 0x34(%rsp), %eax
addl $0x124, %eax            # imm = 0x124
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x179236
movl $0x0, 0x54(%rsp)
jmp 0x179473
movl $0x0, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x179343
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x17fae0
cmpl $0x1, %eax
jne 0x179343
cmpl $0x0, 0x34(%rsp)
jne 0x179298
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x20(%rax)
jne 0x179298
movl $0x1, 0x34(%rsp)
jmp 0x17929a
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0x96, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
movq 0x9d1a9(%rip), %rcx     # 0x216488
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
andq $-0x40001, %rcx         # imm = 0xFFFBFFFF
movq %rcx, (%rax)
jmp 0x179304
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x40(%rsp), %rax
movzwl 0x6(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x6(%rax)
jmp 0x179336
movl $0x1, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0xa13fc(%rip), %rax     # 0x21a750
testb $0x1, (%rax,%rcx)
je 0x1793ed
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x15cfb0
testb $0x1, %al
jne 0x179373
jmp 0x1793ed
jmp 0x179375
movq 0x40(%rsp), %rax
movq (%rax), %rcx
orq $0x800000, %rcx         # imm = 0x800000
orq $0x800, %rcx            # imm = 0x800
movq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq 0x40(%rsp), %rax
movw $0x174, 0x4(%rax)       # imm = 0x174
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
movq 0x9d0cb(%rip), %rcx     # 0x216488
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
andq $-0x40001, %rcx         # imm = 0xFFFBFFFF
movq %rcx, (%rax)
movl $0x1, 0x54(%rsp)
jmp 0x179473
movq 0x38(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x2150(%rcx), %rax
jne 0x179457
cmpl $0x1, 0x60(%rsp)
jne 0x17941c
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
je 0x17942f
movq 0x20(%rsp), %rax
movzwl 0x6(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x179457
jmp 0x179431
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movq 0x40(%rsp), %rax
movw $0x17c, 0x4(%rax)       # imm = 0x17C
movl $0x0, 0x54(%rsp)
jmp 0x179473
movq 0x40(%rsp), %rax
movzwl (%rax), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x801, %edx            # imm = 0x801
cmovel %ecx, %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)