user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x3c(%rbp),%rsi
  lea    D19(%rip),%rdi
  call   <scanf@plt>
  movslq -0x3c(%rbp),%rax
  shl    $0x2,%rax
  lea    0xf(%rax),%rdx
  mov    %rdx,%rsi
  and    $0xfffffffffffffff0,%rsi
  and    $0xfffffffffffff000,%rdx
  mov    %rsp,%rcx
  sub    %rdx,%rcx
L87:
  cmp    %rcx,%rsp
  je     L83
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L87
L83:
  mov    %rsi,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L33
  orq    $0x0,-0x8(%rsp,%rdx,1)
L33:
  mov    %rsp,%r12
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffffff0,%rdx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rcx
  sub    %rax,%rcx
L158:
  cmp    %rcx,%rsp
  je     L75
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L158
L75:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L185
  orq    $0x0,-0x8(%rsp,%rax,1)
L185:
  mov    %rsp,%r13
  lea    D19(%rip),%r15
L63:
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  jle    L168
  mov    %r12,%r14
  mov    $0x0,%ebx
L55:
  mov    %r14,%rsi
  mov    %r15,%rdi
  call   <scanf@plt>
  add    $0x1,%ebx
  mov    -0x3c(%rbp),%eax
  add    $0x4,%r14
  cmp    %ebx,%eax
  jg     L55
L168:
  cmpl   $0x0,(%r12)
  jne    L63
  sub    $0x1,%eax
  cltq
  cmpl   $0x0,(%r12,%rax,4)
  jne    L63
  mov    $0x3e8,%r14d
  lea    D18(%rip),%r15
  jmp    L179
L61:
  cmpl   $0x1,(%r12,%rbx,4)
  sbb    %edi,%edi
  and    $0x4,%edi
  add    $0x2a,%edi
  call   <putchar@plt>
  add    $0x1,%rbx
  cmp    %ebx,-0x3c(%rbp)
  jg     L61
L54:
  mov    %r15,%rdi
  call   <puts@plt>
  mov    -0x3c(%rbp),%esi
  mov    %r12,%rdi
  call   <checkAlive@plt>
  mov    %eax,%ebx
  mov    -0x3c(%rbp),%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <next_generation@plt>
  mov    -0x3c(%rbp),%ecx
  lea    -0x1(%rcx),%eax
  cltq
  movl   $0x0,0x0(%r13,%rax,4)
  movl   $0x0,0x0(%r13)
  test   %ecx,%ecx
  jle    L149
  mov    %ecx,%ecx
  mov    $0x0,%eax
L99:
  mov    0x0(%r13,%rax,4),%edx
  mov    %edx,(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L99
L149:
  cmp    $0x1,%ebx
  jne    L152
  sub    $0x1,%r14d
  je     L152
L179:
  mov    $0x0,%ebx
  cmpl   $0x0,-0x3c(%rbp)
  jg     L61
  jmp    L54
L152:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  mov    $0x0,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L18:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D19
type_infered: string
name: read_data
arguments: label: D18
type_infered: string

tool: D19: %d

tool: D18:  

assistant: ```c
int main() {
  int n;
  scanf("%d", &n);
  int current[n], next[n];
retry:
  for (int i = 0; i < n; i++)
    scanf("%d", &current[i]);
  if (current[0] != 0 || current[n - 1] != 0)
    goto retry;
  int proverka;
  for (int j = 0; j < 1000; j++) {
    proverka = 0;
    for (int i = 0; i < n; i++)
      printf("%c", (current[i] == 0) ? '.' : '*');
    printf(" \n");
    proverka = checkAlive(current, n);
    next_generation(current, next, n);
    next[0] = next[n - 1] = 0;
    for (int i = 0; i < n; i++)
      current[i] = next[i];
    if (proverka != 1)
      break;
  }
}
```