user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
L118:
  lea    D17(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0xc0(%rbp),%rax
  mov    %rax,%rsi
  lea    D65(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xc0(%rbp),%eax
  test   %eax,%eax
  js     L118
  mov    -0xc0(%rbp),%eax
  cmp    $0x14,%eax
  jg     L118
  movl   $0x0,-0xbc(%rbp)
  jmp    L50
L203:
  lea    D76(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    -0xb0(%rbp),%rdx
  mov    -0xbc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,%rsi
  lea    D65(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0xbc(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  je     L119
  mov    -0xbc(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  cmp    $0x1,%eax
  jne    L203
L119:
  addl   $0x1,-0xbc(%rbp)
L50:
  mov    -0xc0(%rbp),%eax
  cmp    %eax,-0xbc(%rbp)
  jl     L203
  mov    -0xb0(%rbp),%eax
  test   %eax,%eax
  jne    L3
  mov    -0xc0(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  je     L129
L3:
  lea    D26(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  jmp    L184
L129:
  movl   $0x0,-0xbc(%rbp)
  jmp    L51
L172:
  mov    -0xbc(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jne    L20
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L63
L20:
  mov    -0xbc(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  cmp    $0x1,%eax
  jne    L63
  lea    D55(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L63:
  addl   $0x1,-0xbc(%rbp)
L51:
  mov    -0xc0(%rbp),%eax
  cmp    %eax,-0xbc(%rbp)
  jl     L172
  movl   $0x0,-0x60(%rbp)
  mov    -0xc0(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movl   $0x0,-0x60(%rbp,%rax,4)
  movl   $0x0,-0xbc(%rbp)
  jmp    L197
L209:
  mov    -0xc0(%rbp),%edx
  lea    -0x60(%rbp),%rcx
  lea    -0xb0(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <next_generation@plt>
  movl   $0x0,-0xb8(%rbp)
  movl   $0x0,-0xb4(%rbp)
  jmp    L67
L149:
  mov    -0xb8(%rbp),%eax
  cltq
  mov    -0xb0(%rbp,%rax,4),%eax
  test   %eax,%eax
  jne    L81
  addl   $0x1,-0xb4(%rbp)
L81:
  addl   $0x1,-0xb8(%rbp)
L67:
  mov    -0xc0(%rbp),%eax
  cmp    %eax,-0xb8(%rbp)
  jl     L149
  addl   $0x1,-0xbc(%rbp)
L197:
  cmpl   $0x3e6,-0xbc(%rbp)
  jg     L9
  mov    -0xc0(%rbp),%eax
  cmp    %eax,-0xb4(%rbp)
  jne    L209
L9:
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
L184:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L26
  call   <__stack_chk_fail@plt>
L26:
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D17
type_guessed: string
name: read_data
arguments: tag: D65
type_guessed: string
name: read_data
arguments: tag: D76
type_guessed: string
name: read_data
arguments: tag: D26
type_guessed: string
name: read_data
arguments: tag: D20
type_guessed: string
name: read_data
arguments: tag: D55
type_guessed: string
name: read_data
arguments: tag: D18
type_guessed: string

tool: D17: Enter length for the cell chain(you can only use a number between 0 and 20):


tool: D65: %d

tool: D76: Enter a number(you can only use 1 or 0):


tool: D26: Error! Cell chain must start and end with 0.


tool: D20: .

tool: D55: *

tool: D18: 


assistant: ```c
int main() {
  int currentGen[20], nextGen[20], n, i, j, temp;
  do {
    printf("Enter length for the cell chain(you can only use a number between 0 and 20):\n");
    scanf("%d", &n);
  } while (n < 0 || n > 20);
  for (i = 0; i < n; i++) {
    do {
      printf("Enter a number(you can only use 1 or 0):\n");
      scanf("%d", &currentGen[i]);
    } while (currentGen[i] != 0 && currentGen[i] != 1);
  }
  if (currentGen[0] != 0 || currentGen[n - 1] != 0) {
    printf("Error! Cell chain must start and end with 0.\n");
    return 0;
  }
  for (i = 0; i < n; i++) {
    if (currentGen[i] == 0) {
      printf(".");
    } else if (currentGen[i] == 1) {
      printf("*");
    }
  }
  nextGen[0] = 0;
  nextGen[n - 1] = 0;
  for (i = 0; i < 999 && temp != n; i++) {
    next_generation(currentGen, nextGen, n);
    for (j = 0, temp = 0; j < n; j++) {
      if (currentGen[j] == 0)
        temp++;
    }
  }
  printf("\n");
  return 0;
}
```