user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x8000(%rsp),%r11
L25:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L25
  sub    $0xc28,%rsp
  mov    $0xffffffff,%r14d
  mov    0x8(%rsi),%rdi
  lea    D49(%rip),%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x8c18(%rsp)
  xor    %eax,%eax
  call   <fopen@plt>
  test   %rax,%rax
  je     L130
  movl   $0x0,0xc(%rsp)
  mov    %rax,%r12
  mov    $0x1,%ebp
  lea    0xc10(%rsp),%rbx
  nopl   0x0(%rax,%rax,1)
L77:
  mov    %rbx,%rdi
  mov    %r12,%rdx
  mov    $0x8000,%esi
  call   <fgets@plt>
  mov    %rbx,%rdi
  test   %rax,%rax
  je     L113
  call   <strlen@plt>
  cmp    $0x8000,%eax
  je     L52
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  jne    L100
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jg     L157
L0:
  add    $0x1,%ebp
  jmp    L77
  nopl   (%rax)
L113:
  call   <strlen@plt>
  mov    $0xfffffffe,%r14d
  cmp    $0x8000,%eax
  jne    L105
L52:
  mov    $0xfffffffd,%r14d
L105:
  mov    %rbx,%rdi
  call   <strlen@plt>
  test   %eax,%eax
  jg     L124
L130:
  mov    0x8c18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L111
  add    $0x8c28,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L124:
  movl   $0x1,0xc(%rsp)
L149:
  lea    0x10(%rsp),%r13
  mov    %ebp,%edx
  lea    D30(%rip),%rsi
  xor    %eax,%eax
  lea    0x410(%rsp),%r15
  mov    %r13,%rdi
  call   <sprintf@plt>
  mov    %r13,%rdx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D68(%rip),%rsi
  call   <sprintf@plt>
  mov    %r15,%rdi
  lea    D52(%rip),%rsi
  call   <fopen@plt>
  mov    %rbx,%rdx
  lea    D12(%rip),%rsi
  mov    %rax,%r15
  mov    %rax,%rdi
  call   <fprintf@plt>
  mov    %r15,%rdi
  lea    0x810(%rsp),%r15
  call   <fclose@plt>
  mov    %r13,%rdx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D13(%rip),%rsi
  call   <sprintf@plt>
  mov    %r15,%rdi
  call   <system@plt>
  imul   $0x3afb7e91,%ebp,%eax
  ror    $0x5,%eax
  cmp    $0x346dc,%eax
  jbe    L47
L42:
  cmp    $0xf4240,%ebp
  jg     L130
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L130
  mov    %r14d,0xc(%rsp)
  jmp    L0
  xchg   %ax,%ax
L157:
  xor    %r14d,%r14d
  jmp    L149
  nopl   0x0(%rax,%rax,1)
L47:
  mov    %r15,%rdi
  mov    %ebp,%edx
  lea    D15(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r15,%rdi
  call   <system@plt>
  jmp    L42
L100:
  mov    0xc(%rsp),%r14d
  jmp    L105
L111:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D49
type: string
name: read_data
arguments: data_label: D30
type: string
name: read_data
arguments: data_label: D68
type: string
name: read_data
arguments: data_label: D52
type: string
name: read_data
arguments: data_label: D12
type: string
name: read_data
arguments: data_label: D13
type: string
name: read_data
arguments: data_label: D15
type: string

tool: D49: r

tool: D30: %08d

tool: D68: %s.json

tool: D52: w

tool: D12: %s

tool: D13: cs-extract-cert %s

tool: D15: x-snap %09d

assistant: ```c
int main(int argc, char *argv[]) {
  int done;
  FILE *errlog;
  FILE *fcs;
  int index;
  char line[32 * 1024];
  int status;
  char *status_gets;
  status = 0;
  errlog = stderr;
  index = 1;
  done = 0;
  fcs = fopen(argv[1], "r");
  if (fcs == NULL) {
    status = -1;
    done = 1;
  };
  while (!done) {
    status_gets = fgets(line, sizeof(line), fcs);
    if (status_gets == NULL) {
      status = -2;
    };
    if (sizeof(line) == strlen(line)) {
      status = -3;
    };
    if (status != 0)
      done = 1;
    if (strlen(line) > 0) {
      char sample_name_base[1024];
      char sample_filename[1024];
      FILE *fjson;
      char command[1024];
      sprintf(sample_name_base, "%08d", index);
      sprintf(sample_filename, "%s.json", sample_name_base);
      fjson = fopen(sample_filename, "w");
      fprintf(fjson, "%s", line);
      fclose(fjson);
      sprintf(command, "cs-extract-cert %s", sample_name_base);
      system(command);
      if (0 == (index % 20000)) {
        sprintf(command, "x-snap %09d", index);
        system(command);
      };
      if (index > 1000000)
        done = 1;
    };
    if (!done)
      index++;
  };
  return (status);
}
```