// File: /workspace/github_c_makefile_star2_O2/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, 0x10(%rsp)
pushq $-0x1
popq %rax
cmpb $0x0, 0x5c(%rdi)
jne 0x3248
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movslq 0x4(%rdi), %rcx
leal -0x1(%rcx), %r14d
movl %r14d, %eax
movq %rax, 0x18(%rsp)
movl %esi, %r15d
movq %rcx, 0x20(%rsp)
testl %ecx, %ecx
jle 0x2f2d
movq %rdx, %r13
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x2d54
movq 0x10(%rsp), %rax
cmpl $0x1, (%rax)
je 0x2f2d
movq 0x8(%rbx), %rax
movq 0x18(%rsp), %rcx
cmpl $0x0, 0x4(%rax,%rcx,8)
jle 0x2d9b
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x2d90
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x2c, (%rax)
incq 0x20(%rbx)
movq 0x8(%rbx), %rax
movq 0x18(%rsp), %rcx
cmpl $0x9, (%rax,%rcx,8)
movb 0x50(%rbx), %cl
pushq $0x1
popq %r12
jne 0x2e49
testb %cl, %cl
je 0x2e75
testq %r13, %r13
je 0x338d
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x338d
cmpb $0x0, (%rax)
je 0x338d
movslq 0x4(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x348c
testl %eax, %eax
js 0x33c8
movq %r13, %rdi
callq 0x1fbf
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x34ea
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r13
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x2, %rcx
ja 0x2e3b
pushq $0x3
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq (%r13), %rax
pushq $0x2
popq %r12
movw $0x93a, (%rax)          # imm = 0x93A
jmp 0x2f29
testb %cl, %cl
je 0x2f2d
cmpl $0x8, %ebp
jne 0x2ee6
movslq 0x4(%rbx), %rsi
movq 0x8(%rsp), %rdi
callq 0x348c
testl %eax, %eax
jns 0x2f46
jmp 0x33c8
testq %r13, %r13
je 0x33a2
movq 0x8(%r13), %rax
testq %rax, %rax
je 0x33a2
cmpb $0x0, (%rax)
je 0x33a2
movq %r13, %rdi
callq 0x1fbf
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x34ea
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r13
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x2ee1
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq (%r13), %rax
movb $0x3a, (%rax)
jmp 0x2f29
movq 0x18(%rsp), %rcx
cmpl $0x0, 0x4(%rax,%rcx,8)
jle 0x2ffd
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
leaq 0x20(%rbx), %r13
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x2f26
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq (%r13), %rax
movb $0x20, (%rax)
addq %r12, (%r13)
cmpl $0x9, %ebp
ja 0x33c8
leaq 0x5497(%rip), %rax      # 0x83d4
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%rsp), %rax
movl (%rax), %eax
cmpl $0x1, %eax
je 0x2fa3
testl %eax, %eax
jne 0x33c8
movslq 0x4(%rbx), %rax
cmpl (%rbx), %eax
je 0x342e
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpl $0x9, %ebp
jne 0x3257
cmpq $0x1, %rcx
ja 0x2f9b
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x7b, (%rax)
jmp 0x3277
movl 0x4(%rbx), %eax
testq %rax, %rax
je 0x340b
movq 0x8(%rbx), %rcx
movslq %r14d, %rsi
cmpl %ebp, (%rcx,%rsi,8)
jne 0x340b
cmpb $0x1, 0x50(%rbx)
jne 0x3304
cmpl $0x2, %eax
jl 0x32d1
cmpl $0x0, -0x4(%rcx,%rax,8)
jle 0x3304
cmpl $0x9, %ebp
jne 0x333a
movq 0x8(%rsp), %rdi
callq 0x348c
testl %eax, %eax
jns 0x3309
jmp 0x33c8
cmpl $0x9, %ebp
ja 0x33c8
leaq 0x539f(%rip), %rax      # 0x83ac
movslq (%rax,%r15,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 0x3042
pushq $0x5
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movl $0x6c6c756e, (%rax)     # imm = 0x6C6C756E
jmp 0x319f
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x307d
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rsi
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x6bf3
jmp 0x3226
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x30bf
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rsi
movq 0x10(%rsp), %rax
movl (%rax), %edi
callq 0x6a17
jmp 0x3226
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x3100
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rsi
movq 0x10(%rsp), %rax
movl (%rax), %edi
callq 0x6d49
jmp 0x3226
cmpq $0x0, 0x10(%rsp)
je 0x33d4
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x33d4
cmpb $0x0, (%rax)
je 0x33d4
movq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1fbf
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x34ea
testl %eax, %eax
jns 0x322c
jmp 0x33c8
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
movq 0x10(%rsp), %rdx
cmpb $0x1, (%rdx)
jne 0x32a0
cmpq $0x4, %rcx
ja 0x3199
pushq $0x5
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movl $0x65757274, (%rax)     # imm = 0x65757274
addq $0x4, 0x20(%rbx)
jmp 0x322c
movq 0x20(%rbx), %rsi
movq 0x30(%rbx), %rax
subq %rsi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x31d9
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rsi
movq 0x10(%rsp), %rax
movq (%rax), %rdi
callq 0x6db9
jmp 0x3226
movq 0x20(%rbx), %rdi
movq 0x30(%rbx), %rax
subq %rdi, %rax
addq 0x18(%rbx), %rax
cmpq $0x80, %rax
ja 0x3218
movl $0x81, %esi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rdi
movq 0x10(%rsp), %rax
movsd (%rax), %xmm0
callq 0x6e2c
cltq
addq %rax, 0x20(%rbx)
movl %ebp, 0x58(%rbx)
cmpl $0x0, 0x20(%rsp)
jle 0x3243
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 0x3274
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x5b, (%rax)
incq 0x20(%rbx)
movslq 0x4(%rbx), %rax
movq 0x8(%rbx), %rcx
testq %rax, %rax
jle 0x3291
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 0x322c
cmpq $0x5, %rcx
ja 0x32bd
pushq $0x6
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x65, 0x4(%rax)
movl $0x736c6166, (%rax)     # imm = 0x736C6166
addq $0x5, 0x20(%rbx)
jmp 0x322c
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x32fd
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0xa, (%rax)
incq 0x20(%rbx)
cmpl $0x9, %ebp
jne 0x3353
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x3335
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x7d, (%rax)
jmp 0x337e
movl 0x58(%rbx), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x3353
movq 0x8(%rsp), %rdi
callq 0x348c
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x1, %rcx
ja 0x337b
pushq $0x2
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movb $0x5d, (%rax)
incq 0x20(%rbx)
decl 0x4(%rbx)
movl %ebp, 0x58(%rbx)
jmp 0x3246
leaq 0x50c8(%rip), %rdi      # 0x845c
leaq 0x51ed(%rip), %rsi      # 0x8588
movl $0x774, %edx            # imm = 0x774
jmp 0x33b5
leaq 0x50b3(%rip), %rdi      # 0x845c
leaq 0x51d8(%rip), %rsi      # 0x8588
movl $0x783, %edx            # imm = 0x783
xorl %eax, %eax
callq 0x10c0
leaq 0x556b(%rip), %rdi      # 0x892e
callq 0x1060
movb $0x1, 0x5c(%rbx)
pushq $-0x1
popq %rax
jmp 0x3248
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rcx
subq %rax, %rcx
addq 0x18(%rbx), %rcx
cmpq $0x2, %rcx
ja 0x33fc
pushq $0x3
popq %rsi
movq 0x8(%rsp), %rdi
callq *0x28(%rbx)
testl %eax, %eax
js 0x33c8
movq 0x20(%rbx), %rax
movw $0x2222, (%rax)         # imm = 0x2222
addq $0x2, 0x20(%rbx)
jmp 0x322c
leaq 0x504a(%rip), %rdi      # 0x845c
leaq 0x516f(%rip), %rsi      # 0x8588
movl $0x7e3, %edx            # imm = 0x7E3
xorl %eax, %eax
callq 0x10c0
leaq 0x54df(%rip), %rdi      # 0x890b
jmp 0x33c3
leaq 0x10(%rax), %rcx
movl %ecx, (%rbx)
movq 0x8(%rbx), %rdi
leaq 0x80(,%rax,8), %rsi
callq 0x1180
testq %rax, %rax
je 0x3453
movq %rax, 0x8(%rbx)
jmp 0x2f66
leaq 0x5002(%rip), %rdi      # 0x845c
leaq 0x5127(%rip), %rsi      # 0x8588
movl $0x7cf, %edx            # imm = 0x7CF
xorl %eax, %eax
callq 0x10c0
leaq 0x54ec(%rip), %rdi      # 0x8960
callq 0x1060
movq 0x8(%rbx), %rdi
callq 0x1030
andq $0x0, 0x8(%rbx)
jmp 0x33c8