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

```asm
<RGBE_to_RGBdivA>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  movss  D44(%rip),%xmm0
  movss  %xmm0,-0x24(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L38
  cmpl   $0x0,-0x3c(%rbp)
  jle    L38
  cmpl   $0x0,-0x40(%rbp)
  jg     L13
L38:
  mov    $0x0,%eax
  jmp    L188
L13:
  cmpl   $0x0,-0x44(%rbp)
  je     L141
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <find_max_RGBE@plt>
  movaps %xmm0,%xmm1
  movss  D16(%rip),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,-0x24(%rbp)
L141:
  mov    -0x3c(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L62
L20:
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  add    $0xffffff80,%eax
  mov    %eax,%edi
  mov    D20(%rip),%eax
  movd   %eax,%xmm0
  call   <ldexp@plt>
  movss  -0x24(%rbp),%xmm1
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movss  -0x20(%rbp),%xmm1
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x1c(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movss  -0x20(%rbp),%xmm1
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movss  -0x20(%rbp),%xmm1
  mulss  %xmm1,%xmm0
  movss  %xmm0,-0x14(%rbp)
  movss  -0x1c(%rbp),%xmm0
  comiss -0x18(%rbp),%xmm0
  jbe    L184
  movss  -0x1c(%rbp),%xmm0
  jmp    L197
L184:
  movss  -0x18(%rbp),%xmm0
L197:
  movss  %xmm0,-0x10(%rbp)
  movss  -0x14(%rbp),%xmm0
  comiss -0x10(%rbp),%xmm0
  jbe    L180
  movss  -0x14(%rbp),%xmm0
  jmp    L71
L180:
  movss  -0x10(%rbp),%xmm0
L71:
  movss  %xmm0,-0x10(%rbp)
  pxor   %xmm0,%xmm0
  ucomiss -0x10(%rbp),%xmm0
  jp     L147
  pxor   %xmm0,%xmm0
  ucomiss -0x10(%rbp),%xmm0
  je     L114
L147:
  movss  D16(%rip),%xmm0
  divss  -0x10(%rbp),%xmm0
  cvttss2si %xmm0,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  cvttss2si %xmm0,%eax
  jmp    L31
L114:
  mov    $0x1,%eax
L31:
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  mov    $0x1,%edx
  test   %eax,%eax
  cmovle %edx,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0xff,-0xc(%rbp)
  jg     L134
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  jmp    L7
L134:
  mov    $0xffffffff,%edx
L7:
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movaps %xmm0,%xmm1
  mulss  -0x1c(%rbp),%xmm1
  movss  D19(%rip),%xmm0
  addss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0xff,-0xc(%rbp)
  jg     L125
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  jmp    L138
L125:
  mov    $0xffffffff,%edx
L138:
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movaps %xmm0,%xmm1
  mulss  -0x18(%rbp),%xmm1
  movss  D19(%rip),%xmm0
  addss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0xff,-0xc(%rbp)
  jg     L47
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  jmp    L204
L47:
  mov    $0xffffffff,%edx
L204:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x3,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  movaps %xmm0,%xmm1
  mulss  -0x14(%rbp),%xmm1
  movss  D19(%rip),%xmm0
  addss  %xmm1,%xmm0
  cvttss2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0xff,-0xc(%rbp)
  jg     L22
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  jmp    L4
L22:
  mov    $0xffffffff,%edx
L4:
  mov    -0x8(%rbp),%rax
  add    $0x2,%rax
  mov    %dl,(%rax)
  addq   $0x4,-0x8(%rbp)
  subl   $0x1,-0x28(%rbp)
L62:
  cmpl   $0x0,-0x28(%rbp)
  jg     L20
  mov    $0x1,%eax
L188:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D44
datatype: byte[4]
name: unpack_data
arguments: data_tag: D16
datatype: byte[4]
name: unpack_data
arguments: data_tag: D20
datatype: byte[4]
name: unpack_data
arguments: data_tag: D19
datatype: byte[4]

tool: {"D44": [0x00,0x00,0x80,0x3f]}

tool: {"D16": [0x00,0x00,0x7f,0x43]}

tool: {"D20": [0x81,0x80,0x80,0x3b]}

tool: {"D19": [0x00,0x00,0x00,0x3f]}

assistant: ```c
int RGBE_to_RGBdivA(unsigned char *image, int width, int height, int rescale_to_max) {
  int i, iv;
  unsigned char *img = image;
  float scale = 1.0f;
  if ((!image) || (width < 1) || (height < 1)) {
    return 0;
  }
  if (rescale_to_max) {
    scale = 255.0f / find_max_RGBE(image, width, height);
  }
  for (i = width * height; i > 0; --i) {
    float r, g, b, e, m;
    e = scale * ldexp(1.0f / 255.0f, (int)(img[3]) - 128);
    r = e * img[0];
    g = e * img[1];
    b = e * img[2];
    m = (r > g) ? r : g;
    m = (b > m) ? b : m;
    iv = (int)((m != 0.0f) ? (int)(255.0f / m) : 1.0f);
    iv = (iv < 1) ? 1 : iv;
    img[3] = (unsigned char)((iv > 255) ? 255 : iv);
    iv = (int)(img[3] * r + 0.5f);
    img[0] = (unsigned char)((iv > 255) ? 255 : iv);
    iv = (int)(img[3] * g + 0.5f);
    img[1] = (unsigned char)((iv > 255) ? 255 : iv);
    iv = (int)(img[3] * b + 0.5f);
    img[2] = (unsigned char)((iv > 255) ? 255 : iv);
    img += 4;
  }
  return 1;
}
```