user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    D47(%rip),%r13
  push   %r12
  mov    %r13,%rdi
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rsi
  call   <scanf@plt>
  mov    0x18(%rsp),%eax
  cmp    $0x14,%eax
  jg     L43
  xor    %ebp,%ebp
  lea    0x1c(%rsp),%r14
  test   %eax,%eax
  jg     L63
  jmp    L27
  nopl   0x0(%rax)
L195:
  mov    0x18(%rsp),%eax
  sub    $0x1,%eax
  cmp    %eax,%ebp
  je     L101
L1:
  lea    0x20(%rsp),%rbx
  mov    %r12d,(%rbx,%rbp,4)
  add    $0x1,%rbp
  cmp    %ebp,0x18(%rsp)
  jle    L44
L63:
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <scanf@plt>
  mov    0x1c(%rsp),%r12d
  cmp    $0x1,%r12d
  ja     L188
  test   %rbp,%rbp
  jne    L195
L101:
  cmp    $0x1,%r12d
  jne    L1
  lea    D70(%rip),%rdi
  call   <printf@plt>
  jmp    L185
L188:
  lea    D44(%rip),%rdi
  mov    $0x1,%r12d
  call   <printf@plt>
L185:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L120
  add    $0xd8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L44:
  movl   $0x3e8,0xc(%rsp)
  lea    D36(%rip),%r15
  lea    D68(%rip),%r13
  lea    D57(%rip),%r12
  nopl   0x0(%rax,%rax,1)
L177:
  mov    0x18(%rsp),%eax
  xor    %r14d,%r14d
  xor    %ebp,%ebp
  test   %eax,%eax
  jg     L132
  jmp    L36
  nop
L189:
  mov    %r12,%rdi
  add    $0x1,%ebp
  add    $0x1,%r14
  call   <printf@plt>
  cmp    %r14d,0x18(%rsp)
  jle    L36
L132:
  mov    (%rbx,%r14,4),%edx
  test   %edx,%edx
  je     L189
  mov    %r13,%rdi
  add    $0x1,%r14
  call   <printf@plt>
  cmp    %r14d,0x18(%rsp)
  jg     L132
L36:
  mov    %r15,%rdi
  call   <printf@plt>
  mov    0x18(%rsp),%edx
  cmp    %ebp,%edx
  je     L172
  lea    0x70(%rsp),%rsi
  mov    %rbx,%rdi
  call   <next_generation@plt>
  subl   $0x1,0xc(%rsp)
  jne    L177
L172:
  xor    %r12d,%r12d
  jmp    L185
L43:
  lea    D72(%rip),%rdi
  mov    $0x1,%r12d
  call   <printf@plt>
  jmp    L185
L27:
  lea    D17(%rip),%rdi
  mov    $0x1,%r12d
  call   <printf@plt>
  jmp    L185
L120:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D47
datatype: string
name: parse_data
arguments: data_label: D70
datatype: string
name: parse_data
arguments: data_label: D44
datatype: string
name: parse_data
arguments: data_label: D36
datatype: string
name: parse_data
arguments: data_label: D68
datatype: string
name: parse_data
arguments: data_label: D57
datatype: string
name: parse_data
arguments: data_label: D72
datatype: string
name: parse_data
arguments: data_label: D17
datatype: string

tool: D47: %d

tool: D70: 
First and last cell should always be 0!

tool: D44: 
Expected 0 or 1!

tool: D36: 


tool: D68: *

tool: D57: .

tool: D72: Length should be max 20!

tool: D17: Length should be 1 at least!

assistant: ```c
int main() {
  int length, n, current[20], next[20], countforZeros, i, j;
  scanf("%d", &length);
  if (length > 20) {
    printf("Length should be max 20!");
    return 1;
  }
  if (length <= 0) {
    printf("Length should be 1 at least!");
    return 1;
  }
  for (i = 0; i < length; i++) {
    scanf("%d", &n);
    if (n == 0 || n == 1) {
      if ((i == 0 || i == (length - 1)) && n == 1) {
        printf("\nFirst and last cell should always be 0!");
        return 1;
      }
      current[i] = n;
    } else {
      printf("\nExpected 0 or 1!");
      return 1;
    }
  }
  for (i = 0; i < 1000; i++) {
    countforZeros = 0;
    for (j = 0; j < length; j++) {
      if (current[j] == 0) {
        countforZeros++;
        printf(".");
      } else
        printf("*");
    }
    printf("\n");
    if (countforZeros == length)
      break;
    next_generation(current, next, length);
  }
  return 0;
}
```