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

```asm
<rgbMapfromto>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %edx,-0x1c(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jle    L26
  mov    -0x18(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    -0x14(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%ecx
  shll   %cl,-0xc(%rbp)
  mov    -0x8(%rbp),%eax
  and    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%ecx
  shll   %cl,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%ecx
  shll   %cl,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  and    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  lea    (%rdx,%rax,1),%esi
  mov    -0x10(%rbp),%eax
  mov    -0x8(%rbp),%edx
  mov    %edx,%edi
  mov    %eax,%ecx
  shl    %cl,%edi
  mov    -0x1c(%rbp),%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  and    %edi,%eax
  add    %esi,%eax
  jmp    L42
L26:
  cmpl   $0x0,-0x10(%rbp)
  jne    L89
  cmpl   $0x5,-0x18(%rbp)
  jne    L78
  mov    -0x14(%rbp),%eax
  and    $0x7fff,%eax
  jmp    L42
L78:
  cmpl   $0x8,-0x18(%rbp)
  jne    L10
  mov    -0x14(%rbp),%eax
  and    $0xffffff,%eax
  jmp    L42
L10:
  mov    -0x14(%rbp),%eax
  jmp    L42
L89:
  cmpl   $0x0,-0x14(%rbp)
  jne    L36
  mov    -0x14(%rbp),%eax
  jmp    L42
L36:
  mov    -0x18(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  sub    $0x1,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x14(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  and    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,%ecx
  shll   %cl,-0xc(%rbp)
  mov    -0x8(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %eax,%ecx
  shr    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  and    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edi
  mov    -0x8(%rbp),%edx
  mov    -0x10(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%ecx
  shr    %cl,%esi
  mov    -0x1c(%rbp),%eax
  mov    -0xc(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  and    %esi,%eax
  add    %edi,%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jne    L81
  mov    $0x1,%eax
  jmp    L42
L81:
  mov    -0x4(%rbp),%eax
L42:
  pop    %rbp
  ret
```

assistant: ```c
int rgbMapfromto(int sourcePixel, int nBitsIn, int nBitsOut) {
  int srcPix;
  int d;
  int mask;
  int destPix;
  if ((d = nBitsOut - nBitsIn) > 0) {
    mask = (1 << nBitsIn) - 1;
    srcPix = sourcePixel << d;
    mask = mask << d;
    destPix = srcPix & mask;
    mask = mask << nBitsOut;
    srcPix = srcPix << d;
    return (destPix + (srcPix & mask)) + ((srcPix << d) & (mask << nBitsOut));
  } else {
    if (d == 0) {
      if (nBitsIn == 5) {
        return sourcePixel & 32767;
      }
      if (nBitsIn == 8) {
        return sourcePixel & 16777215;
      }
      return sourcePixel;
    }
    if (sourcePixel == 0) {
      return sourcePixel;
    }
    d = nBitsIn - nBitsOut;
    mask = (1 << nBitsOut) - 1;
    srcPix = ((unsigned)sourcePixel) >> d;
    destPix = srcPix & mask;
    mask = mask << nBitsOut;
    srcPix = ((unsigned)srcPix) >> d;
    destPix = (destPix + (srcPix & mask)) + ((((unsigned)srcPix) >> d) & (mask << nBitsOut));
    if (destPix == 0) {
      return 1;
    }
    return destPix;
  }
}
```