// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_clangd.c
// Function: convert_string_to_json_string
static char* _convert_string_to_json_string(const char* string){
     char* result = NULL;
     int64_t string_len = strlen(string);
     int64_t result_len = 0;

     // Count how big we need to allocate the string.
     for(int64_t i = 0; i < string_len; i++){
          if(string[i] == '"' ||
             string[i] == '\\' ||
             string[i] == '/' ||
             string[i] == '\b' ||
             string[i] == '\f' ||
             string[i] == '\n' ||
             string[i] == '\r' ||
             string[i] == '\t'){
             // TODO: support \u
               result_len += 2;
          }else{
               result_len++;
          }
     }

     // Allocate and populate the new string with valid
     result = malloc(result_len + 1);
     int64_t r = 0;
     for(int64_t i = 0; i < string_len; i++){
          switch(string[i]){
          case '"':
          case '\\':
          case '/':
               result[r] = '\\';
               r++;
               result[r] = string[i];
               r++;
               break;
          case '\b':
               result[r] = '\\';
               r++;
               result[r] = 'b';
               r++;
               break;
          case '\f':
               result[r] = '\\';
               r++;
               result[r] = 'f';
               r++;
               break;
          case '\n':
               result[r] = '\\';
               r++;
               result[r] = 'n';
               r++;
               break;
          case '\r':
               result[r] = '\\';
               r++;
               result[r] = 'r';
               r++;
               break;
          case '\t':
               result[r] = '\\';
               r++;
               result[r] = 't';
               r++;
               break;
          default:
               result[r] = string[i];
               r++;
               break;
          }
     }
     // End with null terminator
     result[r] = 0;
     return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd200
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1a444
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x22, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x8, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xd, %eax
je 0x1a417
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x1a425
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x1a431
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1a433
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1a381
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
callq 0xd4a0
movq %rax, -0x10(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1a65e
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x3c(%rbp)
subl $0x8, %eax
je 0x1a526
jmp 0x1a48d
movl -0x3c(%rbp), %eax
subl $0x9, %eax
je 0x1a5f7
jmp 0x1a49b
movl -0x3c(%rbp), %eax
subl $0xa, %eax
je 0x1a590
jmp 0x1a4a9
movl -0x3c(%rbp), %eax
subl $0xc, %eax
je 0x1a55b
jmp 0x1a4b7
movl -0x3c(%rbp), %eax
subl $0xd, %eax
je 0x1a5c5
jmp 0x1a4c5
movl -0x3c(%rbp), %eax
subl $0x22, %eax
je 0x1a4e7
jmp 0x1a4cf
movl -0x3c(%rbp), %eax
subl $0x2f, %eax
je 0x1a4e7
jmp 0x1a4d9
movl -0x3c(%rbp), %eax
subl $0x5c, %eax
jne 0x1a629
jmp 0x1a4e7
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x62, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x66, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x6e, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x72, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x5c, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x74, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64b
movq -0x8(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1a64d
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1a465
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x10(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)