// File: /workspace/github_c_makefile_star2_O1/tomcatzh[P]RealityBenchmark/external/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
testq %rdi, %rdi
je 0x7a8c
movq %rdi, %rbx
xorl %r12d, %r12d
movabsq $0x400003700, %rcx      # imm = 0x400003700
xorl %r13d, %r13d
movzbl (%rbx,%r12), %edx
cmpq $0x22, %rdx
ja 0x79b0
btq %rdx, %rcx
jae 0x79ab
incq %r13
incq %r12
jmp 0x7992
testq %rdx, %rdx
je 0x79c2
cmpl $0x5c, %edx
je 0x79a3
leaq 0x5(%r13), %rsi
cmpb $0x20, %dl
cmovbq %rsi, %r13
jmp 0x79a6
leaq (%r12,%r13), %rsi
addq $0x3, %rsi
movq %rax, %rdi
callq 0x7892
testq %rax, %rax
je 0x7aa9
movq %rax, %r15
movb $0x22, (%rax)
testq %r13, %r13
je 0x7aad
movb (%rbx), %al
testb %al, %al
je 0x7abd
incq %rbx
leaq 0xf3a(%rip), %rbp       # 0x8938
movq %r15, %r14
cmpb $0x20, %al
jb 0x7a11
cmpb $0x22, %al
je 0x7a11
movzbl %al, %ecx
cmpl $0x5c, %ecx
jne 0x7a44
leaq 0x2(%r14), %rdi
movb $0x5c, 0x1(%r14)
movzbl -0x1(%rbx), %edx
leal -0x8(%rdx), %eax
cmpl $0x5, %eax
ja 0x7a35
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movb $0x62, (%rdi)
jmp 0x7a7a
cmpl $0x22, %edx
je 0x7a77
cmpl $0x5c, %edx
jne 0x7a4c
movb $0x5c, (%rdi)
jmp 0x7a7a
incq %r14
movb %al, (%r14)
jmp 0x7a5e
leaq 0xf33(%rip), %rsi       # 0x8986
xorl %eax, %eax
callq 0x2080
addq $0x6, %r14
movq %r14, %rdi
jmp 0x7a7a
movb $0x74, (%rdi)
jmp 0x7a7a
movb $0x6e, (%rdi)
jmp 0x7a7a
movb $0x66, (%rdi)
jmp 0x7a7a
movb $0x72, (%rdi)
jmp 0x7a7a
movb $0x22, (%rdi)
movb (%rbx), %al
incq %rbx
movq %rdi, %r14
testb %al, %al
jne 0x7a01
jmp 0x7abd
movl $0x3, %esi
movq %rax, %rdi
callq 0x7892
testq %rax, %rax
je 0x7aa9
movb $0x0, 0x2(%rax)
movw $0x2222, (%rax)         # imm = 0x2222
jmp 0x7ac8
xorl %eax, %eax
jmp 0x7acd
leaq (%r12,%r13), %rdx
leaq 0x1(%r15), %rdi
movq %rbx, %rsi
callq 0x21e0
addq %r13, %r15
movw $0x22, 0x1(%r12,%r15)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq