// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: g_write_string
static s7_pointer g_write_string(s7_scheme *sc, s7_pointer args)
    {
#define H_write_string "(write-string str port start end) writes str to port."
#define Q_write_string s7_make_circular_signature(sc, 3, 4, sc->is_string_symbol, sc->is_string_symbol, s7_make_signature(sc, 2, sc->is_output_port_symbol, sc->not_symbol), sc->is_integer_symbol)
        s7_pointer str, port;
        s7_int start = 0, end;

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

        end = string_length(str);
        if (!is_null(cdr(args)))
        {
            s7_pointer inds;
            port = cadr(args);
            inds = cddr(args);
            if (!is_null(inds))
            {
                s7_pointer p;
                p = start_and_end(sc, sc->write_string_symbol, args, 3, &start, &end);
                if (p != sc->unused) return(p);
            }
        }
        else port = sc->output_port;
        if (!is_output_port(port))
        {
            if (port == sc->F)
            {
                s7_int len;
                if ((start == 0) && (end == string_length(str)))
                    return(str);
                len = (s7_int)(end - start);
                return(make_string_with_length(sc, (char *)(string_value(str) + start), len));
            }
            return(method_or_bust_with_type(sc, port, sc->write_string_symbol, args, an_output_port_string, 2));
        }
        if (start == end)
            return(str);
        port_write_string(port)(sc, (char *)(string_value(str) + start), (end - start), port);
        return(str);
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x13, %eax
je 0x6cb28
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x16b0(%rax), %rdx
movq 0x40(%rsp), %rcx
movl $0x13, %r8d
movl $0x1, %r9d
callq 0x13c50
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x6cbdd
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x110(%rcx), %rax
je 0x6cbdb
movq 0x48(%rsp), %rdi
movq 0x48(%rsp), %rax
movq 0x16b0(%rax), %rsi
movq 0x40(%rsp), %rdx
movl $0x3, %ecx
leaq 0x28(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0xda710
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x140(%rcx), %rax
je 0x6cbd9
movq 0x10(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
jmp 0x6cbdb
jmp 0x6cbee
movq 0x48(%rsp), %rax
movq 0x188(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
je 0x6cca3
movq 0x30(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x120(%rcx), %rax
jne 0x6cc6f
cmpq $0x0, 0x28(%rsp)
jne 0x6cc39
movq 0x20(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x6cc39
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
movq 0x20(%rsp), %rax
subq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rsi
addq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x144d0
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
movq 0x48(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x48(%rsp), %rax
movq 0x16b0(%rax), %rdx
movq 0x40(%rsp), %rcx
movq 0x1b5177(%rip), %r8     # 0x221e08
movl $0x2, %r9d
callq 0x14130
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
movq 0x28(%rsp), %rax
cmpq 0x20(%rsp), %rax
jne 0x6ccbb
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
jmp 0x6ccfa
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x48(%rax), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rcx
movq 0x10(%rcx), %rsi
addq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
subq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq *%rax
movq 0x38(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)