user: Demonstrate the C code that generates the assembly output below:

```asm
<display_state>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    $0x0,%eax
  call   <home@plt>
  mov    -0x3c(%rbp),%eax
  mov    %eax,%esi
  lea    D43(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x3c(%rbp),%edx
  lea    -0x17(%rbp),%rax
  lea    D31(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sprintf@plt>
  lea    -0x17(%rbp),%rax
  lea    D74(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  lea    -0x17(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  lea    D19(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x44(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x20(%rbp),%rax
  lea    D76(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <fwrite@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L16
L10:
  movl   $0x0,-0x24(%rbp)
  jmp    L30
L14:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    D68(%rip),%rdx
  movzbl (%rax,%rdx,1),%eax
  movsbl %al,%eax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <putc@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <putc@plt>
  addl   $0x1,-0x24(%rbp)
L30:
  mov    -0x24(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L14
  addl   $0x1,-0x28(%rbp)
L16:
  mov    -0x28(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L10
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L48
  call   <__stack_chk_fail@plt>
L48:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D43
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D31
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D74
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D24
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D19
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D76
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D9
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D68
type_infered: string

tool: D43: Simulation tick %d


tool: D31: tick_%05d.pgm

tool: D74: w

tool: D24: P2


tool: D19: # %s


tool: D76: %d %d


tool: D9: 2/n

tool: D68: 012

assistant: ```c
void display_state(int **state, int tick, int cols, int rows) {
  int i;
  int j;
  char filename[15];
  FILE *file;
  home();
  printf("Simulation tick %d\n", tick);
  sprintf(filename, "tick_%05d.pgm", tick);
  file = fopen(filename, "w");
  fprintf(file, "P2\n");
  fprintf(file, "# %s\n", filename);
  fprintf(file, "%d %d\n", cols, rows);
  fprintf(file, "2/n");
  for (i = 0; i < rows; i++) {
    for (j = 0; j < cols; j++) {
      putc("012"[state[i][j]], file);
      putc('\n', file);
    }
  }
  fclose(file);
}
```