// File: /workspace/github_c_makefile_star2_O0/xapi-project[P]rrd-client-lib/parson/parson.c
// Function: verify_utf8_sequence
static int verify_utf8_sequence(const unsigned char *string, int *len) {
    unsigned int cp = 0;
    *len = num_bytes_in_utf8_sequence(string[0]);

    if (*len == 1) {
        cp = string[0];
    } else if (*len == 2 && IS_CONT(string[1])) {
        cp = string[0] & 0x1F;
        cp = (cp << 6) | (string[1] & 0x3F);
    } else if (*len == 3 && IS_CONT(string[1]) && IS_CONT(string[2])) {
        cp = ((unsigned char)string[0]) & 0xF;
        cp = (cp << 6) | (string[1] & 0x3F);
        cp = (cp << 6) | (string[2] & 0x3F);
    } else if (*len == 4 && IS_CONT(string[1]) && IS_CONT(string[2]) && IS_CONT(string[3])) {
        cp = string[0] & 0x7;
        cp = (cp << 6) | (string[1] & 0x3F);
        cp = (cp << 6) | (string[2] & 0x3F);
        cp = (cp << 6) | (string[3] & 0x3F);
    } else {
        return 0;
    }

    /* overlong encodings */
    if ((cp < 0x80    && *len > 1) ||
        (cp < 0x800   && *len > 2) ||
        (cp < 0x10000 && *len > 3)) {
        return 0;
    }

    /* invalid unicode */
    if (cp > 0x10FFFF) {
        return 0;
    }

    /* surrogate halves */
    if (cp >= 0xD800 && cp <= 0xDFFF) {
        return 0;
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movzbl (%rax), %edi
callq 0x77e0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x7603
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x7760
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x7648
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x7648
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1f, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
jmp 0x775e
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x76b7
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x76b7
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x76b7
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0xf, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
jmp 0x775c
movq -0x18(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x7751
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x7751
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x7751
movq -0x10(%rbp), %rax
movzbl 0x3(%rax), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x7751
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x7, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
shll $0x6, %eax
movq -0x10(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x1c(%rbp)
jmp 0x775a
movl $0x0, -0x4(%rbp)
jmp 0x77d3
jmp 0x775c
jmp 0x775e
jmp 0x7760
cmpl $0x80, -0x1c(%rbp)
jae 0x7772
movq -0x18(%rbp), %rax
cmpl $0x1, (%rax)
jg 0x7796
cmpl $0x800, -0x1c(%rbp)     # imm = 0x800
jae 0x7784
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jg 0x7796
cmpl $0x10000, -0x1c(%rbp)   # imm = 0x10000
jae 0x779f
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jle 0x779f
movl $0x0, -0x4(%rbp)
jmp 0x77d3
cmpl $0x10ffff, -0x1c(%rbp)  # imm = 0x10FFFF
jbe 0x77b1
movl $0x0, -0x4(%rbp)
jmp 0x77d3
cmpl $0xd800, -0x1c(%rbp)    # imm = 0xD800
jb 0x77cc
cmpl $0xdfff, -0x1c(%rbp)    # imm = 0xDFFF
ja 0x77cc
movl $0x0, -0x4(%rbp)
jmp 0x77d3
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)