// File: /workspace/github_c_makefile_star2_O2/BernardTatin[P]s7sh/s7.c
// Function: call_with_exit
static void call_with_exit(s7_scheme *sc)
    {
        int64_t i, new_stack_top, quit = 0;

        if (!call_exit_active(sc->code))
            s7_error(sc, sc->invalid_escape_function_symbol, set_elist_1(sc, wrap_string(sc, "call-with-exit escape procedure called outside its block", 56)));

        call_exit_active(sc->code) = false;
        new_stack_top = call_exit_goto_loc(sc->code);
        sc->op_stack_now = (s7_pointer *)(sc->op_stack + call_exit_op_loc(sc->code));

        /* look for dynamic-wind in the stack section that we are jumping out of */
        for (i = s7_stack_top(sc) - 1; i > new_stack_top; i -= 4)
        {
            opcode_t op;

            op = stack_op(sc->stack, i);
            switch (op)
            {
                case OP_DYNAMIC_WIND:
                    {
                        s7_pointer lx;
                        lx = stack_code(sc->stack, i);
                        if (dynamic_wind_state(lx) == DWIND_BODY)
                        {
                            dynamic_wind_state(lx) = DWIND_FINISH;
                            if (dynamic_wind_out(lx) != sc->F)
                            {
                                push_stack(sc, OP_EVAL_DONE, sc->args, sc->code);
                                sc->args = sc->nil;
                                sc->code = dynamic_wind_out(lx);
                                eval(sc, OP_APPLY);
                            }}}
                    break;

                case OP_EVAL_STRING:
                    s7_close_input_port(sc, sc->input_port);
                    pop_input_port(sc);
                    break;

                case OP_BARRIER:                /* oops -- we almost certainly went too far */
                    goto SET_VALUE;

                case OP_DEACTIVATE_GOTO:        /* here we're jumping into an unrelated call-with-exit block */
                    call_exit_active(stack_args(sc->stack, i)) = false;
                    break;

                case OP_LET_TEMP_DONE:
                    let_temp_done(sc, stack_args(sc->stack, i), stack_code(sc->stack, i), stack_let(sc->stack, i));
                    break;

                case OP_LET_TEMP_UNWIND:
                    let_temp_unwind(sc, stack_code(sc->stack, i), stack_args(sc->stack, i));
                    break;

                case OP_LET_TEMP_S7_UNWIND:
                    g_s7_let_set_fallback(sc, set_plist_3(sc, sc->s7_let, stack_code(sc->stack, i), stack_args(sc->stack, i)));
                    break;

                    /* call/cc does not close files, but I think call-with-exit should */
                case OP_GET_OUTPUT_STRING:
                case OP_UNWIND_OUTPUT:
                    {
                        s7_pointer x;
                        x = stack_code(sc->stack, i);                /* "code" = port that we opened */
                        s7_close_output_port(sc, x);
                        x = stack_args(sc->stack, i);                /* "args" = port that we shadowed, if not #<unused> */
                        if (x != sc->unused)
                            sc->output_port = x;
                    }
                    break;

                case OP_UNWIND_INPUT:
                    s7_close_input_port(sc, stack_code(sc->stack, i)); /* "code" = port that we opened */
                    sc->input_port = stack_args(sc->stack, i);         /* "args" = port that we shadowed */
                    break;

                case OP_EVAL_DONE: /* goto called in a method -- put off the inner eval return(s) until we clean up the stack */
                    quit++;
                    break;

                default:
                    break;
            }
        }

        /* is this right? maybe the SET_VALUE should skip setting stack_end? */
SET_VALUE:
        sc->stack_end = (s7_pointer *)(sc->stack_start + new_stack_top);

        /* the return value should have an implicit values call, just as in call/cc */
        if (is_null(sc->args))
            sc->value = sc->nil;
        else
        {
            if (is_null(cdr(sc->args)))
                sc->value = car(sc->args);
            else sc->value = splice_in_values(sc, sc->args);
        }

        if (quit > 0)
        {
            if (sc->longjmp_ok)
            {
                pop_stack(sc);
                longjmp(sc->goto_start, CALL_WITH_EXIT_JUMP);
            }
            for (i = 0; i < quit; i++)
                push_stack_op_let(sc, OP_EVAL_DONE);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
cmpb $0x0, 0x18(%rax)
jne 0x9baef
movq 0x1938(%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 0x48067(%rip), %rcx     # 0xe3b2d
movq %rcx, 0x10(%rax)
movq $0x38, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x2cdc0
movq (%rbx), %rax
movb $0x0, 0x18(%rax)
movq (%rbx), %rax
movq 0x50(%rbx), %r12
movq 0x8(%rax), %r15
movq 0x10(%rax), %rax
shlq $0x3, %rax
addq 0x60(%rbx), %rax
movq %rax, 0x68(%rbx)
subq 0x48(%rbx), %r12
sarq $0x3, %r12
xorl %r14d, %r14d
leaq -0x1(%r12), %rax
cmpq %r15, %rax
jle 0x9bd33
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq -0x8(%rax,%r12,8), %rcx
cmpq $0x1ba, %rcx            # imm = 0x1BA
je 0x9bc5c
cmpq $0x1c0, %rcx            # imm = 0x1C0
je 0x9bc9a
cmpq $0x1c1, %rcx            # imm = 0x1C1
je 0x9bc1b
cmpq $0x1df, %rcx            # imm = 0x1DF
je 0x9bc54
cmpq $0x1e1, %rcx            # imm = 0x1E1
je 0x9bcb9
cmpq $0x1ee, %rcx            # imm = 0x1EE
je 0x9bbef
cmpq $0x1ef, %rcx            # imm = 0x1EF
je 0x9bbbc
cmpq $0x204, %rcx            # imm = 0x204
je 0x9bcae
cmpq $0x207, %rcx            # imm = 0x207
je 0x9bbbc
cmpq $0x20f, %rcx            # imm = 0x20F
je 0x9bc78
cmpq $0x203, %rcx            # imm = 0x203
jne 0x9bd2a
jmp 0x9bd33
movq -0x20(%rax,%r12,8), %rsi
movq %rbx, %rdi
callq 0xd6b6
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq -0x10(%rax,%r12,8), %rax
cmpq 0x140(%rbx), %rax
je 0x9bd2a
movq %rax, 0x188(%rbx)
jmp 0x9bd2a
movq -0x20(%rax,%r12,8), %rsi
movq 0x8(%rsi), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq -0x10(%rax,%r12,8), %rax
movq %rax, 0x170(%rbx)
jmp 0x9bd2a
movq 0x2150(%rbx), %rcx
movq -0x20(%rax,%r12,8), %rdx
movq -0x10(%rax,%r12,8), %rax
movq 0x718(%rbx), %rsi
movq %rcx, 0x8(%rsi)
movq 0x10(%rsi), %rcx
movq %rdx, 0x8(%rcx)
movq 0x10(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq %rbx, %rdi
callq 0x70257
jmp 0x9bd2a
incq %r14
jmp 0x9bd2a
movq -0x10(%rax,%r12,8), %rsi
movq -0x20(%rax,%r12,8), %rdx
movq -0x18(%rax,%r12,8), %rcx
movq %rbx, %rdi
callq 0xa9c5e
jmp 0x9bd2a
movq 0x170(%rbx), %rsi
movq 0x8(%rsi), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rbx, %rdi
callq 0x29472
jmp 0x9bd2a
movq -0x20(%rax,%r12,8), %rsi
movq -0x10(%rax,%r12,8), %rdx
movq %rbx, %rdi
callq 0xa9ca6
jmp 0x9bd2a
movq -0x10(%rax,%r12,8), %rax
movb $0x0, 0x18(%rax)
jmp 0x9bd2a
movq -0x20(%rax,%r12,8), %rax
cmpl $0x1, 0x20(%rax)
jne 0x9bd2a
movl $0x2, 0x20(%rax)
movq 0x10(%rax), %rcx
cmpq 0x120(%rbx), %rcx
je 0x9bd2a
movq (%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rcx, (%rdx)
movq 0x8(%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rcx, 0x8(%rdx)
movq 0x10(%rbx), %rcx
movq 0x50(%rbx), %rdx
movq %rcx, 0x10(%rdx)
movq 0x50(%rbx), %rcx
movq $0x1df, 0x18(%rcx)      # imm = 0x1DF
addq $0x20, 0x50(%rbx)
movq 0x110(%rbx), %rcx
movq %rcx, 0x10(%rbx)
movq 0x10(%rax), %rax
movq %rax, (%rbx)
movl $0x198, %esi            # imm = 0x198
movq %rbx, %rdi
callq 0xe1a8
addq $-0x4, %r12
jmp 0x9bb19
shlq $0x3, %r15
addq 0x48(%rbx), %r15
movq %r15, 0x50(%rbx)
movq 0x10(%rbx), %rsi
movq 0x110(%rbx), %rax
cmpq %rax, %rsi
je 0x9bd63
cmpq %rax, 0x10(%rsi)
je 0x9bd5f
movq %rbx, %rdi
callq 0x29aa4
jmp 0x9bd63
movq 0x8(%rsi), %rax
movq %rax, 0x20(%rbx)
testq %r14, %r14
jle 0x9bdc5
cmpb $0x0, 0x678(%rbx)
je 0x9bdbf
movq 0x50(%rbx), %rax
leaq -0x20(%rax), %rcx
movq %rcx, 0x50(%rbx)
movups -0x20(%rax), %xmm0
movups -0x10(%rax), %xmm1
movups %xmm0, (%rbx)
movups %xmm1, 0x10(%rbx)
addq $0x5b0, %rbx            # imm = 0x5B0
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x8530
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x50(%rbx), %rax
movq $0x1df, 0x18(%rax)      # imm = 0x1DF
addq $0x20, 0x50(%rbx)
subq $0x1, %r14
jae 0x9bda2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq