// File: /workspace/github_c_makefile_star2_O3/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 0x1be34(%rip), %rsi     # 0x2ebfc
movq %r14, %rdi
callq 0x1c943
movl %eax, 0x98(%rsp)
movq %rdx, 0xa0(%rsp)
cmpl $0x1, %eax
jne 0x130b6
leaq 0x98(%rsp), %rsi
movq %r14, %rdi
callq 0x1c996
testq %rax, %rax
je 0x130b6
movq %rax, %r14
leaq 0x1bdf8(%rip), %rsi     # 0x2ec03
movq %rax, %rdi
callq 0x1c943
movl %eax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
cmpl $0x3, %eax
jne 0x130b6
leaq 0x88(%rsp), %rsi
movq %r14, %rdi
callq 0x1c9cc
testq %rax, %rax
je 0x130b6
movq %rax, %rdi
callq 0xd640
movq %rax, 0x10(%rbx)
movq %rax, %rdi
callq 0x130cb
leaq 0x1bda8(%rip), %rsi     # 0x2ec07
movq %r14, %rdi
callq 0x1c943
movl %eax, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
cmpl $0x2, %eax
jne 0x130b6
leaq 0x78(%rsp), %rsi
movq %r14, %rdi
callq 0x1c9b1
testq %rax, %rax
je 0x130b6
movq %rax, %r14
movq 0x8(%rax), %rax
testq %rax, %rax
jle 0x130b6
movl $0x8, %r12d
xorl %r15d, %r15d
leaq 0x1bd61(%rip), %r13     # 0x2ec13
movq (%r14), %rbp
cmpl $0x1, -0x8(%rbp,%r12)
jne 0x130a6
addq %r12, %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x1c943
movl %eax, 0x68(%rsp)
movq %rdx, 0x70(%rsp)
cmpl $0x3, %eax
jne 0x130a2
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
movq %rbp, %rdi
leaq 0x68(%rsp), %rsi
callq 0x1c9cc
movq %rax, 0x50(%rsp)
testq %rax, %rax
je 0x130a2
movq %rbp, %rdi
leaq 0x1bcd0(%rip), %rsi     # 0x2ebec
callq 0x1c943
movl %eax, 0x58(%rsp)
movq %rdx, 0x60(%rsp)
cmpl $0x1, %eax
jne 0x130a2
movq %rbp, %rdi
leaq 0x58(%rsp), %rsi
callq 0x1c996
testq %rax, %rax
je 0x130a2
movq %rax, %rbp
movq %rax, %rdi
leaq 0x1a773(%rip), %rsi     # 0x2d6c9
callq 0x1c943
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x1309b
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c996
testq %rax, %rax
je 0x1309b
movq %rax, %r13
movq %rax, %rdi
leaq 0x1ad2d(%rip), %rsi     # 0x2dcbd
callq 0x1c943
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x1309b
movq %r13, %rdi
leaq 0x1bc41(%rip), %rsi     # 0x2ebf2
callq 0x1c943
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x1309b
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1c9e5
cvttsd2si (%rax), %rax
movq %rax, 0x30(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1c9e5
cvttsd2si (%rax), %rax
movq %rax, 0x38(%rsp)
movq %rbp, %rdi
leaq 0x1a71f(%rip), %rsi     # 0x2d71c
callq 0x1c943
movl %eax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
cmpl $0x1, %eax
jne 0x1309b
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1c996
testq %rax, %rax
je 0x1309b
movq %rax, %r13
movq %rax, %rdi
leaq 0x1ac8a(%rip), %rsi     # 0x2dcbd
callq 0x1c943
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
cmpl $0x4, %eax
jne 0x1309b
movq %r13, %rdi
leaq 0x1bba2(%rip), %rsi     # 0x2ebf2
callq 0x1c943
movl %eax, (%rsp)
movq %rdx, 0x8(%rsp)
cmpl $0x4, %eax
jne 0x1309b
movq %r13, %rdi
movq %rsp, %rsi
callq 0x1c9e5
cvttsd2si (%rax), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1c9e5
cvttsd2si (%rax), %rax
movq %rax, 0x48(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x15ff3
leaq 0x1bb71(%rip), %r13     # 0x2ec13
movq 0x8(%r14), %rax
incq %r15
addq $0x18, %r12
cmpq %rax, %r15
jl 0x12eb2
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq