user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<string_match>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  je     L43
  mov    %rdi,%r13
  mov    %rsi,%rbx
  mov    %edx,%r12d
  mov    $0x0,%ebp
  cmpb   $0x0,(%rsi)
  jne    L123
L85:
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L123:
  lea    D4(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  mov    $0x1,%ebp
  test   %rax,%rax
  je     L85
  mov    %r13,%rdi
  call   <strlen@plt>
  mov    %eax,%r14d
  mov    %rbx,%rdi
  call   <strlen@plt>
  movslq %eax,%r8
  movzbl -0x1(%rbx,%r8,1),%ecx
  movzbl (%rbx),%edx
  cmp    $0x2a,%dl
  sete   %sil
  cmp    $0x2a,%cl
  je     L20
  test   %sil,%sil
  jne    L95
L20:
  cmp    $0x2a,%cl
  sete   %cl
  cmp    $0x2a,%dl
  je     L46
  test   %cl,%cl
  jne    L127
L46:
  test   %sil,%sil
  je     L224
  test   %cl,%cl
  jne    L237
L224:
  test   %r12d,%r12d
  jne    L164
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <string_strcasecmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L95:
  sub    $0x1,%eax
  mov    $0x0,%ebp
  cmp    %r14d,%eax
  jg     L85
  test   %r12d,%r12d
  jne    L141
  lea    0x1(%rbx),%rsi
  movslq %r14d,%r14
  mov    %r13,%rdi
  sub    %r8,%rdi
  lea    0x1(%rdi,%r14,1),%rdi
  call   <string_strcasecmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L141:
  lea    0x1(%rbx),%rsi
  movslq %r14d,%r14
  mov    %r13,%rdi
  sub    %r8,%rdi
  lea    0x1(%rdi,%r14,1),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L127:
  lea    -0x1(%rax),%edx
  mov    $0x0,%ebp
  cmp    %r14d,%edx
  jg     L85
  test   %r12d,%r12d
  jne    L108
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <string_strncasecmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L108:
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L237:
  lea    -0x1(%rax),%edx
  mov    $0x0,%ebp
  cmp    %r14d,%edx
  jg     L85
  lea    -0x2(%rax),%esi
  lea    0x1(%rbx),%rdi
  call   <string_strndup@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L85
  test   %r12d,%r12d
  jne    L29
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <string_strcasestr@plt>
  test   %rax,%rax
  setne  %bpl
  movzbl %bpl,%ebp
  jmp    L23
L29:
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  setne  %bpl
  movzbl %bpl,%ebp
L23:
  mov    %rbx,%rdi
  call   <free@plt>
  jmp    L85
L164:
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L85
L43:
  mov    $0x0,%ebp
  jmp    L85
```

tool_calls: name: retrieve_data
arguments: label: D4
data_type: string

tool: D4: *

assistant: ```c
int string_match(const char *string, const char *mask, int case_sensitive) {
  char last, *mask2;
  int len_string, len_mask, rc;
  if (!mask || !mask[0])
    return 0;
  if (strcmp(mask, "*") == 0)
    return 1;
  len_string = strlen(string);
  len_mask = strlen(mask);
  last = mask[len_mask - 1];
  if ((mask[0] == '*') && (last != '*')) {
    if (len_string < len_mask - 1)
      return 0;
    if ((case_sensitive && (strcmp(string + len_string - (len_mask - 1), mask + 1) == 0)) || (!case_sensitive && (string_strcasecmp(string + len_string - (len_mask - 1), mask + 1) == 0)))
      return 1;
    return 0;
  }
  if ((mask[0] != '*') && (last == '*')) {
    if (len_string < len_mask - 1)
      return 0;
    if ((case_sensitive && (strncmp(string, mask, len_mask - 1) == 0)) || (!case_sensitive && (string_strncasecmp(string, mask, len_mask - 1) == 0)))
      return 1;
    return 0;
  }
  if ((mask[0] == '*') && (last == '*')) {
    if (len_string < len_mask - 1)
      return 0;
    mask2 = string_strndup(mask + 1, len_mask - 2);
    if (!mask2)
      return 0;
    rc = ((case_sensitive && strstr(string, mask2)) || (!case_sensitive && string_strcasestr(string, mask2))) ? 1 : 0;
    free(mask2);
    return rc;
  }
  if ((case_sensitive && (strcmp(string, mask) == 0)) || (!case_sensitive && (string_strcasecmp(string, mask) == 0)))
    return 1;
  return 0;
}
```