// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: optimize
static opt_t optimize(s7_scheme *sc, s7_pointer code, int32_t hop, s7_pointer e)
                {
                    s7_pointer x;
#if OPTIMIZE_PRINT
                    fprintf(stderr, "optimize: %s %s\n", DISPLAY_80(code), DISPLAY(e));
#endif
                    for (x = code; (is_pair(x)) && (!is_checked(x)); x = cdr(x))
                    {
                        s7_pointer obj;
                        obj = car(x);
                        set_checked(x);
                        if (is_pair(obj))
                        {
                            if (!is_checked(obj))
                            {
                                if (optimize_expression(sc, obj, hop, e, true) == OPT_OOPS)
                                {
                                    s7_pointer p;
                                    for (p = cdr(x); is_pair(p); p = cdr(p));
                                    if (!is_null(p))
                                        eval_error_no_return(sc, sc->syntax_error_symbol, "stray dot in function body: ~S", 30, code);
                                    return(OPT_OOPS);
                                }
                            }
                        }
                        else
                        {
                            /* new 22-Sep-19, but I don't think this saves anything over falling into trailers */
                            if (is_symbol(obj))
                                set_optimize_op(obj, (is_keyword(obj)) ? OP_CON : ((is_global(obj)) ? OP_GLOBAL_SYM : OP_SYM));
                            else set_optimize_op(obj, OP_CON);
                        }
                    }
                    if (!is_list(x))
                        eval_error_no_return(sc, sc->syntax_error_symbol, "stray dot in function body: ~S", 30, code);
                    return(OPT_F);
                }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x1
popq %r12
movq %rsi, %r13
movb (%r13), %al
cmpb $0x1, %al
jne 0xb5984
movq (%r13), %rax
btl $0x16, %eax
jb 0xb59ee
movq 0x8(%r13), %rsi
orq $0x400000, %rax         # imm = 0x400000
movq %rax, (%r13)
movzbl (%rsi), %ecx
movw $0x188, %ax             # imm = 0x188
cmpl $0xa, %ecx
je 0xb594c
cmpl $0x1, %ecx
jne 0xb5961
testb $0x40, 0x2(%rsi)
jne 0xb5965
movq %rbx, %rdi
movl %ebp, %edx
movq %r15, %rcx
movl %r12d, %r8d
callq 0xac020
cmpl $0x2, %eax
jne 0xb5965
jmp 0xb596b
testb $-0x80, 0x6(%rsi)
jne 0xb5961
movb 0x2(%rsi), %al
andb $0x1, %al
cmpb $0x1, %al
movw $0x187, %ax             # imm = 0x187
sbbw $0x0, %ax
movw %ax, 0x4(%rsi)
movq 0x10(%r13), %r13
jmp 0xb58f6
movq 0x10(%r13), %r13
cmpb $0x1, (%r13)
je 0xb596b
pushq $0x2
popq %rbp
cmpq 0x110(%rbx), %r13
jne 0xb598c
jmp 0xb59f0
decb %al
xorl %ebp, %ebp
cmpb $0x2, %al
jb 0xb59f0
movq 0x1918(%rbx), %rsi
movq 0x820(%rbx), %rax
movslq 0x7dc(%rbx), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
andl $0x7, %ecx
movl %ecx, 0x7dc(%rbx)
leaq 0x2e629(%rip), %rcx     # 0xe3fe0
movq %rcx, 0x10(%rax)
movq $0x1e, 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
callq 0x2cdc0
jmp 0xb59f0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq