user: Please show me the C implementation that matches the assembly code listed below:

```asm
<read_line>:
  endbr64
  mov    D65(%rip),%edx
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  lea    D101(%rip),%rbp
  push   %rbx
  xor    %ebx,%ebx
  test   %edx,%edx
  je     L126
  nopl   (%rax)
L48:
  mov    D115(%rip),%eax
L102:
  movslq %edx,%rsi
  add    %rbp,%rsi
  cmpb   $0x0,(%rsi)
  je     L22
  movslq %ebx,%r14
  add    %r12,%r14
  jmp    L106
  nopl   0x0(%rax)
L71:
  mov    $0x1,%edx
  mov    %r14,%rdi
  add    $0x1,%ebx
  add    $0x1,%r14
  call   <memcpy@plt>
  mov    D65(%rip),%eax
  lea    0x1(%rax),%edx
  mov    D115(%rip),%eax
  movslq %edx,%rsi
  mov    %edx,D100(%rip)
  add    %rbp,%rsi
  cmpb   $0x0,(%rsi)
  je     L22
L106:
  cmp    %eax,%edx
  jl     L71
L22:
  lea    -0x1(%rax),%ecx
  cmp    %edx,%ecx
  je     L51
  jg     L93
  cmp    %eax,%edx
  je     L80
  mov    D100(%rip),%edx
  test   %edx,%edx
  jne    L48
  nopl   0x0(%rax,%rax,1)
L126:
  mov    $0x64,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  xor    %ecx,%ecx
  mov    $0x64,%edx
  mov    %rbp,%rsi
  mov    %r13d,%edi
  call   <recv@plt>
  mov    %eax,D100(%rip)
  test   %eax,%eax
  js     L103
  je     L26
  mov    D100(%rip),%edx
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L80:
  movl   $0x0,D100(%rip)
  jmp    L126
L51:
  movl   $0x0,D100(%rip)
  movslq %ebx,%rax
  movb   $0x0,(%r12,%rax,1)
  lea    0x1(%rbx),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L93:
  movslq %ebx,%rax
  add    $0x1,%edx
  movb   $0x0,(%r12,%rax,1)
  lea    0x1(%rbx),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  mov    %edx,D100(%rip)
  pop    %r13
  pop    %r14
  ret
L26:
  lea    D100(%rip),%rdi
  call   <printf@plt>
  mov    %r13d,%edi
  call   <close@plt>
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L103:
  lea    D35(%rip),%rdi
  call   <perror@plt>
  pop    %rbx
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D100
type_guessed: string
name: retrieve_data
arguments: tag: D35
type_guessed: string

tool: D100:  connection closed by client


tool: D35:  cannot receive data 

assistant: ```c
int read_line(int newSd, char *line_to_return) {
  static int rcv_ptr = 0;
  static char rcv_msg[100];
  static int n;
  int offset;
  offset = 0;
  while (1) {
    if (rcv_ptr == 0) {
      memset(rcv_msg, 0x0, 100);
      n = recv(newSd, rcv_msg, 100, 0);
      if (n < 0) {
        perror(" cannot receive data ");
        return 1;
      } else if (n == 0) {
        printf(" connection closed by client\n");
        close(newSd);
        return 1;
      }
    }
    while (*(rcv_msg + rcv_ptr) != 0x0 && rcv_ptr < n) {
      memcpy(line_to_return + offset, rcv_msg + rcv_ptr, 1);
      offset++;
      rcv_ptr++;
    }
    if (rcv_ptr == n - 1) {
      *(line_to_return + offset) = 0x0;
      rcv_ptr = 0;
      return ++offset;
    }
    if (rcv_ptr < n - 1) {
      *(line_to_return + offset) = 0x0;
      rcv_ptr++;
      return ++offset;
    }
    if (rcv_ptr == n) {
      rcv_ptr = 0;
    }
  }
}
```