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

```asm
<revparseip>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x40(%rbp)
  lea    -0x30(%rbp),%rax
  mov    $0x1e,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x38(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x60(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x60(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x60(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%esi
  lea    D58(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L17
L51:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x40(%rbp),%eax
  cltq
  movb   $0x2e,-0x30(%rbp,%rax,1)
  movl   $0x0,-0x44(%rbp)
  jmp    L11
L23:
  addl   $0x1,-0x40(%rbp)
  addq   $0x1,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x40(%rbp),%eax
  cltq
  mov    %dl,-0x30(%rbp,%rax,1)
  addl   $0x1,-0x44(%rbp)
L11:
  mov    -0x44(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L23
  addq   $0x1,-0x38(%rbp)
  addl   $0x1,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rsi
  lea    D42(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  and    $0xc0,%eax
  cmp    $0xc0,%eax
  jne    L4
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x38(%rbp),%rcx
  lea    -0x46(%rbp),%rax
  mov    $0x2,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movzwl -0x46(%rbp),%eax
  cwtl
  mov    %eax,%edi
  call   <htons@plt>
  xor    $0xc000,%ax
  mov    %ax,-0x46(%rbp)
  movzwl -0x46(%rbp),%eax
  movswq %ax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
L4:
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L17:
  mov    -0x38(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L51
  lea    -0x30(%rbp),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%edx
  lea    -0x30(%rbp),%rcx
  mov    -0x68(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  nop
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L42
  call   <__stack_chk_fail@plt>
L42:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D38
type_infered: string
name: extract_symbolic_data
arguments: label: D58
type_infered: string
name: extract_symbolic_data
arguments: label: D42
type_infered: string
name: extract_symbolic_data
arguments: label: D8
type_infered: string
name: extract_symbolic_data
arguments: label: D13
type_infered: string

tool: D38: Reversep tmpptr = %x,%x,%x


tool: D58: Reversep ipptr = %x,%x,%x


tool: D42: Reversep tmpptr = %s


tool: D8: Pointer Found!

tool: D13: Str = %s


assistant: ```c
int revparseip(struct nserver *ns, char *ipstr, char *outip) {
  char tmp[30];
  char *tmpptr;
  int j, i = 0;
  short tmpsh;
  int lastcount;
  memset(tmp, 0x00, sizeof(tmp));
  tmpptr = ipstr;
  printf("Reversep tmpptr = %x,%x,%x\n", tmpptr[0], tmpptr[2], tmpptr[3]);
  printf("Reversep ipptr = %x,%x,%x\n", ipstr[0], ipstr[2], ipstr[3]);
  while (tmpptr[0] != 0x00) {
    lastcount = tmpptr[0];
    tmp[i] = '.';
    for (j = 0; j < lastcount; j++) {
      i++;
      tmpptr++;
      tmp[i] = tmpptr[0];
    }
    tmpptr++;
    i++;
    printf("Reversep tmpptr = %s\n", tmpptr);
    if ((tmpptr[0] & 0xc0) == 0xc0) {
      printf("Pointer Found!\n");
      memcpy((char *)&tmpsh, tmpptr, sizeof(tmpsh));
      tmpsh = (htons(tmpsh) ^ 0xc000);
      tmpptr = &((char *)ns)[tmpsh];
    }
    printf("Str = %s\n", tmp);
  }
  printf("Str = %s\n", tmp);
  memcpy(outip, tmp, strlen(tmp));
}
```