// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
cmpb $0x0, 0x18(%rax)
jne 0xc6015
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 0x51ba1(%rip), %rcx     # 0x117b8d
movq %rcx, 0x10(%rax)
movq $0x38, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x38dfa
movq (%rbx), %rax
movb $0x0, 0x18(%rax)
movq (%rbx), %rcx
movq 0x48(%rbx), %rax
movq 0x8(%rcx), %r15
movq 0x10(%rcx), %rcx
shlq $0x3, %rcx
addq 0x60(%rbx), %rcx
movq %rcx, 0x68(%rbx)
movq 0x50(%rbx), %r12
subq %rax, %r12
sarq $0x3, %r12
leaq -0x1(%r12), %rcx
cmpq %r15, %rcx
jle 0xc6301
leaq 0x1c8(%rbx), %r13
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq -0x8(%rax,%r12,8), %rcx
cmpq $0x1ed, %rcx            # imm = 0x1ED
jle 0xc60e1
cmpq $0x203, %rcx            # imm = 0x203
jle 0xc618b
cmpq $0x204, %rcx            # imm = 0x204
je 0xc629c
cmpq $0x207, %rcx            # imm = 0x207
je 0xc61a5
cmpq $0x20f, %rcx            # imm = 0x20F
jne 0xc62db
movq 0x170(%rbx), %rsi
movq 0x8(%rsi), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movl 0x184(%rbx), %eax
movq %r13, %rcx
testl %eax, %eax
je 0xc60d9
decl %eax
movl %eax, 0x184(%rbx)
shlq $0x3, %rax
addq 0x178(%rbx), %rax
movq %rax, %rcx
movq (%rcx), %rax
jmp 0xc6293
cmpq $0x1c0, %rcx            # imm = 0x1C0
jle 0xc61ed
cmpq $0x1c1, %rcx            # imm = 0x1C1
je 0xc62a7
cmpq $0x1df, %rcx            # imm = 0x1DF
je 0xc626e
cmpq $0x1e1, %rcx            # imm = 0x1E1
jne 0xc62db
movq -0x20(%rax,%r12,8), %rax
cmpl $0x1, 0x20(%rax)
jne 0xc62db
movl $0x2, 0x20(%rax)
movq 0x10(%rax), %rcx
cmpq 0x120(%rbx), %rcx
je 0xc62db
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
jmp 0xc6264
cmpq $0x1ee, %rcx            # imm = 0x1EE
je 0xc6273
cmpq $0x1ef, %rcx            # imm = 0x1EF
jne 0xc62f2
movq -0x20(%rax,%r12,8), %rsi
cmpq %rsi, 0x120(%rbx)
je 0xc61cf
testb $0x1, 0x3(%rsi)
jne 0xc61cf
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
cmpq 0x140(%rbx), %rax
je 0xc62db
movq %rax, 0x188(%rbx)
jmp 0xc62db
cmpq $0x1ba, %rcx            # imm = 0x1BA
je 0xc621a
cmpq $0x1c0, %rcx            # imm = 0x1C0
jne 0xc62db
movq -0x20(%rax,%r12,8), %rsi
movq -0x10(%rax,%r12,8), %rdx
movq %rbx, %rdi
callq 0xd6b04
jmp 0xc62db
movq -0x10(%rax,%r12,8), %rcx
movq (%rbx), %rdx
movq 0x50(%rbx), %rsi
movups -0x20(%rax,%r12,8), %xmm0
movq %rdx, (%rsi)
movq 0x8(%rbx), %rax
movq 0x50(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq 0x10(%rbx), %rax
movq 0x50(%rbx), %rdx
movq %rax, 0x10(%rdx)
movq 0x50(%rbx), %rax
movq $0x1df, 0x18(%rax)      # imm = 0x1DF
addq $0x20, 0x50(%rbx)
movq %rcx, 0x10(%rbx)
movups %xmm0, (%rbx)
movl $0x1ba, %esi            # imm = 0x1BA
movq %rbx, %rdi
callq 0xfd85
jmp 0xc62db
incq %r14
jmp 0xc62db
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 0xc62db
movq -0x10(%rax,%r12,8), %rax
movb $0x0, 0x18(%rax)
jmp 0xc62db
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 0x8b80c
leaq -0x4(%r12), %rax
addq $-0x5, %r12
cmpq %r15, %r12
movq %rax, %r12
jg 0xc6057
jmp 0xc62fb
cmpq $0x203, %rcx            # imm = 0x203
jne 0xc62db
movq 0x48(%rbx), %rax
jmp 0xc6304
xorl %r14d, %r14d
leaq (%rax,%r15,8), %rax
movq %rax, 0x50(%rbx)
movq 0x10(%rbx), %rsi
movq 0x110(%rbx), %rax
cmpq %rax, %rsi
je 0xc6330
cmpq %rax, 0x10(%rsi)
je 0xc632c
movq %rbx, %rdi
callq 0x35a2c
jmp 0xc6330
movq 0x8(%rsi), %rax
movq %rax, 0x20(%rbx)
testq %r14, %r14
jle 0xc636b
cmpb $0x0, 0x678(%rbx)
jne 0xc6375
movq 0x50(%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq 0x50(%rbx), %rax
movq $0x1df, 0x18(%rax)      # imm = 0x1DF
movq 0x50(%rbx), %rax
addq $0x20, %rax
movq %rax, 0x50(%rbx)
decq %r14
jne 0xc6346
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
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
movq %rbx, %rdi
movl $0x1, %esi
callq 0x8530