user: 这段汇编代码用C语言表示是什么样的:

```asm
<bsearch_range>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    %rcx,0x20(%rsp)
  mov    %r8,0x8(%rsp)
  mov    0x70(%rsp),%r15
  mov    0x78(%rsp),%r14
  test   %r9,%r9
  je     L81
  mov    %r9,%r12
  mov    %r9,%rbp
  mov    $0x0,%r13d
  jmp    L83
L129:
  lea    0x1(%rbx),%r13
L127:
  cmp    %rbp,%r13
  jae    L136
L83:
  lea    0x0(%r13,%rbp,1),%rbx
  shr    %rbx
  mov    %r15,%rsi
  imul   %rbx,%rsi
  add    0x8(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   *%r14
  test   %eax,%eax
  jg     L129
  mov    %rbx,%rbp
  jmp    L127
L136:
  mov    $0x0,%eax
  cmp    %r12,%r13
  jae    L11
  imul   %r15,%r13
  mov    0x8(%rsp),%rax
  add    %r13,%rax
L11:
  mov    0x28(%rsp),%rcx
  mov    %rax,(%rcx)
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   *%r14
  mov    $0x0,%ebx
  test   %eax,%eax
  jg     L79
  cmp    %rbp,%r12
  jbe    L128
  mov    %r12,%r13
  mov    %rbp,0x10(%rsp)
  jmp    L198
L171:
  mov    %rbx,%r13
L72:
  cmp    %r12,%r13
  mov    %r12,%rax
  cmovbe %r13,%rax
  cmp    %rax,0x10(%rsp)
  jae    L114
L198:
  mov    0x10(%rsp),%rax
  lea    (%rax,%r13,1),%rbx
  shr    %rbx
  mov    %r15,%rsi
  imul   %rbx,%rsi
  add    0x8(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   *%r14
  test   %eax,%eax
  js     L171
  lea    0x1(%rbx),%rax
  mov    %rax,0x10(%rsp)
  jmp    L72
L114:
  mov    0x10(%rsp),%rax
  cmp    %r12,%rax
  je     L23
  mov    %rax,%r12
  imul   %r15,%rax
  mov    0x8(%rsp),%rcx
  lea    (%rcx,%rax,1),%rbx
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdi
  call   *%r14
  test   %eax,%eax
  js     L154
L79:
  mov    0x20(%rsp),%rax
  mov    %rbx,(%rax)
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L154:
  cmp    %rbp,%r12
  ja     L89
L172:
  mov    $0x0,%ebx
  jmp    L79
L89:
  mov    0x10(%rsp),%r12
L23:
  sub    $0x1,%r12
  imul   %r15,%r12
  mov    0x8(%rsp),%rbx
  add    %r12,%rbx
  jmp    L79
L128:
  je     L172
  imul   %rbp,%r15
  mov    0x8(%rsp),%rbx
  add    %r15,%rbx
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdi
  call   *%r14
  test   %eax,%eax
  jns    L79
  jmp    L172
L81:
  mov    0x28(%rsp),%rax
  movq   $0x0,(%rax)
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%rdi
  call   *%r14
  mov    $0x0,%ebx
  test   %eax,%eax
  jg     L79
  jmp    L172
```

assistant: ```c
void bsearch_range(const void *key1, const void *key2, void *p1, void *p2, const void *base, size_t nmemb, size_t size, int (*cmp)(const void *, const void *)) {
  const char *b = (const char *)base;
  size_t l1, u1, l2, u2;
  l1 = 0;
  u1 = nmemb;
  while (l1 < u1) {
    size_t idx = (l1 + u1) / 2;
    int comp = (*cmp)(key1, b + idx * size);
    if (comp <= 0)
      u1 = idx;
    else
      l1 = idx + 1;
  }
  if (l1 < nmemb)
    *(const void **)p1 = b + l1 * size;
  else
    *(const void **)p1 = NULL;
  if (((*cmp)(key1, key2)) > 0) {
    *(const void **)p2 = NULL;
    return;
  }
  l2 = u1;
  u2 = nmemb;
  while (l2 < u2 && l2 < nmemb) {
    size_t idx = (l2 + u2) / 2;
    int comp = (*cmp)(key2, b + idx * size);
    if (comp < 0)
      u2 = idx;
    else
      l2 = idx + 1;
  }
  if (l2 == nmemb || ((*cmp)(key2, b + l2 * size)) < 0) {
    if (l2 > u1)
      *(const void **)p2 = b + (l2 - 1) * size;
    else
      *(const void **)p2 = NULL;
  } else
    *(const void **)p2 = b + l2 * size;
}
```