// File: /workspace/github_c_makefile_star2_O3/lengjingzju[P]json/json.c
// Function: json_sax_print_value
int json_sax_print_value(json_sax_print_hd handle, json_type_t type, json_string_t *jkey, const void *value)
{
    json_sax_print_t *print_handle = (json_sax_print_t *)handle;
    json_print_t *print_ptr = &print_handle->print_val;
    json_string_t *jstr = NULL;
    int cur_pos = print_handle->count - 1;

    if (unlikely(print_handle->error_flag)) {
        return -1;
    }

    if (likely(print_handle->count > 0
        && !((type == JSON_ARRAY || type == JSON_OBJECT) && (*(json_sax_cmd_t*)value) == JSON_SAX_FINISH))) {
        // add ","
        if (print_handle->array[cur_pos].num > 0)
            _PRINT_PTR_STRNCAT(",", 1);

        // add key
        if (print_handle->array[cur_pos].type == JSON_OBJECT) {
            if (print_ptr->format_flag) {
                if (unlikely(!jkey || !jkey->str || !jkey->str[0])) {
#if !JSON_PARSE_EMPTY_KEY
                    JsonErr("key is empty!\n");
                    goto err;
#else
                    _PRINT_ADDI_FORMAT(print_ptr, print_handle->count);
                    _PRINT_PTR_STRNCAT("\"\":\t", 4);
#endif
                } else {
                    _PRINT_ADDI_FORMAT(print_ptr, print_handle->count);
                    json_string_info_update(jkey);
                    _JSON_PRINT_STRING(print_ptr, jkey);
                    _PRINT_PTR_STRNCAT(":\t", 2);
                }
            } else {
                if (unlikely(!jkey || !jkey->str || !jkey->str[0])) {
#if !JSON_PARSE_EMPTY_KEY
                    JsonErr("key is empty!\n");
                    goto err;
#else
                    _PRINT_PTR_STRNCAT("\"\":", 3);
#endif
                } else {
                    json_string_info_update(jkey);
                    _JSON_PRINT_STRING(print_ptr, jkey);
                    _PRINT_PTR_STRNCAT(":", 1);
                }
            }
        } else {
            if (print_ptr->format_flag) {
                if (type == JSON_ARRAY) {
                    _PRINT_ADDI_FORMAT(print_ptr, print_handle->count);
                } else {
                    if (print_handle->array[cur_pos].num > 0) {
                        _PRINT_PTR_STRNCAT(" ", 1);
                    } else {
                        if (type == JSON_OBJECT)
                            _PRINT_ADDI_FORMAT(print_ptr, print_handle->count);
                    }
                }
            }
        }
    }

    // add value
    switch (type) {
    case JSON_NULL:
        _PRINT_PTR_STRNCAT("null", 4);
        break;
    case JSON_BOOL:
        if ((*(bool*)value)) {
            _PRINT_PTR_STRNCAT("true", 4);
        } else {
            _PRINT_PTR_STRNCAT("false", 5);
        }
        break;

    case JSON_INT:
        _PRINT_PTR_NUMBER(jnum_itoa, *(int32_t*)value);
        break;
    case JSON_HEX:
        _PRINT_PTR_NUMBER(jnum_htoa, *(uint32_t*)value);
        break;
    case JSON_LINT:
        _PRINT_PTR_NUMBER(jnum_ltoa, *(int64_t*)value);
        break;
    case JSON_LHEX:
        _PRINT_PTR_NUMBER(jnum_lhtoa, *(uint64_t*)value);
        break;
    case JSON_DOUBLE:
        _PRINT_PTR_NUMBER(json_dtoa, *(double*)value);
        break;
    case JSON_STRING:
        jstr = (json_string_t*)value;
        if (unlikely(!jstr || !jstr->str || !jstr->str[0])) {
            _PRINT_PTR_STRNCAT("\"\"", 2);
        } else {
            json_string_info_update(jstr);
            _JSON_PRINT_STRING(print_ptr, jstr);
        }
        break;

    case JSON_ARRAY:
    case JSON_OBJECT:
        switch ((*(json_sax_cmd_t*)value)) {
        case JSON_SAX_START:
            if (unlikely(print_handle->count == print_handle->total)) {
                print_handle->total += JSON_PRINT_DEPTH_DEF;
                json_sax_print_depth_t *new_array = (json_sax_print_depth_t *)json_realloc(
                    print_handle->array, print_handle->total * sizeof(json_sax_print_depth_t));
                if (new_array) {
                    print_handle->array = new_array;
                } else {
                    JsonErr("malloc failed!\n");
                    json_free(print_handle->array);
                    print_handle->array = NULL;
                    goto err;
                }
            }
            if (type == JSON_OBJECT) {
                _PRINT_PTR_STRNCAT("{", 1);
            } else {
                _PRINT_PTR_STRNCAT("[", 1);
            }
            if (print_handle->count > 0)
                ++print_handle->array[cur_pos].num;
            print_handle->array[print_handle->count].type = type;
            print_handle->array[print_handle->count].num = 0;
            ++print_handle->count;
            break;

        case JSON_SAX_FINISH:
            if (unlikely(print_handle->count == 0 || print_handle->array[cur_pos].type != type)) {
                JsonErr("unexpected array or object finish!\n");
                goto err;
            }
            if (print_ptr->format_flag) {
                if (print_handle->count > 1) {
                    if (print_handle->array[print_handle->count-1].num > 0) {
                        if (type == JSON_OBJECT) {
                            _PRINT_ADDI_FORMAT(print_ptr, cur_pos);
                        } else {
                            if (print_handle->last_type == JSON_OBJECT || print_handle->last_type == JSON_ARRAY)
                                _PRINT_ADDI_FORMAT(print_ptr, cur_pos);
                        }
                    }
                } else {
                    _PRINT_PTR_STRNCAT("\n", 1);
                }
            }
            if (type == JSON_OBJECT) {
                _PRINT_PTR_STRNCAT("}", 1);
            } else {
                _PRINT_PTR_STRNCAT("]", 1);
            }
            --print_handle->count;
            print_handle->last_type = type;
            return 0;

        default:
            goto err;
        }
        break;

    default:
        goto err;
    }

    print_handle->last_type = type;
    if (cur_pos >= 0)
        ++print_handle->array[cur_pos].num;
    ++print_ptr->item_count;

    return 0;
err:
    print_handle->error_flag = true;
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, 0x8(%rsp)
pushq $-0x1
popq %rax
cmpb $0x0, 0x5c(%rdi)
jne 0x17c9
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rsp)
movslq 0x4(%rdi), %rcx
leal -0x1(%rcx), %eax
movl %eax, 0x14(%rsp)
movl %eax, %edx
movl %esi, %r12d
movq %rcx, 0x20(%rsp)
testl %ecx, %ecx
movq %rdx, 0x18(%rsp)
jle 0x14a3
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x126a
movq 0x8(%rsp), %rax
cmpl $0x1, (%rax)
je 0x14a3
movq 0x8(%rbx), %rax
cmpl $0x0, 0x4(%rax,%rdx,8)
jle 0x12b0
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x12a5
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movq 0x18(%rsp), %rdx
movb $0x2c, (%rax)
incq 0x20(%rbx)
movq 0x8(%rbx), %rax
cmpl $0x9, (%rax,%rdx,8)
movb 0x50(%rbx), %cl
pushq $0x1
popq %r14
jne 0x138e
testb %cl, %cl
je 0x13f1
testq %r13, %r13
je 0x18ff
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x18ff
cmpb $0x0, (%rax)
je 0x18ff
movslq 0x4(%rbx), %r14
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r15
subq %rax, %rcx
addq 0x18(%rbx), %rcx
leaq 0x2(%r14), %rsi
cmpq %rsi, %rcx
jae 0x131a
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq (%r15), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r15)
movb $0xa, (%rax)
movq (%r15), %rdi
pushq $0x9
popq %rsi
movq %r14, %rdx
callq 0x10f0
addq %r14, (%r15)
movq %r13, %rdi
callq 0x3ee7
movl (%r13), %esi
movq 0x8(%r13), %rdx
movq (%rsp), %rdi
callq 0x4d7a
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x2, %rcx
ja 0x1380
pushq $0x3
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq (%r15), %rax
pushq $0x2
popq %r14
movw $0x93a, (%rax)          # imm = 0x93A
jmp 0x14a0
testb %cl, %cl
je 0x14a3
cmpl $0x8, %ebp
jne 0x1464
movslq 0x4(%rbx), %r14
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
leaq 0x2(%r14), %rsi
cmpq %rsi, %rcx
jae 0x13ce
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x20(%rbx)
movb $0xa, (%rax)
movq 0x20(%rbx), %rdi
pushq $0x9
popq %rsi
movq %r14, %rdx
callq 0x10f0
addq %r14, 0x20(%rbx)
jmp 0x14bc
testq %r13, %r13
je 0x1914
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x1914
cmpb $0x0, (%rax)
je 0x1914
movq %r13, %rdi
callq 0x3ee7
movl (%r13), %esi
movq 0x8(%r13), %rdx
movq (%rsp), %rdi
callq 0x4d7a
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r15
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x145f
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq (%r15), %rax
movb $0x3a, (%rax)
jmp 0x14a0
cmpl $0x0, 0x4(%rax,%rdx,8)
jle 0x1582
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r15
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x149d
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq (%r15), %rax
movb $0x20, (%rax)
addq %r14, (%r15)
cmpl $0x9, %ebp
ja 0x193a
leaq 0x8f21(%rip), %rax      # 0xa3d4
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x8(%rsp), %rax
movl (%rax), %eax
cmpl $0x1, %eax
je 0x1518
testl %eax, %eax
jne 0x193a
movslq 0x4(%rbx), %rax
cmpl (%rbx), %eax
je 0x19b9
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpl $0x9, %ebp
jne 0x17d8
cmpq $0x1, %rcx
ja 0x1510
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0x7b, (%rax)
jmp 0x17f7
movl 0x4(%rbx), %eax
testq %rax, %rax
je 0x1993
movq 0x8(%rbx), %rcx
movslq 0x14(%rsp), %rsi
cmpl %ebp, (%rcx,%rsi,8)
jne 0x1993
cmpb $0x1, 0x50(%rbx)
jne 0x1882
cmpl $0x2, %eax
jl 0x1850
cmpl $0x0, -0x4(%rcx,%rax,8)
jle 0x1882
cmpl $0x9, %ebp
je 0x18f0
movl 0x58(%rbx), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x18b7
movq (%rsp), %rdi
callq 0x1a17
testl %eax, %eax
jns 0x18b7
jmp 0x193a
cmpl $0x9, %ebp
ja 0x193a
leaq 0x8e1a(%rip), %rax      # 0xa3ac
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x4, %rcx
ja 0x15c6
pushq $0x5
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movl $0x6c6c756e, (%rax)     # imm = 0x6C6C756E
jmp 0x1722
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1600
movl $0x81, %esi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rsi
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x7e8f
jmp 0x17a7
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1641
movl $0x81, %esi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rsi
movq 0x8(%rsp), %rax
movl (%rax), %edi
callq 0x7b06
jmp 0x17a7
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1681
movl $0x81, %esi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rsi
movq 0x8(%rsp), %rax
movl (%rax), %edi
callq 0x83dd
jmp 0x17a7
cmpq $0x0, 0x8(%rsp)
je 0x195d
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x195d
cmpb $0x0, (%rax)
je 0x195d
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x3ee7
movl (%r14), %esi
movq 0x8(%r14), %rdx
movq (%rsp), %rdi
callq 0x4d7a
testl %eax, %eax
jns 0x17ad
jmp 0x193a
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
movq 0x8(%rsp), %rdx
cmpb $0x1, (%rdx)
jne 0x1820
cmpq $0x4, %rcx
ja 0x171c
pushq $0x5
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movl $0x65757274, (%rax)     # imm = 0x65757274
addq $0x4, 0x20(%rbx)
jmp 0x17ad
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x175b
movl $0x81, %esi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rsi
movq 0x8(%rsp), %rax
movq (%rax), %rdi
callq 0x8597
jmp 0x17a7
movq 0x20(%rbx), %rdi
movq 0x30(%rbx), %rax
subq %rdi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1799
movl $0x81, %esi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rdi
movq 0x8(%rsp), %rax
movsd (%rax), %xmm0
callq 0x8662
cltq
addq %rax, 0x20(%rbx)
movl %ebp, 0x58(%rbx)
cmpl $0x0, 0x20(%rsp)
jle 0x17c4
movq 0x8(%rbx), %rax
movq 0x18(%rsp), %rcx
incl 0x4(%rax,%rcx,8)
incl 0x4c(%rbx)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x1, %rcx
ja 0x17f4
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0x5b, (%rax)
incq 0x20(%rbx)
movslq 0x4(%rbx), %rax
movq 0x8(%rbx), %rcx
testq %rax, %rax
jle 0x1811
movq 0x20(%rsp), %rdx
incl -0x4(%rcx,%rdx,8)
movl %ebp, (%rcx,%rax,8)
andl $0x0, 0x4(%rcx,%rax,8)
incl %eax
movl %eax, 0x4(%rbx)
jmp 0x17ad
cmpq $0x5, %rcx
ja 0x183c
pushq $0x6
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0x65, 0x4(%rax)
movl $0x736c6166, (%rax)     # imm = 0x736C6166
addq $0x5, 0x20(%rbx)
jmp 0x17ad
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x187b
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0xa, (%rax)
incq 0x20(%rbx)
cmpl $0x9, %ebp
jne 0x18b7
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x18b2
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0x7d, (%rax)
jmp 0x18e1
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x18de
pushq $0x2
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movb $0x5d, (%rax)
incq 0x20(%rbx)
decl 0x4(%rbx)
movl %ebp, 0x58(%rbx)
jmp 0x17c7
movq (%rsp), %rdi
callq 0x1a17
testl %eax, %eax
jns 0x1887
jmp 0x193a
leaq 0x8b56(%rip), %rdi      # 0xa45c
leaq 0x8c7b(%rip), %rsi      # 0xa588
movl $0x774, %edx            # imm = 0x774
jmp 0x1927
leaq 0x8b41(%rip), %rdi      # 0xa45c
leaq 0x8c66(%rip), %rsi      # 0xa588
movl $0x783, %edx            # imm = 0x783
xorl %eax, %eax
callq 0x10c0
leaq 0x8ff9(%rip), %rdi      # 0xa92e
callq 0x1060
movb $0x1, 0x5c(%rbx)
pushq $-0x1
popq %rax
jmp 0x17c9
movslq 0x4(%rbx), %rsi
movq (%rsp), %rdi
callq 0x1a17
testl %eax, %eax
jns 0x14bc
jmp 0x193a
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x2, %rcx
ja 0x1984
pushq $0x3
popq %rsi
movq (%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x193a
movq 0x20(%rbx), %rax
movw $0x2222, (%rax)         # imm = 0x2222
addq $0x2, 0x20(%rbx)
jmp 0x17ad
leaq 0x8ac2(%rip), %rdi      # 0xa45c
leaq 0x8be7(%rip), %rsi      # 0xa588
movl $0x7e3, %edx            # imm = 0x7E3
xorl %eax, %eax
callq 0x10c0
leaq 0x8f57(%rip), %rdi      # 0xa90b
jmp 0x1935
leaq 0x10(%rax), %rcx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
leaq 0x80(,%rax,8), %rsi
callq 0x1180
testq %rax, %rax
je 0x19de
movq %rax, 0x8(%rbx)
jmp 0x14dc
leaq 0x8a77(%rip), %rdi      # 0xa45c
leaq 0x8b9c(%rip), %rsi      # 0xa588
movl $0x7cf, %edx            # imm = 0x7CF
xorl %eax, %eax
callq 0x10c0
leaq 0x8f61(%rip), %rdi      # 0xa960
callq 0x1060
movq 0x8(%rbx), %rdi
callq 0x1030
andq $0x0, 0x8(%rbx)
jmp 0x193a