// File: /workspace/github_c_makefile_star2_O0/BernardTatin[P]s7sh/s7.c
// Function: file_read_line
static s7_pointer file_read_line(s7_scheme *sc, s7_pointer port, bool with_eol, bool copied)
    {
        char *buf;
        s7_int read_size, previous_size = 0;

        if (!sc->read_line_buf)
        {
            sc->read_line_buf_size = 1024;
            sc->read_line_buf = (char *)malloc(sc->read_line_buf_size);
        }

        buf = sc->read_line_buf;
        read_size = sc->read_line_buf_size;

        while (true)
        {
            char *p, *rtn;
            size_t len;

            p = fgets(buf, read_size, port_file(port));
            if (!p)
                return(eof_object);

            rtn = strchr(buf, (int)'\n');
            if (rtn)
            {
                port_line_number(port)++;
                return(make_string_with_length(sc, sc->read_line_buf, (with_eol) ? (previous_size + rtn - p + 1) : (previous_size + rtn - p)));
            }
            /* if no newline, then either at eof or need bigger buffer */
            len = strlen(sc->read_line_buf);

            if ((len + 1) < (size_t)sc->read_line_buf_size)
                return(make_string_with_length(sc, sc->read_line_buf, len));

            previous_size = sc->read_line_buf_size;
            sc->read_line_buf_size *= 2;
            sc->read_line_buf = (char *)realloc(sc->read_line_buf, sc->read_line_buf_size);
            read_size = previous_size;
            previous_size -= 1;
            buf = (char *)(sc->read_line_buf + previous_size);
        }
        return(eof_object);
    }

// Assembly:
subq $0x68, %rsp
movb %cl, %al
movb %dl, %cl
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
andb $0x1, %cl
movb %cl, 0x4f(%rsp)
andb $0x1, %al
movb %al, 0x4e(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x58(%rsp), %rax
cmpq $0x0, 0x4b8(%rax)
jne 0xce737
movq 0x58(%rsp), %rax
movq $0x400, 0x4c0(%rax) # imm = 0x400
movq 0x58(%rsp), %rax
movq 0x4c0(%rax), %rdi
callq 0x9480
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x4b8(%rax)
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rax
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rax
movq 0x4c0(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movl %eax, %esi
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdx
callq 0x9330
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0xce795
movq 0x147b05(%rip), %rax    # 0x216290
movq %rax, 0x60(%rsp)
jmp 0xce910
movq 0x40(%rsp), %rdi
movl $0xa, %esi
callq 0x91d0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0xce838
movq 0x50(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rax
movq %rax, 0x10(%rsp)
testb $0x1, 0x4f(%rsp)
je 0xce805
movq 0x30(%rsp), %rax
addq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, (%rsp)
jmp 0xce81b
movq 0x30(%rsp), %rax
addq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rcx, %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
movq (%rsp), %rdx
callq 0x144d0
movq %rax, 0x60(%rsp)
jmp 0xce910
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rdi
callq 0x91a0
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq 0x58(%rsp), %rcx
cmpq 0x4c0(%rcx), %rax
jae 0xce88a
movq 0x58(%rsp), %rdi
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rsi
movq 0x18(%rsp), %rdx
callq 0x144d0
movq %rax, 0x60(%rsp)
jmp 0xce910
movq 0x58(%rsp), %rax
movq 0x4c0(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq 0x4c0(%rax), %rcx
shlq %rcx
movq %rcx, 0x4c0(%rax)
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rdi
movq 0x58(%rsp), %rax
movq 0x4c0(%rax), %rsi
callq 0x9510
movq %rax, %rcx
movq 0x58(%rsp), %rax
movq %rcx, 0x4b8(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x30(%rsp), %rax
subq $0x1, %rax
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rax
movq 0x4b8(%rax), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0xce759
movq 0x60(%rsp), %rax
addq $0x68, %rsp
retq
nopw (%rax,%rax)