user: Converte this assembly snippet into its equivalent C code:

```asm
<GetNextURL>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %ecx,%ebp
  test   %ecx,%ecx
  je     L389
L113:
  movslq %ebp,%rsi
  movzbl (%rbx,%rsi,1),%edx
  test   %dl,%dl
  je     L28
  mov    %rsi,%rax
  mov    %ebp,%ecx
  sub    %esi,%ecx
  jmp    L237
L389:
  call   <removeWhiteSpace@plt>
  jmp    L113
L76:
  add    $0x1,%rax
  movzbl (%rbx,%rax,1),%edx
  test   %dl,%dl
  je     L105
L237:
  lea    (%rcx,%rax,1),%ebp
  cmp    $0x3c,%dl
  jne    L76
  movzbl 0x1(%rbx,%rax,1),%edx
  and    $0xffffffdf,%edx
  cmp    $0x41,%dl
  jne    L76
  lea    0x1(%rbx,%rax,1),%rdi
  mov    $0x3d,%esi
  call   <strchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L152
  cmpb   $0x65,-0x1(%r12)
  je     L152
  mov    %r12,%rax
  sub    %rbx,%rax
  movslq %ebp,%rdx
  sub    %rdx,%rax
  cmp    $0xa,%rax
  jg     L152
  movzbl 0x1(%r12),%eax
  cmp    $0x22,%al
  je     L11
  cmp    $0x27,%al
  je     L11
L47:
  lea    0x1(%r12),%r15
  lea    D36(%rip),%rsi
  mov    %r15,%rdi
  call   <strpbrk@plt>
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L279
  cmpb   $0x23,0x1(%r12)
  je     L156
  mov    $0x7,%edx
  lea    D7(%rip),%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L162
  mov    $0x4,%edx
  lea    D37(%rip),%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L50
  mov    $0x4,%edx
  lea    D18(%rip),%rsi
  mov    %r15,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L50
  movzbl 0x1(%r12),%eax
  cmp    $0x2e,%al
  je     L246
  cmp    $0x2f,%al
  je     L121
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %eax,%r12d
  mov    %eax,%ecx
  sub    $0x1,%ecx
  js     L222
  movslq %ecx,%rax
  add    %r13,%rax
  mov    %rax,%rdx
  mov    %ecx,%ebp
L94:
  cmpb   $0x2f,(%rdx)
  je     L293
  sub    $0x1,%ebp
  sub    $0x1,%rdx
  cmp    $0xffffffff,%ebp
  jne    L94
L293:
  mov    %ecx,%edx
L140:
  cmpb   $0x2e,(%rax)
  je     L362
  sub    $0x1,%edx
  sub    $0x1,%rax
  cmp    $0xffffffff,%edx
  jne    L140
L362:
  cmp    %ecx,%ebp
  je     L59
  cmp    $0x6,%ebp
  jle    L98
  cmp    %edx,%ebp
  jg     L98
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  movslq %ebp,%rbp
  movb   $0x0,0x1(%r14,%rbp,1)
  mov    0x8(%rsp),%rbp
  mov    %ebp,%edx
  sub    %r15d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    %rbp,%rax
  sub    %rbx,%rax
  add    $0x1,%eax
  jmp    L380
L105:
  mov    $0xffffffff,%eax
L380:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L152:
  lea    0x1(%rbp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <GetNextURL>
  jmp    L380
L11:
  add    $0x1,%r12
  jmp    L47
L279:
  lea    0x1(%rbp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <GetNextURL>
  jmp    L380
L156:
  lea    0x1(%rbp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <GetNextURL>
  jmp    L380
L162:
  lea    0x1(%rbp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <GetNextURL>
  jmp    L380
L50:
  mov    0x8(%rsp),%rbp
  mov    %ebp,%edx
  sub    %r15d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncpy@plt>
  mov    %rbp,%rax
  sub    %rbx,%rax
  add    $0x1,%eax
  jmp    L380
L246:
  mov    0x8(%rsp),%r12
  sub    %r15,%r12
  mov    %r12d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncpy@plt>
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <relativeUrl@plt>
  test   %eax,%eax
  jg     L380
  lea    0x1(%rbp,%r12,1),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <GetNextURL>
  jmp    L380
L121:
  mov    $0x7,%ebp
L187:
  mov    %ebp,%r12d
  mov    %r13,%rdi
  call   <strlen@plt>
  cmp    %ebp,%eax
  jle    L242
  add    $0x1,%rbp
  cmpb   $0x2f,-0x1(%r13,%rbp,1)
  jne    L187
L242:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  movslq %r12d,%r12
  movb   $0x0,(%r14,%r12,1)
  mov    0x8(%rsp),%rbp
  mov    %ebp,%edx
  sub    %r15d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    %rbp,%rax
  sub    %rbx,%rax
  add    $0x1,%eax
  jmp    L380
L222:
  mov    %ecx,%ebp
L59:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  movslq %ebp,%rbp
  movb   $0x0,0x1(%r14,%rbp,1)
  mov    0x8(%rsp),%rbp
  mov    %ebp,%edx
  sub    %r15d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    %rbp,%rax
  sub    %rbx,%rax
  add    $0x1,%eax
  jmp    L380
L98:
  mov    %r13,%rsi
  mov    %r14,%rdi
  call   <strcpy@plt>
  movslq %r12d,%rax
  movb   $0x2f,(%r14,%rax,1)
  mov    0x8(%rsp),%rbp
  mov    %ebp,%edx
  sub    %r15d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <strncat@plt>
  mov    %rbp,%rax
  sub    %rbx,%rax
  add    $0x1,%eax
  jmp    L380
L28:
  mov    $0xffffffff,%eax
  jmp    L380
```

