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

```asm
<uRewriteIPAndPortSIPLine>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  mov    $0xfe,%ecx
  push   %r14
  mov    %rsi,%r14
  mov    $0xd,%esi
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  sub    $0xa18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xa08(%rsp)
  xor    %eax,%eax
  lea    0x210(%rsp),%rdi
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  movaps %xmm0,0x40(%rsp)
  movaps %xmm0,0x50(%rsp)
  movaps %xmm0,0x60(%rsp)
  movaps %xmm0,0x70(%rsp)
  movaps %xmm0,0x90(%rsp)
  movaps %xmm0,0xa0(%rsp)
  movaps %xmm0,0xb0(%rsp)
  movaps %xmm0,0xc0(%rsp)
  movaps %xmm0,0xd0(%rsp)
  movaps %xmm0,0xe0(%rsp)
  movaps %xmm0,0x100(%rsp)
  movaps %xmm0,0x110(%rsp)
  movaps %xmm0,0x120(%rsp)
  movaps %xmm0,0x130(%rsp)
  movaps %xmm0,0x140(%rsp)
  movaps %xmm0,0x150(%rsp)
  movaps %xmm0,0x160(%rsp)
  movaps %xmm0,0x170(%rsp)
  movaps %xmm0,0x180(%rsp)
  movl   $0x0,0x80(%rsp)
  movl   $0x0,0xf0(%rsp)
  movaps %xmm0,0x190(%rsp)
  rep stos %rax,%es:(%rdi)
  mov    %r13,%rdi
  movaps %xmm0,0x1a0(%rsp)
  movaps %xmm0,0x1b0(%rsp)
  movaps %xmm0,0x1c0(%rsp)
  movaps %xmm0,0x1d0(%rsp)
  movaps %xmm0,0x1e0(%rsp)
  movaps %xmm0,0x1f0(%rsp)
  movaps %xmm0,0x200(%rsp)
  call   <strchr@plt>
  mov    %rax,%rbx
  mov    $0x1,%eax
  test   %rbx,%rbx
  je     L8
  movb   $0x0,(%rbx)
  lea    0x1(%rbx),%rax
  mov    %r13,%rdx
  lea    0x100(%rsp),%r12
  mov    %rax,0x8(%rsp)
  lea    D26(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  movb   $0xd,(%rbx)
  lea    D15(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L11
L26:
  lea    D94(%rip),%rsi
  mov    %r12,%rdi
  lea    0x90(%rsp),%r15
  call   <strstr@plt>
  lea    D87(%rip),%r8
  mov    %r15,%rdi
  mov    %r12,%rdx
  movb   $0x0,(%rax)
  mov    %rax,%rbx
  mov    %r8,%rsi
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <sprintf@plt>
  mov    $0x40,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L16
  movb   $0x0,(%rax)
  lea    D87(%rip),%r8
  mov    %rbx,%rdx
  xor    %eax,%eax
  lea    0x20(%rsp),%rdi
  mov    %r8,%rsi
  call   <sprintf@plt>
L16:
  test   %ebp,%ebp
  mov    $0x13c4,%eax
  cmove  %eax,%ebp
  cmpb   $0x0,0x20(%rsp)
  jne    L76
  mov    %ebp,%r8d
  mov    %r14,%rcx
  mov    %r15,%rdx
  mov    %r12,%rdi
  lea    D43(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
L41:
  mov    0x8(%rsp),%rdx
  lea    D55(%rip),%rsi
  xor    %eax,%eax
  lea    0x10(%rsp),%rbp
  lea    0x200(%rsp),%r14
  mov    %r14,%rdi
  call   <sprintf@plt>
  pxor   %xmm0,%xmm0
  mov    %r12,%rdi
  movaps %xmm0,0x10(%rsp)
  call   <strlen@plt>
  mov    $0x7ff,%edx
  lea    D93(%rip),%rsi
  mov    %rbp,%rdi
  sub    %eax,%edx
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  xor    %eax,%eax
L8:
  mov    0xa08(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L70
  add    $0xa18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L76:
  lea    0x20(%rsp),%rcx
  mov    %ebp,%r9d
  mov    %r14,%r8
  mov    %r15,%rdx
  lea    D69(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L41
  nopl   0x0(%rax)
L11:
  lea    D76(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L26
  lea    D41(%rip),%rsi
  mov    %r12,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L26
  mov    $0x2,%eax
  jmp    L8
L70:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D26
type: string
name: retrieve_data
arguments: data_tag: D15
type: string
name: retrieve_data
arguments: data_tag: D94
type: string
name: retrieve_data
arguments: data_tag: D87
type: string
name: retrieve_data
arguments: data_tag: D43
type: string
name: retrieve_data
arguments: data_tag: D55
type: string
name: retrieve_data
arguments: data_tag: D93
type: string
name: retrieve_data
arguments: data_tag: D69
type: string
name: retrieve_data
arguments: data_tag: D76
type: string
name: retrieve_data
arguments: data_tag: D41
type: string

tool: D26: %.255s

tool: D15: INVITE 

tool: D94: sip:

tool: D87: %.99s

tool: D43: %ssip:%s:%u SIP/2.0

tool: D55: %.2047s

tool: D93: %%s%%.%us

tool: D69: %ssip:%s@%s:%u SIP/2.0

tool: D76: CANCEL 

tool: D41: OPTIONS 

assistant: ```c
unsigned uRewriteIPAndPortSIPLine(char *cSIPMessage, const char *cNewIP, unsigned uNewPort) {
  char *cp;
  char *cp1;
  char *cpNextLine;
  char cSomething[100] = {""};
  char cPrefix[100] = {""};
  char cSIPLine[256] = {""};
  char cMessage[2048] = {""};
  if ((cp = strchr(cSIPMessage, '\r'))) {
    cpNextLine = cp + 1;
    *cp = 0;
    sprintf(cSIPLine, "%.255s", cSIPMessage);
    *cp = '\r';
  } else
    return (1);
  if (!(strstr(cSIPLine, "INVITE ") || strstr(cSIPLine, "CANCEL ") || strstr(cSIPLine, "OPTIONS ")))
    return (2);
  cp = strstr(cSIPLine, "sip:");
  *cp = 0;
  sprintf(cPrefix, "%.99s", cSIPLine);
  if ((cp1 = strchr(cp + strlen("sip:"), '@'))) {
    *cp1 = 0;
    sprintf(cSomething, "%.99s", cp + strlen("sip:"));
  }
  if (!uNewPort)
    uNewPort = 5060;
  if (cSomething[0])
    sprintf(cSIPLine, "%ssip:%s@%s:%u SIP/2.0\r", cPrefix, cSomething, cNewIP, uNewPort);
  else
    sprintf(cSIPLine, "%ssip:%s:%u SIP/2.0\r", cPrefix, cNewIP, uNewPort);
  sprintf(cMessage, "%.2047s", cpNextLine);
  char cFormat[16] = {""};
  sprintf(cFormat, "%%s%%.%us", (unsigned)(2047 - strlen(cSIPLine)));
  sprintf(cSIPMessage, cFormat, cSIPLine, cMessage);
  return (0);
}
```