user: Translate the below assembly code into C programming language:

```asm
<scale_image_bicubic>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x108,%rsp
  mov    %rdi,0xd0(%rsp)
  mov    %esi,0xc8(%rsp)
  mov    %edx,0x10(%rsp)
  mov    %rcx,0xc0(%rsp)
  mov    %r8d,0xf0(%rsp)
  movss  %xmm0,0x4(%rsp)
  imul   0x140(%rsp),%esi
  mov    %esi,0xec(%rsp)
  cmpl   $0x0,0x148(%rsp)
  jne    L57
  test   %edx,%edx
  jle    L199
  mov    0xf0(%rsp),%ebx
  lea    0x3(%rbx),%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0x18(%rsp)
  lea    0x2(%rbx),%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0x20(%rsp)
  lea    0x1(%rbx),%edx
  imul   0x140(%rsp),%edx
  movslq %edx,%rax
  mov    %rax,0x28(%rsp)
  mov    %ebx,%edi
  imul   0x140(%rsp),%edi
  movslq %edi,%rax
  mov    %rax,0x30(%rsp)
  mov    0x140(%rsp),%eax
  add    %eax,%eax
  mov    %eax,%ecx
  add    0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x60(%rsp)
  cltq
  mov    %rax,0x68(%rsp)
  lea    (%rbx,%rbx,1),%eax
  lea    0x3(%rax),%ecx
  imul   0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x38(%rsp)
  lea    (%rdx,%rdx,1),%esi
  movslq %esi,%rcx
  mov    %rcx,0x40(%rsp)
  lea    0x1(%rax),%ecx
  imul   0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x48(%rsp)
  lea    (%rdi,%rdi,1),%ecx
  movslq %ecx,%r11
  mov    %r11,0x50(%rsp)
  add    %edx,%esi
  movslq %esi,%rdx
  mov    %rdx,0x78(%rsp)
  add    %ebx,%eax
  lea    0x2(%rax),%edx
  imul   0x140(%rsp),%edx
  movslq %edx,%rdx
  mov    %rdx,0x80(%rsp)
  add    $0x1,%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0x88(%rsp)
  add    %edi,%ecx
  movslq %ecx,%rax
  mov    %rax,0x90(%rsp)
  sub    $0x1,%r9d
  shl    $0x7,%r9d
  mov    %r9d,0xe0(%rsp)
  lea    -0x1(%rbx),%eax
  shl    $0x7,%eax
  mov    %eax,0xb0(%rsp)
  mov    0x148(%rsp),%eax
  mov    %eax,0xcc(%rsp)
  movl   $0x0,0xd8(%rsp)
  movl   $0x0,0xdc(%rsp)
  movslq 0x140(%rsp),%rax
  mov    %rax,0x70(%rsp)
  jmp    L203
L57:
  movss  D6(%rip),%xmm0
  divss  0x4(%rsp),%xmm0
  movss  %xmm0,0x70(%rsp)
  cmpl   $0x0,0x10(%rsp)
  jle    L199
  mov    0xf0(%rsp),%ebx
  lea    0x3(%rbx),%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0x30(%rsp)
  lea    0x2(%rbx),%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0x38(%rsp)
  lea    0x1(%rbx),%edx
  imul   0x140(%rsp),%edx
  movslq %edx,%rax
  mov    %rax,0x40(%rsp)
  mov    %ebx,%edi
  imul   0x140(%rsp),%edi
  movslq %edi,%rax
  mov    %rax,0x48(%rsp)
  mov    0x140(%rsp),%eax
  add    %eax,%eax
  mov    %eax,%ecx
  add    0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x88(%rsp)
  cltq
  mov    %rax,0x90(%rsp)
  lea    (%rbx,%rbx,1),%eax
  lea    0x3(%rax),%ecx
  imul   0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x50(%rsp)
  lea    (%rdx,%rdx,1),%esi
  movslq %esi,%rcx
  mov    %rcx,0x58(%rsp)
  lea    0x1(%rax),%ecx
  imul   0x140(%rsp),%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x60(%rsp)
  lea    (%rdi,%rdi,1),%ecx
  movslq %ecx,%r10
  mov    %r10,0x68(%rsp)
  add    %edx,%esi
  movslq %esi,%rdx
  mov    %rdx,0xa0(%rsp)
  add    %ebx,%eax
  lea    0x2(%rax),%edx
  imul   0x140(%rsp),%edx
  movslq %edx,%rdx
  mov    %rdx,0xa8(%rsp)
  add    $0x1,%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    %rax,0xb0(%rsp)
  add    %edi,%ecx
  movslq %ecx,%rax
  mov    %rax,0xb8(%rsp)
  sub    $0x1,%r9d
  shl    $0x7,%r9d
  mov    %r9d,0xfc(%rsp)
  lea    -0x1(%rbx),%eax
  shl    $0x7,%eax
  mov    %eax,0xe0(%rsp)
  movl   $0x0,0xf4(%rsp)
  movl   $0x0,0xf8(%rsp)
  movl   $0x0,0xe8(%rsp)
  movslq 0x140(%rsp),%rax
  mov    %rax,0x98(%rsp)
  jmp    L34
L319:
  movl   $0x0,0x28(%rsp)
  mov    $0x0,%r15d
  jmp    L110
L86:
  mov    $0x0,%r15d
  mov    $0x0,%eax
  jmp    L140
L252:
  mov    0x50(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,0x18(%rsp)
  mov    0x58(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%r12d
  mov    0x60(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%ebp
  mov    0x68(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%edi
  mov    %r15d,%r8d
  mov    0x18(%rsp),%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  call   <icerp@plt>
  mov    %eax,%ebp
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  mov    %ebp,%ecx
  cmp    0x14(%rsp),%eax
  jg     L152
L218:
  mov    0x28(%rsp),%r8d
  mov    %ebp,%edx
  mov    %ebx,%esi
  mov    0x8(%rsp),%edi
  call   <icerp@plt>
  mov    $0xff,%edx
  cmp    %edx,%eax
  cmovle %eax,%edx
  mov    %edx,%edi
  test   %edx,%edx
  mov    $0x0,%eax
  cmovs  %eax,%edi
  movss  0x70(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %al,0x0(%r13)
  add    $0x1,%r14
  add    $0x1,%r13
  cmp    %r14,0x20(%rsp)
  je     L132
L259:
  mov    0x30(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%r12d
  mov    0x38(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%ebp
  mov    0x40(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%ebx
  mov    0x48(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%edi
  mov    %r15d,%r8d
  mov    %r12d,%ecx
  mov    %ebp,%edx
  mov    %ebx,%esi
  call   <icerp@plt>
  mov    %eax,%ebx
  mov    %eax,0x8(%rsp)
  cmpl   $0x0,0x14(%rsp)
  jle    L252
  mov    0x88(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,0x8(%rsp)
  mov    0x90(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%r12d
  mov    0x98(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%ebp
  movzbl (%r14),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%edi
  mov    %r15d,%r8d
  mov    0x8(%rsp),%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  call   <icerp@plt>
  mov    %eax,0x8(%rsp)
  jmp    L252
L152:
  mov    0xa0(%rsp),%rax
  movzbl (%r14,%rax,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,0x18(%rsp)
  mov    0xa8(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,0x78(%rsp)
  mov    0xb0(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%r12d
  mov    0xb8(%rsp),%rsi
  movzbl (%r14,%rsi,1),%edi
  movss  0x4(%rsp),%xmm0
  call   <gamma_correct@plt>
  mov    %eax,%edi
  mov    %r15d,%r8d
  mov    0x18(%rsp),%ecx
  mov    0x78(%rsp),%edx
  mov    %r12d,%esi
  call   <icerp@plt>
  mov    %eax,%ecx
  jmp    L218
L132:
  addl   $0x1,0x80(%rsp)
  mov    0x80(%rsp),%eax
  mov    0xe0(%rsp),%ebx
  add    %ebx,0xd8(%rsp)
  mov    0x140(%rsp),%ebx
  add    %ebx,0xcc(%rsp)
  cmp    %eax,0xc8(%rsp)
  je     L119
L45:
  cmpl   $0x1,0xc8(%rsp)
  jle    L86
  mov    0xd8(%rsp),%eax
  mov    0xe4(%rsp),%ebx
  cltd
  idiv   %ebx
  cmp    0x80(%rsp),%ebx
  sete   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,%r15d
  and    $0x7f,%r15d
  sar    $0x7,%eax
L140:
  mov    0xdc(%rsp),%ebx
  lea    -0x1(%rbx,%rax,1),%eax
  imul   0x140(%rsp),%eax
  cltq
  mov    0xc0(%rsp),%rcx
  lea    (%rcx,%rax,1),%r14
  cmpl   $0x0,0x140(%rsp)
  jle    L132
  movslq 0xcc(%rsp),%rax
  mov    0xd0(%rsp),%rcx
  lea    (%rcx,%rax,1),%r13
  mov    0x140(%rsp),%eax
  add    %r14,%rax
  mov    %rax,0x20(%rsp)
  jmp    L259
L119:
  addl   $0x1,0xe8(%rsp)
  mov    0xe8(%rsp),%eax
  mov    0xfc(%rsp),%ecx
  add    %ecx,0xf8(%rsp)
  mov    0xec(%rsp),%ebx
  add    %ebx,0xf4(%rsp)
  cmp    %eax,0x10(%rsp)
  je     L199
L34:
  mov    0x10(%rsp),%eax
  cmp    $0x1,%eax
  jle    L319
  lea    -0x1(%rax),%ecx
  mov    0xf8(%rsp),%eax
  cltd
  idiv   %ecx
  cmp    0xe8(%rsp),%ecx
  sete   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,%ebx
  and    $0x7f,%ebx
  mov    %ebx,0x28(%rsp)
  sar    $0x7,%eax
  mov    %eax,%r15d
L110:
  mov    0xc8(%rsp),%ebx
  test   %ebx,%ebx
  jle    L119
  lea    -0x1(%r15),%eax
  imul   0xf0(%rsp),%eax
  mov    %eax,0xdc(%rsp)
  mov    0xf4(%rsp),%eax
  mov    %eax,0xcc(%rsp)
  movl   $0x0,0xd8(%rsp)
  movl   $0x0,0x80(%rsp)
  lea    -0x1(%rbx),%eax
  mov    %eax,0xe4(%rsp)
  mov    %r15d,0x14(%rsp)
  jmp    L45
L54:
  mov    0x148(%rsp),%eax
  mov    %eax,0x14(%rsp)
  mov    %eax,%r15d
  jmp    L211
L260:
  mov    0x148(%rsp),%r15d
  mov    %r15d,%eax
  jmp    L100
L21:
  mov    0x38(%rsp),%rax
  movzbl (%rbx,%rax,1),%ecx
  mov    0x40(%rsp),%rax
  movzbl (%rbx,%rax,1),%edx
  mov    0x48(%rsp),%rax
  movzbl (%rbx,%rax,1),%esi
  mov    0x50(%rsp),%rax
  movzbl (%rbx,%rax,1),%edi
  mov    %r15d,%r8d
  call   <icerp@plt>
  mov    %eax,%r12d
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  mov    %r12d,%ecx
  cmp    %r14d,%eax
  jg     L243
L89:
  mov    0x14(%rsp),%r8d
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    0x4(%rsp),%edi
  call   <icerp@plt>
  mov    $0xff,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  test   %eax,%eax
  mov    $0x0,%edx
  cmovs  %edx,%eax
  mov    %al,0x0(%r13)
  add    $0x1,%rbx
  add    $0x1,%r13
  cmp    0x8(%rsp),%rbx
  je     L231
L324:
  mov    0x18(%rsp),%rax
  movzbl (%rbx,%rax,1),%ecx
  mov    0x20(%rsp),%rax
  movzbl (%rbx,%rax,1),%edx
  mov    0x28(%rsp),%rax
  movzbl (%rbx,%rax,1),%esi
  mov    0x30(%rsp),%rax
  movzbl (%rbx,%rax,1),%edi
  mov    %r15d,%r8d
  call   <icerp@plt>
  mov    %eax,%ebp
  mov    %eax,0x4(%rsp)
  test   %r14d,%r14d
  jle    L21
  mov    0x60(%rsp),%rax
  movzbl (%rbx,%rax,1),%ecx
  mov    0x68(%rsp),%rax
  movzbl (%rbx,%rax,1),%edx
  mov    0x70(%rsp),%rax
  movzbl (%rbx,%rax,1),%esi
  movzbl (%rbx),%edi
  mov    %r15d,%r8d
  call   <icerp@plt>
  mov    %eax,0x4(%rsp)
  jmp    L21
L243:
  mov    0x78(%rsp),%rax
  movzbl (%rbx,%rax,1),%ecx
  mov    0x80(%rsp),%rax
  movzbl (%rbx,%rax,1),%edx
  mov    0x88(%rsp),%rax
  movzbl (%rbx,%rax,1),%esi
  mov    0x90(%rsp),%rax
  movzbl (%rbx,%rax,1),%edi
  mov    %r15d,%r8d
  call   <icerp@plt>
  mov    %eax,%ecx
  jmp    L89
L231:
  addl   $0x1,0x58(%rsp)
  mov    0x58(%rsp),%eax
  mov    0xb0(%rsp),%ebx
  add    %ebx,0xa0(%rsp)
  mov    0x140(%rsp),%ebx
  add    %ebx,0x98(%rsp)
  cmp    %eax,0xc8(%rsp)
  je     L222
L4:
  cmpl   $0x1,0xc8(%rsp)
  jle    L260
  mov    0xa0(%rsp),%eax
  mov    0xb8(%rsp),%ecx
  cltd
  idiv   %ecx
  cmp    0x58(%rsp),%ecx
  sete   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,%r15d
  and    $0x7f,%r15d
  sar    $0x7,%eax
L100:
  mov    0xa8(%rsp),%ecx
  lea    -0x1(%rcx,%rax,1),%ebx
  imul   0x140(%rsp),%ebx
  movslq %ebx,%rbx
  add    0xc0(%rsp),%rbx
  cmpl   $0x0,0x140(%rsp)
  jle    L231
  movslq 0x98(%rsp),%r13
  add    0xd0(%rsp),%r13
  mov    0x140(%rsp),%eax
  add    %rbx,%rax
  mov    %rax,0x8(%rsp)
  jmp    L324
L222:
  addl   $0x1,0xcc(%rsp)
  mov    0xcc(%rsp),%eax
  mov    0xe0(%rsp),%ecx
  add    %ecx,0xdc(%rsp)
  mov    0xec(%rsp),%ebx
  add    %ebx,0xd8(%rsp)
  cmp    %eax,0x10(%rsp)
  je     L199
L203:
  mov    0x10(%rsp),%eax
  cmp    $0x1,%eax
  jle    L54
  lea    -0x1(%rax),%ecx
  mov    0xdc(%rsp),%eax
  cltd
  idiv   %ecx
  cmp    0xcc(%rsp),%ecx
  sete   %dl
  movzbl %dl,%edx
  sub    %edx,%eax
  mov    %eax,%ebx
  and    $0x7f,%ebx
  mov    %ebx,0x14(%rsp)
  sar    $0x7,%eax
  mov    %eax,%r15d
L211:
  mov    0xc8(%rsp),%ecx
  test   %ecx,%ecx
  jle    L222
  lea    -0x1(%r15),%eax
  imul   0xf0(%rsp),%eax
  mov    %eax,0xa8(%rsp)
  mov    0xd8(%rsp),%eax
  mov    %eax,0x98(%rsp)
  mov    0x148(%rsp),%eax
  mov    %eax,0x58(%rsp)
  movl   $0x0,0xa0(%rsp)
  lea    -0x1(%rcx),%eax
  mov    %eax,0xb8(%rsp)
  mov    %r15d,%r14d
  jmp    L4
L199:
  add    $0x108,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D6
type: f32

tool: D6: 1

assistant: ```c
void scale_image_bicubic(unsigned char *dst, int dw, int dh, unsigned char *src, int sw, int sh, int bpp, int gc, float gamma) {
  int x, y, n, ix, iy, wx, wy, v;
  int a, b, c, d;
  int dstride = dw * bpp;
  unsigned char *s;
  float invgamma;
  if (gc) {
    invgamma = 1.0 / gamma;
    for (y = 0; y < dh; ++y) {
      if (dh > 1) {
        iy = (((sh - 1) * y) << 7) / (dh - 1);
        if (y == dh - 1)
          --iy;
        wy = iy & 0x7f;
        iy >>= 7;
      } else
        iy = wy = 0;
      for (x = 0; x < dw; ++x) {
        if (dw > 1) {
          ix = (((sw - 1) * x) << 7) / (dw - 1);
          if (x == dw - 1)
            --ix;
          wx = ix & 0x7f;
          ix >>= 7;
        } else
          ix = wx = 0;
        s = src + ((iy - 1) * sw + (ix - 1)) * bpp;
        for (n = 0; n < bpp; ++n) {
          b = icerp(gamma_correct(s[(sw + 0) * bpp], gamma), gamma_correct(s[(sw + 1) * bpp], gamma), gamma_correct(s[(sw + 2) * bpp], gamma), gamma_correct(s[(sw + 3) * bpp], gamma), wx);
          if (iy > 0) {
            a = icerp(gamma_correct(s[0], gamma), gamma_correct(s[bpp], gamma), gamma_correct(s[2 * bpp], gamma), gamma_correct(s[3 * bpp], gamma), wx);
          } else
            a = b;
          c = icerp(gamma_correct(s[(2 * sw + 0) * bpp], gamma), gamma_correct(s[(2 * sw + 1) * bpp], gamma), gamma_correct(s[(2 * sw + 2) * bpp], gamma), gamma_correct(s[(2 * sw + 3) * bpp], gamma), wx);
          if (iy < dh - 1) {
            d = icerp(gamma_correct(s[(3 * sw + 0) * bpp], gamma), gamma_correct(s[(3 * sw + 1) * bpp], gamma), gamma_correct(s[(3 * sw + 2) * bpp], gamma), gamma_correct(s[(3 * sw + 3) * bpp], gamma), wx);
          } else
            d = c;
          v = icerp(a, b, c, d, wy);
          if (v < 0)
            v = 0;
          if (v > 255)
            v = 255;
          dst[(y * dstride) + (x * bpp) + n] = gamma_correct(v, invgamma);
          ++s;
        }
      }
    }
  } else {
    for (y = 0; y < dh; ++y) {
      if (dh > 1) {
        iy = (((sh - 1) * y) << 7) / (dh - 1);
        if (y == dh - 1)
          --iy;
        wy = iy & 0x7f;
        iy >>= 7;
      } else
        iy = wy = 0;
      for (x = 0; x < dw; ++x) {
        if (dw > 1) {
          ix = (((sw - 1) * x) << 7) / (dw - 1);
          if (x == dw - 1)
            --ix;
          wx = ix & 0x7f;
          ix >>= 7;
        } else
          ix = wx = 0;
        s = src + ((iy - 1) * sw + (ix - 1)) * bpp;
        for (n = 0; n < bpp; ++n) {
          b = icerp(s[(sw + 0) * bpp], s[(sw + 1) * bpp], s[(sw + 2) * bpp], s[(sw + 3) * bpp], wx);
          if (iy > 0) {
            a = icerp(s[0], s[bpp], s[2 * bpp], s[3 * bpp], wx);
          } else
            a = b;
          c = icerp(s[(2 * sw + 0) * bpp], s[(2 * sw + 1) * bpp], s[(2 * sw + 2) * bpp], s[(2 * sw + 3) * bpp], wx);
          if (iy < dh - 1) {
            d = icerp(s[(3 * sw + 0) * bpp], s[(3 * sw + 1) * bpp], s[(3 * sw + 2) * bpp], s[(3 * sw + 3) * bpp], wx);
          } else
            d = c;
          v = icerp(a, b, c, d, wy);
          if (v < 0)
            v = 0;
          if (v > 255)
            v = 255;
          dst[(y * dstride) + (x * bpp) + n] = v;
          ++s;
        }
      }
    }
  }
}
```