// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_clangd.c
// Function: parse_response_block
static void _parse_response_block(ParseResponse_t* parse,
                                  char* block,
                                  int64_t block_size){
     int64_t expected_header_prefix_len = 0;
     int64_t header_len = 0;
     int64_t message_body_len = 0;

     // If we haven't parsed the header yet.
     for(int64_t i = 0; i < block_size; i++){
          if(parse->message_body_size <= 0){
               // Calculate these values as needed.
               if(expected_header_prefix_len == 0){
                    expected_header_prefix_len = strlen(parse->expected_header_prefix);
               }
               if (header_len == 0){
                    header_len = strlen(parse->header);
               }
               // If we haven't matched the expected header prefix copy the bytes that match it.
               if(header_len < expected_header_prefix_len){
                    if(block[i] == parse->expected_header_prefix[header_len]){
                         parse->header[header_len] = block[i];
                         header_len++;
                    }else{
                         memset(parse->header, 0, MAX_HEADER_SIZE);
                         header_len = 0;
                    }
               }else{
                    // If we have copied the header prefix, continue coping until we get the \r\n\r\n pattern.
                    if(header_len >= MAX_HEADER_SIZE){
                         // Clear the header and retry. This can mean we might miss a message.
                         memset(parse->header, 0, MAX_HEADER_SIZE);
                         return;
                    }

                    parse->header[header_len] = block[i];
                    header_len++;

                    // Check for the end of the header.
                    if(parse->header[header_len - 4] == '\r' &&
                       parse->header[header_len - 3] == '\n' &&
                       parse->header[header_len - 2] == '\r' &&
                       parse->header[header_len - 1] == '\n'){
                         char* end = NULL;
                         parse->message_body_size = strtol(parse->header + expected_header_prefix_len, &end, 10);
                         if(parse->header == end){
                              memset(parse->header, 0, MAX_HEADER_SIZE);
                              return;
                         }
                         // Account for null terminator.
                         int64_t full_message_body_size = parse->message_body_size + 1;
                         parse->message_body = malloc(full_message_body_size);
                         memset(parse->message_body, 0, full_message_body_size);
                    }
               }
          }else{
               if(message_body_len == 0){
                    message_body_len = strnlen(parse->message_body, parse->message_body_size);
               }
               if(message_body_len >= parse->message_body_size){
                    return;
               }

               parse->message_body[message_body_len] = block[i];
               message_body_len++;
          }
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jge 0x1ba0d
movq -0x8(%rbp), %rax
cmpq $0x0, 0x100(%rax)
jg 0x1b998
cmpq $0x0, -0x20(%rbp)
jne 0x1b7a8
movq -0x8(%rbp), %rdi
callq 0xd200
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1b7c3
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
callq 0xd200
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x1b835
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movq -0x8(%rbp), %rcx
movq -0x28(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x1b811
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movb %dl, 0x80(%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x1b830
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xd290
movq $0x0, -0x28(%rbp)
jmp 0x1b996
cmpq $0x80, -0x28(%rbp)
jl 0x1b85b
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xd290
jmp 0x1ba0d
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
movb %dl, 0x80(%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x4, %rcx
movsbl 0x80(%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1b994
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x3, %rcx
movsbl 0x80(%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x1b994
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x2, %rcx
movsbl 0x80(%rax,%rcx), %eax
cmpl $0xd, %eax
jne 0x1b994
movq -0x8(%rbp), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
movsbl 0x80(%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x1b994
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
addq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0xa, %edx
callq 0xd3e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x100(%rax)
movq -0x8(%rbp), %rax
addq $0x80, %rax
cmpq -0x40(%rbp), %rax
jne 0x1b954
movq -0x8(%rbp), %rdi
addq $0x80, %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xd290
jmp 0x1ba0d
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0xd4a0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x108(%rax)
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rdi
movq -0x48(%rbp), %rdx
xorl %esi, %esi
callq 0xd290
jmp 0x1b996
jmp 0x1b9fa
cmpq $0x0, -0x30(%rbp)
jne 0x1b9be
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x100(%rax), %rsi
callq 0xd2b0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x100(%rcx), %rax
jl 0x1b9d1
jmp 0x1ba0d
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq 0x108(%rax), %rax
movq -0x30(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1b9fc
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x1b774
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)