// File: /workspace/github_c_makefile_star2_O2/justy989[P]ce/ce_app.c
// Function: extract_diagnostics_from_response
CeClangDDiagnostics_t _extract_diagnostics_from_response(CeJsonObj_t* obj){
     CeClangDDiagnostics_t result = {};

     CeJsonFindResult_t params_find = ce_json_obj_find(obj, "params");
     if(params_find.type != CE_JSON_TYPE_OBJECT){
         return result;
     }
     CeJsonObj_t* params_obj = ce_json_obj_get_obj(obj, &params_find);
     if(params_obj == NULL){
         return result;
     }

     CeJsonFindResult_t uri_find = ce_json_obj_find(params_obj, "uri");
     if(uri_find.type != CE_JSON_TYPE_STRING){
         return result;
     }

     const char* file_uri = ce_json_obj_get_string(params_obj, &uri_find);
     if(file_uri == NULL){
         return result;
     }
     result.filepath = strdup(file_uri);
#if defined(PLATFORM_WINDOWS)
     _convert_uri_to_windows_path(result.filepath);
#else
     _convert_uri_to_linux_path(result.filepath);
#endif

     CeJsonFindResult_t diagnostics_find = ce_json_obj_find(params_obj, "diagnostics");
     if(diagnostics_find.type != CE_JSON_TYPE_ARRAY){
         return result;
     }

     CeJsonArray_t* diagnostics_array = ce_json_obj_get_array(params_obj, &diagnostics_find);
     if(diagnostics_array == NULL){
         return result;
     }

     for(int64_t i = 0; i < diagnostics_array->count; i++){
          CeJsonValue_t* value = diagnostics_array->values + i;
          if(value->type != CE_JSON_TYPE_OBJECT){
               continue;
          }

          CeJsonFindResult_t message_find = ce_json_obj_find(&value->obj, "message");
          if(message_find.type != CE_JSON_TYPE_STRING){
              continue;
          }
          CeClangDDiagnostic_t diag = {};
          diag.message = (char*)(ce_json_obj_get_string(&value->obj, &message_find));
          if(diag.message == NULL){
              continue;
          }

          CeJsonFindResult_t range_find = ce_json_obj_find(&value->obj, "range");
          if(range_find.type != CE_JSON_TYPE_OBJECT){
              continue;
          }

          CeJsonObj_t* range_obj = ce_json_obj_get_obj(&value->obj, &range_find);
          if(range_obj == NULL){
              continue;
          }

          // This logic can be compressed.
          {
              CeJsonFindResult_t start_find = ce_json_obj_find(range_obj, "start");
              if(start_find.type != CE_JSON_TYPE_OBJECT){
                   continue;
              }
              CeJsonObj_t* start_obj = ce_json_obj_get_obj(range_obj, &start_find);
              if(start_obj == NULL){
                   continue;
              }
              CeJsonFindResult_t line_find = ce_json_obj_find(start_obj, "line");
              if(line_find.type != CE_JSON_TYPE_NUMBER){
                   continue;
              }
              CeJsonFindResult_t character_find = ce_json_obj_find(start_obj, "character");
              if(character_find.type != CE_JSON_TYPE_NUMBER){
                   continue;
              }
              diag.start.x = (int64_t)(*ce_json_obj_get_number(start_obj, &character_find));
              diag.start.y = (int64_t)(*ce_json_obj_get_number(start_obj, &line_find));
          }
          {
              CeJsonFindResult_t end_find = ce_json_obj_find(range_obj, "end");
              if(end_find.type != CE_JSON_TYPE_OBJECT){
                   continue;
              }
              CeJsonObj_t* end_obj = ce_json_obj_get_obj(range_obj, &end_find);
              if(end_obj == NULL){
                   continue;
              }
              CeJsonFindResult_t line_find = ce_json_obj_find(end_obj, "line");
              if(line_find.type != CE_JSON_TYPE_NUMBER){
                   continue;
              }
              CeJsonFindResult_t character_find = ce_json_obj_find(end_obj, "character");
              if(character_find.type != CE_JSON_TYPE_NUMBER){
                   continue;
              }
              diag.end.x = (int64_t)(*ce_json_obj_get_number(end_obj, &character_find));
              diag.end.y = (int64_t)(*ce_json_obj_get_number(end_obj, &line_find));
          }

          ce_clangd_diag_add(&result, &diag);
     }

     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
leaq 0x1961a(%rip), %rsi     # 0x2bbfc
movq %r14, %rdi
callq 0x1af29
movl %eax, 0x98(%rsp)
movq %rdx, 0xa0(%rsp)
cmpl $0x1, %eax
jne 0x128c0
leaq 0x98(%rsp), %rsi
movq %r14, %rdi
callq 0x1af8c
testq %rax, %rax
je 0x128c0
movq %rax, %r14
leaq 0x195de(%rip), %rsi     # 0x2bc03
movq %rax, %rdi
callq 0x1af29
movl %eax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
cmpl $0x3, %eax
jne 0x128c0
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x1afc2
testq %rax, %rax
je 0x128c0
movq %rax, %rdi
callq 0xd640
movq %rax, 0x10(%rbx)
movq %rax, %rdi
callq 0x128d5
leaq 0x1958e(%rip), %rsi     # 0x2bc07
movq %r14, %rdi
callq 0x1af29
movl %eax, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
cmpl $0x2, %eax
jne 0x128c0
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x1afa7
testq %rax, %rax
je 0x128c0
movq %rax, %r14
pushq $0x8
popq %r12
xorl %r15d, %r15d
leaq 0x19556(%rip), %r13     # 0x2bc13
cmpq 0x8(%r14), %r15
jge 0x128c0
movq (%r14), %rbp
cmpl $0x1, -0x8(%rbp,%r12)
jne 0x128b4
addq %r12, %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1af29
movl %eax, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
cmpl $0x3, %eax
jne 0x128b4
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
andq $0x0, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x68(%rsp), %rsi
callq 0x1afc2
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x128b4
movq %rbp, %rdi
leaq 0x194be(%rip), %rsi     # 0x2bbec
callq 0x1af29
movl %eax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
cmpl $0x1, %eax
jne 0x128b4
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x1af8c
testq %rax, %rax
je 0x128b4
movq %rax, %rbp
movq %rax, %rdi
leaq 0x17f61(%rip), %rsi     # 0x2a6c9
callq 0x1af29
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x128ad
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1af8c
testq %rax, %rax
je 0x128ad
movq %rax, %r13
movq %rax, %rdi
leaq 0x1851b(%rip), %rsi     # 0x2acbd
callq 0x1af29
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x128ad
movq %r13, %rdi
leaq 0x1942f(%rip), %rsi     # 0x2bbf2
callq 0x1af29
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x128ad
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1afdb
cvttsd2si (%rax), %rax
movq %rax, 0x30(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1afdb
cvttsd2si (%rax), %rax
movq %rax, 0x38(%rsp)
movq %rbp, %rdi
leaq 0x17f0d(%rip), %rsi     # 0x2a71c
callq 0x1af29
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x128ad
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1af8c
testq %rax, %rax
je 0x128ad
movq %rax, %r13
movq %rax, %rdi
leaq 0x18478(%rip), %rsi     # 0x2acbd
callq 0x1af29
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x128ad
movq %r13, %rdi
leaq 0x19390(%rip), %rsi     # 0x2bbf2
callq 0x1af29
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x128ad
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1afdb
cvttsd2si (%rax), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1afdb
cvttsd2si (%rax), %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x1562a
leaq 0x1935f(%rip), %r13     # 0x2bc13
incq %r15
addq $0x18, %r12
jmp 0x126bd
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq