// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/linenoise/linenoise.c
// Function: refreshSingleLine
static void refreshSingleLine(struct linenoiseState *l) {
    char seq[64];
    size_t plen = strlen(l->prompt);
    int fd = l->ofd;
    char *buf = l->buf;
    size_t len = l->len;
    size_t pos = l->pos;
    struct abuf ab;

    while((plen+pos) >= l->cols) {
        buf++;
        len--;
        pos--;
    }
    while (plen+len > l->cols) {
        len--;
    }

    abInit(&ab);
    /* Cursor to left edge */
    snprintf(seq,64,"\r");
    abAppend(&ab,seq,strlen(seq));
    /* Write the prompt and the current buffer content */
    abAppend(&ab,l->prompt,strlen(l->prompt));
    abAppend(&ab,buf,len);
    /* Show hits if any. */
    refreshShowHints(&ab,l,plen);
    /* Erase to right */
    snprintf(seq,64,"\x1b[0K");
    abAppend(&ab,seq,strlen(seq));
    /* Move cursor to original position. */
    snprintf(seq,64,"\r\x1b[%dC", (int)(pos+plen));
    abAppend(&ab,seq,strlen(seq));
    if (write(fd,ab.b,ab.len) == -1) {} /* Can't recover from write error. */
    abFree(&ab);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x101a0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x58(%rbp), %rax
addq -0x78(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jb 0x23a86
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
movq -0x78(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x23a4e
jmp 0x23a88
movq -0x58(%rbp), %rax
addq -0x70(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jbe 0x23aa8
movq -0x70(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x23a88
leaq -0x88(%rbp), %rdi
callq 0x23c10
leaq -0x50(%rbp), %rdi
movl $0x40, %esi
leaq 0x68363(%rip), %rdx     # 0x8be27
movb $0x0, %al
callq 0x101e0
leaq -0x50(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x101a0
movq -0xa8(%rbp), %rsi
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x22550
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x101a0
movq -0xa0(%rbp), %rsi
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x22550
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rax
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x22550
movq -0x8(%rbp), %rsi
movq -0x58(%rbp), %rax
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x223e0
leaq -0x50(%rbp), %rdi
movl $0x40, %esi
leaq 0x682af(%rip), %rdx     # 0x8be10
movb $0x0, %al
callq 0x101e0
leaq -0x50(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x101a0
movq -0x98(%rbp), %rsi
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x22550
leaq -0x50(%rbp), %rdi
movq -0x78(%rbp), %rax
addq -0x58(%rbp), %rax
movl %eax, %ecx
movl $0x40, %esi
leaq 0x6a70b(%rip), %rdx     # 0x8e2b6
movb $0x0, %al
callq 0x101e0
leaq -0x50(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x101a0
movq -0x90(%rbp), %rsi
movl %eax, %edx
leaq -0x88(%rbp), %rdi
callq 0x22550
movl -0x5c(%rbp), %edi
movq -0x88(%rbp), %rsi
movslq -0x80(%rbp), %rdx
callq 0x10150
cmpq $-0x1, %rax
jne 0x23bf6
jmp 0x23bf6
leaq -0x88(%rbp), %rdi
callq 0x23c30
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)