// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: optimize_closure_one_arg
static opt_t optimize_closure_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)
                {
                    bool one_form, safe_case;
                    s7_pointer body, arg1;
                    int32_t arit;

                    arg1 = cadr(expr);
                    arit = closure_arity_to_int(sc, func);
                    if (arit != 1)
                    {
                        if ((arit == -1) &&
                                (is_symbol(closure_args(func))))
                            return(optimize_func_dotted_args(sc, expr, func, hop, 1, e));
                        return(OPT_F);
                    }

                    safe_case = is_safe_closure(func);
                    body = closure_body(func);
                    one_form = is_null(cdr(body));
                    if (is_immutable(func)) hop = 1;

                    if (pairs == 0)
                    {
                        bool sym;
                        sym = (symbols == 1);
                        if (sym)
                            set_opt2_sym(expr, arg1);
                        else set_opt2_con(expr, arg1);
                        set_opt1_lambda(expr, func);

                        if (one_form)
                        {
                            if (safe_case)
                            {
                                if (is_fxable(sc, car(body)))
                                {
                                    annotate_arg(sc, body, e);
                                    if (sym)
                                    {
                                        if (((optimize_op(car(body)) == HOP_SAFE_C_S) || (optimize_op(car(body)) == HOP_SAFE_C_SC)) &&
                                                (car(closure_args(func)) == cadar(body)))
                                        {
                                            if (optimize_op(car(body)) == HOP_SAFE_C_S)
                                                set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_S_TO_S);
                                            else
                                            {
                                                set_opt3_any(cdr(expr), caddar(body));
                                                set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_S_TO_SC);
                                            }
                                        }
                                        else
                                        {
                                            if (car(closure_args(func)) == car(body))
                                                set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_ID_S);
                                            else set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_S_A);
                                        }
                                    }
                                    else set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_C_A);
                                    set_closure_has_fx(func);
                                    fx_tree(sc, body, car(closure_args(func)), NULL);
                                    return(OPT_T);
                                }
                                set_optimize_op(expr, hop + ((sym) ? OP_SAFE_CLOSURE_S_P : OP_SAFE_CLOSURE_C_P));
                            }
                            else set_optimize_op(expr, hop + ((sym) ? OP_CLOSURE_S_P : OP_CLOSURE_C_P));
                        }
                        else set_optimize_op(expr, hop + ((sym) ? ((safe_case) ? OP_SAFE_CLOSURE_S : OP_CLOSURE_S) : ((safe_case) ? OP_SAFE_CLOSURE_C : OP_CLOSURE_C)));
                        set_unsafely_optimized(expr);
                        return(OPT_F);
                    }

                    if (fx_count(sc, expr) == 1)
                    {
                        set_unsafely_optimized(expr);
                        set_opt1_lambda(expr, func);
                        annotate_arg(sc, cdr(expr), e);
                        set_opt3_arglen(expr, small_int(1));

                        if (one_form)
                        {
                            if (safe_case)
                            {
                                if (is_fxable(sc, car(body)))
                                {
                                    annotate_arg(sc, body, e);
                                    set_safe_optimize_op(expr, hop + OP_SAFE_CLOSURE_A_A);
                                    set_closure_has_fx(func);
                                    fx_tree(sc, body, car(closure_args(func)), NULL);
                                    return(OPT_T);
                                }
                                set_optimize_op(expr, hop + OP_SAFE_CLOSURE_A_P);
                            }
                            else set_optimize_op(expr, hop + OP_CLOSURE_A_P);
                        }
                        else set_optimize_op(expr, hop + ((safe_case) ? OP_SAFE_CLOSURE_A : OP_CLOSURE_A));
                        set_unsafely_optimized(expr);
                        return(OPT_F);
                    }
                    set_optimize_op(expr, hop + ((safe_case) ? OP_SAFE_CLOSURE_P : OP_CLOSURE_P));
                    set_opt1_lambda(expr, func);
                    set_unsafely_optimized(expr);
                    return(OPT_F);  /* don't check is_optimized here for OPT_T */
                }

