// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_get_next_line
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
                              lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
{
    if(txt == NULL) return 0;
    if(font == NULL) return 0;

    if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX;
    lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
    uint32_t i = 0;                                        /* Iterating index into txt */

    while(txt[i] != '\0' && max_width > 0) {
        uint32_t word_w = 0;
        uint32_t advance = lv_txt_get_next_word(&txt[i], font, letter_space, max_width, flag, &word_w, &cmd_state, i==0);
        max_width -= word_w;

        if( advance == 0 ){
            if(i == 0) lv_txt_encoded_next(txt, &i); // prevent inf loops
            break;
        }

        i += advance;

        if(txt[0] == '\n' || txt[0] == '\r') break;

        if(txt[i] == '\n' || txt[i] == '\r'){
            i++;  /* Include the following newline in the current line */
            break;
        }

    }

    /* Always step at least one to avoid infinite loops */
    if(i == 0) {
        lv_txt_encoded_next(txt, &i);
    }

    return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %r8b, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movw %dx, -0x1a(%rbp)
movw %cx, -0x1c(%rbp)
movb %al, -0x1d(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x46a70
movw $0x0, -0x2(%rbp)
jmp 0x46bc1
cmpq $0x0, -0x18(%rbp)
jne 0x46a82
movw $0x0, -0x2(%rbp)
jmp 0x46bc1
movzbl -0x1d(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x46a94
movw $0x7c18, -0x1c(%rbp)    # imm = 0x7C18
movb $0x0, -0x1e(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
je 0x46ac1
movswl -0x1c(%rbp), %eax
cmpl $0x0, %eax
setg %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x46acd
jmp 0x46ba3
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %eax
addq %rax, %rdi
movq -0x18(%rbp), %rsi
movw -0x1a(%rbp), %dx
movw -0x1c(%rbp), %cx
movb -0x1d(%rbp), %al
cmpl $0x0, -0x24(%rbp)
sete %r9b
movq %rsp, %r8
leaq -0x1e(%rbp), %r10
movq %r10, (%r8)
movzbl %r9b, %r9d
andl $0x1, %r9d
movl %r9d, 0x8(%r8)
movswl %dx, %edx
movswl %cx, %ecx
movzbl %al, %r8d
leaq -0x28(%rbp), %r9
callq 0x46d00
movzwl %ax, %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %ecx
movswl -0x1c(%rbp), %eax
subl %ecx, %eax
movw %ax, -0x1c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x46b50
cmpl $0x0, -0x24(%rbp)
jne 0x46b4e
movq 0x35b7c(%rip), %rax     # 0x7c6c0
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq *%rax
jmp 0x46ba3
movl -0x2c(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
je 0x46b71
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x46b73
jmp 0x46ba3
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x46b93
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x46b9e
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x46ba3
jmp 0x46a9f
cmpl $0x0, -0x24(%rbp)
jne 0x46bba
movq 0x35b10(%rip), %rax     # 0x7c6c0
movq -0x10(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq *%rax
movl -0x24(%rbp), %eax
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)