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

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  lea    D56(%rip),%rdi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x118,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  xor    %eax,%eax
  call   <printf@plt>
  cmp    $0x3,%ebp
  je     L173
L16:
  lea    D1(%rip),%rdi
  call   <printf@plt>
  mov    $0x1,%eax
L147:
  mov    0x108(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x118,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L173:
  mov    0x8(%rbx),%rdi
  lea    D11(%rip),%r12
  mov    $0x1,%ebp
  mov    %r12,%rsi
  call   <CheckExtension@plt>
  test   %rax,%rax
  jne    L95
L186:
  lea    D28(%rip),%r12
  mov    0x8(%rbx),%rdi
  mov    %r12,%rsi
  call   <CheckExtension@plt>
  test   %rax,%rax
  jne    L88
  lea    D3(%rip),%rbp
  mov    0x8(%rbx),%rdi
  mov    %rbp,%rsi
  call   <CheckExtension@plt>
  test   %rax,%rax
  je     L16
  mov    0x10(%rbx),%rdi
  mov    %rbp,%rsi
  call   <CheckExtension@plt>
  test   %rax,%rax
  jne    L16
L78:
  mov    $0x1,%r12d
  mov    $0x2,%ebp
L31:
  movslq %r12d,%r12
  mov    %rsp,%r13
  mov    $0x104,%esi
  lea    (%rbx,%r12,8),%r12
  mov    %r13,%rdi
  mov    (%r12),%rdx
  call   <GetFilenameWithoutExt@plt>
  mov    (%rbx,%rbp,8),%rdi
  mov    (%r12),%rsi
  mov    %r13,%rdx
  call   <Hd3Unpack@plt>
  jmp    L147
L88:
  mov    0x10(%rbx),%rdi
  mov    %r12,%rsi
  lea    D3(%rip),%r13
  xor    %r12d,%r12d
  call   <CheckExtension@plt>
  mov    0x8(%rbx),%rdi
  mov    %r13,%rsi
  test   %rax,%rax
  sete   %r12b
  add    %r12d,%r12d
  call   <CheckExtension@plt>
  test   %rax,%rax
  jne    L4
  test   %r12d,%r12d
  jne    L116
  mov    $0x1,%r12d
L156:
  test   %ebp,%ebp
  je     L16
  cmp    %r12d,%ebp
  je     L16
  movslq %ebp,%rbp
  mov    %rsp,%r13
  mov    $0x104,%esi
  lea    (%rbx,%rbp,8),%rbp
  mov    %r13,%rdi
  mov    0x0(%rbp),%rdx
  call   <GetFilenameWithoutExt@plt>
  mov    (%rbx,%r12,8),%rdi
  mov    0x0(%rbp),%rsi
  mov    %r13,%rdx
  call   <Hd2Unpack@plt>
  jmp    L147
L95:
  mov    0x10(%rbx),%rdi
  mov    %r12,%rsi
  xor    %ebp,%ebp
  call   <CheckExtension@plt>
  test   %rax,%rax
  sete   %bpl
  add    %ebp,%ebp
  jmp    L186
L116:
  mov    $0x1,%ebp
  jmp    L31
L22:
  call   <__stack_chk_fail@plt>
L4:
  mov    0x10(%rbx),%rdi
  mov    %r13,%rsi
  call   <CheckExtension@plt>
  test   %rax,%rax
  jne    L16
  test   %r12d,%r12d
  jne    L105
  mov    $0x2,%r12d
  jmp    L156
L105:
  cmp    $0x2,%r12d
  jne    L78
  jmp    L16
```

tool_calls: name: extract_symbolic_data
arguments: tag: D56
data_type: string
name: extract_symbolic_data
arguments: tag: D1
data_type: string
name: extract_symbolic_data
arguments: tag: D11
data_type: string
name: extract_symbolic_data
arguments: tag: D28
data_type: string
name: extract_symbolic_data
arguments: tag: D3
data_type: string

tool: D56: White Cloud - Dark Cloud's HD2/HD3 unpacker
Developed by Luciano Ciccariello (Xeeynamo)



tool: D1: Usage:	whitecloud <data.dat> (<data.hd3> | <data.hd2)
	whitecloud (<data.hd3> | <data.hd2) <data.dat>


tool: D11: .HD2

tool: D28: .HD3

tool: D3: .DAT

assistant: ```c
int main(int argc, char *argv[]) {
  printf("White Cloud - Dark Cloud's HD2/HD3 unpacker\n"
         "Developed by Luciano Ciccariello (Xeeynamo)\n\n");
  if (argc == 3) {
    int hd2Pos;
    int hd3Pos;
    int datPos;
    hd2Pos = CheckExtension(argv[1], ".HD2") == 0 ? 1 : CheckExtension(argv[2], ".HD2") == 0 ? 2 : 0;
    hd3Pos = CheckExtension(argv[1], ".HD3") == 0 ? 1 : CheckExtension(argv[2], ".HD3") == 0 ? 2 : 0;
    datPos = CheckExtension(argv[1], ".DAT") == 0 ? 1 : CheckExtension(argv[2], ".DAT") == 0 ? 2 : 0;
    if (hd3Pos != 0) {
      if (hd3Pos != 0 && datPos != 0 && hd3Pos != datPos) {
        char exportDir[260];
        GetFilenameWithoutExt(exportDir, sizeof(exportDir), argv[hd3Pos]);
        return Hd3Unpack(argv[datPos], argv[hd3Pos], exportDir);
      }
    } else {
      if (hd2Pos != 0 && datPos != 0 && hd2Pos != datPos) {
        char exportDir[260];
        GetFilenameWithoutExt(exportDir, sizeof(exportDir), argv[hd2Pos]);
        return Hd2Unpack(argv[datPos], argv[hd2Pos], exportDir);
      }
    }
  }
  printf("Usage:"
         "\twhitecloud <data.dat> (<data.hd3> | <data.hd2)\n"
         "\twhitecloud (<data.hd3> | <data.hd2) <data.dat>\n");
  return 1;
}
```