ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strstr>:
  endbr64
  mov    %rdi,%r9
  mov    $0x0,%r10d
  cmpb   $0x0,(%rdi)
  jne    L50
L25:
  mov    $0x0,%eax
  cmpb   $0x0,(%rsi)
  jne    L41
L24:
  movslq %r10d,%r10
  lea    (%rdi,%r10,1),%rax
L41:
  ret
L3:
  cmpb   $0x0,(%rax)
  je     L24
  add    $0x1,%r10d
  add    $0x1,%r9
  cmpb   $0x0,(%r9)
  je     L25
L50:
  movzbl (%r9),%edx
  mov    %rsi,%rax
  mov    %r9,%r8
  test   %dl,%dl
  je     L3
L42:
  movzbl (%rax),%ecx
  cmp    %dl,%cl
  jne    L3
  test   %cl,%cl
  je     L3
  add    $0x1,%r8
  add    $0x1,%rax
  movzbl (%r8),%edx
  test   %dl,%dl
  jne    L42
  jmp    L3
```

assistant: ```c
char *strstr(s1, s2)
char *s1;
char *s2;
{
  int i;
  char *p1;
  char *p2;
  char *s = s1;
  for (p2 = s2, i = 0; *s; p2 = s2, i++, s++) {
    for (p1 = s; *p1 && *p2 && *p1 == *p2; p1++, p2++)
      ;
    if (!*p2)
      break;
  }
  if (!*p2)
    return s1 + i;
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strstr>:
  endbr64
  movzbl (%rdi),%eax
  mov    %rdi,%r9
  xor    %r10d,%r10d
  test   %al,%al
  je     L39
  nopl   0x0(%rax)
L31:
  mov    %rsi,%rcx
  mov    %r9,%r8
  jmp    L57
L61:
  test   %dl,%dl
  je     L89
  movzbl 0x1(%r8),%eax
  add    $0x1,%r8
  lea    0x1(%rcx),%rdx
  test   %al,%al
  je     L60
  mov    %rdx,%rcx
L57:
  movzbl (%rcx),%edx
  cmp    %al,%dl
  je     L61
L6:
  test   %dl,%dl
  je     L89
  movzbl 0x1(%r9),%eax
  add    $0x1,%r9
  add    $0x1,%r10d
  test   %al,%al
  jne    L31
L39:
  xor    %eax,%eax
  cmpb   $0x0,(%rsi)
  je     L89
  ret
  nopl   0x0(%rax)
L89:
  movslq %r10d,%r10
  lea    (%rdi,%r10,1),%rax
  ret
  nopl   0x0(%rax,%rax,1)
L60:
  movzbl 0x1(%rcx),%edx
  jmp    L6
```

assistant: ```c
char *strstr(s1, s2)
char *s1;
char *s2;
{
  int i;
  char *p1;
  char *p2;
  char *s = s1;
  for (p2 = s2, i = 0; *s; p2 = s2, i++, s++) {
    for (p1 = s; *p1 && *p2 && *p1 == *p2; p1++, p2++)
      ;
    if (!*p2)
      break;
  }
  if (!*p2)
    return s1 + i;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<strstr>:
  endbr64
  xor    %r10d,%r10d
  cmpb   $0x0,(%rdi)
  mov    %rdi,%r9
  je     L83
  nop
L58:
  movzbl (%r9),%eax
  mov    %rsi,%rcx
  mov    %r9,%r8
  test   %al,%al
  jne    L3
  jmp    L59
L109:
  test   %dl,%dl
  je     L103
  movzbl 0x1(%r8),%eax
  add    $0x1,%r8
  lea    0x1(%rcx),%rdx
  test   %al,%al
  je     L11
  mov    %rdx,%rcx
L3:
  movzbl (%rcx),%edx
  cmp    %al,%dl
  je     L109
L62:
  test   %dl,%dl
  je     L103
  add    $0x1,%r9
  add    $0x1,%r10d
  cmpb   $0x0,(%r9)
  jne    L58
L83:
  xor    %eax,%eax
  cmpb   $0x0,(%rsi)
  je     L103
  ret
  nopl   0x0(%rax)
L103:
  movslq %r10d,%r10
  lea    (%rdi,%r10,1),%rax
  ret
  nopl   0x0(%rax,%rax,1)
L11:
  movzbl 0x1(%rcx),%edx
  jmp    L62
L59:
  movzbl (%rsi),%edx
  jmp    L62
```

assistant: ```c
char *strstr(s1, s2)
char *s1;
char *s2;
{
  int i;
  char *p1;
  char *p2;
  char *s = s1;
  for (p2 = s2, i = 0; *s; p2 = s2, i++, s++) {
    for (p1 = s; *p1 && *p2 && *p1 == *p2; p1++, p2++)
      ;
    if (!*p2)
      break;
  }
  if (!*p2)
    return s1 + i;
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<it_pol_neville2D_s4>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  movsd  %xmm0,-0x28(%rbp)
  movsd  %xmm1,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  lea    -0x4(%rax),%edx
  mov    -0x8(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <min@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  movq   %rax,%xmm0
  call   <floor@plt>
  sub    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <max@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x14(%rbp),%eax
  lea    -0x4(%rax),%edx
  mov    -0x4(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <min@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L5
L2:
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x8(%rbp),%xmm1
  movsd  -0x30(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  mov    -0x4(%rbp),%ecx
  mov    -0xc(%rbp),%edx
  add    %ecx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x20(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%rcx
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  add    %rcx,%rdx
  movq   %rax,%xmm0
  mov    %rdx,%rdi
  call   <it_pol_neville_s4@plt>
  movq   %xmm0,%rax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  lea    D1(%rip),%rdx
  mov    %rax,(%rcx,%rdx,1)
  addl   $0x1,-0xc(%rbp)
L5:
  cmpl   $0x3,-0xc(%rbp)
  jle    L2
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x4(%rbp),%xmm1
  movsd  -0x28(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <it_pol_neville_s4@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

assistant: ```c
double it_pol_neville2D_s4(int n, int m, double **f, double y_1, double x_1) {
  int i;
  static double x_interm[4];
  int indice_x1_inf = (int)floor(x_1) - 1;
  indice_x1_inf = max(indice_x1_inf, 0);
  indice_x1_inf = min(indice_x1_inf, m - 4);
  int indice_y1_inf = (int)floor(y_1) - 1;
  indice_y1_inf = max(indice_y1_inf, 0);
  indice_y1_inf = min(indice_y1_inf, n - 4);
  for (i = 0; i < 4; i++) {
    x_interm[i] = it_pol_neville_s4(&(f[indice_y1_inf + i][indice_x1_inf]), x_1 - indice_x1_inf);
  }
  return it_pol_neville_s4(x_interm, y_1 - indice_y1_inf);
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<it_pol_neville2D_s4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebp
  mov    %esi,%r12d
  mov    %rdx,%rbx
  movsd  %xmm0,(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movapd %xmm1,%xmm0
  call   <floor@plt>
  lea    -0x1(%rax),%edi
  mov    $0x0,%esi
  call   <max@plt>
  mov    %eax,%edi
  lea    -0x4(%r12),%esi
  call   <min@plt>
  mov    %eax,%r14d
  movsd  (%rsp),%xmm0
  call   <floor@plt>
  lea    -0x1(%rax),%edi
  mov    $0x0,%esi
  call   <max@plt>
  mov    %eax,%edi
  lea    -0x4(%rbp),%esi
  call   <min@plt>
  mov    %eax,%r13d
  movslq %r14d,%r12
  shl    $0x3,%r12
  cltq
  lea    (%rbx,%rax,8),%rbp
  lea    D15(%rip),%rbx
  lea    0x20(%rbx),%r15
  pxor   %xmm0,%xmm0
  cvtsi2sd %r14d,%xmm0
  movsd  0x8(%rsp),%xmm2
  subsd  %xmm0,%xmm2
  movq   %xmm2,%r14
L1:
  mov    %r12,%rdi
  add    0x0(%rbp),%rdi
  movq   %r14,%xmm0
  call   <it_pol_neville_s4@plt>
  movsd  %xmm0,(%rbx)
  add    $0x8,%rbp
  add    $0x8,%rbx
  cmp    %r15,%rbx
  jne    L1
  pxor   %xmm1,%xmm1
  cvtsi2sd %r13d,%xmm1
  movsd  (%rsp),%xmm0
  subsd  %xmm1,%xmm0
  lea    D15(%rip),%rdi
  call   <it_pol_neville_s4@plt>
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
double it_pol_neville2D_s4(int n, int m, double **f, double y_1, double x_1) {
  int i;
  static double x_interm[4];
  int indice_x1_inf = (int)floor(x_1) - 1;
  indice_x1_inf = max(indice_x1_inf, 0);
  indice_x1_inf = min(indice_x1_inf, m - 4);
  int indice_y1_inf = (int)floor(y_1) - 1;
  indice_y1_inf = max(indice_y1_inf, 0);
  indice_y1_inf = min(indice_y1_inf, n - 4);
  for (i = 0; i < 4; i++) {
    x_interm[i] = it_pol_neville_s4(&(f[indice_y1_inf + i][indice_x1_inf]), x_1 - indice_x1_inf);
  }
  return it_pol_neville_s4(x_interm, y_1 - indice_y1_inf);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<it_pol_neville2D_s4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm1,%xmm0
  movsd  %xmm1,(%rsp)
  call   <floor@plt>
  xor    %esi,%esi
  lea    -0x1(%rax),%edi
  call   <max@plt>
  lea    -0x4(%rbp),%esi
  mov    %eax,%edi
  call   <min@plt>
  movsd  0x8(%rsp),%xmm0
  mov    %eax,%r12d
  call   <floor@plt>
  xor    %esi,%esi
  lea    -0x1(%rax),%edi
  call   <max@plt>
  lea    -0x4(%rbx),%esi
  movslq %r12d,%rbx
  mov    %eax,%edi
  shl    $0x3,%rbx
  call   <min@plt>
  pxor   %xmm0,%xmm0
  movsd  (%rsp),%xmm1
  cvtsi2sd %r12d,%xmm0
  mov    %eax,%ebp
  cltq
  lea    0x0(%r13,%rax,8),%r15
  lea    D6(%rip),%r13
  mov    %r13,%r14
  lea    0x20(%r13),%r12
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
L2:
  mov    (%r15),%rdi
  movsd  (%rsp),%xmm0
  add    $0x8,%r14
  add    $0x8,%r15
  add    %rbx,%rdi
  call   <it_pol_neville_s4@plt>
  movsd  %xmm0,-0x8(%r14)
  cmp    %r12,%r14
  jne    L2
  pxor   %xmm1,%xmm1
  movsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  mov    %r13,%rdi
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  subsd  %xmm1,%xmm0
  jmp    10b0 <it_pol_neville_s4@plt>
```

assistant: ```c
double it_pol_neville2D_s4(int n, int m, double **f, double y_1, double x_1) {
  int i;
  static double x_interm[4];
  int indice_x1_inf = (int)floor(x_1) - 1;
  indice_x1_inf = max(indice_x1_inf, 0);
  indice_x1_inf = min(indice_x1_inf, m - 4);
  int indice_y1_inf = (int)floor(y_1) - 1;
  indice_y1_inf = max(indice_y1_inf, 0);
  indice_y1_inf = min(indice_y1_inf, n - 4);
  for (i = 0; i < 4; i++) {
    x_interm[i] = it_pol_neville_s4(&(f[indice_y1_inf + i][indice_x1_inf]), x_1 - indice_x1_inf);
  }
  return it_pol_neville_s4(x_interm, y_1 - indice_y1_inf);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<it_pol_neville2D_s4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm1,%xmm0
  movsd  %xmm1,(%rsp)
  call   <floor@plt>
  xor    %esi,%esi
  lea    -0x1(%rax),%edi
  call   <max@plt>
  lea    -0x4(%rbp),%esi
  mov    %eax,%edi
  call   <min@plt>
  movsd  0x8(%rsp),%xmm0
  mov    %eax,%r12d
  call   <floor@plt>
  xor    %esi,%esi
  lea    -0x1(%rax),%edi
  call   <max@plt>
  lea    -0x4(%rbx),%esi
  movslq %r12d,%rbx
  mov    %eax,%edi
  shl    $0x3,%rbx
  call   <min@plt>
  pxor   %xmm0,%xmm0
  movsd  (%rsp),%xmm1
  cvtsi2sd %r12d,%xmm0
  mov    %eax,%ebp
  cltq
  lea    0x0(%r13,%rax,8),%r15
  lea    D2(%rip),%r13
  mov    %r13,%r14
  lea    0x20(%r13),%r12
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
L7:
  mov    (%r15),%rdi
  movsd  (%rsp),%xmm0
  add    $0x8,%r14
  add    $0x8,%r15
  add    %rbx,%rdi
  call   <it_pol_neville_s4@plt>
  movsd  %xmm0,-0x8(%r14)
  cmp    %r14,%r12
  jne    L7
  pxor   %xmm1,%xmm1
  movsd  0x8(%rsp),%xmm0
  add    $0x18,%rsp
  mov    %r13,%rdi
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  subsd  %xmm1,%xmm0
  jmp    10b0 <it_pol_neville_s4@plt>
```

assistant: ```c
double it_pol_neville2D_s4(int n, int m, double **f, double y_1, double x_1) {
  int i;
  static double x_interm[4];
  int indice_x1_inf = (int)floor(x_1) - 1;
  indice_x1_inf = max(indice_x1_inf, 0);
  indice_x1_inf = min(indice_x1_inf, m - 4);
  int indice_y1_inf = (int)floor(y_1) - 1;
  indice_y1_inf = max(indice_y1_inf, 0);
  indice_y1_inf = min(indice_y1_inf, n - 4);
  for (i = 0; i < 4; i++) {
    x_interm[i] = it_pol_neville_s4(&(f[indice_y1_inf + i][indice_x1_inf]), x_1 - indice_x1_inf);
  }
  return it_pol_neville_s4(x_interm, y_1 - indice_y1_inf);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<binary_search>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    %r8d,-0x2c(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  js     L40
  cmpl   $0x0,-0x2c(%rbp)
  jns    L31
L40:
  mov    $0xffffffff,%eax
  jmp    L106
L31:
  mov    -0x28(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jge    L56
  mov    $0xffffffff,%eax
  jmp    L106
L56:
  mov    -0x28(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jne    L75
  mov    -0x2c(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jne    L98
  mov    -0x2c(%rbp),%eax
  jmp    L106
L98:
  mov    $0xffffffff,%eax
  jmp    L106
L75:
  mov    -0x28(%rbp),%eax
  sub    -0x2c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcmp@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L55
  mov    -0x8(%rbp),%eax
  lea    -0x1(%rax),%ecx
  mov    -0x2c(%rbp),%edi
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <binary_search>
  jmp    L106
L55:
  cmpl   $0x0,-0x4(%rbp)
  jns    L27
  mov    -0x8(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <binary_search>
  jmp    L106
L27:
  mov    -0x8(%rbp),%eax
L106:
  leave
  ret
```

assistant: ```c
int binary_search(const void *arr, const void *key, unsigned int entry_size, int max, int min) {
  if (max < 0 || min < 0)
    return -1;
  if (max < min)
    return -1;
  if (max == min)
    return memcmp(arr + (min * entry_size), key, entry_size) == 0 ? min : -1;
  int mid = min + ((max - min) / 2), comparison = memcmp(arr + (mid * entry_size), key, entry_size);
  if (comparison > 0)
    return binary_search(arr, key, entry_size, mid - 1, min);
  if (comparison < 0)
    return binary_search(arr, key, entry_size, max, mid + 1);
  return mid;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<binary_search>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %r8d,%r8d
  mov    $0x0,%eax
  cmovns %r8d,%eax
  cmp    %ecx,%eax
  jg     L51
  mov    %rdi,%r14
  mov    %rsi,%r15
  mov    %edx,%r13d
  mov    %ecx,%r12d
  mov    %r8d,%ebp
  test   %r8d,%r8d
  js     L51
  cmp    %r8d,%ecx
  je     L28
  mov    %ecx,%eax
  sub    %r8d,%eax
  mov    %eax,%ebx
  shr    $0x1f,%ebx
  add    %eax,%ebx
  sar    %ebx
  add    %r8d,%ebx
  mov    %ebx,%edi
  imul   %edx,%edi
  add    %r14,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jg     L33
  js     L80
L12:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L28:
  mov    %r8d,%edi
  imul   %edx,%edi
  add    %r14,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  mov    $0xffffffff,%ebx
  cmove  %ebp,%ebx
  jmp    L12
L33:
  lea    -0x1(%rbx),%ecx
  mov    %ebp,%r8d
  mov    %r13d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <binary_search>
  mov    %eax,%ebx
  jmp    L12
L80:
  lea    0x1(%rbx),%r8d
  mov    %r12d,%ecx
  mov    %r13d,%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  call   <binary_search>
  mov    %eax,%ebx
  jmp    L12
L51:
  mov    $0xffffffff,%ebx
  jmp    L12
```

assistant: ```c
int binary_search(const void *arr, const void *key, unsigned int entry_size, int max, int min) {
  if (max < 0 || min < 0)
    return -1;
  if (max < min)
    return -1;
  if (max == min)
    return memcmp(arr + (min * entry_size), key, entry_size) == 0 ? min : -1;
  int mid = min + ((max - min) / 2), comparison = memcmp(arr + (mid * entry_size), key, entry_size);
  if (comparison > 0)
    return binary_search(arr, key, entry_size, mid - 1, min);
  if (comparison < 0)
    return binary_search(arr, key, entry_size, max, mid + 1);
  return mid;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<binary_search>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %r8d,%r8d
  cmovns %r8d,%eax
  cmp    %eax,%ecx
  jl     L98
  mov    %r8d,%ebx
  test   %r8d,%r8d
  js     L98
  mov    %rdi,%rbp
  mov    %rsi,%r15
  mov    %edx,%r14d
  mov    %ecx,%r13d
  cmp    %r8d,%ecx
  jne    L48
  jmp    L23
  nopw   0x0(%rax,%rax,1)
L2:
  lea    -0x1(%r12),%r13d
  mov    %ebx,%eax
  or     %r13d,%eax
  js     L98
L87:
  cmp    %r13d,%ebx
  jg     L98
  je     L23
L48:
  mov    %r13d,%eax
  mov    %r14d,%edx
  mov    %r15,%rsi
  sub    %ebx,%eax
  mov    %eax,%r12d
  shr    $0x1f,%r12d
  add    %eax,%r12d
  sar    %r12d
  add    %ebx,%r12d
  mov    %r12d,%edi
  imul   %r14d,%edi
  add    %rbp,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jg     L2
  je     L111
  lea    0x1(%r12),%ebx
  mov    %ebx,%eax
  or     %r13d,%eax
  jns    L87
  nop
L98:
  mov    $0xffffffff,%r12d
L111:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L23:
  mov    %r13d,%eax
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %r13d,%r12d
  imul   %r14d,%eax
  lea    0x0(%rbp,%rax,1),%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L111
  jmp    L98
```

assistant: ```c
int binary_search(const void *arr, const void *key, unsigned int entry_size, int max, int min) {
  if (max < 0 || min < 0)
    return -1;
  if (max < min)
    return -1;
  if (max == min)
    return memcmp(arr + (min * entry_size), key, entry_size) == 0 ? min : -1;
  int mid = min + ((max - min) / 2), comparison = memcmp(arr + (mid * entry_size), key, entry_size);
  if (comparison > 0)
    return binary_search(arr, key, entry_size, mid - 1, min);
  if (comparison < 0)
    return binary_search(arr, key, entry_size, max, mid + 1);
  return mid;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<binary_search>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %r8d,%r8d
  cmovns %r8d,%eax
  cmp    %eax,%ecx
  jl     L0
  mov    %r8d,%ebx
  test   %r8d,%r8d
  js     L0
  mov    %rdi,%rbp
  mov    %rsi,%r15
  mov    %edx,%r14d
  mov    %ecx,%r13d
  cmp    %r8d,%ecx
  jne    L63
  jmp    L16
  nopw   0x0(%rax,%rax,1)
L3:
  lea    -0x1(%r12),%r13d
  mov    %ebx,%eax
  or     %r13d,%eax
  js     L0
L90:
  cmp    %r13d,%ebx
  jg     L0
  je     L16
L63:
  mov    %r13d,%eax
  mov    %r14d,%edx
  mov    %r15,%rsi
  sub    %ebx,%eax
  mov    %eax,%r12d
  shr    $0x1f,%r12d
  add    %eax,%r12d
  sar    %r12d
  add    %ebx,%r12d
  mov    %r12d,%edi
  imul   %r14d,%edi
  add    %rbp,%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  jg     L3
  je     L24
  lea    0x1(%r12),%ebx
  mov    %ebx,%eax
  or     %r13d,%eax
  jns    L90
  nop
L0:
  mov    $0xffffffff,%r12d
L24:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L16:
  mov    %r13d,%eax
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    %r13d,%r12d
  imul   %r14d,%eax
  lea    0x0(%rbp,%rax,1),%rdi
  call   <memcmp@plt>
  test   %eax,%eax
  je     L24
  jmp    L0
```

assistant: ```c
int binary_search(const void *arr, const void *key, unsigned int entry_size, int max, int min) {
  if (max < 0 || min < 0)
    return -1;
  if (max < min)
    return -1;
  if (max == min)
    return memcmp(arr + (min * entry_size), key, entry_size) == 0 ? min : -1;
  int mid = min + ((max - min) / 2), comparison = memcmp(arr + (mid * entry_size), key, entry_size);
  if (comparison > 0)
    return binary_search(arr, key, entry_size, mid - 1, min);
  if (comparison < 0)
    return binary_search(arr, key, entry_size, max, mid + 1);
  return mid;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<WebbyFindQueryVar>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  movl   $0xffffffff,-0x2c(%rbp)
  mov    -0x48(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L31
L39:
  mov    -0x28(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  je     L29
  mov    -0x28(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x26,%al
  jne    L103
L29:
  mov    -0x28(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3d,%al
  jne    L103
  mov    -0x10(%rbp),%rdx
  mov    -0x28(%rbp),%rcx
  mov    -0x40(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncasecmp@plt>
  test   %rax,%rax
  jne    L103
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  add    %rax,-0x28(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x28(%rbp),%rax
  mov    $0x26,%esi
  mov    %rax,%rdi
  call   <memchr@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L3
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L3:
  mov    -0x20(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  setae  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x20(%rbp),%rax
  sub    -0x28(%rbp),%rax
  cmp    %rax,-0x50(%rbp)
  jbe    L26
  mov    -0x20(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    %rax,%rsi
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    $0x1,%r8d
  mov    %rax,%rdi
  call   <url_decode@plt>
  mov    %eax,-0x2c(%rbp)
  jmp    L26
L103:
  addq   $0x1,-0x28(%rbp)
L31:
  cmpq   $0x0,-0x28(%rbp)
  je     L21
  mov    -0x28(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  ja     L39
  jmp    L21
L26:
  nop
L21:
  mov    -0x2c(%rbp),%eax
  leave
  ret
```

assistant: ```c
int WebbyFindQueryVar(const char *buf, const char *name, char *dst, size_t dst_len) {
  const char *p, *e, *s;
  size_t name_len;
  int len;
  size_t buf_len = strlen(buf);
  name_len = strlen(name);
  e = buf + buf_len;
  len = -1;
  dst[0] = '\0';
  for (p = buf; p != NULL && p + name_len < e; p++) {
    if ((p == buf || p[-1] == '&') && p[name_len] == '=' && 0 == strncasecmp(name, p, name_len)) {
      p += name_len + 1;
      s = (const char *)memchr(p, '&', (size_t)(e - p));
      if (s == NULL) {
        s = e;
      }
      assert(s >= p);
      if ((size_t)(s - p) < dst_len) {
        len = (int)url_decode(p, (size_t)(s - p), dst, dst_len, 1);
      }
      break;
    }
  }
  return len;
}
```