// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movb (%rsi), %al
cmpb $0x1, %al
jne 0xe1abd
movq %rcx, %r15
movl %edx, %ebp
movq %r14, %r12
movq (%r12), %rax
btl $0x16, %eax
jb 0xe1b47
movq 0x8(%r12), %rsi
orq $0x400000, %rax         # imm = 0x400000
movq %rax, (%r12)
movzbl (%rsi), %ecx
movw $0x188, %ax             # imm = 0x188
cmpl $0xa, %ecx
je 0xe1a97
cmpl $0x1, %ecx
jne 0xe1aac
testb $0x40, 0x2(%rsi)
jne 0xe1ab0
movq %rbx, %rdi
movl %ebp, %edx
movq %r15, %rcx
movl $0x1, %r8d
callq 0xd9bb5
cmpl $0x2, %eax
jne 0xe1ab0
jmp 0xe1b2b
testb $-0x80, 0x6(%rsi)
jne 0xe1aac
movb 0x2(%rsi), %al
andb $0x1, %al
cmpb $0x1, %al
movw $0x187, %ax             # imm = 0x187
sbbw $0x0, %ax
movw %ax, 0x4(%rsi)
movq 0x10(%r12), %r12
movb (%r12), %al
cmpb $0x1, %al
je 0xe1a46
decb %al
xorl %ebp, %ebp
cmpb $0x2, %al
jb 0xe1b49
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 0x3654c(%rip), %rcx     # 0x118040
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 0x38dfa
jmp 0xe1b49
movq 0x10(%r12), %r12
cmpb $0x1, (%r12)
je 0xe1b2b
movl $0x2, %ebp
cmpq 0x110(%rbx), %r12
jne 0xe1ac9
jmp 0xe1b49
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq