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

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  cmp    $0x1,%edi
  jle    L72
L62:
  mov    0x8(%rbx),%rbx
  mov    %rbx,%rdi
  call   <strlen@plt>
  lea    0x5(%rax),%edi
  call   <malloc@plt>
  mov    %rbx,%rdx
  lea    D105(%rip),%rsi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rsi
  lea    D46(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    0x30(%rsp),%rdx
  mov    %rbx,%r9
  lea    0x40(%rsp),%r8
  lea    0x38(%rsp),%rcx
  lea    0x2c(%rsp),%rsi
  lea    0x28(%rsp),%rdi
  call   <epistasis_dataset_load@plt>
  lea    D75(%rip),%rsi
  mov    %rbp,%rdi
  mov    %rax,%rcx
  mov    %rax,0x18(%rsp)
  mov    0x40(%rsp),%rax
  lea    (%rcx,%rax,4),%rax
  mov    %rax,0x10(%rsp)
  mov    0x2c(%rsp),%eax
  add    0x28(%rsp),%eax
  mov    %eax,0xc(%rsp)
  call   <fopen@plt>
  mov    0x40(%rsp),%rsi
  lea    D87(%rip),%rdi
  mov    %rax,%r15
  xor    %eax,%eax
  call   <printf@plt>
  cmpq   $0x0,0x30(%rsp)
  je     L24
  xor    %ebx,%ebx
  lea    D82(%rip),%rbp
  nopl   0x0(%rax)
L125:
  mov    %ebx,%edx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  cmp    %rbx,0x30(%rsp)
  ja     L125
L24:
  mov    %r15,%rcx
  mov    $0x6,%edx
  mov    $0x1,%esi
  lea    D59(%rip),%rdi
  call   <fwrite@plt>
  mov    0x28(%rsp),%eax
  mov    %eax,0x8(%rsp)
  test   %eax,%eax
  jle    L0
  movslq 0xc(%rsp),%rbx
  movq   $0x0,(%rsp)
  lea    D81(%rip),%rbp
  shl    $0x2,%rbx
  nopl   0x0(%rax,%rax,1)
L7:
  cmpq   $0x0,0x30(%rsp)
  je     L67
  mov    0x10(%rsp),%rax
  mov    (%rsp),%rcx
  xor    %r14d,%r14d
  mov    $0x3,%r13d
  lea    (%rax,%rcx,4),%r12
  cs nopw 0x0(%rax,%rax,1)
L9:
  mov    (%r12),%edx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  cmp    $0xff,%edx
  cmove  %r13d,%edx
  xor    %eax,%eax
  add    $0x1,%r14
  add    %rbx,%r12
  call   <fprintf@plt>
  cmp    %r14,0x30(%rsp)
  ja     L9
L67:
  mov    %r15,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D50(%rip),%rdi
  call   <fwrite@plt>
  addq   $0x1,(%rsp)
  mov    0x28(%rsp),%ecx
  mov    (%rsp),%rax
  mov    %ecx,0x8(%rsp)
  cmp    %eax,%ecx
  jg     L7
L0:
  mov    0xc(%rsp),%ecx
  movslq 0x8(%rsp),%rax
  cmp    %eax,%ecx
  jle    L83
  mov    0x10(%rsp),%rsi
  movslq %ecx,%rbp
  lea    D81(%rip),%r12
  shl    $0x2,%rbp
  lea    (%rsi,%rax,4),%rax
  mov    %rax,(%rsp)
  nopl   0x0(%rax,%rax,1)
L105:
  xor    %r14d,%r14d
  cmpq   $0x0,0x30(%rsp)
  mov    (%rsp),%r13
  mov    $0x3,%ebx
  je     L113
  nopl   0x0(%rax)
L26:
  mov    0x0(%r13),%edx
  mov    %r12,%rsi
  mov    %r15,%rdi
  cmp    $0xff,%edx
  cmove  %ebx,%edx
  xor    %eax,%eax
  add    $0x1,%r14
  add    %rbp,%r13
  call   <fprintf@plt>
  cmp    %r14,0x30(%rsp)
  ja     L26
L113:
  mov    %r15,%rcx
  mov    $0x2,%edx
  mov    $0x1,%esi
  lea    D95(%rip),%rdi
  call   <fwrite@plt>
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  addq   $0x4,(%rsp)
  cmp    %eax,0xc(%rsp)
  jne    L105
L83:
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    0x38(%rsp),%rsi
  mov    0x18(%rsp),%rdi
  call   <epistasis_dataset_close@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L129
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L72:
  lea    D45(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L62
L129:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D105
data_type: string
name: read_data
arguments: data_tag: D46
data_type: string
name: read_data
arguments: data_tag: D75
data_type: string
name: read_data
arguments: data_tag: D87
data_type: string
name: read_data
arguments: data_tag: D82
data_type: string
name: read_data
arguments: data_tag: D59
data_type: string
name: read_data
arguments: data_tag: D81
data_type: string
name: read_data
arguments: data_tag: D50
data_type: string
name: read_data
arguments: data_tag: D95
data_type: string
name: read_data
arguments: data_tag: D45
data_type: string

tool: D105: %s.txt

tool: D46: output file is %s


tool: D75: w

tool: D87: genotypes offset is %zu


tool: D82: S%d	

tool: D59: Class


tool: D81: %d	

tool: D50: 0


tool: D95: 1


tool: D45: Usage: hpgvariant2mdrjava <filename>

assistant: ```c
int main(int argc, char *argv[]) {
  int num_affected, num_unaffected, num_samples;
  size_t num_variants, file_len, genotypes_offset;
  char *filename, *output_filename;
  if (argc < 2) {
    printf("Usage: hpgvariant2mdrjava <filename>\n");
    exit(1);
  }
  filename = argv[1];
  output_filename = malloc((strlen(filename) + 5) * sizeof(char));
  sprintf(output_filename, "%s.txt", filename);
  printf("output file is %s\n", output_filename);
  uint8_t *input_file = epistasis_dataset_load(&num_affected, &num_unaffected, &num_variants, &file_len, &genotypes_offset, filename);
  uint8_t *genotypes = input_file + genotypes_offset;
  num_samples = num_affected + num_unaffected;
  FILE *outfile = fopen(output_filename, "w");
  printf("genotypes offset is %zu\n", genotypes_offset);
  int i, j;
  for (i = 0; i < num_variants; i++) {
    fprintf(outfile, "S%d\t", i);
  }
  fprintf(outfile, "Class\n");
  for (j = 0; j < num_affected; j++) {
    for (i = 0; i < num_variants; i++) {
      uint8_t gt = genotypes[i * num_samples + j];
      if (gt == 255)
        gt = 3;
      fprintf(outfile, "%d\t", gt);
    }
    fprintf(outfile, "0\n");
  }
  for (j = num_affected; j < num_samples; j++) {
    for (i = 0; i < num_variants; i++) {
      uint8_t gt = genotypes[i * num_samples + j];
      if (gt == 255)
        gt = 3;
      fprintf(outfile, "%d\t", gt);
    }
    fprintf(outfile, "1\n");
  }
  fclose(outfile);
  epistasis_dataset_close(input_file, file_len);
  return 0;
}
```