// 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)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x15cd60
movl %eax, 0x14(%rsp)
cmpl $0x1, 0x14(%rsp)
je 0x18117b
cmpl $-0x1, 0x14(%rsp)
jne 0x18116e
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x18116e
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rdx
movl 0x34(%rsp), %ecx
movq 0x70(%rsp), %r9
movl $0x1, %r8d
callq 0x182300
movl %eax, 0x54(%rsp)
jmp 0x18171e
movl $0x0, 0x54(%rsp)
jmp 0x18171e
movq 0x38(%rsp), %rax
movzwl (%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x2a(%rsp)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x110(%rcx), %rax
sete %al
andb $0x1, %al
movb %al, 0x2b(%rsp)
movq 0x38(%rsp), %rax
movq (%rax), %rax
andq $0x1000000, %rax        # imm = 0x1000000
cmpq $0x0, %rax
je 0x1811dc
movl $0x1, 0x34(%rsp)
cmpl $0x0, 0x30(%rsp)
jne 0x181516
cmpl $0x1, 0x2c(%rsp)
sete %al
andb $0x1, %al
movb %al, 0x13(%rsp)
testb $0x1, 0x13(%rsp)
je 0x18120c
movq 0x18(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x18121a
movq 0x18(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%rax)
testb $0x1, 0x2b(%rsp)
je 0x181494
testb $0x1, 0x2a(%rsp)
je 0x18146a
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x15cfb0
testb $0x1, %al
jne 0x18125a
jmp 0x181440
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
testb $0x1, 0x13(%rsp)
je 0x1813d7
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movzwl 0x4(%rax), %eax
cmpl $0x5, %eax
je 0x1812a1
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movzwl 0x4(%rax), %eax
cmpl $0x9, %eax
jne 0x181367
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x181367
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movzwl 0x4(%rax), %eax
cmpl $0x5, %eax
jne 0x181301
jmp 0x1812d9
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xb4, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x181365
jmp 0x181303
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rcx
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 0x18133d
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xb6, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x181365
jmp 0x1813d5
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq 0x20(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x1813a9
jmp 0x181381
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xc2, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x1813d3
jmp 0x1813ab
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xb2, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x1813d3
jmp 0x1813d5
jmp 0x181401
jmp 0x1813d9
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xc0, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x181401
movq 0x38(%rsp), %rax
movq (%rax), %rcx
orq $0x500, %rcx            # imm = 0x500
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x15d170
movl $0x1, 0x54(%rsp)
jmp 0x18171e
movl 0x34(%rsp), %eax
movb 0x13(%rsp), %sil
movl $0xbe, %ecx
movl $0xb0, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x181492
movl 0x34(%rsp), %eax
movb 0x13(%rsp), %sil
movl $0xba, %ecx
movl $0xac, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x1814eb
movl 0x34(%rsp), %eax
movl %eax, 0xc(%rsp)
testb $0x1, 0x13(%rsp)
je 0x1814bd
movb 0x2a(%rsp), %dl
movl $0xaa, %eax
movl $0xae, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x8(%rsp)
jmp 0x1814d5
movb 0x2a(%rsp), %dl
movl $0xb8, %eax
movl $0xbc, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
movl 0x8(%rsp), %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%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)
movl $0x0, 0x54(%rsp)
jmp 0x18171e
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rsi
callq 0x17fae0
cmpl $0x1, %eax
jne 0x1816c2
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), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
movq 0x94f0f(%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)
testb $0x1, 0x2b(%rsp)
je 0x181672
testb $0x1, 0x2a(%rsp)
je 0x18165b
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x15cfb0
testb $0x1, %al
jne 0x1815cb
jmp 0x181644
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x70(%rsp), %rdx
callq 0x15d020
movq 0x40(%rsp), %rax
movzwl (%rax), %ecx
orl $0x800, %ecx            # imm = 0x800
movw %cx, (%rax)
movl 0x34(%rsp), %eax
addl $0xcc, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
movq 0x38(%rsp), %rax
movq (%rax), %rcx
orq $0x500, %rcx            # imm = 0x500
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x15d170
movl $0x1, 0x54(%rsp)
jmp 0x18171e
movl 0x34(%rsp), %eax
addl $0xca, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x181670
movl 0x34(%rsp), %eax
addl $0xc6, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
jmp 0x18169a
movl 0x34(%rsp), %eax
movb 0x2a(%rsp), %sil
movl $0xc4, %ecx
movl $0xc8, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%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)
movl $0x0, 0x54(%rsp)
jmp 0x18171e
movl 0x34(%rsp), %eax
movb 0x2a(%rsp), %sil
movl $0xce, %ecx
movl $0xd0, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq 0x40(%rsp), %rax
movw %cx, 0x4(%rax)
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x18(%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)
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopw (%rax,%rax)