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

```asm
<revparseip>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  xor    %esi,%esi
  push   %r12
  lea    D41(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,(%rsp)
  lea    0x20(%rsp),%rbp
  mov    %rdx,0x8(%rsp)
  mov    %rbp,%rdi
  mov    $0x1e,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <memset@plt>
  movsbl 0x3(%r13),%ecx
  xor    %eax,%eax
  movsbl 0x2(%r13),%edx
  movsbl 0x0(%r13),%esi
  lea    D37(%rip),%rdi
  call   <printf@plt>
  movsbl 0x3(%r13),%ecx
  xor    %eax,%eax
  movsbl 0x2(%r13),%edx
  movsbl 0x0(%r13),%esi
  lea    D46(%rip),%rdi
  call   <printf@plt>
  movsbl 0x0(%r13),%r10d
  test   %r10b,%r10b
  je     L149
  xor    %r14d,%r14d
  lea    D29(%rip),%rbx
  nopl   0x0(%rax,%rax,1)
L45:
  movslq %r14d,%rdx
  movb   $0x2e,0x20(%rsp,%rdx,1)
  test   %r10b,%r10b
  jle    L113
L55:
  movsbq %r10b,%rax
  lea    0x1(%rbp,%rdx,1),%rdx
  lea    0x1(%r13),%rsi
  cmp    $0x8,%eax
  jae    L3
  test   $0x4,%al
  jne    L28
  test   %eax,%eax
  je     L95
  movzbl (%rsi),%ecx
  mov    %cl,(%rdx)
  test   $0x2,%al
  jne    L0
L95:
  lea    0x0(%r13,%rax,1),%r15
  add    %r10d,%r14d
L141:
  lea    0x1(%r15),%r13
  mov    %rbx,%rdi
  xor    %eax,%eax
  add    $0x1,%r14d
  mov    %r13,%rsi
  call   <printf@plt>
  movsbl 0x1(%r15),%eax
  and    $0xc0,%eax
  cmp    $0xc0,%eax
  je     L17
  mov    %rbp,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movsbl 0x1(%r15),%r10d
  test   %r10b,%r10b
  jne    L45
L149:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    0x8(%rsp),%rdi
  mov    %rbp,%rsi
  mov    %eax,%edx
  call   <memcpy@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L30
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L3:
  mov    0x1(%r13),%rcx
  mov    %rcx,(%rdx)
  mov    %eax,%ecx
  mov    -0x8(%rsi,%rcx,1),%rdi
  mov    %rdi,-0x8(%rdx,%rcx,1)
  lea    0x8(%rdx),%rdi
  and    $0xfffffffffffffff8,%rdi
  sub    %rdi,%rdx
  sub    %rdx,%rsi
  add    %eax,%edx
  shr    $0x3,%edx
  mov    %edx,%ecx
  rep movsq %ds:(%rsi),%es:(%rdi)
  jmp    L95
L17:
  lea    D36(%rip),%rdi
  call   <puts@plt>
  mov    %r13,%rsi
  mov    $0x2,%edx
  lea    0x1e(%rsp),%rdi
  call   <memcpy@plt>
  movswl 0x1e(%rsp),%edi
  call   <htons@plt>
  mov    (%rsp),%rcx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  xor    $0xc000,%ax
  mov    %ax,0x1e(%rsp)
  movswq %ax,%rax
  lea    (%rcx,%rax,1),%r13
  xor    %eax,%eax
  call   <printf@plt>
  movsbl 0x0(%r13),%r10d
  test   %r10b,%r10b
  je     L149
  movslq %r14d,%rdx
  movb   $0x2e,0x20(%rsp,%rdx,1)
  test   %r10b,%r10b
  jg     L55
  nopl   0x0(%rax)
L113:
  mov    %r13,%r15
  jmp    L141
L28:
  mov    (%rsi),%ecx
  mov    %ecx,(%rdx)
  mov    %eax,%ecx
  mov    -0x4(%rsi,%rcx,1),%esi
  mov    %esi,-0x4(%rdx,%rcx,1)
  jmp    L95
L0:
  mov    %eax,%ecx
  movzwl -0x2(%rsi,%rcx,1),%esi
  mov    %si,-0x2(%rdx,%rcx,1)
  jmp    L95
L30:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D41
datatype: string
name: extract_symbolic_data
arguments: data_label: D37
datatype: string
name: extract_symbolic_data
arguments: data_label: D46
datatype: string
name: extract_symbolic_data
arguments: data_label: D29
datatype: string
name: extract_symbolic_data
arguments: data_label: D36
datatype: string

tool: D41: Str = %s


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


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


tool: D29: Reversep tmpptr = %s


tool: D36: Pointer Found!

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));
}
```