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

```asm
<build_table_color>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rax
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %rdi,-0x10(%rsp)
  add    $0x4000,%rax
  mov    %rax,-0x8(%rsp)
  mov    $0x1,%r9d
  mov    $0x8,%ebx
  mov    $0xffffff80,%r8d
  jmp    L107
L3:
  mov    (%r11),%ecx
  shr    $0xf,%ecx
  and    $0x7,%ecx
  jmp    L22
L20:
  mov    (%r11),%ecx
  shr    $0xc,%ecx
  and    $0x7,%ecx
  jmp    L22
L99:
  mov    (%r11),%ecx
  shr    $0x9,%ecx
  and    $0x7,%ecx
  jmp    L22
L135:
  mov    (%r11),%ecx
  shr    $0x6,%ecx
  and    $0x7,%ecx
  jmp    L22
L63:
  mov    (%r11),%ecx
  shr    $0x3,%ecx
  and    $0x7,%ecx
  jmp    L22
L141:
  add    $0x20,%rbp
  add    $0x1,%r10d
  add    $0x4,%r11
  sub    $0xffffffffffffff80,%r12
  cmp    $0x8,%r10d
  je     L15
L10:
  lea    0x1(%rbp),%rdi
  mov    %r12,%rdx
  mov    $0x0,%esi
  jmp    L104
L15:
  add    $0x400,%r13
  add    $0x100,%r14
  addq   $0x20,-0x10(%rsp)
  cmp    -0x8(%rsp),%r13
  je     L26
L107:
  mov    %r13,%r12
  mov    %r14,%rbp
  mov    -0x10(%rsp),%r11
  mov    $0x0,%r10d
  jmp    L10
L100:
  mov    %rdi,%r15
  mov    %r9d,%ecx
  mov    %ebx,%eax
L145:
  mov    %al,-0x1(%rdi)
  mov    %cl,(%r15)
  mov    %r9d,%eax
  shl    %cl,%eax
  lea    -0x80(%rax),%ecx
  mov    %cl,(%rdx)
  lea    -0x80(%rax,%rax,1),%ecx
  mov    %cl,0x10(%rdx)
  lea    (%rax,%rax,2),%r15d
  lea    -0x80(%r15),%ecx
  mov    %cl,0x20(%rdx)
  lea    -0x80(,%rax,4),%ecx
  mov    %cl,0x30(%rdx)
  mov    %r8d,%ecx
  sub    %eax,%ecx
  mov    %cl,0x40(%rdx)
  lea    -0x40(%rax),%ecx
  neg    %ecx
  add    %ecx,%ecx
  mov    %cl,0x50(%rdx)
  mov    %r8d,%ecx
  sub    %r15d,%ecx
  mov    %cl,0x60(%rdx)
  sub    $0x20,%eax
  neg    %eax
  shl    $0x2,%eax
  mov    %al,0x70(%rdx)
  add    $0x1,%esi
  add    $0x2,%rdi
  add    $0x1,%rdx
  cmp    $0x10,%esi
  je     L141
L104:
  test   %esi,%esi
  je     L100
  mov    %esi,%eax
  lea    -0x1(%rsi),%ecx
  cmp    $0x1,%ecx
  jbe    L3
  lea    -0x3(%rsi),%ecx
  cmp    $0x2,%ecx
  jbe    L20
  lea    -0x6(%rsi),%ecx
  cmp    $0x3,%ecx
  jbe    L99
  lea    -0xa(%rsi),%ecx
  cmp    $0x2,%ecx
  jbe    L135
  sub    $0xd,%eax
  cmp    $0x1,%eax
  jbe    L63
  mov    (%r11),%ecx
  and    $0x7,%ecx
L22:
  mov    %rdi,%r15
  mov    %r10d,%eax
  sub    %ecx,%eax
  jmp    L145
L26:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void build_table_color(const unsigned int romtable[16][8], unsigned char p0004[16][1024], unsigned char p8004[16][256]) {
  int compression_mode, j, k, bit, pw;
  unsigned char *p0, *p8;
  const unsigned int *r;
  for (compression_mode = 0; compression_mode < 16; compression_mode++) {
    p0 = p0004[compression_mode];
    p8 = p8004[compression_mode];
    r = romtable[compression_mode];
    for (j = 0; j < 8; j++, r++, p0 += 128) {
      for (k = 0; k < 16; k++) {
        if (k == 0)
          bit = 1;
        else if (k >= 1 && k < 3)
          bit = (r[0] >> 15) & 7;
        else if (k >= 3 && k < 6)
          bit = (r[0] >> 12) & 7;
        else if (k >= 6 && k < 10)
          bit = (r[0] >> 9) & 7;
        else if (k >= 10 && k < 13)
          bit = (r[0] >> 6) & 7;
        else if (k >= 13 && k < 15)
          bit = (r[0] >> 3) & 7;
        else
          bit = (r[0]) & 7;
        if (k == 0)
          *p8++ = 8;
        else
          *p8++ = j - bit;
        *p8++ = bit;
        pw = 1 << bit;
        p0[k + 0x00] = (1 * pw) + 0x80;
        p0[k + 0x10] = (2 * pw) + 0x80;
        p0[k + 0x20] = (3 * pw) + 0x80;
        p0[k + 0x30] = (4 * pw) + 0x80;
        p0[k + 0x40] = (-1 * pw) + 0x80;
        p0[k + 0x50] = (-2 * pw) + 0x80;
        p0[k + 0x60] = (-3 * pw) + 0x80;
        p0[k + 0x70] = (-4 * pw) + 0x80;
      }
    }
  }
}
```