user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<RepadBitmap>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %r9d,%ebx
  cmp    $0x4,%edx
  je     L145
  ja     L80
  cmp    $0x1,%edx
  je     L153
  cmp    $0x2,%edx
  jne    L117
  lea    0xf(%r8),%r11d
  sar    $0x4,%r11d
  add    %r11d,%r11d
  jmp    L54
L117:
  mov    $0x0,%eax
  jmp    L109
L80:
  mov    $0x0,%eax
  cmp    $0x8,%edx
  jne    L109
  lea    0x3f(%r8),%r11d
  sar    $0x6,%r11d
  shl    $0x3,%r11d
  jmp    L54
L153:
  lea    0x7(%r8),%r11d
  sar    $0x3,%r11d
L54:
  cmp    $0x4,%ecx
  je     L43
  ja     L120
  cmp    $0x1,%ecx
  je     L0
  cmp    $0x2,%ecx
  jne    L88
  lea    0xf(%r8),%eax
  sar    $0x4,%eax
  add    %eax,%eax
  jmp    L45
L145:
  lea    0x1f(%r8),%r11d
  sar    $0x5,%r11d
  shl    $0x2,%r11d
  jmp    L54
L88:
  mov    $0x0,%eax
  jmp    L109
L120:
  mov    $0x0,%eax
  cmp    $0x8,%ecx
  jne    L109
  lea    0x3f(%r8),%eax
  sar    $0x6,%eax
  shl    $0x3,%eax
  jmp    L45
L0:
  lea    0x7(%r8),%eax
  sar    $0x3,%eax
L45:
  cmp    %eax,%r11d
  mov    %eax,%r9d
  cmovle %r11d,%r9d
  mov    $0x0,%r10d
  test   %ebx,%ebx
  jle    L264
  mov    %r9d,%r8d
  mov    $0x0,%r12d
  lea    -0x1(%rax),%ebp
  sub    %r9d,%r11d
  movslq %r11d,%r11
  jmp    L96
L43:
  lea    0x1f(%r8),%eax
  sar    $0x5,%eax
  shl    $0x2,%eax
  jmp    L45
L247:
  movzbl (%rdi,%rdx,1),%ecx
  mov    %cl,(%rsi,%rdx,1)
  add    $0x1,%rdx
  cmp    %r8,%rdx
  jne    L247
  add    %r8,%rdi
  lea    (%rsi,%r8,1),%rdx
  mov    %r9d,%ecx
L121:
  cmp    %ecx,%eax
  jle    L249
  mov    %ebp,%esi
  sub    %ecx,%esi
  lea    0x1(%rdx,%rsi,1),%rsi
L173:
  add    $0x1,%rdx
  movb   $0x0,-0x1(%rdx)
  cmp    %rsi,%rdx
  jne    L173
L239:
  add    %r11,%rdi
  add    $0x1,%r10d
  cmp    %r10d,%ebx
  je     L264
L96:
  mov    $0x0,%edx
  test   %r9d,%r9d
  jg     L247
  mov    %rsi,%rdx
  mov    %r12d,%ecx
  jmp    L121
L249:
  mov    %rdx,%rsi
  jmp    L239
L264:
  imul   %ebx,%eax
L109:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
int RepadBitmap(char *pSrc, char *pDst, unsigned int srcPad, unsigned int dstPad, int width, int height) {
  int srcWidthBytes, dstWidthBytes;
  int row, col;
  char *pTmpSrc, *pTmpDst;
  switch (srcPad) {
  case 1:
    srcWidthBytes = (width + 7) >> 3;
    break;
  case 2:
    srcWidthBytes = ((width + 15) >> 4) << 1;
    break;
  case 4:
    srcWidthBytes = ((width + 31) >> 5) << 2;
    break;
  case 8:
    srcWidthBytes = ((width + 63) >> 6) << 3;
    break;
  default:
    return 0;
  }
  switch (dstPad) {
  case 1:
    dstWidthBytes = (width + 7) >> 3;
    break;
  case 2:
    dstWidthBytes = ((width + 15) >> 4) << 1;
    break;
  case 4:
    dstWidthBytes = ((width + 31) >> 5) << 2;
    break;
  case 8:
    dstWidthBytes = ((width + 63) >> 6) << 3;
    break;
  default:
    return 0;
  }
  width = srcWidthBytes;
  if (width > dstWidthBytes)
    width = dstWidthBytes;
  pTmpSrc = pSrc;
  pTmpDst = pDst;
  for (row = 0; row < height; row++) {
    for (col = 0; col < width; col++)
      *pTmpDst++ = *pTmpSrc++;
    while (col < dstWidthBytes) {
      *pTmpDst++ = '\0';
      col++;
    }
    pTmpSrc += srcWidthBytes - width;
  }
  return dstWidthBytes * height;
}
```