// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
cmpb $0x0, 0x18(%rax)
jne 0xce7c4
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 0x522df(%rip), %rcx     # 0x120a7d
movq %rcx, 0x10(%rax)
movq $0x38, 0x8(%rax)
movq 0x6d8(%rbx), %rcx
movq %rax, 0x8(%rcx)
movq 0x6d8(%rbx), %rdx
movq %rbx, %rdi
callq 0x3b366
movq (%rbx), %rax
movb $0x0, 0x18(%rax)
movq (%rbx), %rax
movq 0x50(%rbx), %r12
movq 0x10(%rax), %rcx
shlq $0x3, %rcx
addq 0x60(%rbx), %rcx
movq 0x8(%rax), %r15
movq %rcx, 0x68(%rbx)
subq 0x48(%rbx), %r12
sarq $0x3, %r12
leaq -0x1(%r12), %rax
cmpq %r15, %rax
jle 0xceac4
addq $-0x5, %r12
xorl %r14d, %r14d
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x20(%rax,%r12,8), %rcx
cmpq $0x1ed, %rcx            # imm = 0x1ED
jle 0xce854
cmpq $0x203, %rcx            # imm = 0x203
jg 0xce909
cmpq $0x1ee, %rcx            # imm = 0x1EE
je 0xcea6e
cmpq $0x1ef, %rcx            # imm = 0x1EF
je 0xce994
cmpq $0x203, %rcx            # imm = 0x203
jne 0xceaa9
xorl %ebp, %ebp
jmp 0xceaac
cmpq $0x1c0, %rcx            # imm = 0x1C0
jle 0xce967
cmpq $0x1c1, %rcx            # imm = 0x1C1
je 0xcea38
cmpq $0x1df, %rcx            # imm = 0x1DF
je 0xcea33
cmpq $0x1e1, %rcx            # imm = 0x1E1
jne 0xceaa9
movq 0x8(%rax,%r12,8), %rax
movb $0x1, %bpl
cmpl $0x1, 0x20(%rax)
jne 0xceaac
movl $0x2, 0x20(%rax)
movq 0x10(%rax), %rcx
cmpq 0x120(%rbx), %rcx
je 0xceaac
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 0x10b83
jmp 0xceaac
cmpq $0x204, %rcx            # imm = 0x204
je 0xcea90
cmpq $0x207, %rcx            # imm = 0x207
je 0xce994
cmpq $0x20f, %rcx            # imm = 0x20F
jne 0xceaa9
movq 0x170(%rbx), %rsi
movq 0x8(%rsi), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movl 0x184(%rbx), %eax
testl %eax, %eax
je 0xcea9b
movq 0x178(%rbx), %rcx
decl %eax
movl %eax, 0x184(%rbx)
movq (%rcx,%rax,8), %rax
jmp 0xceaa2
cmpq $0x1ba, %rcx            # imm = 0x1BA
je 0xce9df
cmpq $0x1c0, %rcx            # imm = 0x1C0
jne 0xceaa9
movq 0x8(%rax,%r12,8), %rsi
movq 0x18(%rax,%r12,8), %rdx
movq %rbx, %rdi
callq 0xdf3b8
jmp 0xceaa9
movq 0x8(%rax,%r12,8), %rsi
cmpq %rsi, 0x120(%rbx)
je 0xce9b6
testb $0x1, 0x3(%rsi)
jne 0xce9b6
movq 0x8(%rsi), %rax
movq 0x48(%rax), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq 0x38(%rbx), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax,%r12,8), %rax
movb $0x1, %bpl
cmpq 0x140(%rbx), %rax
je 0xceaac
movq %rax, 0x188(%rbx)
jmp 0xceaac
movq 0x18(%rax,%r12,8), %rcx
movq (%rbx), %rdx
movq 0x50(%rbx), %rsi
movups 0x8(%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 0x10b83
jmp 0xceaa9
incq %r14
jmp 0xceaa9
movq 0x2150(%rbx), %rcx
movq 0x8(%rax,%r12,8), %rdx
movq 0x18(%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 0x91be7
jmp 0xceaa9
movq 0x8(%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 0x18(%rax,%r12,8), %rax
jmp 0xceaa2
movq 0x18(%rax,%r12,8), %rax
movb $0x0, 0x18(%rax)
jmp 0xceaa9
movq 0x1c8(%rbx), %rax
movq %rax, 0x170(%rbx)
movb $0x1, %bpl
testb %bpl, %bpl
je 0xceac7
leaq -0x4(%r12), %rax
cmpq %r15, %r12
movq %rax, %r12
jg 0xce803
jmp 0xceac7
xorl %r14d, %r14d
shlq $0x3, %r15
addq 0x48(%rbx), %r15
movq %r15, 0x50(%rbx)
movq 0x10(%rbx), %rsi
movq 0x110(%rbx), %rax
cmpq %rax, %rsi
je 0xceaf7
cmpq %rax, 0x10(%rsi)
je 0xceaf3
movq %rbx, %rdi
callq 0x37e41
jmp 0xceaf7
movq 0x8(%rsi), %rax
movq %rax, 0x20(%rbx)
testq %r14, %r14
jle 0xceb2b
cmpb $0x0, 0x678(%rbx)
jne 0xceb34
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)
decq %r14
jne 0xceb09
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
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 0x9530