// File: /workspace/github_c_makefile_star2_O2/back1127[P]linkedge-thing-access-websocket_client_sdk/sdk/utility/json/cJSON.c
// Function: print_string_ptr
static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffer * const output_buffer)
{
    const unsigned char *input_pointer = NULL;
    unsigned char *output = NULL;
    unsigned char *output_pointer = NULL;
    size_t output_length = 0;
    /* numbers of additional characters needed for escaping */
    size_t escape_characters = 0;

    if (output_buffer == NULL)
    {
        return false;
    }

    /* empty string */
    if (input == NULL)
    {
        output = ensure(output_buffer, sizeof("\"\""));
        if (output == NULL)
        {
            return false;
        }
        strcpy((char*)output, "\"\"");

        return true;
    }

    /* set "flag" to 1 if something needs to be escaped */
    for (input_pointer = input; *input_pointer; input_pointer++)
    {
        switch (*input_pointer)
        {
            case '\"':
            case '\\':
            case '\b':
            case '\f':
            case '\n':
            case '\r':
            case '\t':
                /* one character escape sequence */
                escape_characters++;
                break;
            default:
                if (*input_pointer < 32)
                {
                    /* UTF-16 escape sequence uXXXX */
                    escape_characters += 5;
                }
                break;
        }
    }
    output_length = (size_t)(input_pointer - input) + escape_characters;

    output = ensure(output_buffer, output_length + sizeof("\"\""));
    if (output == NULL)
    {
        return false;
    }

    /* no characters have to be escaped */
    if (escape_characters == 0)
    {
        output[0] = '\"';
        memcpy(output + 1, input, output_length);
        output[output_length + 1] = '\"';
        output[output_length + 2] = '\0';

        return true;
    }

    output[0] = '\"';
    output_pointer = output + 1;
    /* copy the string */
    for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++)
    {
        if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\'))
        {
            /* normal character, copy */
            *output_pointer = *input_pointer;
        }
        else
        {
            /* character needs to be escaped */
            *output_pointer++ = '\\';
            switch (*input_pointer)
            {
                case '\\':
                    *output_pointer = '\\';
                    break;
                case '\"':
                    *output_pointer = '\"';
                    break;
                case '\b':
                    *output_pointer = 'b';
                    break;
                case '\f':
                    *output_pointer = 'f';
                    break;
                case '\n':
                    *output_pointer = 'n';
                    break;
                case '\r':
                    *output_pointer = 'r';
                    break;
                case '\t':
                    *output_pointer = 't';
                    break;
                default:
                    /* escape and print as unicode codepoint */
                    sprintf((char*)output_pointer, "u%04x", *input_pointer);
                    output_pointer += 4;
                    break;
            }
        }
    }
    output[output_length + 1] = '\"';
    output[output_length + 2] = '\0';

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
testq %rdi, %rdi
je 0x916a
movq %rdi, %rbx
xorl %r12d, %r12d
movabsq $0x400003700, %rcx      # imm = 0x400003700
xorl %r13d, %r13d
movzbl (%rbx,%r12), %edx
cmpq $0x22, %rdx
ja 0x9099
btq %rdx, %rcx
jae 0x9094
incq %r13
incq %r12
jmp 0x907b
testq %rdx, %rdx
je 0x90ab
cmpl $0x5c, %edx
je 0x908c
leaq 0x5(%r13), %rsi
cmpb $0x20, %dl
cmovbq %rsi, %r13
jmp 0x908f
leaq (%r12,%r13), %rsi
addq $0x3, %rsi
movq %rax, %rdi
callq 0x8f62
testq %rax, %rax
je 0x9185
movq %rax, %r14
movb $0x22, (%rax)
testq %r13, %r13
je 0x919a
leaq 0x164e(%rip), %r15      # 0xa728
movq %r14, -0x30(%rbp)
movb (%rbx), %al
testb %al, %al
je 0x9189
cmpb $0x20, %al
jb 0x90f8
cmpb $0x22, %al
je 0x90f8
movzbl %al, %ecx
cmpl $0x5c, %ecx
jne 0x9129
leaq 0x2(%r14), %rdi
movb $0x5c, 0x1(%r14)
movzbl (%rbx), %edx
leal -0x8(%rdx), %eax
cmpl $0x5, %eax
ja 0x911a
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movb $0x62, (%rdi)
jmp 0x915f
cmpl $0x22, %edx
je 0x915c
cmpl $0x5c, %edx
jne 0x9131
movb $0x5c, (%rdi)
jmp 0x915f
incq %r14
movb %al, (%r14)
jmp 0x9143
leaq 0x1636(%rip), %rsi      # 0xa76e
xorl %eax, %eax
callq 0x4620
addq $0x6, %r14
movq %r14, %rdi
jmp 0x915f
movb $0x74, (%rdi)
jmp 0x915f
movb $0x6e, (%rdi)
jmp 0x915f
movb $0x66, (%rdi)
jmp 0x915f
movb $0x72, (%rdi)
jmp 0x915f
movb $0x22, (%rdi)
incq %rbx
movq %rdi, %r14
jmp 0x90de
pushq $0x3
popq %rsi
movq %rax, %rdi
callq 0x8f62
testq %rax, %rax
je 0x9185
movb $0x0, 0x2(%rax)
movw $0x2222, (%rax)         # imm = 0x2222
jmp 0x91b5
xorl %eax, %eax
jmp 0x91b8
movq -0x30(%rbp), %rax
addq %r13, %rax
movw $0x22, 0x1(%r12,%rax)
jmp 0x91b5
leaq (%r12,%r13), %rdx
leaq 0x1(%r14), %rdi
movq %rbx, %rsi
callq 0x43f0
addq %r13, %r14
movw $0x22, 0x1(%r12,%r14)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop