// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: check_for_dynamic_winds
static bool check_for_dynamic_winds(s7_scheme *sc, s7_pointer c)
    {
        /* called only from call_with_current_continuation.
         *   if call/cc jumps into a dynamic-wind, the init/finish funcs are wrapped in with-baffle
         *   so they'll complain.  Otherwise we're supposed to re-run the init func before diving
         *   into the body.  Similarly for let-temporarily.  If a call/cc jumps out of a dynamic-wind
         *   body-func, we're supposed to call the finish-func.  The continuation is called at
         *   s7_stack_top(sc); the continuation form is at continuation_stack_top(c).
         */
        int64_t i;
        opcode_t op;

        /* check sc->stack for dynamic-winds we're jumping out of */
        for (i = s7_stack_top(sc) - 1; i > 0; i -= 4)
        {
            op = stack_op(sc->stack, i);
            switch (op)
            {
                case OP_DYNAMIC_WIND:
                case OP_LET_TEMP_DONE:
                    {
                        s7_pointer x;
                        int64_t j, s_base = 0;
                        x = stack_code(sc->stack, i);
                        for (j = 3; j < continuation_stack_top(c); j += 4)
                            if (((stack_op(continuation_stack(c), j) == OP_DYNAMIC_WIND) ||
                                        (stack_op(continuation_stack(c), j) == OP_LET_TEMP_DONE)) &&
                                    (x == stack_code(continuation_stack(c), j)))
                            {
                                s_base = i;
                                break;
                            }
                        if (s_base == 0)
                        {
                            if (op == OP_DYNAMIC_WIND)
                            {
                                if (dynamic_wind_state(x) == DWIND_BODY)
                                {
                                    dynamic_wind_state(x) = DWIND_FINISH;
                                    if (dynamic_wind_out(x) != sc->F)
                                    {
                                        push_stack(sc, OP_EVAL_DONE, sc->args, sc->code);
                                        sc->args = sc->nil;
                                        sc->code = dynamic_wind_out(x);
                                        eval(sc, OP_APPLY);
                                    }
                                }
                            }
                            else 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;

                case OP_BARRIER:
                    if (i > continuation_stack_top(c))  /* otherwise it's some unproblematic outer eval-string? */
                        return(false);                    /*    but what if we've already evaluated a dynamic-wind closer? */
                    break;

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

                default:
                    break;
            }
        }

        /* check continuation-stack for dynamic-winds we're jumping into */
        for (i = s7_stack_top(sc) - 1; i < continuation_stack_top(c); i += 4)
        {
            op = stack_op(continuation_stack(c), i);
            if (op == OP_DYNAMIC_WIND)
            {
                s7_pointer x;
                x = stack_code(continuation_stack(c), i);
                if (dynamic_wind_in(x) != sc->F)
                {
                    push_stack(sc, OP_EVAL_DONE, sc->args, sc->code);
                    sc->args = sc->nil;
                    sc->code = dynamic_wind_in(x);
                    eval(sc, OP_APPLY);
                }
                dynamic_wind_state(x) = DWIND_BODY;
            }
            else
            {
                if (op == OP_DEACTIVATE_GOTO)
                    call_exit_active(stack_args(continuation_stack(c), i)) = true;
                /* not let_temp_done here! */
                /* if op == OP_LET_TEMP_DONE, we're jumping back into a let-temporarily.  MIT and Chez scheme say they remember the
                 *   let-temp vars (fluid-let or parameters in their terminology) at the point of the call/cc, and restore them
                 *   on re-entry; that strikes me as incoherently complex -- they've wrapped a hidden dynamic-wind around the
                 *   call/cc to restore all let-temp vars!  I think let-temp here should be the same as let -- if you jump back
                 *   in, nothing hidden happens. So,
                 *     (let ((x #f) (cc #f)) (let-temporarily ((x 1)) (set! x 2) (call/cc (lambda (r) (set! cc r))) (display x) (unless (= x 2) (newline) (exit)) (set! x 3) (cc)))
                 *   behaves the same (in this regard) if let-temp is replaced with let.
                 */
            }
        }
        return(true);
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x48(%rsp), %rcx
movq 0x48(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
subq $0x1, %rax
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jle 0x16e5d6
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
subq $0x1ba, %rax            # imm = 0x1BA
je 0x16e289
jmp 0x16e22b
movq 0x8(%rsp), %rax
subq $0x1c0, %rax            # imm = 0x1C0
je 0x16e4a9
jmp 0x16e23e
movq 0x8(%rsp), %rax
subq $0x1c1, %rax            # imm = 0x1C1
je 0x16e4ec
jmp 0x16e251
movq 0x8(%rsp), %rax
subq $0x1e1, %rax            # imm = 0x1E1
je 0x16e289
jmp 0x16e260
movq 0x8(%rsp), %rax
subq $0x203, %rax            # imm = 0x203
je 0x16e54d
jmp 0x16e273
movq 0x8(%rsp), %rax
subq $0x204, %rax            # imm = 0x204
je 0x16e57c
jmp 0x16e5bf
movq $0x0, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x3, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
movq $0x3, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x40(%rsp), %rdx
movq 0x20(%rdx), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jge 0x16e35b
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x1e1, %rax            # imm = 0x1E1
je 0x16e319
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x1ba, %rax            # imm = 0x1BA
jne 0x16e346
movq 0x28(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x10(%rcx), %rcx
movq 0x10(%rcx), %rcx
movq 0x20(%rsp), %rdx
subq $0x3, %rdx
cmpq (%rcx,%rdx,8), %rax
jne 0x16e346
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x16e35b
jmp 0x16e348
movq 0x20(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x20(%rsp)
jmp 0x16e2ba
cmpq $0x0, 0x18(%rsp)
jne 0x16e4a4
cmpq $0x1e1, 0x30(%rsp)      # imm = 0x1E1
jne 0x16e44a
movq 0x28(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x16e448
movq 0x28(%rsp), %rax
movl $0x2, 0x20(%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x120(%rcx), %rax
je 0x16e446
jmp 0x16e3ae
movq 0x48(%rsp), %rax
movq (%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1df, %ecx            # imm = 0x1DF
movq %rcx, 0x18(%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
movl $0x198, %esi            # imm = 0x198
callq 0x163d0
jmp 0x16e448
jmp 0x16e4a2
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rsi
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x3, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x2, %rcx
movq (%rax,%rcx,8), %rcx
callq 0x16e780
jmp 0x16e4a4
jmp 0x16e5c1
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x3, %rcx
movq (%rax,%rcx,8), %rsi
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
callq 0x16e840
jmp 0x16e5c1
movq 0x48(%rsp), %rax
movq %rax, (%rsp)
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x2150(%rax), %rsi
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x3, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
callq 0x359a0
movq (%rsp), %rdi
movq %rax, %rsi
callq 0xbe5b0
jmp 0x16e5c1
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x40(%rsp), %rdx
movq 0x20(%rdx), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jle 0x16e57a
movb $0x0, 0x57(%rsp)
jmp 0x16e770
jmp 0x16e5c1
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x40(%rsp), %rdx
movq 0x20(%rdx), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jle 0x16e5bd
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movb $0x0, 0x18(%rax)
jmp 0x16e5c1
jmp 0x16e5c1
jmp 0x16e5c3
movq 0x38(%rsp), %rax
subq $0x4, %rax
movq %rax, 0x38(%rsp)
jmp 0x16e1f0
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x48(%rsp), %rcx
movq 0x48(%rcx), %rcx
subq %rcx, %rax
sarq $0x3, %rax
subq $0x1, %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq 0x28(%rcx), %rcx
movq 0x40(%rsp), %rdx
movq 0x20(%rdx), %rdx
subq %rdx, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rax
jge 0x16e76b
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x30(%rsp)
cmpq $0x1e1, 0x30(%rsp)      # imm = 0x1E1
jne 0x16e72b
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x3, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x120(%rcx), %rax
je 0x16e71d
jmp 0x16e685
movq 0x48(%rsp), %rax
movq (%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1df, %ecx            # imm = 0x1DF
movq %rcx, 0x18(%rax)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x48(%rsp), %rax
movq 0x110(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x48(%rsp), %rax
movq %rcx, (%rax)
movq 0x48(%rsp), %rdi
movl $0x198, %esi            # imm = 0x198
callq 0x163d0
movq 0x10(%rsp), %rax
movl $0x1, 0x20(%rax)
jmp 0x16e756
cmpq $0x204, 0x30(%rsp)      # imm = 0x204
jne 0x16e754
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq 0x38(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movb $0x1, 0x18(%rax)
jmp 0x16e756
jmp 0x16e758
movq 0x38(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x38(%rsp)
jmp 0x16e5f8
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopl (%rax,%rax)