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

```asm
<GrOffScreen4BPPPixelDrawMultiple>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %rcx,-0x40(%rbp)
  mov    %r8,-0x48(%rbp)
  mov    %r9,-0x50(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x1,%rax
  movzwl (%rax),%eax
  movzwl %ax,%eax
  add    $0x1,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  imul   -0x38(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  mov    %rax,%rcx
  shr    $0x3f,%rcx
  add    %rcx,%rax
  sar    %rax
  add    %rdx,%rax
  add    $0x36,%rax
  add    %rax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  jne    L166
  mov    $0x4,%eax
  jmp    L88
L166:
  mov    $0x0,%eax
L88:
  mov    %rax,-0x30(%rbp)
  cmpq   $0x8,-0x50(%rbp)
  je     L205
  cmpq   $0x8,-0x50(%rbp)
  jg     L157
  cmpq   $0x1,-0x50(%rbp)
  je     L123
  cmpq   $0x4,-0x50(%rbp)
  je     L227
  jmp    L157
L81:
  mov    0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x10(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %rax,-0x8(%rbp)
  jmp    L85
L59:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  not    %eax
  and    %esi,%eax
  mov    %eax,%esi
  mov    -0x40(%rbp),%rax
  mov    %eax,%edx
  mov    $0x7,%eax
  sub    %edx,%eax
  mov    -0x8(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  lea    0x0(,%rax,8),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x30(%rbp),%rdx
  mov    %edx,%ecx
  shl    %cl,%rax
  or     %eax,%esi
  mov    %esi,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  xorq   $0x4,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L179
  addq   $0x1,-0x18(%rbp)
L179:
  addq   $0x1,-0x40(%rbp)
  subq   $0x1,-0x48(%rbp)
L85:
  cmpq   $0x7,-0x40(%rbp)
  jg     L226
  cmpq   $0x0,-0x48(%rbp)
  jne    L59
L226:
  movq   $0x0,-0x40(%rbp)
L123:
  cmpq   $0x0,-0x48(%rbp)
  jne    L81
  jmp    L157
L227:
  mov    -0x40(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L51
  cmp    $0x1,%rax
  je     L110
  jmp    L157
L212:
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  shr    $0x4,%al
  movzbl %al,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  mov    %rax,-0x8(%rbp)
  mov    0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  and    $0xffffff,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <GrOffScreen4BPPColorTranslate@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  not    %eax
  and    %esi,%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  shl    %cl,%rax
  or     %eax,%esi
  mov    %esi,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  xorq   $0x4,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L6
  addq   $0x1,-0x18(%rbp)
L6:
  subq   $0x1,-0x48(%rbp)
  cmpq   $0x0,-0x48(%rbp)
  je     L153
L110:
  mov    0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x10(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  mov    %rax,-0x8(%rbp)
  mov    0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  and    $0xffffff,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <GrOffScreen4BPPColorTranslate@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  not    %eax
  and    %esi,%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  shl    %cl,%rax
  or     %eax,%esi
  mov    %esi,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  xorq   $0x4,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L198
  addq   $0x1,-0x18(%rbp)
L198:
  subq   $0x1,-0x48(%rbp)
  jmp    L153
L51:
  nop
L153:
  cmpq   $0x0,-0x48(%rbp)
  jne    L212
  jmp    L157
L177:
  mov    0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x10(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  mov    %rax,-0x8(%rbp)
  mov    0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  and    $0xffffff,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <GrOffScreen4BPPColorTranslate@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  not    %eax
  and    %esi,%eax
  mov    %eax,%esi
  mov    -0x30(%rbp),%rax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%ecx
  shl    %cl,%rax
  or     %eax,%esi
  mov    %esi,%edx
  mov    -0x18(%rbp),%rax
  mov    %dl,(%rax)
  xorq   $0x4,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L205
  addq   $0x1,-0x18(%rbp)
L205:
  mov    -0x48(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  test   %rax,%rax
  jne    L177
  nop
L157:
  nop
  leave
  ret
```

assistant: ```c
void GrOffScreen4BPPPixelDrawMultiple(void *pvDisplayData, long lX, long lY, long lX0, long lCount, long lBPP, const unsigned char *pucData, const unsigned char *pucPalette) {
  unsigned char *pucPtr;
  unsigned long ulByte;
  long lBytesPerRow;
  ;
  ;
  ;
  pucPtr = (unsigned char *)pvDisplayData;
  lBytesPerRow = (*(unsigned short *)(pucPtr + 1) + 1) / 2;
  pucPtr += (lBytesPerRow * lY) + (lX / 2) + 6 + (16 * 3);
  lX = (1 - (lX & 1)) * 4;
  switch (lBPP) {
  case 1: {
    while (lCount) {
      ulByte = *pucData++;
      for (; (lX0 < 8) && lCount; lX0++, lCount--) {
        *pucPtr = ((*pucPtr & ~(0xf << lX)) | (((unsigned long *)pucPalette)[(ulByte >> (7 - lX0)) & 1] << lX));
        if (lX ^= 4) {
          pucPtr++;
        }
      }
      lX0 = 0;
    }
    break;
  }
  case 4: {
    switch (lX0 & 1) {
    case 0:
      while (lCount) {
        ulByte = (*pucData >> 4) * 3;
        ulByte = (*(unsigned long *)(pucPalette + ulByte) & 0x00ffffff);
        ulByte = GrOffScreen4BPPColorTranslate(pvDisplayData, ulByte);
        *pucPtr = (*pucPtr & ~(0xf << lX)) | (ulByte << lX);
        if (lX ^= 4) {
          pucPtr++;
        }
        lCount--;
        if (lCount) {
        case 1:
          ulByte = (*pucData++ & 15) * 3;
          ulByte = (*(unsigned long *)(pucPalette + ulByte) & 0x00ffffff);
          ulByte = GrOffScreen4BPPColorTranslate(pvDisplayData, ulByte);
          *pucPtr = ((*pucPtr & ~(0xf << lX)) | (ulByte << lX));
          if (lX ^= 4) {
            pucPtr++;
          }
          lCount--;
        }
      }
    }
    break;
  }
  case 8: {
    while (lCount--) {
      ulByte = *pucData++ * 3;
      ulByte = *(unsigned long *)(pucPalette + ulByte) & 0x00ffffff;
      ulByte = GrOffScreen4BPPColorTranslate(pvDisplayData, ulByte);
      *pucPtr = (*pucPtr & ~(0xf << lX)) | (ulByte << lX);
      if (lX ^= 4) {
        pucPtr++;
      }
    }
    break;
  }
  }
}
```