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

```asm
<geturl>:
  endbr64
  push   %r12
  mov    $0x2,%edx
  mov    %rdi,%r12
  push   %rbp
  lea    0x1(%rdi),%rbp
  lea    D120(%rip),%rdi
  mov    %rbp,%rsi
  sub    $0x8,%rsp
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L49
  mov    $0x5,%edx
  mov    %rbp,%rsi
  lea    D30(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L27
L49:
  mov    %r12,%rdi
  lea    D34(%rip),%rsi
  call   <tagoption@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L83
  cmpb   $0x23,(%rax)
  je     L83
  mov    $0x7,%edx
  mov    %rax,%rsi
  lea    D48(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L83
  mov    $0x23,%esi
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L29
  mov    %r12,%rdi
  mov    $0x23,%esi
  call   <strchr@plt>
  movb   $0x0,(%rax)
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L83:
  xor    %r12d,%r12d
L29:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L27:
  mov    $0x5,%edx
  mov    %rbp,%rsi
  lea    D122(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L49
  mov    $0x5,%edx
  mov    %rbp,%rsi
  lea    D70(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L49
  mov    $0x4,%edx
  mov    %rbp,%rsi
  lea    D74(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L105
  mov    $0x8,%edx
  mov    %rbp,%rsi
  lea    D9(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L105
  mov    $0x6,%edx
  mov    %rbp,%rsi
  lea    D91(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L105
  mov    $0x6,%edx
  mov    %rbp,%rsi
  lea    D55(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L105
  mov    $0x7,%edx
  mov    %rbp,%rsi
  lea    D26(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  je     L105
  mov    $0x5,%edx
  mov    %rbp,%rsi
  lea    D118(%rip),%rdi
  call   <strncasecmp@plt>
  test   %eax,%eax
  jne    L83
  lea    D15(%rip),%rsi
L145:
  add    $0x8,%rsp
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  jmp    1090 <tagoption@plt>
  nopw   0x0(%rax,%rax,1)
L105:
  lea    D130(%rip),%rsi
  jmp    L145
```

tool_calls: name: read_data
arguments: data_tag: D120
data_type: string
name: read_data
arguments: data_tag: D30
data_type: string
name: read_data
arguments: data_tag: D34
data_type: string
name: read_data
arguments: data_tag: D48
data_type: string
name: read_data
arguments: data_tag: D122
data_type: string
name: read_data
arguments: data_tag: D70
data_type: string
name: read_data
arguments: data_tag: D74
data_type: string
name: read_data
arguments: data_tag: D9
data_type: string
name: read_data
arguments: data_tag: D91
data_type: string
name: read_data
arguments: data_tag: D55
data_type: string
name: read_data
arguments: data_tag: D26
data_type: string
name: read_data
arguments: data_tag: D118
data_type: string
name: read_data
arguments: data_tag: D15
data_type: string
name: read_data
arguments: data_tag: D130
data_type: string

tool: D120: a 

tool: D30: area 

tool: D34: href

tool: D48: mailto:

tool: D122: base 

tool: D70: link 

tool: D74: img 

tool: D9: bgsound 

tool: D91: embed 

tool: D55: frame 

tool: D26: iframe 

tool: D118: body 

tool: D15: background

tool: D130: src

assistant: ```c
char *geturl(char *tag) {
  char *tmp;
  if (0)
    printf("geturl: %s\n", tag);
  if (!strncasecmp("a ", tag + 1, 2) || !strncasecmp("area ", tag + 1, 5) || !strncasecmp("base ", tag + 1, 5) || !strncasecmp("link ", tag + 1, 5)) {
    tmp = tagoption(tag, "href");
    if (!tmp)
      return NULL;
    if (tmp[0] == '#')
      return NULL;
    if (!strncasecmp("mailto:", tmp, 7))
      return NULL;
    if (strchr(tmp, '#'))
      *strchr(tmp, '#') = '\0';
    return tmp;
  }
  if (!strncasecmp("img ", tag + 1, 4) || !strncasecmp("bgsound ", tag + 1, 8) || !strncasecmp("embed ", tag + 1, 6) || !strncasecmp("frame ", tag + 1, 6) || !strncasecmp("iframe ", tag + 1, 7))
    return tagoption(tag, "src");
  if (!strncasecmp("body ", tag + 1, 5))
    return tagoption(tag, "background");
  return NULL;
}
```