// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: fgetline
int
fgetline(FILE* fp, STRING** s)
{
    int     c       = 0;

    size_t  length  = 0,
            bufsiz  = T_STRING_DEFAULT_ALLOC_SIZE + 1;

    char*   buf     = NULL;

    if ((buf = (char*)
                malloc(sizeof(char) * bufsiz)) == NULL) {
#ifdef  LIBRARY_VERBOSE
        print_error();
/* LIBRARY_VERBOSE */
#endif
        status = EMEMORYALLOC; goto ERR;
    } else {
        memset(buf, '\0', bufsiz);
    }
    while ((c = fgetc(fp)) != EOF) {
        if (length >= (bufsiz - 1)) {
            bufsiz += T_STRING_DEFAULT_ALLOC_SIZE;
            if ((buf = (char*)
                        realloc(buf, sizeof(char) * bufsiz)) == NULL) {
#ifdef  LIBRARY_VERBOSE
                print_error();
/* LIBRARY_VERBOSE */
#endif
                status = EMEMORYALLOC; goto ERR;
            } else {
                memset(buf + length, '\0', bufsiz - length);
            }
        }
        *(buf + length) = c;
        length++;
        if (c == '\n') {
            *(buf + length) = '\0';
            break;
        }
    }
    if (!length && c == EOF) {
        status = EOF; goto IS_EOF;
    }
    if ((*s = new_string(buf)) == NULL)
        goto ERR;
    if (buf != NULL) {
        free(buf);
        buf = NULL;
    }

    return 0;

ERR:
IS_EOF:
    if (buf != NULL) {
        free(buf);
        buf = NULL;
    }

    return status;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x401, -0x30(%rbp)     # imm = 0x401
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rdi
shlq $0x0, %rdi
callq 0x20e0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xee98
leaq 0x83bb(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xefad
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x2050
jmp 0xeea9
movq -0x10(%rbp), %rdi
callq 0x21f0
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0xef58
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jb 0xef23
movq -0x30(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
shlq $0x0, %rsi
callq 0x23c0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xef0a
leaq 0x8349(%rip), %rax      # 0x17248
movl $0xfffffffd, (%rax)     # imm = 0xFFFFFFFD
jmp 0xefad
movq -0x38(%rbp), %rdi
addq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
subq -0x28(%rbp), %rdx
xorl %esi, %esi
callq 0x2050
jmp 0xef23
movl -0x1c(%rbp), %eax
movb %al, %dl
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpl $0xa, -0x1c(%rbp)
jne 0xef53
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movb $0x0, (%rax,%rcx)
jmp 0xef58
jmp 0xeea9
cmpq $0x0, -0x28(%rbp)
jne 0xef74
cmpl $-0x1, -0x1c(%rbp)
jne 0xef74
leaq 0x82dc(%rip), %rax      # 0x17248
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0xefaf
movq -0x38(%rbp), %rdi
callq 0x8fd0
movq -0x18(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0xef8c
jmp 0xefad
cmpq $0x0, -0x38(%rbp)
je 0xefa4
movq -0x38(%rbp), %rdi
callq 0x2180
movq $0x0, -0x38(%rbp)
movl $0x0, -0x4(%rbp)
jmp 0xefd3
jmp 0xefaf
cmpq $0x0, -0x38(%rbp)
je 0xefc7
movq -0x38(%rbp), %rdi
callq 0x2180
movq $0x0, -0x38(%rbp)
leaq 0x827a(%rip), %rax      # 0x17248
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)