// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: check_lambda_1
static int32_t check_lambda_1(s7_scheme *sc, bool optl)
                {
                    /* code is a lambda form minus the "lambda": ((a b) (+ a b)) */
                    /* this includes unevaluated symbols (direct symbol table refs) in macro arg list */
                    s7_pointer code, body, form;
                    int32_t arity = 0;

                    /* fprintf(stderr, "%s[%d]: %s\n", __func__, __LINE__, DISPLAY(sc->code)); */

                    form = sc->code;
                    if ((sc->safety > NO_SAFETY) &&
                            (tree_is_cyclic(sc, form)))
                        s7_error(sc, sc->wrong_type_arg_symbol, wrap_string(sc, "lambda: body is cyclic", 22));

                    sc->code = cdr(sc->code);
                    code = sc->code;
                    if (!is_pair(code))                                 /* (lambda) or (lambda . 1) */
                        eval_error_no_return(sc, sc->syntax_error_symbol, "lambda: no args? ~A", 19, form);

                    body = cdr(code);
                    if (!is_pair(body))                                 /* (lambda #f) */
                        eval_error_no_return(sc, sc->syntax_error_symbol, "lambda: no body? ~A", 19, form);

                    /* in many cases, this is a no-op -- we already checked at define */
                    check_lambda_args(sc, car(code), &arity);
                    clear_symbol_list(sc);

                    /* look for (define f (let (...) (lambda ...))) and treat as equivalent to (define (f ...)...)
                     *   one problem the hop=0 fixes is that safe closures assume the old frame exists, so we need to check for define below
                     *   I wonder about apply define...
                     */
                    if ((optl) ||
                            (main_stack_op(sc) == OP_DEFINE1) ||
                            (((sc->stack_end - sc->stack_start) > 4) &&
                             (((opcode_t)(sc->stack_end[-5])) == OP_DEFINE1) &&  /* surely if define is ok, so is define dilambda? 16-Apr-16 */
                             (sc->op_stack_now > sc->op_stack) &&
                             ((*(sc->op_stack_now - 1)) == (s7_pointer)slot_value(global_slot(sc->dilambda_symbol)))))
                        optimize_lambda(sc, true, sc->unused, car(code), body);
                    else
                    {
                        if (optimize(sc, body, 0,
                                    /* ((sc->op_stack_now > sc->op_stack) && (is_c_function((*(sc->op_stack_now - 1)))) && (is_scope_safe((*(sc->op_stack_now - 1))))) ? 1 : 0, */
                                    /* this works except when someone resets outlet(curlet) after defining a local function! */
                                    collect_parameters(sc, car(sc->code), sc->nil)) == OPT_OOPS)
                            clear_all_optimizations(sc, body);
                    }
                    pair_set_syntax_op(form, OP_LAMBDA_UNCHECKED);
                    if (arity < -1) arity++; /* confusing! at least 0 = (), but (lambda arg...) has same "arity" here as (lambda (a . b)...)? */
                    set_opt3_any(sc->code, (s7_pointer)((intptr_t)arity));
                    return(arity);
                }

// Assembly:
subq $0x88, %rsp
movb %sil, %al
movq %rdi, 0x80(%rsp)
andb $0x1, %al
movb %al, 0x7f(%rsp)
movl $0x0, 0x5c(%rsp)
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x60(%rsp)
movq 0x80(%rsp), %rax
cmpq $0x0, 0x6a0(%rax)
jle 0x1827f6
movq 0x80(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x2f870
testb $0x1, %al
jne 0x1827aa
jmp 0x1827f6
movq 0x80(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x80(%rsp), %rax
movq 0x1940(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x6d71f(%rip), %rsi     # 0x1efef9
movl $0x16, %edx
callq 0xb880
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rcx
movq 0x80(%rsp), %rax
movq %rcx, (%rax)
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x182898
movq 0x80(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x80(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x6d6a6(%rip), %rsi     # 0x1eff10
movl $0x13, %edx
callq 0xb880
movq 0x30(%rsp), %rdi
movq %rax, %rsi
movq 0x60(%rsp), %rdx
callq 0xb830
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq 0x70(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x18291e
movq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x80(%rsp), %rax
movq 0x1918(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x80(%rsp), %rdi
leaq 0x6d634(%rip), %rsi     # 0x1eff24
movl $0x13, %edx
callq 0xb880
movq 0x18(%rsp), %rdi
movq %rax, %rsi
movq 0x60(%rsp), %rdx
callq 0xb830
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %rax, %rdx
callq 0x2f940
movq 0x80(%rsp), %rdi
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0x5c(%rsp), %rdx
callq 0x11e7e0
movq 0x80(%rsp), %rdi
callq 0xdd1b0
testb $0x1, 0x7f(%rsp)
jne 0x1829f1
movq 0x80(%rsp), %rax
movq 0x50(%rax), %rax
movq -0x8(%rax), %rax
cmpq $0x19e, %rax            # imm = 0x19E
je 0x1829f1
movq 0x80(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x80(%rsp), %rcx
movq 0x48(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
cmpq $0x4, %rax
jle 0x182a22
movq 0x80(%rsp), %rax
movq 0x50(%rax), %rax
movq -0x28(%rax), %rax
cmpq $0x19e, %rax            # imm = 0x19E
jne 0x182a22
movq 0x80(%rsp), %rax
movq 0x68(%rax), %rax
movq 0x80(%rsp), %rcx
cmpq 0x60(%rcx), %rax
jbe 0x182a22
movq 0x80(%rsp), %rax
movq 0x68(%rax), %rax
movq -0x8(%rax), %rax
movq 0x80(%rsp), %rcx
movq 0xe78(%rcx), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jne 0x182a22
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq 0x140(%rax), %rdx
movq 0x70(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x68(%rsp), %r8
movl $0x1, %esi
callq 0x182d50
jmp 0x182a91
movq 0x80(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x80(%rsp), %rdi
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rsi
movq 0x80(%rsp), %rax
movq 0x110(%rax), %rdx
callq 0x17fc80
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rcx
xorl %edx, %edx
callq 0x1835e0
cmpl $0x2, %eax
jne 0x182a8f
movq 0x80(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x15a840
jmp 0x182a91
jmp 0x182a93
movq 0x60(%rsp), %rax
movw $0x214, 0x4(%rax)       # imm = 0x214
movq 0x60(%rsp), %rax
movq (%rax), %rcx
andq $-0x10000, %rcx         # imm = 0xFFFF0000
orq $0x201, %rcx            # imm = 0x201
movq 0x60(%rsp), %rax
movq %rcx, (%rax)
cmpl $-0x1, 0x5c(%rsp)
jge 0x182ace
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x182ad0
movslq 0x5c(%rsp), %rcx
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x80(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rcx
andq $-0x40001, %rcx         # imm = 0xFFFBFFFF
movq %rcx, (%rax)
movl 0x5c(%rsp), %eax
addq $0x88, %rsp
retq
nopl (%rax,%rax)