ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<inverso>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <num_cifras@plt>
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L11
L18:
  mov    -0x24(%rbp),%edx
  movslq %edx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  mov    %eax,%ebx
  mov    %ebx,%eax
  shl    $0x2,%eax
  add    %ebx,%eax
  add    %eax,%eax
  mov    %edx,%ebx
  sub    %eax,%ebx
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  mov    $0xa,%edi
  mov    $0x0,%eax
  call   <potencia@plt>
  imul   %ebx,%eax
  add    %eax,-0x14(%rbp)
  subl   $0x1,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x24(%rbp)
L11:
  mov    -0x24(%rbp),%eax
  add    $0x9,%eax
  cmp    $0x12,%eax
  ja     L18
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void inverso(int n) {
  int elevar = num_cifras(n) - 1;
  int suma = 0;
  while (n / 10 != 0) {
    suma = suma + (n % 10) * potencia(10, elevar);
    elevar = elevar - 1;
    n = n / 10;
  }
  return suma;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<inverso>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%ebx
  mov    $0x0,%eax
  call   <num_cifras@plt>
  lea    -0x1(%rax),%ebp
  lea    0x9(%rbx),%eax
  cmp    $0x12,%eax
  jbe    L10
L6:
  mov    %ebp,%esi
  mov    $0xa,%edi
  mov    $0x0,%eax
  call   <potencia@plt>
  sub    $0x1,%ebp
  movslq %ebx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  sar    $0x1f,%ebx
  sub    %ebx,%eax
  mov    %eax,%ebx
  add    $0x9,%eax
  cmp    $0x12,%eax
  ja     L6
L10:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void inverso(int n) {
  int elevar = num_cifras(n) - 1;
  int suma = 0;
  while (n / 10 != 0) {
    suma = suma + (n % 10) * potencia(10, elevar);
    elevar = elevar - 1;
    n = n / 10;
  }
  return suma;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<inverso>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  call   <num_cifras@plt>
  lea    -0x1(%rax),%ebp
  lea    0x9(%rbx),%eax
  cmp    $0x12,%eax
  jbe    L16
  xchg   %ax,%ax
L1:
  mov    %ebp,%esi
  mov    $0xa,%edi
  xor    %eax,%eax
  sub    $0x1,%ebp
  call   <potencia@plt>
  movslq %ebx,%rax
  mov    %ebx,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  mov    %eax,%ebx
  lea    0x9(%rax),%eax
  cmp    $0x12,%eax
  ja     L1
L16:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void inverso(int n) {
  int elevar = num_cifras(n) - 1;
  int suma = 0;
  while (n / 10 != 0) {
    suma = suma + (n % 10) * potencia(10, elevar);
    elevar = elevar - 1;
    n = n / 10;
  }
  return suma;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<inverso>:
  endbr64
  push   %rbp
  xor    %eax,%eax
  push   %rbx
  mov    %edi,%ebx
  sub    $0x8,%rsp
  call   <num_cifras@plt>
  lea    -0x1(%rax),%ebp
  lea    0x9(%rbx),%eax
  cmp    $0x12,%eax
  jbe    L11
  xchg   %ax,%ax
L10:
  mov    %ebp,%esi
  mov    $0xa,%edi
  xor    %eax,%eax
  sub    $0x1,%ebp
  call   <potencia@plt>
  movslq %ebx,%rax
  mov    %ebx,%edx
  imul   $0x66666667,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x22,%rax
  sub    %edx,%eax
  mov    %eax,%ebx
  lea    0x9(%rax),%eax
  cmp    $0x12,%eax
  ja     L10
L11:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void inverso(int n) {
  int elevar = num_cifras(n) - 1;
  int suma = 0;
  while (n / 10 != 0) {
    suma = suma + (n % 10) * potencia(10, elevar);
    elevar = elevar - 1;
    n = n / 10;
  }
  return suma;
}
```
user: What is the c source code of the assembly code below:

```asm
<ipv6_ipv4_c>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ipv6_ipv4@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free_string@plt>
  nop
  leave
  ret
```

assistant: ```c
void ipv6_ipv4_c(char *userInput, char *buf) {
  char *result = ipv6_ipv4(userInput);
  strcpy(buf, result);
  free_string(result);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ipv6_ipv4_c>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbp
  call   <ipv6_ipv4@plt>
  mov    %rax,%rbx
  mov    %rax,%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  mov    %rbx,%rdi
  call   <free_string@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void ipv6_ipv4_c(char *userInput, char *buf) {
  char *result = ipv6_ipv4(userInput);
  strcpy(buf, result);
  free_string(result);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ipv6_ipv4_c>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  sub    $0x8,%rsp
  call   <ipv6_ipv4@plt>
  mov    %r12,%rdi
  mov    %rax,%rsi
  mov    %rax,%rbp
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1090 <free_string@plt>
```

assistant: ```c
void ipv6_ipv4_c(char *userInput, char *buf) {
  char *result = ipv6_ipv4(userInput);
  strcpy(buf, result);
  free_string(result);
}
```
user: Translate the below assembly code into C programming language:

```asm
<ipv6_ipv4_c>:
  endbr64
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  sub    $0x8,%rsp
  call   <ipv6_ipv4@plt>
  mov    %r12,%rdi
  mov    %rax,%rsi
  mov    %rax,%rbp
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1090 <free_string@plt>
```

assistant: ```c
void ipv6_ipv4_c(char *userInput, char *buf) {
  char *result = ipv6_ipv4(userInput);
  strcpy(buf, result);
  free_string(result);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<child_wait>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x18(%rbp)
  je     L22
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <close@plt>
L22:
  cmpq   $0x0,-0x20(%rbp)
  je     L25
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <close@plt>
L25:
  lea    -0xc(%rbp),%rcx
  mov    -0x24(%rbp),%eax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <waitpid@plt>
  mov    -0xc(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L17
  call   <__stack_chk_fail@plt>
L17:
  leave
  ret
```

assistant: ```c
int child_wait(int *pfdin, int *pfdout, int pid) {
  int stat;
  if (pfdin)
    close(*pfdin);
  if (pfdout)
    close(*pfdout);
  waitpid(pid, &stat, 0);
  return stat;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<child_wait>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,%rbx
  mov    %edx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L19
  mov    (%rdi),%edi
  call   <close@plt>
L19:
  test   %rbx,%rbx
  je     L2
  mov    (%rbx),%edi
  call   <close@plt>
L2:
  lea    0x4(%rsp),%rsi
  mov    $0x0,%edx
  mov    %ebp,%edi
  call   <waitpid@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L28
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L28:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int child_wait(int *pfdin, int *pfdout, int pid) {
  int stat;
  if (pfdin)
    close(*pfdin);
  if (pfdout)
    close(*pfdout);
  waitpid(pid, &stat, 0);
  return stat;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<child_wait>:
  endbr64
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L16
  mov    (%rdi),%edi
  call   <close@plt>
L16:
  test   %rbx,%rbx
  je     L17
  mov    (%rbx),%edi
  call   <close@plt>
L17:
  lea    0x4(%rsp),%rsi
  xor    %edx,%edx
  mov    %ebp,%edi
  call   <waitpid@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L2
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int child_wait(int *pfdin, int *pfdout, int pid) {
  int stat;
  if (pfdin)
    close(*pfdin);
  if (pfdout)
    close(*pfdout);
  waitpid(pid, &stat, 0);
  return stat;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<child_wait>:
  endbr64
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L21
  mov    (%rdi),%edi
  call   <close@plt>
L21:
  test   %rbx,%rbx
  je     L24
  mov    (%rbx),%edi
  call   <close@plt>
L24:
  lea    0x4(%rsp),%rsi
  xor    %edx,%edx
  mov    %ebp,%edi
  call   <waitpid@plt>
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L16
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int child_wait(int *pfdin, int *pfdout, int pid) {
  int stat;
  if (pfdin)
    close(*pfdin);
  if (pfdout)
    close(*pfdout);
  waitpid(pid, &stat, 0);
  return stat;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0xc(%rbp),%rax
  mov    %rax,%rsi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <statfs@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D1
type: string

tool: D1: .

assistant: ```c
int main(void) {
  struct statfs buf;
  return statfs(".", &buf);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  lea    D7(%rip),%rdi
  call   <statfs@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x18,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D7
data_type: string

tool: D7: .

assistant: ```c
int main(void) {
  struct statfs buf;
  return statfs(".", &buf);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D1(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <statfs@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L3
  add    $0x18,%rsp
  ret
L3:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D1
data_type: string

tool: D1: .

assistant: ```c
int main(void) {
  struct statfs buf;
  return statfs(".", &buf);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  sub    $0x18,%rsp
  lea    D6(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <statfs@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x18,%rsp
  ret
L1:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D6
data_type: string

tool: D6: .

assistant: ```c
int main(void) {
  struct statfs buf;
  return statfs(".", &buf);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<mix_mono_u16>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  movq   $0x0,-0x8(%rbp)
  cmpl   $0x1,-0x1c(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  jmp    L41
L1:
  movl   $0x0,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L40
L0:
  mov    -0x18(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    (%rax),%rax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
L40:
  mov    -0x10(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L0
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  neg    %rax
  add    %rax,-0x18(%rbp)
  mov    -0xc(%rbp),%eax
  cltd
  idivl  -0x1c(%rbp)
  mov    %eax,-0xc(%rbp)
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  mov    -0xc(%rbp),%edx
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L30
L48:
  mov    -0x18(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  mov    %rdx,(%rax)
  addl   $0x1,-0x10(%rbp)
L30:
  mov    -0x10(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L48
  mov    -0x1c(%rbp),%eax
  cltq
  add    %rax,-0x8(%rbp)
L41:
  mov    -0x8(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jb     L1
  nop
  nop
  leave
  ret
```

assistant: ```c
void mix_mono_u16(uint16_t *buf, int channels, size_t samples) {
  int c;
  size_t i = 0;
  do {
  } while (0);
  assert(channels > 1);
  while (i < samples) {
    int32_t mono = 0;
    for (c = 0; c < channels; c++)
      mono += *buf++;
    buf -= channels;
    mono /= channels;
    mono = ((mono) < (UINT16_MAX) ? (mono) : (UINT16_MAX));
    for (c = 0; c < channels; c++)
      *buf++ = (uint16_t)mono;
    i += channels;
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<mix_mono_u16>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %rdx,%r12
  cmp    $0x1,%esi
  setg   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  test   %r12,%r12
  je     L6
  movslq %ebp,%r9
  lea    0x0(,%r9,8),%r8
  neg    %r8
  lea    -0x1(%rbp),%eax
  lea    0x8(,%rax,8),%rdi
  mov    $0x0,%esi
  mov    $0x0,%r10d
  jmp    L11
L66:
  add    $0x8,%rcx
  mov    %rax,-0x8(%rcx)
  cmp    %rcx,%rbx
  jne    L66
L27:
  add    %r9,%rsi
  cmp    %rsi,%r12
  jbe    L6
L11:
  lea    (%rbx,%rdi,1),%rcx
  mov    %r10d,%eax
  test   %ebp,%ebp
  jle    L75
L24:
  add    $0x8,%rbx
  add    -0x8(%rbx),%eax
  cmp    %rcx,%rbx
  jne    L24
  add    %r8,%rcx
  cltd
  idiv   %ebp
  mov    D0(%rip),%rdx
  mov    (%rdx),%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  lea    (%rcx,%rdi,1),%rbx
  cltq
  jmp    L66
L75:
  add    %r8,%rbx
  jmp    L27
L6:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void mix_mono_u16(uint16_t *buf, int channels, size_t samples) {
  int c;
  size_t i = 0;
  do {
  } while (0);
  assert(channels > 1);
  while (i < samples) {
    int32_t mono = 0;
    for (c = 0; c < channels; c++)
      mono += *buf++;
    buf -= channels;
    mono /= channels;
    mono = ((mono) < (UINT16_MAX) ? (mono) : (UINT16_MAX));
    for (c = 0; c < channels; c++)
      *buf++ = (uint16_t)mono;
    i += channels;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<mix_mono_u16>:
  endbr64
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  xor    %edi,%edi
  cmp    $0x1,%esi
  setg   %dil
  call   <assert@plt>
  test   %r12,%r12
  je     L0
  mov    D7(%rip),%rax
  movslq %ebp,%r10
  xor    %esi,%esi
  lea    0x0(,%r10,8),%r9
  mov    (%rax),%r8d
  lea    -0x1(%rbp),%eax
  neg    %r9
  lea    0x8(,%rax,8),%rdi
  nopl   0x0(%rax,%rax,1)
L33:
  lea    (%rbx,%rdi,1),%rdx
  xor    %eax,%eax
  test   %ebp,%ebp
  jle    L64
  nopw   0x0(%rax,%rax,1)
L35:
  add    $0x8,%rbx
  add    -0x8(%rbx),%eax
  cmp    %rdx,%rbx
  jne    L35
  cltd
  lea    (%rbx,%r9,1),%rcx
  idiv   %ebp
  lea    (%rcx,%rdi,1),%rbx
  cmp    %r8d,%eax
  cmovg  %r8d,%eax
  cltq
L59:
  add    $0x8,%rcx
  mov    %rax,-0x8(%rcx)
  cmp    %rcx,%rbx
  jne    L59
  add    %r10,%rsi
  cmp    %rsi,%r12
  ja     L33
L0:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L64:
  add    %r10,%rsi
  add    %r9,%rbx
  cmp    %rsi,%r12
  ja     L33
  jmp    L0
```

assistant: ```c
void mix_mono_u16(uint16_t *buf, int channels, size_t samples) {
  int c;
  size_t i = 0;
  do {
  } while (0);
  assert(channels > 1);
  while (i < samples) {
    int32_t mono = 0;
    for (c = 0; c < channels; c++)
      mono += *buf++;
    buf -= channels;
    mono /= channels;
    mono = ((mono) < (UINT16_MAX) ? (mono) : (UINT16_MAX));
    for (c = 0; c < channels; c++)
      *buf++ = (uint16_t)mono;
    i += channels;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<globMatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %ecx,%eax
  mov    %dl,-0x34(%rbp)
  mov    %al,-0x38(%rbp)
  movl   $0x0,-0x18(%rbp)
L103:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,-0x19(%rbp)
  cmpb   $0x0,-0x19(%rbp)
  jne    L73
  cmpl   $0x0,-0x18(%rbp)
  je     L169
  nop
L111:
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L111
  mov    $0x1,%eax
  jmp    L199
L169:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L195
  mov    $0x0,%eax
  jmp    L199
L195:
  mov    $0x1,%eax
  jmp    L199
L73:
  movzbl -0x19(%rbp),%eax
  cmp    -0x38(%rbp),%al
  jne    L108
  movl   $0x1,-0x18(%rbp)
  jmp    L23
L108:
  movzbl -0x19(%rbp),%eax
  cmp    -0x34(%rbp),%al
  jne    L151
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L76
  mov    $0x0,%eax
  jmp    L199
L76:
  addq   $0x1,-0x30(%rbp)
  jmp    L23
L151:
  cmpl   $0x0,-0x18(%rbp)
  je     L30
L68:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L42
  mov    $0x0,%eax
  jmp    L199
L42:
  movsbl -0x38(%rbp),%ecx
  movsbl -0x34(%rbp),%edx
  mov    -0x28(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <subMatch@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  je     L85
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x30(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x28(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L103
L85:
  addq   $0x1,-0x30(%rbp)
  jmp    L68
L30:
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  mov    %rax,%rbx
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <toupper@plt>
  cmp    %rax,%rbx
  je     L100
  mov    $0x0,%eax
  jmp    L199
L100:
  addq   $0x1,-0x30(%rbp)
L23:
  addq   $0x1,-0x28(%rbp)
  jmp    L103
L199:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int globMatch(const char *wildCard, const char *string, char single, char multi) {
  int matchStar = 0;
  int starMatchSize;
  char c;
  for (;;) {
  NEXT_WILD:
    c = *wildCard;
    if (c == 0) {
      if (matchStar) {
        while (*string++)
          ;
        return 1;
      } else if (*string)
        return 0;
      else
        return 1;
    } else if (c == multi) {
      matchStar = 1;
    } else if (c == single) {
      if (*string == 0)
        return 0;
      ++string;
    } else {
      if (matchStar) {
        for (;;) {
          if (*string == 0)
            return 0;
          if ((starMatchSize = subMatch(string, wildCard, single, multi)) != 0) {
            string += starMatchSize;
            wildCard += starMatchSize;
            matchStar = 0;
            goto NEXT_WILD;
          }
          ++string;
        }
      }
      if (toupper(*string) != toupper(*wildCard))
        return 0;
      ++string;
    }
    ++wildCard;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<globMatch>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rbx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L102
  mov    %rdi,%r12
  mov    %edx,%r13d
  mov    %ecx,%r15d
  mov    $0x0,%ebp
  jmp    L128
L20:
  test   %ebp,%ebp
  jne    L194
L102:
  cmpb   $0x0,(%rbx)
  sete   %bpl
  movzbl %bpl,%ebp
  jmp    L157
L194:
  add    $0x1,%rbx
  cmpb   $0x0,-0x1(%rbx)
  jne    L194
  jmp    L157
L134:
  cmpb   $0x0,(%rbx)
  je     L141
  add    $0x1,%rbx
  jmp    L94
L11:
  cmpb   $0x0,(%rbx)
  je     L32
  movsbl %r15b,%r14d
L142:
  movsbl %r13b,%edx
  mov    %r14d,%ecx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <subMatch@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L106
  add    $0x1,%rbx
  cmpb   $0x0,(%rbx)
  jne    L142
L157:
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L106:
  movslq %eax,%rbp
  add    %rbp,%rbx
  add    %rbp,%r12
  mov    $0x0,%ebp
  jmp    L104
L109:
  mov    $0x1,%ebp
L94:
  add    $0x1,%r12
L104:
  movzbl (%r12),%eax
  test   %al,%al
  je     L20
L128:
  cmp    %al,%r15b
  je     L109
  cmp    %al,%r13b
  je     L134
  test   %ebp,%ebp
  jne    L11
  movsbl (%rbx),%edi
  call   <toupper@plt>
  mov    %rax,%r14
  movsbl (%r12),%edi
  call   <toupper@plt>
  cmp    %rax,%r14
  jne    L157
  add    $0x1,%rbx
  jmp    L94
L141:
  mov    $0x0,%ebp
  jmp    L157
L32:
  mov    $0x0,%ebp
  jmp    L157
```

assistant: ```c
int globMatch(const char *wildCard, const char *string, char single, char multi) {
  int matchStar = 0;
  int starMatchSize;
  char c;
  for (;;) {
  NEXT_WILD:
    c = *wildCard;
    if (c == 0) {
      if (matchStar) {
        while (*string++)
          ;
        return 1;
      } else if (*string)
        return 0;
      else
        return 1;
    } else if (c == multi) {
      matchStar = 1;
    } else if (c == single) {
      if (*string == 0)
        return 0;
      ++string;
    } else {
      if (matchStar) {
        for (;;) {
          if (*string == 0)
            return 0;
          if ((starMatchSize = subMatch(string, wildCard, single, multi)) != 0) {
            string += starMatchSize;
            wildCard += starMatchSize;
            matchStar = 0;
            goto NEXT_WILD;
          }
          ++string;
        }
      }
      if (toupper(*string) != toupper(*wildCard))
        return 0;
      ++string;
    }
    ++wildCard;
  }
}
```