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

```asm
<write_cg_info>:
  endbr64
  push   %r15
  lea    -0x41(%rdx),%eax
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x10,%rsp
  cmp    $0x16,%al
  ja     L30
  lea    D143(%rip),%rcx
  movzbl %al,%eax
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  nopw   0x0(%rax,%rax,1)
L30:
  movsbl %dl,%esi
  lea    D85(%rip),%rdi
  mov    %r8d,0xc(%rsp)
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  mov    0xc(%rsp),%r8d
L77:
  mov    %r8d,%edx
  mov    %rbp,%rdi
  lea    D141(%rip),%rsi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r15d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D147(%rip),%rsi
  call   <fprintf@plt>
  mov    %r14d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D22(%rip),%rsi
  call   <fprintf@plt>
  mov    %r13,%rdx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D90(%rip),%rsi
  call   <fprintf@plt>
  lea    D125(%rip),%rsi
  lea    D174(%rip),%rdx
  xor    %eax,%eax
  mov    %rbp,%rdi
  call   <fprintf@plt>
  mov    %r12d,%edi
  call   <ilog2@plt>
  mov    %r12d,%edi
  mov    %eax,%edx
  shr    $0x1f,%edx
  lea    (%rdx,%rax,1),%r13d
  call   <ilog2@plt>
  sar    %r13d
  xor    %edi,%edi
  lea    0x0(%r13,%r13,1),%edx
  cmp    %eax,%edx
  setne  %dil
  add    %r13d,%edi
  call   <ipow2@plt>
  mov    %r13d,%edi
  mov    %eax,%r14d
  call   <ipow2@plt>
  mov    %rbp,%rcx
  mov    $0x37,%edx
  mov    $0x1,%esi
  lea    D165(%rip),%rdi
  mov    %eax,%r13d
  call   <fwrite@plt>
  mov    %r12d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D188(%rip),%rsi
  call   <fprintf@plt>
  mov    %r14d,%edx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    D172(%rip),%rsi
  call   <fprintf@plt>
  add    $0x10,%rsp
  mov    %r13d,%edx
  mov    %rbp,%rdi
  lea    D21(%rip),%rsi
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10c0 <fprintf@plt>
  nopl   0x0(%rax)
  lea    D145(%rip),%r13
  mov    $0xf,%r14d
  mov    $0xb,%r15d
  mov    $0x36b0,%r8d
  jmp    L77
  cs nopw 0x0(%rax,%rax,1)
  lea    D118(%rip),%r13
  mov    $0x4b,%r14d
  mov    $0xd,%r15d
  mov    $0x124f8,%r8d
  jmp    L77
  xchg   %ax,%ax
  lea    D56(%rip),%r13
  mov    $0x4b,%r14d
  mov    $0xf,%r15d
  mov    $0x249f0,%r8d
  jmp    L77
  xchg   %ax,%ax
  lea    D13(%rip),%r13
  mov    $0x64,%r14d
  mov    $0x15,%r15d
  mov    $0x16e360,%r8d
  jmp    L77
  xchg   %ax,%ax
  lea    D62(%rip),%r13
  mov    $0x64,%r14d
  mov    $0x1a,%r15d
  mov    $0x895440,%r8d
  jmp    L77
  xchg   %ax,%ax
  lea    D72(%rip),%r13
  mov    $0xf,%r14d
  mov    $0x7,%r15d
  mov    $0x578,%r8d
  jmp    L77
  xchg   %ax,%ax
  lea    D14(%rip),%r13
  mov    $0xf,%r14d
  mov    $0x8,%r15d
  mov    $0x1b58,%r8d
  jmp    L77
```

tool_calls: name: parse_data
arguments: label: D85
datatype: string
name: parse_data
arguments: label: D141
datatype: string
name: parse_data
arguments: label: D147
datatype: string
name: parse_data
arguments: label: D22
datatype: string
name: parse_data
arguments: label: D90
datatype: string
name: parse_data
arguments: label: D125
datatype: string
name: parse_data
arguments: label: D174
datatype: string
name: parse_data
arguments: label: D165
datatype: string
name: parse_data
arguments: label: D188
datatype: string
name: parse_data
arguments: label: D172
datatype: string
name: parse_data
arguments: label: D21
datatype: string
name: parse_data
arguments: label: D145
datatype: string
name: parse_data
arguments: label: D118
datatype: string
name: parse_data
arguments: label: D56
datatype: string
name: parse_data
arguments: label: D13
datatype: string
name: parse_data
arguments: label: D62
datatype: string
name: parse_data
arguments: label: D72
datatype: string
name: parse_data
arguments: label: D14
datatype: string

tool: D85: setparams: Internal error: invalid class type %c


tool: D141: const int na = %d;


tool: D147: const int nonzer = %d;


tool: D22: const int niter = %d;


tool: D90: const double shift = %s;


tool: D125: const double rcond = %s;


tool: D174: 1.0e-1

tool: D165: 
// number of nodes for which this version is compiled


tool: D188: const int nnodes_compiled = %d;


tool: D172: const int num_proc_cols = %d;


tool: D21: const int num_proc_rows = %d;


tool: D145: 20.

tool: D118: 60.

tool: D56: 110.

tool: D13: 500.

tool: D62: 1.5e3

tool: D72: 10.

tool: D14: 12.

assistant: ```c
void write_cg_info(FILE *fp, int nprocs, char class) {
  int na, nonzer, niter;
  char *shift, *rcond = "1.0e-1";
  char *shiftS = "10.", *shiftW = "12.", *shiftA = "20.", *shiftB = "60.", *shiftC = "110.", *shiftD = "500.", *shiftE = "1.5e3";
  int num_proc_cols, num_proc_rows;
  if (class == 'S') {
    na = 1400;
    nonzer = 7;
    niter = 15;
    shift = shiftS;
  } else if (class == 'W') {
    na = 7000;
    nonzer = 8;
    niter = 15;
    shift = shiftW;
  } else if (class == 'A') {
    na = 14000;
    nonzer = 11;
    niter = 15;
    shift = shiftA;
  } else if (class == 'B') {
    na = 75000;
    nonzer = 13;
    niter = 75;
    shift = shiftB;
  } else if (class == 'C') {
    na = 150000;
    nonzer = 15;
    niter = 75;
    shift = shiftC;
  } else if (class == 'D') {
    na = 1500000;
    nonzer = 21;
    niter = 100;
    shift = shiftD;
  } else if (class == 'E') {
    na = 9000000;
    nonzer = 26;
    niter = 100;
    shift = shiftE;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  fprintf(fp, "const int na = %d;\n", na);
  fprintf(fp, "const int nonzer = %d;\n", nonzer);
  fprintf(fp, "const int niter = %d;\n", niter);
  fprintf(fp, "const double shift = %s;\n", shift);
  fprintf(fp, "const double rcond = %s;\n", rcond);
  num_proc_cols = num_proc_rows = ilog2(nprocs) / 2;
  if (num_proc_cols + num_proc_rows != ilog2(nprocs))
    num_proc_cols += 1;
  num_proc_cols = ipow2(num_proc_cols);
  num_proc_rows = ipow2(num_proc_rows);
  fprintf(fp, "\n// number of nodes for which this version is compiled\n");
  fprintf(fp, "const int nnodes_compiled = %d;\n", nprocs);
  fprintf(fp, "const int num_proc_cols = %d;\n", num_proc_cols);
  fprintf(fp, "const int num_proc_rows = %d;\n", num_proc_rows);
}
```