user: Please show me the C implementation that matches the assembly code listed below:

```asm
<gen_table>:
  endbr64
  push   %r15
  mov    %edi,%esi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  lea    D32(%rip),%rdi
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  call   <printf@plt>
  movl   $0x0,0x8(%rsp)
L131:
  movl   $0x0,0xc(%rsp)
  test   %ebx,%ebx
  jle    L42
L220:
  mov    0xc(%rsp),%r15d
  mov    0x8(%rsp),%edx
  lea    D12(%rip),%rdi
  xor    %eax,%eax
  mov    %r15d,%esi
  mov    %r15d,%r14d
  mov    %r15d,%ebp
  call   <printf@plt>
  mov    %r15d,%eax
  sar    %r14d
  and    $0x1,%ebp
  sar    $0x3,%eax
  sar    $0x2,%r15d
  and    $0x1,%r14d
  xor    %r10d,%r10d
  movl   $0x0,0x10(%rsp)
  mov    %eax,%r13d
  mov    %r12,%rax
  and    $0x1,%r15d
  mov    %r13d,%r12d
  mov    %rax,%r13
L217:
  movl   $0x0,0x14(%rsp)
  xor    %esi,%esi
L37:
  movl   $0x0,0x18(%rsp)
L202:
  movl   $0x0,0x1c(%rsp)
  mov    0x18(%rsp),%edi
  jmp    L97
  xchg   %ax,%ax
L169:
  cmp    $0x4,%ebx
  je     L157
L72:
  add    $0x1,%ecx
  mov    0x14(%rsp),%esi
  mov    0x10(%rsp),%r10d
  mov    %ecx,0x1c(%rsp)
  cmp    $0x3,%ecx
  jg     L148
L97:
  mov    0x1c(%rsp),%ecx
  mov    %r10d,%r9d
  xor    %esi,%r9d
  mov    %ecx,%eax
  mov    %r9d,%r10d
  mov    %r9d,%r8d
  xor    %edi,%eax
  sar    %r10d
  and    $0x1,%r8d
  mov    %eax,%edx
  xor    %r9d,%r10d
  mov    %ecx,%r9d
  sar    %edx
  xor    %esi,%r9d
  xor    %eax,%edx
  and    $0x1,%eax
  and    $0x1,%r9d
  not    %eax
  xor    %r10d,%edx
  and    %r8d,%eax
  and    $0x1,%edx
  xor    %r9d,%eax
  cmp    $0x8,%ebx
  je     L159
  cmp    $0x10,%ebx
  jne    L169
  xor    %r12d,%esi
  xor    $0x1,%esi
  cmp    %r8d,%r14d
  mov    %esi,%r9d
  sete   %sil
  and    %r9d,%esi
  cmp    %eax,%ebp
  sete   %al
  test   %al,%sil
  je     L72
  cmp    %edx,%r15d
  jne    L72
  nopl   0x0(%rax)
L207:
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <classify@plt>
  cmp    0x8(%rsp),%eax
  je     L36
L69:
  mov    0x18(%rsp),%edi
  mov    0x1c(%rsp),%ecx
  jmp    L72
  nopl   0x0(%rax)
L159:
  cmp    %eax,%ebp
  sete   %sil
  cmp    %edx,%r15d
  sete   %al
  test   %al,%sil
  je     L72
  cmp    %r8d,%r14d
  jne    L72
  jmp    L207
L157:
  cmp    %r8d,%r14d
  jne    L72
  cmp    %eax,%ebp
  jne    L72
  jmp    L207
  nopl   0x0(%rax,%rax,1)
L148:
  add    $0x1,%edi
  mov    %edi,0x18(%rsp)
  cmp    $0x3,%edi
  jle    L202
  add    $0x1,%esi
  mov    %esi,0x14(%rsp)
  cmp    $0x3,%esi
  jle    L37
  add    $0x1,%r10d
  mov    %r10d,0x10(%rsp)
  cmp    $0x3,%r10d
  jle    L217
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  mov    %r13,%r12
  cmp    %eax,%ebx
  jne    L220
L42:
  cmpl   $0x1,0x8(%rsp)
  je     L221
  movl   $0x1,0x8(%rsp)
  jmp    L131
L36:
  mov    0x1c(%rsp),%r8d
  mov    0x18(%rsp),%ecx
  xor    %eax,%eax
  lea    D24(%rip),%rdi
  mov    0x14(%rsp),%edx
  mov    0x10(%rsp),%esi
  call   <printf@plt>
  jmp    L69
L221:
  lea    D37(%rip),%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L43:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D32
data_type: string
name: parse_data
arguments: data_label: D12
data_type: string
name: parse_data
arguments: data_label: D24
data_type: string
name: parse_data
arguments: data_label: D37
data_type: string

tool: D32: u8 trellis_trans_%d[256][4] = {


tool: D12:  /* trans=%d y0=%d */


tool: D24:  { %d, %d, %d, %d },


tool: D37: };

assistant: ```c
void gen_table(int nb_trans) {
  int Y[5], Yt[5], trans, ss[2][3], xx[2][2];
  int res, i, y0;
  printf("u8 trellis_trans_%d[256][4] = {\n", nb_trans);
  for (y0 = 0; y0 < 2; y0++) {
    for (trans = 0; trans < nb_trans; trans++) {
      printf(" /* trans=%d y0=%d */\n", trans, y0);
      Yt[1] = trans & 1;
      Yt[2] = (trans >> 1) & 1;
      Yt[4] = (trans >> 2) & 1;
      Yt[3] = (trans >> 3) & 1;
      for (xx[0][0] = 0; xx[0][0] < 4; xx[0][0]++)
        for (xx[0][1] = 0; xx[0][1] < 4; xx[0][1]++)
          for (xx[1][0] = 0; xx[1][0] < 4; xx[1][0]++)
            for (xx[1][1] = 0; xx[1][1] < 4; xx[1][1]++) {
              for (i = 0; i < 2; i++) {
                int x, y, y0, x0, y1, x1;
                x = xx[i][0];
                y = xx[i][1];
                x0 = x & 1;
                x1 = ((x & 2) >> 1);
                y0 = y & 1;
                y1 = ((y & 2) >> 1);
                ss[i][2] = x1 ^ y1 ^ y0 ^ x0;
                ss[i][1] = y0;
                ss[i][0] = y0 ^ x0;
              }
              Y[4] = ss[0][2] ^ ss[1][2];
              Y[3] = ss[0][1];
              Y[2] = ss[0][0];
              Y[1] = (ss[0][0] & ~ss[1][0] & 1) ^ ss[0][1] ^ ss[1][1];
              res = 0;
              switch (nb_trans) {
              case 4:
                res = (Yt[1] == Y[1] && Yt[2] == Y[2]);
                break;
              case 8:
                res = (Yt[1] == Y[1] && Yt[2] == Y[2] && Yt[4] == Y[4]);
                break;
              case 16:
                res = (Yt[1] == Y[1] && Yt[2] == Y[2] && Yt[3] == Y[3] && Yt[4] == Y[4]);
                break;
              }
              if (res && classify(xx) == y0) {
                printf(" { %d, %d, %d, %d },\n", xx[0][0], xx[0][1], xx[1][0], xx[1][1]);
              }
            }
    }
  }
  printf("};\n");
}
```