// File: /workspace/github_c_makefile_star2_O1/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 $-0x1
popq %rax
cmpb $0x0, 0x5c(%rdi)
jne 0x17b5
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq %rcx, 0x10(%rsp)
leaq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movslq 0x4(%rdi), %r12
leal -0x1(%r12), %eax
movl %eax, 0x1c(%rsp)
movl %esi, %eax
movq %rax, 0x20(%rsp)
testl %r12d, %r12d
jle 0x14ac
movq %rdx, %r14
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x1276
movq 0x10(%rsp), %rax
cmpl $0x1, (%rax)
je 0x14ac
movq 0x8(%rbx), %rax
cmpl $0x0, -0x4(%rax,%r12,8)
jle 0x12b2
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x1, %rax
ja 0x12a7
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movb $0x2c, (%rax)
incq 0x20(%rbx)
movq 0x8(%rbx), %rax
cmpl $0x9, -0x8(%rax,%r12,8)
movb 0x50(%rbx), %cl
pushq $0x1
popq %r13
jne 0x139e
leaq 0x965e(%rip), %r15      # 0xa92e
testb %cl, %cl
je 0x13fc
movl $0x774, %edx            # imm = 0x774
testq %r14, %r14
je 0x18a7
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x18a7
cmpb $0x0, (%rax)
je 0x18a7
movslq 0x4(%rbx), %r15
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
leaq 0x2(%r15), %rsi
cmpq %rsi, %rax
jae 0x1325
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x20(%rbx)
movb $0xa, (%rax)
movq 0x20(%rbx), %rdi
pushq $0x9
popq %rsi
movq %r15, %rdx
callq 0x1100
addq %r15, 0x20(%rbx)
movq %r14, %rdi
callq 0x3b73
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x4992
testl %eax, %eax
js 0x18c4
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x2, %rax
ja 0x1389
pushq $0x3
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
pushq $0x2
popq %r13
leaq 0x20(%rbx), %r14
movq (%r14), %rax
movw $0x93a, (%rax)          # imm = 0x93A
jmp 0x14a9
testb %cl, %cl
je 0x14ac
cmpl $0x8, %ebp
jne 0x146e
movslq 0x4(%rbx), %r13
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
leaq 0x2(%r13), %rsi
cmpq %rsi, %rax
jae 0x13d8
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
leaq 0x20(%rbx), %r14
movq (%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r14)
movb $0xa, (%rax)
movq (%r14), %rdi
pushq $0x9
popq %rsi
movq %r13, %rdx
callq 0x1100
jmp 0x14a9
movl $0x783, %edx            # imm = 0x783
testq %r14, %r14
je 0x18a7
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x18a7
cmpb $0x0, (%rax)
je 0x18a7
movq %r14, %rdi
callq 0x3b73
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x4992
testl %eax, %eax
js 0x18c4
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x1, %rax
ja 0x1462
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
leaq 0x20(%rbx), %r14
movq (%r14), %rax
movb $0x3a, (%rax)
jmp 0x14a9
cmpl $0x0, -0x4(%rax,%r12,8)
jle 0x157a
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x1, %rax
ja 0x149f
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
leaq 0x20(%rbx), %r14
movq (%r14), %rax
movb $0x20, (%rax)
addq %r13, (%r14)
cmpl $0x9, %ebp
ja 0x18c4
leaq 0x8f18(%rip), %rax      # 0xa3d4
movq 0x20(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%rsp), %rax
movl (%rax), %eax
cmpl $0x1, %eax
je 0x1507
testl %eax, %eax
jne 0x18c4
movslq (%rbx), %rax
cmpl %eax, 0x4(%rbx)
je 0x191c
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpl $0x9, %ebp
jne 0x17e4
movb $0x7b, %r14b
jmp 0x17e7
movl 0x4(%rbx), %eax
leaq 0x93fa(%rip), %r15      # 0xa90b
movl $0x7e3, %edx            # imm = 0x7E3
testq %rax, %rax
je 0x18a7
movq 0x8(%rbx), %rcx
movslq 0x1c(%rsp), %rsi
cmpl %ebp, (%rcx,%rsi,8)
jne 0x18a7
cmpb $0x1, 0x50(%rbx)
jne 0x1863
cmpl $0x2, %eax
jl 0x1837
cmpl $0x0, -0x4(%rcx,%rax,8)
jle 0x1863
cmpl $0x9, %ebp
je 0x1563
movl 0x58(%rbx), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x1863
movq 0x8(%rsp), %rdi
callq 0x1991
testl %eax, %eax
jns 0x1863
jmp 0x18c4
cmpl $0x9, %ebp
ja 0x18c4
leaq 0x8e22(%rip), %rax      # 0xa3ac
movq 0x20(%rsp), %rcx
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x4, %rax
ja 0x15bd
pushq $0x5
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movl $0x6c6c756e, (%rax)     # imm = 0x6C6C756E
jmp 0x170a
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x15f5
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq 0x20(%rbx), %rsi
callq 0x7fa7
jmp 0x1788
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1634
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x10(%rsp), %rax
movl (%rax), %edi
movq 0x20(%rbx), %rsi
callq 0x7b95
jmp 0x1788
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1672
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x10(%rsp), %rax
movl (%rax), %edi
movq 0x20(%rbx), %rsi
callq 0x84f3
jmp 0x1788
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x18e8
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x18e8
cmpb $0x0, (%rax)
je 0x18e8
movq %r14, %rdi
callq 0x3b73
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x4992
testl %eax, %eax
jns 0x178e
jmp 0x18c4
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
movq 0x10(%rsp), %rcx
cmpb $0x1, (%rcx)
jne 0x17b6
cmpq $0x4, %rax
ja 0x1700
pushq $0x5
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movl $0x65757274, (%rax)     # imm = 0x65757274
addq $0x4, 0x20(%rbx)
jmp 0x178e
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x173a
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x10(%rsp), %rax
movq (%rax), %rdi
movq 0x20(%rbx), %rsi
callq 0x86a2
jmp 0x1788
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x1776
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
movq 0x20(%rbx), %rdi
callq 0x876d
cltq
addq %rax, 0x20(%rbx)
movl %ebp, 0x58(%rbx)
testl %r12d, %r12d
jle 0x17a2
movq 0x8(%rbx), %rax
movl 0x1c(%rsp), %ecx
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 $0x5, %rax
ja 0x17cf
pushq $0x6
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movb $0x65, 0x4(%rax)
movl $0x736c6166, (%rax)     # imm = 0x736C6166
addq $0x5, 0x20(%rbx)
jmp 0x178e
movb $0x5b, %r14b
cmpq $0x1, %rax
ja 0x1800
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movb %r14b, (%rax)
incq 0x20(%rbx)
movslq 0x4(%rbx), %rax
testq %rax, %rax
jle 0x1821
movq 0x8(%rbx), %rcx
movslq 0x1c(%rsp), %rdx
incl 0x4(%rcx,%rdx,8)
movq 0x8(%rbx), %rcx
movl %ebp, (%rcx,%rax,8)
andl $0x0, 0x4(%rcx,%rax,8)
incl %eax
movl %eax, 0x4(%rbx)
jmp 0x178e
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x1, %rax
ja 0x1858
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movb $0xa, (%rax)
incq 0x20(%rbx)
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpl $0x9, %ebp
jne 0x1879
movb $0x7d, %r14b
jmp 0x187c
movb $0x5d, %r14b
cmpq $0x1, %rax
ja 0x1891
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movb %r14b, (%rax)
incq 0x20(%rbx)
decl 0x4(%rbx)
movl %ebp, 0x58(%rbx)
jmp 0x17a5
leaq 0x8bae(%rip), %rdi      # 0xa45c
leaq 0x8cd3(%rip), %rsi      # 0xa588
xorl %eax, %eax
callq 0x10d0
movq %r15, %rdi
callq 0x1070
movb $0x1, 0x5c(%rbx)
pushq $-0x1
popq %rax
jmp 0x17a7
movslq 0x4(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x1991
testl %eax, %eax
jns 0x14ac
jmp 0x18c4
movq 0x30(%rbx), %rax
subq 0x20(%rbx), %rax
addq 0x18(%rbx), %rax
cmpq $0x2, %rax
ja 0x1909
pushq $0x3
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x18c4
movq 0x20(%rbx), %rax
movw $0x2222, (%rax)         # imm = 0x2222
addq $0x2, 0x20(%rbx)
jmp 0x178e
leaq 0x10(%rax), %rcx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
leaq 0x80(,%rax,8), %rsi
callq 0x1190
testq %rax, %rax
je 0x193f
movq %rax, %r14
xorl %eax, %eax
jmp 0x1974
leaq 0x8b16(%rip), %rdi      # 0xa45c
leaq 0x8c3b(%rip), %rsi      # 0xa588
xorl %r14d, %r14d
movl $0x7cf, %edx            # imm = 0x7CF
xorl %eax, %eax
callq 0x10d0
leaq 0x8ffd(%rip), %rdi      # 0xa960
callq 0x1070
movq 0x8(%rbx), %rdi
callq 0x1030
pushq $0x6
popq %rax
movq %r14, 0x8(%rbx)
cmpl $0x6, %eax
je 0x18c4
testl %eax, %eax
pushq $-0x1
popq %rax
je 0x14ea
jmp 0x17a7