user: Converte this assembly snippet into its equivalent C code:

```asm
<drawBitmap2BPP>:
  endbr64
  push   %r15
  mov    %r8d,%eax
  shl    $0x6,%r9d
  push   %r14
  mov    %edx,%r14d
  and    $0x1,%eax
  sar    %r8d
  push   %r13
  sub    $0x1,%r14d
  push   %r12
  sar    $0x2,%r14d
  push   %rbp
  add    $0x1,%r14d
  push   %rbx
  mov    0x38(%rsp),%r11d
  movslq 0x50(%rsp),%rdx
  mov    0x58(%rsp),%r15d
  lea    (%r11,%r11,1),%ecx
  sar    $0x2,%r11d
  mov    %eax,-0x8(%rsp)
  mov    0x40(%rsp),%eax
  and    $0x6,%ecx
  imul   %r14d,%eax
  add    %r11d,%eax
  cltq
  lea    (%rsi,%rax,1),%r12
  lea    (%r9,%r8,1),%eax
  cltq
  lea    (%rdi,%rax,1),%rbp
  test   %edx,%edx
  jle    L63
  mov    0x48(%rsp),%eax
  shl    $0x6,%rdx
  mov    %r15d,%r13d
  movslq %r14d,%r14
  shl    $0x4,%r15d
  sub    $0x1,%eax
  mov    %eax,-0x4(%rsp)
  lea    0x0(%rbp,%rdx,1),%rax
  mov    %rax,-0x10(%rsp)
  xchg   %ax,%ax
L25:
  movsbl (%r12),%eax
  mov    0x48(%rsp),%esi
  sar    %cl,%eax
  test   %esi,%esi
  jle    L54
  mov    0x60(%rsp),%edx
  mov    -0x4(%rsp),%esi
  test   %edx,%edx
  sete   %r10b
  test   %r13b,%r13b
  js     L84
  mov    -0x8(%rsp),%r8d
  mov    %ecx,%edx
  mov    %r12,%r11
  mov    %rbp,%r9
  jmp    L182
  nopl   (%rax)
L160:
  mov    $0x1,%r8d
  sub    $0x1,%esi
  jb     L54
L182:
  test   $0x3,%al
  jne    L164
  test   %r10b,%r10b
  jne    L164
L166:
  add    $0x2,%edx
  sar    $0x2,%al
  cmp    $0x6,%edx
  jle    L32
  movzbl 0x1(%r11),%eax
  xor    %edx,%edx
  add    $0x1,%r11
L32:
  cmp    $0x1,%r8d
  jne    L160
  add    $0x1,%r9
  xor    %r8d,%r8d
  sub    $0x1,%esi
  jae    L182
  nopl   0x0(%rax)
L54:
  add    %r14,%r12
  add    $0x40,%rbp
  cmp    %rbp,-0x10(%rsp)
  jne    L25
L63:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L164:
  movzbl (%r9),%edi
  test   %r8d,%r8d
  jne    L172
  and    $0xfffffff0,%edi
  or     %r13d,%edi
  mov    %dil,(%r9)
  jmp    L166
  nopl   0x0(%rax)
L172:
  and    $0xf,%edi
  or     %r15d,%edi
  mov    %dil,(%r9)
  jmp    L166
  nopl   0x0(%rax,%rax,1)
L84:
  mov    -0x8(%rsp),%edi
  mov    %ecx,%edx
  mov    %r12,%rbx
  mov    %rbp,%r11
  jmp    L88
  xchg   %ax,%ax
L159:
  mov    $0x1,%edi
L131:
  sub    $0x1,%esi
  jb     L54
L88:
  mov    %eax,%r9d
  and    $0x3,%r9d
  jne    L106
  test   %r10b,%r10b
  jne    L106
L170:
  add    $0x2,%edx
  sar    $0x2,%al
  cmp    $0x6,%edx
  jle    L149
  movzbl 0x1(%rbx),%eax
  xor    %edx,%edx
  add    $0x1,%rbx
L149:
  cmp    $0x1,%edi
  jne    L159
  add    $0x1,%r11
  xor    %edi,%edi
  jmp    L131
  nopw   0x0(%rax,%rax,1)
L106:
  movzbl (%r11),%r8d
  test   %edi,%edi
  je     L126
  shl    $0x4,%r9d
  and    $0xf,%r8d
  or     %r8d,%r9d
  mov    %r9b,(%r11)
  jmp    L170
  nopl   0x0(%rax,%rax,1)
L126:
  and    $0xfffffff0,%r8d
  or     %r9d,%r8d
  mov    %r8b,(%r11)
  jmp    L170
```

assistant: ```c
void drawBitmap2BPP(char *buffer, char *bitmap, int bitmapWidth, int bitmapHeight, int destX, int destY, int sourceX, int sourceY, int width, int height, signed char shade, int isTransparent) {
  int startPos, startShift, widthLeft;
  char currentBitmap, currentShade;
  char *startBitmap, *startBuffer;
  int bitmapScanlineSkip = ((bitmapWidth - 1) >> 2) + 1;
  int bitmapShift = (sourceX & 0x03) << 1;
  int pixelPos = destX & 0x1;
  bitmap += (sourceY * bitmapScanlineSkip) + (sourceX >> 2);
  buffer += (destY << 6) + (destX >> 1);
  startShift = bitmapShift;
  startPos = pixelPos;
  startBitmap = bitmap;
  startBuffer = buffer;
  while (height-- > 0) {
    widthLeft = width;
    currentBitmap = *bitmap >> bitmapShift;
    while (widthLeft-- > 0) {
      currentShade = currentBitmap & 0x03;
      if (currentShade != 0 || !isTransparent) {
        if (shade >= 0)
          currentShade = shade;
        if (pixelPos == 0) {
          *buffer &= 0xF0;
          *buffer |= currentShade;
        } else {
          *buffer &= 0x0F;
          *buffer |= currentShade << 4;
        }
      }
      bitmapShift += 2;
      if (bitmapShift > 6) {
        bitmapShift = 0;
        currentBitmap = *(++bitmap);
      } else
        currentBitmap >>= 2;
      if (++pixelPos > 1) {
        buffer++;
        pixelPos = 0;
      }
    }
    bitmapShift = startShift;
    startBitmap += bitmapScanlineSkip;
    bitmap = startBitmap;
    pixelPos = startPos;
    startBuffer += 64;
    buffer = startBuffer;
  }
}
```