user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rsi,%r14
  cmp    $0x4,%edi
  jle    L182
  mov    %edi,%ebx
  mov    0x18(%rsi),%rdi
  call   <atoi@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L155
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %r13,%r13
  je     L64
  test   %rax,%rax
  je     L64
  mov    %r12d,%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  lea    0x20(%r14),%rbp
  lea    -0x5(%rbx),%eax
  lea    0x28(%r14,%rax,8),%r15
L124:
  mov    0x0(%rbp),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  mov    %eax,%esi
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  test   %ebx,%ebx
  jle    L167
  cmp    %ebx,%r12d
  jl     L167
  movslq %ebx,%rbx
  movb   $0x1,-0x1(%r13,%rbx,1)
  add    $0x8,%rbp
  cmp    %r15,%rbp
  jne    L124
  mov    0x8(%r14),%rdi
  lea    D58(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,0x10(%rsp)
  test   %rax,%rax
  je     L203
  mov    0x10(%r14),%rdi
  lea    D41(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r15
  mov    %r12d,%eax
  mov    %rax,0x18(%rsp)
  test   %r15,%r15
  je     L5
L237:
  mov    0x10(%rsp),%rcx
  mov    $0x1,%edx
  mov    %r12d,%esi
  mov    0x8(%rsp),%rdi
  call   <fread@plt>
  test   %rax,%rax
  je     L99
  test   %r12d,%r12d
  jle    L237
  mov    %r13,%rbx
  mov    0x8(%rsp),%rbp
  mov    0x18(%rsp),%rax
  lea    (%rax,%r13,1),%r14
  jmp    L101
L182:
  mov    (%rsi),%rsi
  lea    D31(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L131
L155:
  lea    D26(%rip),%rdi
  call   <puts@plt>
  movq   $0x0,0x8(%rsp)
  mov    $0x0,%r13d
  jmp    L100
L64:
  lea    D13(%rip),%rdi
  call   <puts@plt>
  jmp    L100
L167:
  mov    %ebx,%esi
  lea    D91(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L100
L203:
  mov    0x8(%r14),%rsi
  lea    D3(%rip),%rdi
  call   <printf@plt>
  jmp    L100
L5:
  mov    0x10(%r14),%rsi
  lea    D50(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L99
L227:
  add    $0x1,%rbx
  add    $0x1,%rbp
  cmp    %r14,%rbx
  je     L237
L101:
  cmpb   $0x0,(%rbx)
  je     L227
  mov    %r15,%rcx
  mov    $0x1,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fwrite@plt>
  test   %eax,%eax
  jne    L227
  lea    D7(%rip),%rdi
  call   <puts@plt>
L99:
  mov    0x10(%rsp),%rdi
  call   <fclose@plt>
  test   %r15,%r15
  je     L95
  mov    %r15,%rdi
  call   <fclose@plt>
L100:
  test   %r13,%r13
  je     L152
L95:
  mov    %r13,%rdi
  call   <free@plt>
L152:
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L131
  mov    %rax,%rdi
  call   <free@plt>
L131:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D4
data_type: string
name: read_data
arguments: data_label: D58
data_type: string
name: read_data
arguments: data_label: D41
data_type: string
name: read_data
arguments: data_label: D31
data_type: string
name: read_data
arguments: data_label: D26
data_type: string
name: read_data
arguments: data_label: D13
data_type: string
name: read_data
arguments: data_label: D91
data_type: string
name: read_data
arguments: data_label: D3
data_type: string
name: read_data
arguments: data_label: D50
data_type: string
name: read_data
arguments: data_label: D7
data_type: string

tool: D4: Adding column number %d


tool: D58: rb

tool: D41: wb

tool: D31: Usage: %s <InFile> <OutFile> <RowLength> <CopyCol1> [<CopyCol2> [<CopyCol3> [...]]]
Column numbers start at 1


tool: D26: Row length must be greater than Zero!!!

tool: D13: Error allocating working memory

tool: D91: Invalid column number %d


tool: D3: Cannot open input file %s


tool: D50: Cannot open output file %s


tool: D7: Error writing to output file

assistant: ```c
void main(int argc, char **argv) {
  FILE *InFile = NULL;
  FILE *OutFile = NULL;
  char *CopyFlags = NULL;
  char *SourceRow = NULL;
  int RowLength;
  int Count;
  int ColNumber;
  if (argc < 5) {
    printf("Usage: %s <InFile> <OutFile> <RowLength> <CopyCol1> [<CopyCol2> [<CopyCol3> [...]]]\nColumn numbers start at 1\n", argv[0]);
    return;
  }
  RowLength = atoi(argv[3]);
  if (!RowLength) {
    printf("Row length must be greater than Zero!!!\n");
    goto Exit;
  }
  CopyFlags = malloc(RowLength);
  SourceRow = malloc(RowLength);
  if ((!CopyFlags) || (!SourceRow)) {
    printf("Error allocating working memory\n");
    goto Exit;
  }
  memset(CopyFlags, 0, RowLength);
  for (Count = 4; Count < argc; Count++) {
    ColNumber = atoi(argv[Count]);
    printf("Adding column number %d\n", ColNumber);
    if ((ColNumber < 1) || (ColNumber > RowLength)) {
      printf("Invalid column number %d\n", ColNumber);
      goto Exit;
    }
    CopyFlags[ColNumber - 1] = 1;
  }
  InFile = fopen(argv[1], "rb");
  if (!InFile) {
    printf("Cannot open input file %s\n", argv[1]);
    goto Exit;
  }
  OutFile = fopen(argv[2], "wb");
  if (!OutFile) {
    printf("Cannot open output file %s\n", argv[2]);
    goto Exit;
  }
  while (fread(SourceRow, RowLength, 1, InFile)) {
    for (Count = 0; Count < RowLength; Count++)
      if (CopyFlags[Count])
        if (!fwrite(SourceRow + Count, 1, 1, OutFile)) {
          printf("Error writing to output file\n");
          goto Exit;
        }
  }
Exit:
  if (InFile)
    fclose(InFile);
  if (OutFile)
    fclose(OutFile);
  if (CopyFlags)
    free(CopyFlags);
  if (SourceRow)
    free(SourceRow);
}
```