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

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x4,%edi
  je     L175
  lea    D58(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%ebp
L49:
  mov    %ebp,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L175:
  mov    %rsi,%rbx
  mov    0x18(%rsi),%rdi
  call   <strlen@plt>
  mov    %eax,%ebp
  cmp    $0x1,%eax
  jne    L25
  mov    0x18(%rbx),%rax
  movsbl (%rax),%edi
  call   <isdigit@plt>
  test   %eax,%eax
  jne    L74
L25:
  lea    D38(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%ebp
  jmp    L49
L74:
  mov    0x18(%rbx),%rdi
  call   <atoi@plt>
  mov    %eax,%r12d
  cmp    $0x3,%eax
  ja     L21
  mov    0x8(%rbx),%rdi
  lea    D52(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L80
  mov    0x10(%rbx),%rdi
  lea    D116(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L95
  mov    %r13,%rdi
  call   <verifyBootSignature@plt>
  test   %rax,%rax
  je     L84
  lea    D115(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <readPartitionsInfo@plt>
  test   %eax,%eax
  je     L89
  mov    %r12d,%edi
  call   <verifyPartition@plt>
  test   %eax,%eax
  je     L1
  mov    %r12d,%edx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <copyPartition@plt>
  test   %eax,%eax
  je     L14
  lea    D6(%rip),%rdi
  call   <printf@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  mov    $0x0,%ebp
  jmp    L49
L21:
  lea    D38(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L80:
  lea    D96(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L95:
  lea    D92(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L84:
  lea    D128(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L89:
  lea    D99(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L1:
  lea    D36(%rip),%rdi
  call   <printf@plt>
  jmp    L49
L14:
  lea    D121(%rip),%rdi
  call   <printf@plt>
  jmp    L49
```

tool_calls: name: retrieve_data
arguments: tag: D58
datatype: string
name: retrieve_data
arguments: tag: D38
datatype: string
name: retrieve_data
arguments: tag: D52
datatype: string
name: retrieve_data
arguments: tag: D116
datatype: string
name: retrieve_data
arguments: tag: D115
datatype: string
name: retrieve_data
arguments: tag: D6
datatype: string
name: retrieve_data
arguments: tag: D96
datatype: string
name: retrieve_data
arguments: tag: D92
datatype: string
name: retrieve_data
arguments: tag: D128
datatype: string
name: retrieve_data
arguments: tag: D99
datatype: string
name: retrieve_data
arguments: tag: D36
datatype: string
name: retrieve_data
arguments: tag: D121
datatype: string

tool: D58: Usage: fileIn filePartitionOut numberOfPartition(0,1,2 or 3)


tool: D38: Wrong partition number


tool: D52: r

tool: D116: w

tool: D115: Boot signature OK!


tool: D6: Done!


tool: D96: Can't open fileIn


tool: D92: Can't open filePartitionOut


tool: D128: Wrong boot signature in mbr! Is fileIn valid disk image?


tool: D99: Failed to read data about partitions

tool: D36: Selected partition does not exist


tool: D121: Error while extracting partition


assistant: ```c
int main(int argc, char **argv) {
  FILE *in;
  FILE *out;
  if (argc != 4) {
    printf("Usage: fileIn filePartitionOut "
           "numberOfPartition(0,1,2 or 3)\n");
    return 1;
  }
  if (strlen(argv[3]) != 1 || !isdigit(argv[3][0])) {
    printf("Wrong partition number\n");
    return 1;
  }
  int getPartition = atoi(argv[3]);
  if (getPartition < 0 || getPartition > 3) {
    printf("Wrong partition number\n");
    return 1;
  }
  in = fopen(argv[1], "r");
  if (in == NULL) {
    printf("Can't open fileIn\n");
    return 1;
  }
  out = fopen(argv[2], "w");
  if (out == NULL) {
    printf("Can't open filePartitionOut\n");
    return 1;
  }
  if (verifyBootSignature(in))
    printf("Boot signature OK!\n");
  else {
    printf("Wrong boot signature in mbr! Is fileIn valid disk image?\n");
    return 1;
  }
  if (!readPartitionsInfo(in)) {
    printf("Failed to read data about partitions");
    return 1;
  }
  if (!verifyPartition(getPartition)) {
    printf("Selected partition does not exist\n");
    return 1;
  }
  if (!copyPartition(in, out, getPartition)) {
    printf("Error while extracting partition\n");
    return 1;
  }
  printf("Done!\n");
  fclose(in);
  fclose(out);
  return 0;
}
```