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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xc0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    D75(%rip),%rdi
  call   <scanf@plt>
  cmpl   $0x14,0xc(%rsp)
  jbe    L109
  lea    D75(%rip),%rbx
L168:
  lea    0xc(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  cmpl   $0x14,0xc(%rsp)
  ja     L168
L109:
  lea    D75(%rip),%r12
L178:
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jle    L86
  lea    0x10(%rsp),%rbp
  mov    $0x0,%ebx
L165:
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    0xc(%rsp),%eax
  add    $0x4,%rbp
  cmp    %ebx,%eax
  jg     L165
L86:
  cmpl   $0x0,0x10(%rsp)
  jne    L178
  sub    $0x1,%eax
  cltq
  cmpl   $0x0,0x10(%rsp,%rax,4)
  jne    L178
  mov    $0x3e8,%r14d
  lea    0x10(%rsp),%rbp
  lea    D74(%rip),%r13
  lea    D35(%rip),%r12
  jmp    L23
L98:
  mov    %r13,%rdi
  call   <printf@plt>
L60:
  add    $0x1,%rbx
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    %ebx,%eax
  jle    L61
L133:
  cmpl   $0x0,0x0(%rbp,%rbx,4)
  jne    L98
  mov    %r12,%rdi
  call   <printf@plt>
  jmp    L60
L16:
  mov    %r13,%rdi
  call   <printf@plt>
  jmp    L58
L152:
  sub    $0x1,%r14d
  je     L186
L23:
  mov    $0x0,%ebx
  cmpl   $0x1,0xc(%rsp)
  jg     L133
L61:
  lea    D68(%rip),%rdi
  call   <printf@plt>
  lea    0x60(%rsp),%rdi
  mov    0xc(%rsp),%edx
  mov    %rbp,%rsi
  call   <next_generation@plt>
  mov    0xc(%rsp),%edx
  cmp    $0x1,%edx
  jle    L126
  lea    0x10(%rsp),%rax
  lea    -0x2(%rdx),%edx
  lea    0x14(%rsp,%rdx,4),%rdx
L108:
  cmpl   $0x0,(%rax)
  jne    L152
  add    $0x4,%rax
  cmp    %rax,%rdx
  jne    L108
  mov    $0x0,%ebx
  lea    0x10(%rsp),%rbp
  lea    D74(%rip),%r13
  lea    D35(%rip),%r12
L73:
  cmpl   $0x0,0x0(%rbp,%rbx,4)
  jne    L16
  mov    %r12,%rdi
  call   <printf@plt>
L58:
  add    $0x1,%rbx
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    %ebx,%eax
  jg     L73
L126:
  lea    D68(%rip),%rdi
  call   <printf@plt>
L186:
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L82
  mov    $0x0,%eax
  add    $0xc0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L82:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D75
data_type: string
name: retrieve_data
arguments: data_label: D74
data_type: string
name: retrieve_data
arguments: data_label: D35
data_type: string
name: retrieve_data
arguments: data_label: D68
data_type: string

tool: D75: %d

tool: D74: *

tool: D35: .

tool: D68:  


assistant: ```c
int main() {
  int n, j, i, check, current[20], next[20];
  scanf("%d", &n);
  while (n < 0 || n > 20) {
    scanf("%d", &n);
  }
  do {
    for (i = 0; i < n; i++) {
      scanf("%d", &current[i]);
    }
  } while (current[0] != 0 || current[n - 1] != 0);
  for (j = 0; j < 1000; j++) {
    check = 0;
    for (i = 0; i < n - 1; i++) {
      if (current[i] == 0) {
        printf(".");
      } else {
        printf("*");
      }
    }
    printf(" \n");
    next_generation(&next[0], &current[0], n);
    for (i = 0; i < n - 1; i++) {
      if (current[i] != 0) {
        check = 1;
        break;
      }
    }
    if (check != 1) {
      for (i = 0; i < n - 1; i++) {
        if (current[i] == 0) {
          printf(".");
        } else {
          printf("*");
        }
      }
      printf(" \n");
      break;
    }
  }
}
```