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

```asm
<bin2oct>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L66
L187:
  cmpl   $0x68,-0x4(%rbp)
  je     L145
  cmpl   $0x72,-0x4(%rbp)
  jne    L66
  movl   $0x1,-0x10(%rbp)
  jmp    L66
L145:
  movl   $0x1,-0xc(%rbp)
  nop
L66:
  mov    -0x20(%rbp),%rcx
  mov    -0x14(%rbp),%eax
  lea    D27(%rip),%rdx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <getopt@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0xffffffff,-0x4(%rbp)
  jne    L187
  cmpl   $0x0,-0xc(%rbp)
  jne    L2
  cmpl   $0x0,-0x10(%rbp)
  je     L62
  cmpl   $0x2,-0x14(%rbp)
  jle    L159
  lea    D45(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L76
L159:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <noArgument@plt>
  jmp    L76
L62:
  cmpl   $0x1,-0x14(%rbp)
  jle    L61
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L76
L61:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <noArgument@plt>
L76:
  movl   $0x1,-0x8(%rbp)
  jmp    L102
L78:
  cmpl   $0x0,-0x10(%rbp)
  je     L138
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  lea    D10(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L10
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    $0x2,%edx
  mov    $0x8,%esi
  mov    %rax,%rdi
  call   <convertBase@plt>
  jmp    L154
L138:
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    $0x8,%edx
  mov    $0x2,%esi
  mov    %rax,%rdi
  call   <convertBase@plt>
  jmp    L154
L10:
  nop
L154:
  addl   $0x1,-0x8(%rbp)
L102:
  mov    -0x8(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jl     L78
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L152
L2:
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <showUsage@plt>
L152:
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D27
datatype: string
name: parse_data
arguments: label: D45
datatype: string
name: parse_data
arguments: label: D12
datatype: string
name: parse_data
arguments: label: D10
datatype: string
name: parse_data
arguments: label: D22
datatype: string

tool: D27: rh

tool: D45: BIN: 

tool: D12: OCT: 

tool: D10: -r

tool: D22: 


assistant: ```c
void bin2oct(int argc, char **argv, char *applet) {
  int opt = 0;
  bool reverse = false;
  bool pr_help = false;
  while ((opt = getopt(argc, argv, "rh")) != -1) {
    switch (opt) {
    case 'r':
      reverse = true;
      break;
    case 'h':
      pr_help = true;
      break;
    }
  }
  if (!pr_help) {
    if (reverse) {
      if (argc > 2) {
        printf("BIN: ");
      } else {
        noArgument(applet);
      }
    } else {
      if (argc > 1) {
        printf("OCT: ");
      } else {
        noArgument(applet);
      }
    }
    for (int i = 1; i < argc; i++) {
      if (reverse) {
        if (strcmp(argv[i], "-r") == 0) {
          continue;
        }
        convertBase(argv[i], 8, 2);
      } else {
        convertBase(argv[i], 2, 8);
      }
    }
    printf("\n");
  } else {
    showUsage(applet);
  }
}
```