// File: /workspace/github_c_makefile_star2_O1/goghcrow[P]dubbo_ab/lib/utf8_decode.c
// Function: utf8_decode_next
int utf8_decode_next() {
    int c;  /* the first byte of the character */
    int c1; /* the first continuation character */
    int c2; /* the second continuation character */
    int c3; /* the third continuation character */
    int r;  /* the result */

    if (the_index >= the_length) {
        return the_index == the_length ? UTF8_END : UTF8_ERROR;
    }
    the_byte = the_index;
    the_char += 1;
    c = get();
/*
    Zero continuation (0 to 127)
*/
    if ((c & 0x80) == 0) {
        return c;
    }
/*
    One continuation (128 to 2047)
*/
    if ((c & 0xE0) == 0xC0) {
        c1 = cont();
        if (c1 >= 0) {
            r = ((c & 0x1F) << 6) | c1;
            if (r >= 128) {
                return r;
            }
        }

/*
    Two continuations (2048 to 55295 and 57344 to 65535)
*/
    } else if ((c & 0xF0) == 0xE0) {
        c1 = cont();
        c2 = cont();
        if ((c1 | c2) >= 0) {
            r = ((c & 0x0F) << 12) | (c1 << 6) | c2;
            if (r >= 2048 && (r < 55296 || r > 57343)) {
                return r;
            }
        }

/*
    Three continuations (65536 to 1114111)
*/
    } else if ((c & 0xF8) == 0xF0) {
        c1 = cont();
        c2 = cont();
        c3 = cont();
        if ((c1 | c2 | c3) >= 0) {
            r = ((c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3;
            if (r >= 65536 && r <= 1114111) {
                return r;
            }
        }
    }
    return UTF8_ERROR;
}

// Assembly:
movl 0xca41(%rip), %edx      # 0x10200
movl 0xca4b(%rip), %ecx      # 0x10210
cmpl %ecx, %edx
jge 0x3859
pushq %rbp
movq %rsp, %rbp
movslq %edx, %rax
movl %edx, 0xca3e(%rip)      # 0x10218
incl 0xca34(%rip)            # 0x10214
movq 0xca21(%rip), %rsi      # 0x10208
movzbl (%rsi,%rax), %eax
incl %edx
movl %edx, 0xca0d(%rip)      # 0x10200
testb %al, %al
jns 0x3a25
movl %eax, %edx
andl $-0x20, %edx
cmpl $0xc0, %edx
jne 0x3863
movslq 0xc9f1(%rip), %rsi      # 0x10200
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl %ecx, %esi
jge 0x382c
movq 0xc9e9(%rip), %rcx      # 0x10208
movzbl (%rcx,%rsi), %edx
leal 0x1(%rsi), %ecx
movl %ecx, 0xc9d4(%rip)      # 0x10200
movl %edx, %ecx
andl $0xc0, %ecx
cmpl $0x80, %ecx
jne 0x3a20
andl $0x1f, %eax
shll $0x6, %eax
cmpl $0x7f, %eax
jbe 0x3a20
andl $0x3f, %edx
orl %edx, %eax
jmp 0x3a25
sete %al
movzbl %al, %eax
orl $-0x2, %eax
retq
movl %eax, %edx
andl $-0x10, %edx
cmpl $0xe0, %edx
jne 0x392b
movslq 0xc985(%rip), %rdi      # 0x10200
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl %ecx, %edi
jge 0x389c
movq 0xc978(%rip), %rdx      # 0x10208
movzbl (%rdx,%rdi), %edx
incl %edi
movl %edi, 0xc964(%rip)      # 0x10200
movl %edx, %edi
andl $0xc0, %edi
andl $0x3f, %edx
cmpl $0x80, %edi
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
cmovnel %edi, %edx
movslq 0xc944(%rip), %r8       # 0x10200
cmpl %ecx, %r8d
jge 0x38d7
movq 0xc940(%rip), %rcx      # 0x10208
movzbl (%rcx,%r8), %esi
leal 0x1(%r8), %ecx
movl %ecx, 0xc929(%rip)      # 0x10200
movl %esi, %ecx
andl $0xc0, %ecx
andl $0x3f, %esi
cmpl $0x80, %ecx
cmovel %esi, %edi
movl %edi, %ecx
orl %edx, %ecx
js 0x3a20
shll $0xc, %eax
movzwl %ax, %eax
shll $0x6, %edx
orl %edi, %edx
orl %eax, %edx
cmpl $0x800, %edx            # imm = 0x800
setge %cl
movl %edx, %eax
addl $0xffff2000, %eax       # imm = 0xFFFF2000
cmpl $0xfffff800, %eax       # imm = 0xFFFFF800
setb %sil
movl %edx, %eax
testb %sil, %cl
je 0x3a20
jmp 0x3a25
movl %eax, %edx
andl $-0x8, %edx
cmpl $0xf0, %edx
jne 0x3a20
movslq 0xc8bd(%rip), %rsi      # 0x10200
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl %ecx, %esi
jge 0x3964
movq 0xc8b0(%rip), %rdx      # 0x10208
movzbl (%rdx,%rsi), %edx
incl %esi
movl %esi, 0xc89c(%rip)      # 0x10200
movl %edx, %esi
andl $0xc0, %esi
andl $0x3f, %edx
cmpl $0x80, %esi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
cmovnel %esi, %edx
movslq 0xc87c(%rip), %r8       # 0x10200
cmpl %ecx, %r8d
jge 0x399f
movq 0xc878(%rip), %rdi      # 0x10208
movzbl (%rdi,%r8), %edi
incl %r8d
movl %r8d, 0xc861(%rip)      # 0x10200
movl %edi, %r8d
andl $0xc0, %r8d
andl $0x3f, %edi
cmpl $0x80, %r8d
cmovel %edi, %esi
movslq 0xc843(%rip), %r8       # 0x10200
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl %ecx, %r8d
jge 0x39dd
movq 0xc83a(%rip), %rcx      # 0x10208
movzbl (%rcx,%r8), %edi
leal 0x1(%r8), %ecx
movl %ecx, 0xc823(%rip)      # 0x10200
movl %edi, %ecx
andl $0xc0, %ecx
andl $0x3f, %edi
cmpl $0x80, %ecx
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
cmovel %edi, %ecx
movl %esi, %edi
orl %edx, %edi
orl %ecx, %edi
js 0x3a20
andl $0x7, %eax
shll $0x12, %eax
shll $0xc, %edx
shll $0x6, %esi
orl %edx, %esi
orl %ecx, %esi
orl %eax, %esi
leal -0x10000(%rsi), %ecx
movl %esi, %eax
cmpl $0x100000, %ecx         # imm = 0x100000
jb 0x3a25
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
popq %rbp
retq
nop