// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, %ebp
movl %edx, 0x54(%rsp)
testq %rdi, %rdi
sete %al
movq %rsi, 0x58(%rsp)
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x2ae4e
xorl %r12d, %r12d
jmp 0x2b292
movl %r8d, %ebx
movq %rdi, %r15
testb $0x2, %bl
movl $0x7c18, %eax           # imm = 0x7C18
cmovnel %eax, %ebp
movl $0x0, 0xc(%rsp)
cmpb $0x0, (%rdi)
sete %al
testw %bp, %bp
setle %cl
orb %al, %cl
jne 0x2b27e
movq %r15, %rcx
movq $0x0, 0x48(%rsp)
xorl %r12d, %r12d
movq %r15, 0x30(%rsp)
movl %ebx, 0x8(%rsp)
movq %rcx, 0x28(%rsp)
testb $0x2, %bl
movl $0x7c18, %eax           # imm = 0x7C18
cmovel %ebp, %eax
movl %eax, 0x40(%rsp)
xorl %eax, %eax
movl %eax, 0x24(%rsp)
movl %eax, 0x4(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq *0x2876f(%rip)          # 0x53630
movq 0x28(%rsp), %rdi
movl %eax, %r14d
movl 0x4(%rsp), %eax
movl %eax, 0x20(%rsp)
cmpb $0x0, (%rdi)
je 0x2b111
movl %r12d, 0x3c(%rsp)
movl %ebp, 0x10(%rsp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x0, (%rsp)
xorl %ebp, %ebp
xorl %edx, %edx
xorl %r10d, %r10d
movl $0x0, 0x14(%rsp)
movl %r14d, %r12d
movl %esi, 0x18(%rsp)
movl %edx, 0x1c(%rsp)
movq 0x48(%rsp), %rax
movq %rbp, 0x60(%rsp)
movl %r10d, 0x44(%rsp)
movl %r10d, %ecx
movl %r12d, %r15d
movl %ecx, %r13d
movl %eax, %ebx
leaq 0x20(%rsp), %rsi
callq *0x28702(%rip)          # 0x53630
movl %eax, %r12d
testb $0x1, 0x8(%rsp)
je 0x2af87
cmpl $0x23, %r15d
jne 0x2af59
movb $0x1, %al
testb %bl, %bl
movq 0x28(%rsp), %rdi
je 0x2af6c
movzbl %bl, %eax
cmpl $0x2, %eax
jne 0x2affa
xorl %eax, %eax
jmp 0x2af6c
cmpb $0x1, %bl
movq 0x28(%rsp), %rdi
jne 0x2af8e
cmpl $0x20, %r15d
sete %al
incb %al
movl 0x4(%rsp), %ebp
movl 0x20(%rsp), %ecx
movl %ecx, 0x4(%rsp)
leal 0x1(%r13), %ecx
cmpb $0x0, (%rdi,%rbp)
jne 0x2af1b
jmp 0x2b0cd
movq 0x60(%rsp), %rbp
jmp 0x2af9d
movl %ebx, %eax
movq %rax, 0x48(%rsp)
movl %r13d, 0x44(%rsp)
movl %r15d, %r14d
leaq 0x180fc(%rip), %rbx     # 0x430a0
movq 0x58(%rsp), %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x28487
movl 0x14(%rsp), %esi
addl %eax, %esi
cmpw 0x40(%rsp), %si
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovgl %ebp, %ecx
movl 0x1c(%rsp), %edx
movl %edx, %r15d
movl 0x44(%rsp), %r9d
cmovgl %r9d, %r15d
movl 0x18(%rsp), %edi
cmpl $-0x1, %edi
cmovnel %edi, %ecx
cmovnel %edx, %r15d
cmpl $0xa, %r14d
je 0x2b239
cmpl $0xd, %r14d
jne 0x2b056
jmp 0x2b239
cmpl $0x1, %eax
jne 0x2b001
xorl %ebx, %ebx
movl $0x23, %r14d
movq 0x58(%rsp), %rdi
movl $0x23, %esi
movl %r12d, %edx
callq 0x28487
movl 0x14(%rsp), %esi
addl %eax, %esi
cmpw 0x40(%rsp), %si
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmovgl %ebp, %ecx
movl 0x1c(%rsp), %edx
movl %edx, %r15d
cmovgl %r13d, %r15d
movl 0x18(%rsp), %edi
cmpl $-0x1, %edi
cmovnel %edi, %ecx
cmovnel %edx, %r15d
movl %ebx, %edx
movq %rdx, 0x48(%rsp)
movl %r13d, %r9d
leaq 0x1804a(%rip), %rbx     # 0x430a0
movl %esi, %r8d
leal 0x1(%r13), %r10d
xorl %edx, %edx
movsbl (%rdx,%rbx), %esi
cmpl %esi, %r14d
je 0x2b075
leaq 0x1(%rdx), %rdi
cmpq $0x6, %rdx
movq %rdi, %rdx
jne 0x2b05f
cmpl %esi, %r14d
je 0x2b236
cmpl $-0x1, %ecx
movl (%rsp), %edx
cmovel %r8d, %edx
movl %edx, (%rsp)
testw %ax, %ax
movl $0x0, %eax
cmovgl 0x54(%rsp), %eax
addl %r8d, %eax
movl 0x4(%rsp), %ebp
movl 0x20(%rsp), %edx
movl %edx, 0x4(%rsp)
movq 0x28(%rsp), %rdi
cmpb $0x0, (%rdi,%rbp)
movl %r15d, %edx
movl %ecx, %esi
movl %eax, 0x14(%rsp)
movl %r12d, %r14d
jne 0x2af01
incl %r13d
movl %r12d, %r14d
movl %r13d, %r9d
jmp 0x2b0e6
incl %r13d
movq %rax, 0x48(%rsp)
movl %r12d, %r14d
movl %r13d, %r9d
movl 0x18(%rsp), %ecx
movl 0x1c(%rsp), %eax
movl %eax, %r15d
cmpl $-0x1, %ecx
je 0x2b115
cmpl $0xb, %r9d
ja 0x2b140
movl (%rsp), %eax
movl %eax, %esi
movl %ecx, %eax
cmpl $0x0, 0x3c(%rsp)
movq 0x30(%rsp), %r15
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %ebp
je 0x2b17d
jmp 0x2b25b
xorl %esi, %esi
jmp 0x2b178
movl (%rsp), %eax
movl %eax, %esi
movl %ebp, %eax
testl %r9d, %r9d
movq 0x30(%rsp), %r15
je 0x2b170
cmpl $0xd, %r14d
jne 0x2b218
cmpl $0xa, %r12d
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %ebp
je 0x2b178
jmp 0x2b17d
cmpl $0x2, %r15d
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %ebp
leaq 0x24(%rsp), %r14
movl 0x3c(%rsp), %edx
ja 0x2b1e2
movl (%rsp), %eax
movl %eax, %esi
movl %ecx, %eax
testl %edx, %edx
movq 0x30(%rsp), %r15
je 0x2b17d
jmp 0x2b25b
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %ebp
movzwl 0x4(%rsp), %eax
movl %eax, %r12d
andl $0xffff, %r12d          # imm = 0xFFFF
je 0x2b25b
addl 0xc(%rsp), %r12d
movl %r12d, 0xc(%rsp)
movzbl (%r15), %eax
cmpl $0xa, %eax
je 0x2b279
cmpl $0xd, %eax
je 0x2b279
movl %r12d, %ecx
movzbl (%r15,%rcx), %eax
cmpl $0xd, %eax
je 0x2b251
cmpl $0xa, %eax
je 0x2b251
testb %al, %al
je 0x2b279
subl %esi, %ebp
addq %r15, %rcx
testw %bp, %bp
jg 0x2ae93
jmp 0x2b279
movl %ecx, 0x24(%rsp)
subl %r9d, %r15d
leal 0x3(%r15), %eax
testl %eax, %eax
jle 0x2b225
addl $0x4, %r15d
movq 0x28(%rsp), %rdi
movq %r14, %rsi
callq *0x28435(%rip)          # 0x53638
decl %r15d
cmpl $0x1, %r15d
ja 0x2b1f5
movzwl 0x24(%rsp), %eax
movl (%rsp), %ecx
movl %ecx, %esi
jmp 0x2b22c
movl 0x8(%rsp), %ebx
movl 0x10(%rsp), %ebp
jmp 0x2b17d
movl (%rsp), %eax
movl %eax, %esi
movl %ecx, %eax
movq 0x30(%rsp), %r15
jmp 0x2b17d
movl %r8d, %esi
testl %ebp, %ebp
jne 0x2b0e6
xorl %eax, %eax
cmpl $-0x1, %ecx
je 0x2b11c
jmp 0x2b0e6
incl %r12d
movl %r12d, 0xc(%rsp)
jmp 0x2b279
movl 0xc(%rsp), %r12d
testl %r12d, %r12d
jne 0x2b292
leaq 0xc(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq *0x283ba(%rip)          # 0x53630
movl (%rbx), %r12d
testl %r12d, %r12d
jne 0x2b292
leaq 0xc(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq *0x283a1(%rip)          # 0x53630
movl (%rbx), %r12d
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq