// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xb0bb
movl $0x0, -0x4(%rbp)
jmp 0xb369
cmpq $0x0, -0x10(%rbp)
jne 0xb103
movq -0x18(%rbp), %rdi
movl $0x3, %esi
callq 0xa700
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb0e7
movl $0x0, -0x4(%rbp)
jmp 0xb369
movq -0x28(%rbp), %rdi
leaq 0x1b35(%rip), %rsi      # 0xcc27
callq 0x2220
movl $0x1, -0x4(%rbp)
jmp 0xb369
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0xb181
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x44(%rbp)
addl $-0x8, %eax
subl $0x3, %eax
jb 0xb149
jmp 0xb128
movl -0x44(%rbp), %eax
addl $-0xc, %eax
subl $0x2, %eax
jb 0xb149
jmp 0xb135
movl -0x44(%rbp), %eax
subl $0x22, %eax
je 0xb149
jmp 0xb13f
movl -0x44(%rbp), %eax
subl $0x5c, %eax
jne 0xb157
jmp 0xb149
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xb171
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x20, %eax
jge 0xb16f
movq -0x40(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x40(%rbp)
jmp 0xb171
jmp 0xb173
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xb10b
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
addq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x3, %rsi
callq 0xa700
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xb1bc
movl $0x0, -0x4(%rbp)
jmp 0xb369
cmpq $0x0, -0x40(%rbp)
jne 0xb205
movq -0x28(%rbp), %rax
movb $0x22, (%rax)
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x21f0
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movb $0x22, 0x1(%rax,%rcx)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movb $0x0, 0x2(%rax,%rcx)
movl $0x1, -0x4(%rbp)
jmp 0xb369
movq -0x28(%rbp), %rax
movb $0x22, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0xb348
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x1f, %eax
jle 0xb265
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x22, %eax
je 0xb265
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5c, %eax
je 0xb265
movq -0x20(%rbp), %rax
movb (%rax), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
jmp 0xb329
movq -0x30(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x30(%rbp)
movb $0x5c, (%rax)
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x48(%rbp)
subl $0x8, %eax
je 0xb2d5
jmp 0xb287
movl -0x48(%rbp), %eax
subl $0x9, %eax
je 0xb2f9
jmp 0xb291
movl -0x48(%rbp), %eax
subl $0xa, %eax
je 0xb2e7
jmp 0xb29b
movl -0x48(%rbp), %eax
subl $0xc, %eax
je 0xb2de
jmp 0xb2a5
movl -0x48(%rbp), %eax
subl $0xd, %eax
je 0xb2f0
jmp 0xb2af
movl -0x48(%rbp), %eax
subl $0x22, %eax
je 0xb2cc
jmp 0xb2b9
movl -0x48(%rbp), %eax
subl $0x5c, %eax
jne 0xb302
jmp 0xb2c3
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x22, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x62, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x66, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x6e, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x72, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rax
movb $0x74, (%rax)
jmp 0xb327
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movzbl (%rax), %edx
leaq 0x1916(%rip), %rsi      # 0xcc2a
movb $0x0, %al
callq 0x2080
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0xb329
jmp 0xb32b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xb220
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movb $0x22, 0x1(%rax,%rcx)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movb $0x0, 0x2(%rax,%rcx)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)