// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_call_with_output_file
static s7_pointer g_call_with_output_file(s7_scheme *sc, s7_pointer args)
    {
#define H_call_with_output_file "(call-with-output-file filename proc) opens filename and calls proc with the output port as its argument"
#define Q_call_with_output_file sc->pl_sf
        s7_pointer port, file, proc;

        file = car(args);
        if (!is_string(file))
            return(method_or_bust(sc, file, sc->call_with_output_file_symbol, args, T_STRING, 1));

        proc = cadr(args);
        if ((!is_any_procedure(proc)) ||
                (!s7_is_aritable(sc, proc, 1)))
            return(method_or_bust_with_type(sc, proc, sc->call_with_output_file_symbol, args, wrap_string(sc, "a procedure of one argument (the port)", 38), 2));

        port = s7_open_output_file(sc, string_value(file), "w");
        push_stack(sc, OP_UNWIND_OUTPUT, sc->unused, port); /* #<unused> here is a marker (needed) */
        push_stack(sc, OP_APPLY, list_1(sc, port), proc);
        return(sc->F);
    }

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq 0x60(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x13, %eax
je 0x6ebaf
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq 0x68(%rsp), %rax
movq 0xd10(%rax), %rdx
movq 0x60(%rsp), %rcx
movl $0x13, %r8d
movl $0x1, %r9d
callq 0x13c50
movq %rax, 0x70(%rsp)
jmp 0x6eddc
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x28, %eax
jl 0x6ebe6
movq 0x68(%rsp), %rdi
movq 0x48(%rsp), %rsi
movl $0x1, %edx
callq 0x3cbf0
testb $0x1, %al
jne 0x6ec57
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x68(%rsp), %rax
movq 0xd10(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rdi
leaq 0x184a0a(%rip), %rsi    # 0x1f362b
movl $0x26, %edx
callq 0xb880
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %rax, %r8
movl $0x2, %r9d
callq 0x14130
movq %rax, 0x70(%rsp)
jmp 0x6eddc
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rax
movq 0x10(%rax), %rsi
leaq 0x185169(%rip), %rdx    # 0x1f3dd5
callq 0x15250
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x68(%rsp), %rax
movq 0x140(%rax), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x1ef, %ecx            # imm = 0x1EF
movq %rcx, 0x18(%rax)
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
jmp 0x6ecdb
movq 0x48(%rsp), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, (%rax)
movq 0x68(%rsp), %rax
movq 0x8(%rax), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x8(%rax)
movq 0x58(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rax
movq 0x110(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x68(%rsp), %rax
movq 0x90(%rax), %rax
movq 0x68(%rsp), %rcx
cmpq 0x98(%rcx), %rax
ja 0x6ed41
movq 0x68(%rsp), %rdi
callq 0xc670
movq 0x68(%rsp), %rcx
movq 0x90(%rcx), %rax
movq %rax, %rdx
addq $-0x8, %rdx
movq %rdx, 0x90(%rcx)
movq -0x8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
movq $0x200001, (%rax)       # imm = 0x200001
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x30(%rsp), %rcx
movq 0x40(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rcx
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movq %rcx, 0x10(%rax)
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rax
movl $0x198, %ecx            # imm = 0x198
movq %rcx, 0x18(%rax)
movq 0x68(%rsp), %rax
movq 0x50(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x50(%rax)
movq 0x68(%rsp), %rax
movq 0x120(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x70(%rsp), %rax
addq $0x78, %rsp
retq
nopw %cs:(%rax,%rax)