user: 下面的汇编指令对应的C源代码是什么:

```asm
<generate_scaling>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%r10
  mov    %edx,%r11d
  mov    %rcx,%r12
  lea    -0x8(%rdi),%r8d
  mov    $0x1,%r13d
  mov    %edi,%ecx
  shl    %cl,%r13d
  mov    (%rsi),%eax
  mov    %r8d,%ecx
  shl    %cl,%eax
  test   %eax,%eax
  jle    L24
  mov    $0x0,%eax
  mov    %r8d,%ecx
L6:
  mov    0x4(%r10),%edx
  mov    %edx,(%r12,%rax,4)
  add    $0x1,%rax
  mov    (%r10),%edx
  shl    %cl,%edx
  cmp    %eax,%edx
  jg     L6
  mov    %ecx,%r8d
L24:
  lea    -0x1(%r11),%ebp
  test   %ebp,%ebp
  jle    L129
  mov    %r10,%r9
  lea    -0x2(%r11),%eax
  lea    0x8(%r10,%rax,8),%rbx
  mov    %r8d,%ecx
L54:
  mov    (%r9),%edi
  mov    0x4(%r9),%r14d
  mov    0x8(%r9),%r15d
  mov    %r15d,%esi
  sub    %edi,%esi
  mov    %esi,%eax
  sar    %eax
  add    $0x10000,%eax
  cltd
  idiv   %esi
  mov    0xc(%r9),%edx
  sub    %r14d,%edx
  imul   %edx,%eax
  test   %esi,%esi
  jle    L121
  mov    %edi,%edx
  mov    $0x8000,%edi
L70:
  mov    %edx,%esi
  shl    %cl,%esi
  movslq %esi,%rsi
  mov    %edi,%r8d
  sar    $0x10,%r8d
  add    %r14d,%r8d
  mov    %r8d,(%r12,%rsi,4)
  add    %eax,%edi
  add    $0x1,%edx
  cmp    %r15d,%edx
  jne    L70
L121:
  add    $0x8,%r9
  cmp    %rbx,%r9
  jne    L54
  mov    %ecx,%r8d
L129:
  movslq %r11d,%rax
  lea    -0x8(%r10,%rax,8),%rsi
  mov    (%rsi),%eax
  mov    %r8d,%ecx
  shl    %cl,%eax
  mov    %eax,%ecx
  cmp    %eax,%r13d
  jle    L101
  movslq %eax,%rdi
  lea    (%r12,%rdi,4),%rax
  lea    -0x1(%r13),%edx
  sub    %ecx,%edx
  add    %rdi,%rdx
  lea    0x4(%r12,%rdx,4),%rcx
L127:
  mov    0x4(%rsi),%edx
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L127
L101:
  mov    $0x1,%ebx
  mov    %r8d,%ecx
  shl    %cl,%ebx
  mov    %ebx,%r14d
  sar    %r14d
  test   %ebp,%ebp
  jle    L135
  mov    %r10,%r15
  lea    -0x2(%r11),%eax
  lea    0x8(%r10,%rax,8),%rax
  mov    %rax,-0x20(%rsp)
  movslq %ebx,%r13
  lea    0x0(,%r13,4),%rax
  lea    -0x2(%rbx),%ecx
  mov    %rcx,-0x18(%rsp)
  lea    0x4(%r12),%rcx
  mov    %rcx,-0x10(%rsp)
  mov    %r8d,%ecx
  mov    %r12,-0x8(%rsp)
  mov    %rax,%r12
L66:
  mov    (%r15),%eax
  shl    %cl,%eax
  mov    0x8(%r15),%r8d
  shl    %cl,%r8d
  sub    %eax,%r8d
  test   %r8d,%r8d
  jle    L49
  cltq
  mov    -0x8(%rsp),%rdi
  lea    (%rdi,%rax,4),%r11
  add    -0x18(%rsp),%rax
  mov    -0x10(%rsp),%rdi
  lea    (%rdi,%rax,4),%r9
  mov    $0x0,%ebp
L81:
  mov    %r11,%r10
  mov    (%r11,%r13,4),%edi
  sub    (%r11),%edi
  cmp    $0x1,%ebx
  jle    L112
  lea    (%r14,%rdi,1),%esi
  mov    %r11,%rax
L126:
  mov    %esi,%edx
  sar    %cl,%edx
  add    (%r10),%edx
  mov    %edx,0x4(%rax)
  add    %edi,%esi
  add    $0x4,%rax
  cmp    %r9,%rax
  jne    L126
L112:
  add    %ebx,%ebp
  add    %r12,%r11
  add    %r12,%r9
  cmp    %ebp,%r8d
  jg     L81
L49:
  add    $0x8,%r15
  cmp    -0x20(%rsp),%r15
  jne    L66
L135:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void generate_scaling(const int bitdepth, const uint8_t points[][2], const int num, uint8_t scaling[256]) {
  const int shift_x = bitdepth - 8;
  const int scaling_size = 1 << bitdepth;
  for (int i = 0; i < points[0][0] << shift_x; i++)
    scaling[i] = points[0][1];
  for (int i = 0; i < num - 1; i++) {
    const int bx = points[i][0];
    const int by = points[i][1];
    const int ex = points[i + 1][0];
    const int ey = points[i + 1][1];
    const int dx = ex - bx;
    const int dy = ey - by;
    const int delta = dy * ((0x10000 + (dx >> 1)) / dx);
    for (int x = 0; x < dx; x++) {
      const int v = by + ((x * delta + 0x8000) >> 16);
      scaling[(bx + x) << shift_x] = v;
    }
  }
  for (int i = points[num - 1][0] << shift_x; i < scaling_size; i++)
    scaling[i] = points[num - 1][1];
  const int pad = 1 << shift_x, rnd = pad >> 1;
  for (int i = 0; i < num - 1; i++) {
    const int bx = points[i][0] << shift_x;
    const int ex = points[i + 1][0] << shift_x;
    const int dx = ex - bx;
    for (int x = 0; x < dx; x += pad) {
      const int range = scaling[bx + x + pad] - scaling[bx + x];
      for (int n = 1; n < pad; n++) {
        scaling[bx + x + n] = scaling[bx + x] + ((range * n + rnd) >> shift_x);
      }
    }
  }
}
```