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

```asm
<draw_block4x4_rgb8_etc2_planar_mode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  movzbl 0x1(%rdi),%ebx
  movzbl (%rdi),%r9d
  movzbl 0x2(%rdi),%ecx
  movl   $0x0,0x14(%rsp)
  mov    %ebx,%eax
  mov    %r9d,%r10d
  shl    $0x6,%r9d
  sar    %eax
  and    $0x40,%r9d
  shl    $0x5,%ebx
  lea    (%rcx,%rcx,1),%edx
  and    $0x3f,%eax
  and    $0x6,%edx
  and    $0x20,%ebx
  and    $0x18,%ecx
  or     %eax,%r9d
  movzbl 0x3(%rdi),%eax
  or     %edx,%ebx
  sar    %r10d
  and    $0x3f,%r10d
  mov    %eax,%edx
  shr    $0x7,%dl
  or     %ecx,%edx
  mov    %eax,%ecx
  and    $0x1,%eax
  shr    %ecx
  movzbl %dl,%edx
  and    $0x3e,%ecx
  or     %edx,%ebx
  movzbl 0x4(%rdi),%edx
  or     %eax,%ecx
  movzbl 0x5(%rdi),%eax
  mov    %edx,%r8d
  shl    $0x5,%edx
  lea    0x0(,%rcx,4),%r12d
  mov    %eax,%r11d
  and    $0x20,%edx
  shl    $0x3,%eax
  shr    $0x3,%r11b
  and    $0x38,%eax
  shr    %r8b
  movzbl %r11b,%r11d
  movzbl %r8b,%r8d
  or     %r11d,%edx
  movzbl 0x6(%rdi),%r11d
  movzbl 0x7(%rdi),%edi
  mov    %r11d,%ebp
  lea    0x0(,%r11,4),%r13d
  mov    %edi,%r11d
  shr    $0x5,%bpl
  shr    $0x6,%r11b
  and    $0x7c,%r13d
  movzbl %bpl,%ebp
  movzbl %r11b,%r11d
  or     %ebp,%eax
  or     %r11d,%r13d
  lea    0x0(,%r10,4),%r11d
  and    $0x3f,%edi
  sar    $0x4,%r10d
  lea    0x0(%r13,%r13,1),%r14d
  lea    (%r8,%r8,1),%ebp
  sar    $0x4,%ecx
  sar    $0x6,%r13d
  or     %r10d,%r11d
  lea    (%r9,%r9,1),%r10d
  sar    $0x6,%r9d
  or     %r9d,%r10d
  mov    %r13d,(%rsp)
  sar    $0x6,%r8d
  or     %ecx,%r12d
  lea    0x0(,%rbx,4),%r9d
  sar    $0x4,%ebx
  or     %r8d,%ebp
  or     (%rsp),%r14d
  or     %ebx,%r9d
  lea    0x0(,%rdx,4),%ebx
  sar    $0x4,%edx
  sub    %r11d,%r12d
  lea    0x0(,%rax,4),%r15d
  sar    $0x4,%eax
  or     %edx,%ebx
  sub    %r10d,%ebp
  or     %eax,%r15d
  sub    %r9d,%ebx
  sub    %r10d,%r14d
  mov    %r12d,0x8(%rsp)
  lea    0x0(,%rdi,4),%r13d
  sar    $0x4,%edi
  mov    %ebp,0xc(%rsp)
  sub    %r11d,%r15d
  lea    0x2(,%r11,4),%eax
  or     %edi,%r13d
  mov    %ebx,0x10(%rsp)
  mov    %eax,0x20(%rsp)
  lea    0x2(,%r10,4),%eax
  sub    %r9d,%r13d
  mov    %eax,0x1c(%rsp)
  lea    0x2(,%r9,4),%eax
  mov    %r14d,0x28(%rsp)
  mov    %r13d,0x24(%rsp)
  mov    %eax,0x18(%rsp)
  mov    %r15d,0x2c(%rsp)
  lea    0x10(%rsi),%r15
L19:
  lea    -0x10(%r15),%r13
  mov    0x18(%rsp),%ebp
  mov    0x1c(%rsp),%ebx
  mov    %r15,(%rsp)
  mov    0x20(%rsp),%r12d
  mov    %r12d,%eax
  mov    %r13,%r12
  mov    %eax,%r13d
L2:
  mov    %r13d,%edi
  add    $0x4,%r12
  sar    $0x2,%edi
  call   <clamp@plt>
  mov    %ebx,%edi
  sar    $0x2,%edi
  mov    %eax,%r14d
  call   <clamp@plt>
  mov    %ebp,%edi
  sar    $0x2,%edi
  mov    %eax,%r15d
  call   <clamp@plt>
  mov    %r15d,%esi
  mov    %r14d,%edi
  mov    %eax,%edx
  call   <pack_rgb_alpha_0xff@plt>
  add    0x8(%rsp),%r13d
  add    0xc(%rsp),%ebx
  mov    %eax,-0x4(%r12)
  add    0x10(%rsp),%ebp
  cmp    %r12,(%rsp)
  jne    L2
  addl   $0x4,0x14(%rsp)
  mov    (%rsp),%r15
  mov    0x14(%rsp),%eax
  mov    0x2c(%rsp),%ecx
  mov    0x28(%rsp),%esi
  add    %ecx,0x20(%rsp)
  add    $0x10,%r15
  mov    0x24(%rsp),%ecx
  add    %esi,0x1c(%rsp)
  add    %ecx,0x18(%rsp)
  cmp    $0x10,%eax
  jne    L19
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void draw_block4x4_rgb8_etc2_planar_mode(const unsigned char *bitstring, unsigned int *image_buffer) {
  int RO = (bitstring[0] & 0x7E) >> 1;
  int GO = ((bitstring[0] & 0x1) << 6) | ((bitstring[1] & 0x7E) >> 1);
  int BO = ((bitstring[1] & 0x1) << 5) | (bitstring[2] & 0x18) | ((bitstring[2] & 0x03) << 1) | ((bitstring[3] & 0x80) >> 7);
  int RH = ((bitstring[3] & 0x7C) >> 1) | (bitstring[3] & 0x1);
  int GH = (bitstring[4] & 0xFE) >> 1;
  int BH = ((bitstring[4] & 0x1) << 5) | ((bitstring[5] & 0xF8) >> 3);
  int RV = ((bitstring[5] & 0x7) << 3) | ((bitstring[6] & 0xE0) >> 5);
  int GV = ((bitstring[6] & 0x1F) << 2) | ((bitstring[7] & 0xC0) >> 6);
  int BV = bitstring[7] & 0x3F;
  RO = (RO << 2) | ((RO & 0x30) >> 4);
  GO = (GO << 1) | ((GO & 0x40) >> 6);
  BO = (BO << 2) | ((BO & 0x30) >> 4);
  RH = (RH << 2) | ((RH & 0x30) >> 4);
  GH = (GH << 1) | ((GH & 0x40) >> 6);
  BH = (BH << 2) | ((BH & 0x30) >> 4);
  RV = (RV << 2) | ((RV & 0x30) >> 4);
  GV = (GV << 1) | ((GV & 0x40) >> 6);
  BV = (BV << 2) | ((BV & 0x30) >> 4);
  for (int y = 0; y < 4; y++)
    for (int x = 0; x < 4; x++) {
      int r = clamp((x * (RH - RO) + y * (RV - RO) + 4 * RO + 2) >> 2);
      int g = clamp((x * (GH - GO) + y * (GV - GO) + 4 * GO + 2) >> 2);
      int b = clamp((x * (BH - BO) + y * (BV - BO) + 4 * BO + 2) >> 2);
      image_buffer[y * 4 + x] = pack_rgb_alpha_0xff(r, g, b);
    }
}
```