tool_calls: name: disassemble_data
arguments: data_tag: D36
type_infered: string
name: disassemble_data
arguments: data_tag: D7
type_infered: string
name: disassemble_data
arguments: data_tag: D37
type_infered: string
name: disassemble_data
arguments: data_tag: D18
type_infered: string

tool: D36: '">

tool: D7: mailto:

tool: D37: http

tool: D18: HTTP

assistant: ```c
int GetNextURL(char *html, char *urlofthispage, char *result, int pos) {
  char c;
  int len, i, j;
  char *p1;
  char *p2;
  if (pos == 0) {
    removeWhiteSpace(html);
  }
  while (0 != (c = html[pos])) {
    if ((c == '<') && ((html[pos + 1] == 'a') || (html[pos + 1] == 'A'))) {
      break;
    }
    pos++;
  }
  if (c) {
    p1 = strchr(&(html[pos + 1]), '=');
    if ((!p1) || (*(p1 - 1) == 'e') || ((p1 - html - pos) > 10)) {
      return GetNextURL(html, urlofthispage, result, pos + 1);
    }
    if (*(p1 + 1) == '\"' || *(p1 + 1) == '\'')
      p1++;
    p1++;
    p2 = strpbrk(p1, "\'\">");
    if (!p2) {
      return GetNextURL(html, urlofthispage, result, pos + 1);
    }
    if (*p1 == '#') {
      return GetNextURL(html, urlofthispage, result, pos + 1);
    }
    if (!strncmp(p1, "mailto:", 7))
      return GetNextURL(html, urlofthispage, result, pos + 1);
    if (!strncmp(p1, "http", 4) || !strncmp(p1, "HTTP", 4)) {
      strncpy(result, p1, (p2 - p1));
      return (int)(p2 - html + 1);
    } else {
      if (p1[0] == '.') {
        pos = pos + (int)(p2 - p1);
        strncpy(result, p1, (p2 - p1));
        int len = 0;
        if ((len = relativeUrl(urlofthispage, result)) > 0) {
          return len;
        } else {
          return GetNextURL(html, urlofthispage, result, pos + 1);
        }
      }
      if (p1[0] == '/') {
        for (i = 7; i < strlen(urlofthispage); i++)
          if (urlofthispage[i] == '/')
            break;
        strcpy(result, urlofthispage);
        result[i] = 0;
        strncat(result, p1, (p2 - p1));
        return (int)(p2 - html + 1);
      } else {
        len = strlen(urlofthispage);
        for (i = (len - 1); i >= 0; i--)
          if (urlofthispage[i] == '/')
            break;
        for (j = (len - 1); j >= 0; j--)
          if (urlofthispage[j] == '.')
            break;
        if (i == (len - 1)) {
          strcpy(result, urlofthispage);
          result[i + 1] = 0;
          strncat(result, p1, p2 - p1);
          return (int)(p2 - html + 1);
        }
        if ((i <= 6) || (i > j)) {
          strcpy(result, urlofthispage);
          result[len] = '/';
          strncat(result, p1, p2 - p1);
          return (int)(p2 - html + 1);
        }
        strcpy(result, urlofthispage);
        result[i + 1] = 0;
        strncat(result, p1, p2 - p1);
        return (int)(p2 - html + 1);
      }
    }
  }
  return -1;
}
```