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

```asm
<image_rgb48be_from_rgb96f>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %edi,%r13d
  mov    %r13d,%eax
  push   %r12
  imul   %esi,%eax
  push   %rbp
  push   %rbx
  lea    (%rax,%rax,2),%edi
  add    %edi,%edi
  sub    $0x18,%rsp
  movslq %edi,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %r15d,%r15d
  jle    L26
  test   %r13d,%r13d
  jle    L26
  lea    0x0(%r13,%r13,2),%eax
  mov    %r14,%r8
  mov    %r12,%r10
  xor    %r9d,%r9d
  movslq %eax,%rbp
  add    %eax,%eax
  movss  D5(%rip),%xmm0
  movslq %eax,%r11
  lea    0x0(%r13,%r13,2),%rax
  shl    $0x2,%rbp
  lea    (%r12,%rax,2),%rdi
  xchg   %ax,%ax
L8:
  mov    %r10,%rcx
  mov    %r8,%rsi
  cs nopw 0x0(%rax,%rax,1)
L21:
  movss  0x4(%rsi),%xmm1
  xor    %r14d,%r14d
  mulss  %xmm0,%xmm1
  cvttss2si %xmm1,%edx
  movss  0x8(%rsi),%xmm1
  mulss  %xmm0,%xmm1
  cvttss2si %xmm1,%eax
  movss  (%rsi),%xmm1
  mulss  %xmm0,%xmm1
  mov    %eax,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cvttss2si %xmm1,%ebx
  test   %ebx,%ebx
  cmovs  %r14d,%ebx
  mov    $0xffff,%r14d
  cmp    %r14d,%ebx
  cmovg  %r14d,%ebx
  xor    %r13d,%r13d
  test   %edx,%edx
  cmovs  %r13d,%edx
  mov    $0xffff,%r13d
  mov    %bh,(%rcx)
  cmp    %r13d,%edx
  mov    %bl,0x1(%rcx)
  cmovg  %r13d,%edx
  mov    %dh,0x2(%rcx)
  mov    %dl,0x3(%rcx)
  xor    %edx,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  mov    $0xffff,%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
  add    $0x6,%rcx
  add    $0xc,%rsi
  rol    $0x8,%ax
  mov    %ax,-0x2(%rcx)
  cmp    %rdi,%rcx
  jne    L21
  add    $0x1,%r9d
  add    %rbp,%r8
  add    %r11,%r10
  add    %r11,%rdi
  cmp    %r9d,%r15d
  jne    L8
L26:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_tag: D5
data_type: byte[4]

tool: {"D5": [0x00,0xff,0x7f,0x47]}

assistant: ```c
unsigned char *image_rgb48be_from_rgb96f(signed int xres, signed int yres, float *fimg) {
  signed int x;
  signed int y;
  signed int R;
  signed int G;
  signed int B;
  unsigned char *img;
  void *return_value_malloc$1;
  return_value_malloc$1 = malloc((unsigned long int)(xres * yres * 6));
  img = (unsigned char *)return_value_malloc$1;
  y = 0;
  while (!(y >= yres)) {
    x = 0;
    while (!(x >= xres)) {
      signed int faddr = (xres * y + x) * 3;
      signed int iaddr = faddr * 2;
      R = (signed int)(fimg[(signed long int)faddr] * 65535.000000f);
      G = (signed int)(fimg[(signed long int)(faddr + 1)] * 65535.000000f);
      B = (signed int)(fimg[(signed long int)(faddr + 2)] * 65535.000000f);
      if (R > 65535)
        R = 65535;
      if (R < 0)
        R = 0;
      img[(signed long int)iaddr] = (unsigned char)(R >> 8 & 255);
      img[(signed long int)(iaddr + 1)] = (unsigned char)(R & 255);
      if (G > 65535)
        G = 65535;
      if (G < 0)
        G = 0;
      img[(signed long int)(iaddr + 2)] = (unsigned char)(G >> 8 & 255);
      img[(signed long int)(iaddr + 3)] = (unsigned char)(G & 255);
      if (B > 65535)
        B = 65535;
      if (B < 0)
        B = 0;
      img[(signed long int)(iaddr + 4)] = (unsigned char)(B >> 8 & 255);
      img[(signed long int)(iaddr + 5)] = (unsigned char)(B & 255);
      x = x + 1;
    }
    y = y + 1;
  }
  return img;
}
```