// File: /workspace/github_c_makefile_star2_O2/AlxHnr[P]nano-backup/src/nb.c
// Function: main
int main(const int arg_count, const char **arg_list)
{
  CR_Region *r = CR_RegionNew();
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);

  if(arg_count < 2)
  {
    die("no repository specified");
  }

  StringView path_to_repo = str(arg_list[1]);
  if(!sPathExists(path_to_repo))
  {
    die("repository doesn't exist: \"%s\"", arg_list[1]);
  }
  else if(!S_ISDIR(sStat(path_to_repo).st_mode))
  {
    die("not a directory: \"%s\"", arg_list[1]);
  }

  if(arg_count == 2)
  {
    backup(r, path_to_repo);
  }
  else if(strcmp(arg_list[2], "gc") == 0)
  {
    if(arg_count > 3)
    {
      die("too many arguments for gc command");
    }

    runGC(metadataLoadFromRepo(r, path_to_repo, RLH_readwrite),
          path_to_repo, false);
  }
  else if(strcmp(arg_list[2], "integrity") == 0)
  {
    if(arg_count > 3)
    {
      die("too many arguments for integrity command");
    }

    runIntegrityCheck(metadataLoadFromRepo(r, path_to_repo, RLH_readonly),
                      path_to_repo);
  }
  else if(sRegexIsMatching(
            sRegexCompile(r, str("^[0-9]+$"), str(__FILE__), __LINE__),
            str(arg_list[2])))
  {
    if(arg_count > 4)
    {
      die("too many paths to restore");
    }

    restore(r, path_to_repo, sStringToSize(str(arg_list[2])),
            arg_count == 4 ? str(arg_list[3]) : str("/"));
  }
  else
  {
    die("invalid arguments");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rsi, %r14
movl %edi, %ebp
callq 0xd040
movq %rax, %rbx
movq 0xdfa7(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2140
movq 0xdfbe(%rip), %rax      # 0x13ff8
movq (%rax), %rdi
xorl %esi, %esi
callq 0x2140
cmpl $0x1, %ebp
jle 0x6920
movq 0x8(%r14), %rsi
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0xa3d0
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0x886e
testb %al, %al
je 0x692c
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x228(%rsp), %r15
movq %r15, %rdi
callq 0x88e8
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%r15), %eax
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x6939
cmpl $0x2, %ebp
jne 0x6299
movups 0x58(%rsp), %xmm0
movaps %xmm0, 0x90(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %rbx, %rdi
callq 0x2578
movq %rax, %r14
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xf0(%rsp), %r15
movq %r15, %rdi
callq 0xa4a2
leaq 0x80d1(%rip), %rsi      # 0xe1e2
leaq 0xd0(%rsp), %r12
movq %r12, %rdi
callq 0xa3d0
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0xb0(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xa6c6
leaq 0x8089(%rip), %rsi      # 0xe1e9
leaq 0x110(%rsp), %r13
movq %r13, %rdi
callq 0xa3d0
movq 0x10(%r13), %rax
movq %rax, 0x28(%rsp)
movups (%r13), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0xa6c6
leaq 0x84f3(%rip), %rsi      # 0xe69b
leaq 0x210(%rsp), %r13
movq %r13, %rdi
callq 0xa3d0
movq 0x10(%r13), %rax
movq %rax, 0x28(%rsp)
movups (%r13), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
leaq 0x130(%rsp), %rdi
movq %r14, %rsi
callq 0xa6c6
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
callq 0x886e
testb %al, %al
je 0x694b
movq 0x100(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xf0(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7718
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0xb0(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x9ce5
movq %rax, %r15
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0x886e
testb %al, %al
je 0x63a8
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x51b5
jmp 0x63b0
movq 0x10(%r14), %rdi
cmpb $0x67, (%rdi)
jne 0x62b2
cmpb $0x63, 0x1(%rdi)
jne 0x62b2
cmpb $0x0, 0x2(%rdi)
je 0x68dd
leaq 0x8525(%rip), %rsi      # 0xe7de
callq 0x2230
testl %eax, %eax
je 0x6558
leaq 0x8390(%rip), %rsi      # 0xe65d
leaq 0x1f8(%rsp), %r15
movq %r15, %rdi
callq 0xa3d0
leaq 0x8382(%rip), %rsi      # 0xe666
leaq 0x1e0(%rsp), %r12
movq %r12, %rdi
callq 0xa3d0
movq 0x10(%r12), %rax
movq %rax, 0x28(%rsp)
movups (%r12), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
movl $0x196, %esi            # imm = 0x196
movq %rbx, %rdi
callq 0x933d
movq %rax, %r15
movq 0x10(%r14), %rsi
leaq 0x1c8(%rsp), %r12
movq %r12, %rdi
callq 0xa3d0
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0x9418
testb %al, %al
je 0x6968
cmpl $0x5, %ebp
jae 0x6971
movq 0x10(%r14), %rsi
leaq 0x1b0(%rsp), %r15
movq %r15, %rdi
callq 0xa3d0
movq 0x10(%r15), %rax
movq %rax, 0x10(%rsp)
movups (%r15), %xmm0
movups %xmm0, (%rsp)
callq 0x910e
movq %rax, %r15
cmpl $0x4, %ebp
jne 0x664f
movq 0x18(%r14), %rsi
jmp 0x6656
movq %rbx, %rdi
callq 0x5170
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x28ac
movq 0x58(%r15), %rax
movq (%rax), %rdx
leaq 0x160(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x421f
movq %r15, %rdi
callq 0x404a
movq %r12, %rdi
callq 0x4560
testb %al, %al
je 0x68c9
pushq $0xa
popq %rdi
callq 0x2050
movb $0x0, 0x57(%rsp)
movq 0x160(%rsp), %rdx
testq %rdx, %rdx
je 0x6426
movq 0x168(%rsp), %rcx
leaq 0x82b1(%rip), %rdi      # 0xe6ca
pushq $0x5
popq %rsi
leaq 0x57(%rsp), %r8
callq 0x6b48
movq 0x170(%rsp), %rdx
testq %rdx, %rdx
je 0x644f
movq 0x178(%rsp), %rcx
leaq 0x828c(%rip), %rdi      # 0xe6ce
pushq $0x3
popq %rsi
leaq 0x57(%rsp), %r8
callq 0x6b48
movq 0x180(%rsp), %rdx
testq %rdx, %rdx
je 0x6478
movq 0x188(%rsp), %rcx
leaq 0x826b(%rip), %rdi      # 0xe6d6
pushq $0x9
popq %rsi
leaq 0x57(%rsp), %r8
callq 0x6b48
cmpb $0x1, 0x57(%rsp)
jne 0x648b
leaq 0x8318(%rip), %rdi      # 0xe79e
callq 0x20a0
movq %rbx, %rdi
callq 0x2590
leaq 0x8241(%rip), %rdi      # 0xe6db
movq %rax, %rsi
callq 0x6bca
movq 0x140(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x130(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x2ea8
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movups 0x70(%rsp), %xmm0
movups %xmm0, 0x30(%rsp)
movq 0x140(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x130(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x57c5
movq 0xa0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x90(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x69c0
jmp 0x68c9
cmpl $0x4, %ebp
jae 0x697a
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x6a4b
movq %rax, %r14
movq 0x68(%rsp), %rax
movq %rax, 0x170(%rsp)
movups 0x58(%rsp), %xmm0
movaps %xmm0, 0x160(%rsp)
callq 0xd040
movq %rax, %r15
movq 0xda25(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
callq 0x90d1
testb %al, %al
je 0x65cb
pushq $0xa
popq %rdi
callq 0x2050
pushq $0x64
popq %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x6edf
xorps %xmm0, %xmm0
leaq 0xf0(%rsp), %rbx
movaps %xmm0, (%rbx)
movq 0x170(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x160(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x8fc(%rip), %rdx       # 0x6ef5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rcx
callq 0x4dd0
movq %rax, %r14
movq (%rbx), %rdx
pushq $0x1
popq %rdi
movq %rdx, %rsi
callq 0x6edf
leaq 0x8154(%rip), %rdi      # 0xe773
xorl %eax, %eax
callq 0x2150
movq 0xd9a3(%rip), %rax      # 0x13fd0
movq (%rax), %rdi
testq %r14, %r14
movq %r15, 0x108(%rsp)
je 0x6843
leaq 0x814b(%rip), %rdx      # 0xe793
pushq $0x3
jmp 0x684c
leaq 0x7df2(%rip), %rsi      # 0xe448
leaq 0x148(%rsp), %rdi
callq 0xa3d0
movups 0x148(%rsp), %xmm0
movaps %xmm0, 0x70(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x80(%rsp)
movups 0x58(%rsp), %xmm0
movaps %xmm0, 0x110(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x120(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x6a4b
movq %rax, %r14
movq %rbx, %rdi
callq 0x2578
movq %rax, %r12
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0xb0(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xb0(%rsp), %rax
cmpb $0x2f, (%rax)
jne 0x670f
movq 0x80(%rsp), %rax
movq %rax, 0xe0(%rsp)
movaps 0x70(%rsp), %xmm0
movaps %xmm0, 0xd0(%rsp)
jmp 0x6780
leaq 0x160(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x8ecd
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
leaq 0xf0(%rsp), %r13
movq %r13, %rdi
callq 0xa4a2
movq 0xc0(%rsp), %rax
movq %rax, 0x28(%rsp)
movaps 0xb0(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x10(%r13), %rax
movq %rax, 0x10(%rsp)
movups (%r13), %xmm0
movups %xmm0, (%rsp)
leaq 0xd0(%rsp), %rdi
movq %r12, %rsi
callq 0xa6c6
movq 0xe0(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0xd0(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0xf0(%rsp), %r12
movq %r12, %rdi
callq 0xa4a2
movq 0x10(%r12), %rax
movq %rax, 0x10(%rsp)
movups (%r12), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x78a0
leaq 0x160(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x421f
movq %r12, %rdi
callq 0x4560
testb %al, %al
je 0x68c9
leaq 0x7fab(%rip), %rdi      # 0xe79e
xorl %eax, %eax
callq 0x2150
cmpl $0x1, %eax
jne 0x68c9
movq %rbx, %rdi
callq 0x2590
leaq 0x7fe0(%rip), %rdi      # 0xe7f2
movq %rax, %rsi
callq 0x6bca
movq 0x120(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x110(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7c81
jmp 0x68c9
leaq 0x7f40(%rip), %rdx      # 0xe78a
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x3830
leaq 0x7f45(%rip), %r13      # 0xe7a0
pushq $0x2
popq %rbx
leaq 0x7f96(%rip), %r12      # 0xe7fb
xorl %r15d, %r15d
testq %r14, %r14
je 0x68b3
movq 0xd75c(%rip), %rbp      # 0x13fd0
movq (%rbp), %rdi
pushq $0x3
popq %rsi
leaq 0x7ab8(%rip), %rdx      # 0xe33a
xorl %eax, %eax
callq 0x3830
movq (%rbp), %rdi
movq (%r14), %rax
movl 0x8(%rax), %ecx
movq (%rax), %r8
movl %ebx, %esi
movq %r13, %rdx
xorl %eax, %eax
callq 0x3830
movq %r12, %rdi
callq 0x20a0
incq %r15
movq 0x8(%r14), %r14
jmp 0x6868
movq 0x108(%rsp), %rdi
callq 0xd21a
testq %r15, %r15
jne 0x6983
xorl %eax, %eax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x4, %ebp
jae 0x69b2
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6a4b
movq 0x68(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movups 0x58(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %rax, %rdi
xorl %esi, %esi
jmp 0x654e
leaq 0x7c9e(%rip), %rdi      # 0xe5c5
jmp 0x69b9
movq 0x8(%r14), %rsi
leaq 0x7ca6(%rip), %rdi      # 0xe5dd
jmp 0x6944
movq 0x8(%r14), %rsi
leaq 0x7cb8(%rip), %rdi      # 0xe5fc
xorl %eax, %eax
callq 0x3918
movl 0x98(%rsp), %esi
movq 0x90(%rsp), %rdx
leaq 0x7d43(%rip), %rdi      # 0xe6a4
xorl %eax, %eax
callq 0x3918
leaq 0x7d1a(%rip), %rdi      # 0xe689
jmp 0x69b9
leaq 0x7cf7(%rip), %rdi      # 0xe66f
jmp 0x69b9
leaq 0x7cb3(%rip), %rdi      # 0xe634
jmp 0x69b9
pushq $0xa
popq %rdi
callq 0x2050
cmpq $0x1, %r15
leaq 0x7e09(%rip), %rax      # 0xe79f
leaq 0x7ac0(%rip), %rdx      # 0xe45d
cmoveq %rax, %rdx
leaq 0x7dfe(%rip), %rdi      # 0xe7a6
movq %r15, %rsi
xorl %eax, %eax
callq 0x3918
leaq 0x7c59(%rip), %rdi      # 0xe612
xorl %eax, %eax
callq 0x3918