user: 请从给定的汇编指令推导出C源代码：

```asm
<get_link_category>:
  endbr64
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  test   %rdi,%rdi
  je     L27
  lea    D43(%rip),%rsi
  mov    %rdi,%rbp
  call   <strstr@plt>
  test   %rax,%rax
  jne    L61
  lea    D64(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L41
  lea    D41(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  xor    %eax,%eax
L139:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L61:
  mov    %r13d,%esi
  mov    %r12,%rdi
  lea    D68(%rip),%rdx
  call   <snprintf@plt>
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L41:
  lea    D140(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L48
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L47
  lea    D84(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  xor    %eax,%eax
  jmp    L139
  xchg   %ax,%ax
L48:
  mov    %r13d,%esi
  mov    %r12,%rdi
  lea    D63(%rip),%rdx
  call   <snprintf@plt>
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L47:
  lea    D106(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L137
  lea    D13(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L51
  lea    D91(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L3
L51:
  lea    D156(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  xor    %eax,%eax
  jmp    L139
  nopl   (%rax)
L137:
  lea    D32(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  xor    %eax,%eax
  jmp    L139
L3:
  lea    D89(%rip),%rsi
  mov    %rbp,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L48
  lea    D141(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  xor    %eax,%eax
  jmp    L139
L27:
  lea    D63(%rip),%rdx
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  mov    $0xffffffff,%eax
  jmp    L139
```

tool_calls: name: read_data
arguments: data_label: D43
type_guessed: string
name: read_data
arguments: data_label: D64
type_guessed: string
name: read_data
arguments: data_label: D41
type_guessed: string
name: read_data
arguments: data_label: D68
type_guessed: string
name: read_data
arguments: data_label: D140
type_guessed: string
name: read_data
arguments: data_label: D34
type_guessed: string
name: read_data
arguments: data_label: D84
type_guessed: string
name: read_data
arguments: data_label: D63
type_guessed: string
name: read_data
arguments: data_label: D106
type_guessed: string
name: read_data
arguments: data_label: D13
type_guessed: string
name: read_data
arguments: data_label: D91
type_guessed: string
name: read_data
arguments: data_label: D156
type_guessed: string
name: read_data
arguments: data_label: D32
type_guessed: string
name: read_data
arguments: data_label: D89
type_guessed: string
name: read_data
arguments: data_label: D141
type_guessed: string

tool: D43: .rm

tool: D64: .ram

tool: D41: ram

tool: D68: rm

tool: D140: .mp3

tool: D34: .wma

tool: D84: wma

tool: D63: mp3

tool: D106: .asf

tool: D13: .swf

tool: D91: .flash

tool: D156: swf

tool: D32: asf

tool: D89: .rtsp

tool: D141: rtsp

assistant: ```c
int get_link_category(const char *link, char *type, int size) {
  if (NULL == link) {
    snprintf(type, size, "mp3");
    return -1;
  }
  if (strstr(link, ".rm")) {
    snprintf(type, size, "rm");
  } else if (strstr(link, ".ram")) {
    snprintf(type, size, "ram");
  } else if (strstr(link, ".mp3")) {
    snprintf(type, size, "mp3");
  } else if (strstr(link, ".wma")) {
    snprintf(type, size, "wma");
  } else if (strstr(link, ".asf")) {
    snprintf(type, size, "asf");
  } else if (strstr(link, ".swf") || strstr(link, ".flash")) {
    snprintf(type, size, "swf");
  } else if (strstr(link, ".rtsp")) {
    snprintf(type, size, "rtsp");
  } else {
    snprintf(type, size, "mp3");
  }
  return 0;
}
```