// File: /workspace/github_c_makefile_star2_O1/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)
movq $0x0, 0x10(%rdi)
leaq 0x1cc32(%rip), %rsi     # 0x2fbfa
movq %r14, %rdi
callq 0x1c543
movl %eax, 0x98(%rsp)
movq %rdx, 0xa0(%rsp)
cmpl $0x1, %eax
jne 0x132b1
leaq 0x98(%rsp), %rsi
movq %r14, %rdi
callq 0x1c596
testq %rax, %rax
je 0x132b1
movq %rax, %r14
leaq 0x1cbf6(%rip), %rsi     # 0x2fc01
movq %rax, %rdi
callq 0x1c543
movl %eax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
cmpl $0x3, %eax
jne 0x132b1
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x1c5cc
testq %rax, %rax
je 0x132b1
movq %rax, %rdi
callq 0xd640
movq %rax, 0x10(%rbx)
movq %rax, %rdi
callq 0x132c6
leaq 0x1cba6(%rip), %rsi     # 0x2fc05
movq %r14, %rdi
callq 0x1c543
movl %eax, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
cmpl $0x2, %eax
jne 0x132b1
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x1c5b1
testq %rax, %rax
je 0x132b1
movq %rax, %r14
cmpq $0x0, 0x8(%rax)
jle 0x132b1
movl $0x8, %r12d
xorl %r15d, %r15d
leaq 0x1cb61(%rip), %r13     # 0x2fc11
movq (%r14), %rbp
cmpl $0x1, -0x8(%rbp,%r12)
jne 0x132a0
addq %r12, %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1c543
movl %eax, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
cmpl $0x3, %eax
jne 0x132a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x68(%rsp), %rsi
callq 0x1c5cc
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x132a0
movq %rbp, %rdi
leaq 0x1cad0(%rip), %rsi     # 0x2fbea
callq 0x1c543
movl %eax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
cmpl $0x1, %eax
jne 0x132a0
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x1c596
testq %rax, %rax
je 0x132a0
movq %rax, %rbp
movq %rax, %rdi
leaq 0x1b575(%rip), %rsi     # 0x2e6c9
callq 0x1c543
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x13299
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c596
testq %rax, %rax
je 0x13299
movq %rax, %r13
movq %rax, %rdi
leaq 0x1bb2d(%rip), %rsi     # 0x2ecbb
callq 0x1c543
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x13299
movq %r13, %rdi
leaq 0x1ca41(%rip), %rsi     # 0x2fbf0
callq 0x1c543
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x13299
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1c5e5
cvttsd2si (%rax), %rax
movq %rax, 0x30(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1c5e5
cvttsd2si (%rax), %rax
movq %rax, 0x38(%rsp)
movq %rbp, %rdi
leaq 0x1b521(%rip), %rsi     # 0x2e71c
callq 0x1c543
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x13299
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c596
testq %rax, %rax
je 0x13299
movq %rax, %r13
movq %rax, %rdi
leaq 0x1ba8a(%rip), %rsi     # 0x2ecbb
callq 0x1c543
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x13299
movq %r13, %rdi
leaq 0x1c9a2(%rip), %rsi     # 0x2fbf0
callq 0x1c543
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x13299
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1c5e5
cvttsd2si (%rax), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1c5e5
cvttsd2si (%rax), %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x16384
leaq 0x1c971(%rip), %r13     # 0x2fc11
incq %r15
addq $0x18, %r12
cmpq 0x8(%r14), %r15
jl 0x130b0
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq