user: 请将以下的汇编代码转换成C语言代码:

```asm
<NESConvertTileDataToComposite>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  lea    D14(%rip),%rax
  mov    %rax,%rsi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <v_printf@plt>
  cmpq   $0x0,-0x60(%rbp)
  je     L4
  cmpl   $0x0,-0x64(%rbp)
  je     L4
  cmpq   $0x0,-0x58(%rbp)
  jne    L74
L4:
  mov    $0x0,%eax
  jmp    L105
L74:
  mov    -0x64(%rbp),%eax
  and    $0xf,%eax
  test   %eax,%eax
  je     L33
  mov    $0x0,%eax
  jmp    L105
L33:
  mov    -0x64(%rbp),%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,-0x38(%rbp)
  movl   $0x0,-0x44(%rbp)
  movl   $0x0,-0x40(%rbp)
  movl   $0x0,-0x3c(%rbp)
  mov    -0x38(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x3c(%rbp)
  jmp    L69
L23:
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x38(%rbp),%eax
  mov    %eax,%ecx
  lea    D37(%rip),%rax
  mov    %rax,%rsi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <v_printf@plt>
  movl   $0x0,-0x44(%rbp)
  jmp    L136
L128:
  mov    -0x3c(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  cltq
  mov    %dl,-0x28(%rbp,%rax,1)
  mov    -0x3c(%rbp),%eax
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x8(%rax),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  cltq
  mov    %dl,-0x20(%rbp,%rax,1)
  mov    -0x44(%rbp),%eax
  cltq
  movzbl -0x20(%rbp,%rax,1),%eax
  movzbl %al,%edx
  mov    -0x44(%rbp),%eax
  cltq
  movzbl -0x28(%rbp,%rax,1),%eax
  movzbl %al,%eax
  mov    %edx,%ecx
  mov    %eax,%edx
  lea    D10(%rip),%rax
  mov    %rax,%rsi
  mov    $0x4,%edi
  mov    $0x0,%eax
  call   <v_printf@plt>
  addl   $0x1,-0x44(%rbp)
L136:
  cmpl   $0x7,-0x44(%rbp)
  jle    L128
  movl   $0x0,-0x44(%rbp)
  jmp    L40
L117:
  movl   $0x7,-0x40(%rbp)
  jmp    L92
L32:
  mov    -0x44(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    $0x8,%eax
  sub    -0x40(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  movzbl -0x20(%rbp,%rax,1),%eax
  movzbl %al,%ecx
  mov    -0x44(%rbp),%eax
  cltq
  movzbl -0x28(%rbp,%rax,1),%eax
  movzbl %al,%eax
  mov    -0x3c(%rbp),%edx
  mov    %edx,%esi
  shl    $0x6,%esi
  mov    -0x34(%rbp),%edx
  add    %esi,%edx
  movslq %edx,%rdx
  lea    -0x1(%rdx),%rsi
  mov    -0x30(%rbp),%rdx
  lea    (%rsi,%rdx,1),%rbx
  mov    -0x40(%rbp),%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <NESCombineBits@plt>
  mov    %al,(%rbx)
  mov    -0x3c(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    -0x3c(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  lea    (%rdx,%rax,1),%esi
  mov    -0x40(%rbp),%edx
  mov    -0x44(%rbp),%eax
  mov    %ecx,%r9d
  mov    %esi,%r8d
  mov    %edx,%ecx
  mov    %eax,%edx
  lea    D18(%rip),%rax
  mov    %rax,%rsi
  mov    $0x4,%edi
  mov    $0x0,%eax
  call   <v_printf@plt>
  subl   $0x1,-0x40(%rbp)
L92:
  cmpl   $0x0,-0x40(%rbp)
  jns    L32
  addl   $0x1,-0x44(%rbp)
L40:
  cmpl   $0x7,-0x44(%rbp)
  jle    L117
  addl   $0x1,-0x3c(%rbp)
L69:
  mov    -0x3c(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jl     L23
  mov    -0x38(%rbp),%eax
  shl    $0x6,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    $0x1,%eax
L105:
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D14
datatype: string
name: extract_symbolic_data
arguments: label: D37
datatype: string
name: extract_symbolic_data
arguments: label: D10
datatype: string
name: extract_symbolic_data
arguments: label: D18
datatype: string

tool: D14: Start NESConvertTileDataToComposite()

tool: D37: curTile: %d/%d

tool: D10: Channels A/B: %d/%d

tool: D18: Composite (%d,%d:%d): %d

assistant: ```c
int NESConvertTileDataToComposite(char *buf, char *tileData, int size) {
  v_printf(3, "Start NESConvertTileDataToComposite()");
  if (!tileData || !size || !buf)
    return 0;
  if (size % 16)
    return 0;
  int tileCount = size / 16;
  unsigned char channel_a[8], channel_b[8];
  int i = 0;
  int j = 0;
  int curTile = 0;
  char *composite = (char *)malloc(64 * tileCount);
  for (curTile = 0; curTile < tileCount; curTile++) {
    v_printf(3, "curTile: %d/%d", curTile + 1, tileCount);
    for (i = 0; i < 8; i++) {
      channel_a[i] = tileData[16 * (curTile) + i];
      channel_b[i] = tileData[16 * (curTile) + i + 8];
      v_printf(4, "Channels A/B: %d/%d", channel_a[i], channel_b[i]);
    }
    for (i = 0; i < 8; i++) {
      for (j = 7; j >= 0; j--) {
        int pixel_offset = (i * 8) + (8 - j);
        composite[(pixel_offset + curTile * 64) - 1] = NESCombineBits(channel_a[i], channel_b[i], j);
        v_printf(4, "Composite (%d,%d:%d): %d", i, j, (pixel_offset + curTile * 64), composite[pixel_offset + curTile * 64]);
      }
    }
  }
  memcpy(buf, composite, 64 * tileCount);
  return 1;
}
```