// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0x22f30
movq %rax, -0x18(%rbp)
movq 0x20b17(%rip), %rax     # 0x28fc0
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2120
movq 0x20b3c(%rip), %rax     # 0x28ff8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2120
cmpl $0x2, -0x8(%rbp)
jge 0x84dc
leaq 0x1c0f8(%rip), %rdi     # 0x245cd
movb $0x0, %al
callq 0x4680
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0xf100
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xc4d0
testb $0x1, %al
jne 0x8529
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x1c0c3(%rip), %rdi     # 0x245e5
movb $0x0, %al
callq 0x4680
leaq -0xc0(%rbp), %rdi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xc5a0
movl -0xa8(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
je 0x857a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x1c091(%rip), %rdi     # 0x24604
movb $0x0, %al
callq 0x4680
jmp 0x857c
cmpl $0x2, -0x8(%rbp)
jne 0x85ad
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8890
jmp 0x8878
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x1c05e(%rip), %rsi     # 0x2461a
callq 0x2210
cmpl $0x0, %eax
jne 0x862e
cmpl $0x3, -0x8(%rbp)
jle 0x85da
leaq 0x1c04a(%rip), %rdi     # 0x2461d
movb $0x0, %al
callq 0x4680
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rax
xorl %esi, %esi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8e10
movq %rax, %rdi
leaq -0x30(%rbp), %rax
xorl %esi, %esi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8d30
jmp 0x8876
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x1c1b9(%rip), %rsi     # 0x247f6
callq 0x2210
cmpl $0x0, %eax
jne 0x86b0
cmpl $0x3, -0x8(%rbp)
jle 0x865b
leaq 0x1bfeb(%rip), %rdi     # 0x2463f
movb $0x0, %al
callq 0x4680
movq -0x18(%rbp), %rdi
leaq -0x30(%rbp), %rax
movl $0x1, %esi
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8e10
movq %rax, %rdi
leaq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x8f50
jmp 0x8874
movq -0x18(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0xd8(%rbp), %rdi
leaq 0x1bf9f(%rip), %rsi     # 0x24668
callq 0xf100
leaq -0xf0(%rbp), %rdi
leaq 0x1bf95(%rip), %rsi     # 0x24671
callq 0xf100
movq -0x148(%rbp), %rdi
leaq -0xd8(%rbp), %rcx
leaq -0xf0(%rbp), %rax
movl $0x196, %esi            # imm = 0x196
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0xd670
movq %rax, -0x140(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x108(%rbp), %rdi
callq 0xf100
movq -0x140(%rbp), %rdi
leaq -0x108(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd7a0
testb $0x1, %al
jne 0x8783
jmp 0x8864
cmpl $0x4, -0x8(%rbp)
jle 0x8797
leaq 0x1beea(%rip), %rdi     # 0x2467a
movb $0x0, %al
callq 0x4680
movq -0x18(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0x120(%rbp), %rdi
callq 0xf100
leaq -0x120(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0xd2f0
movq %rax, -0x150(%rbp)
cmpl $0x4, -0x8(%rbp)
jne 0x87fe
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq -0x138(%rbp), %rdi
callq 0xf100
jmp 0x8811
leaq -0x138(%rbp), %rdi
leaq 0x1bbf2(%rip), %rsi     # 0x243fe
callq 0xf100
movq -0x150(%rbp), %rsi
movq -0x158(%rbp), %rdi
leaq -0x30(%rbp), %rcx
leaq -0x138(%rbp), %rax
movq (%rcx), %rdx
movq %rdx, (%rsp)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rsp)
movq (%rax), %rcx
movq %rcx, 0x18(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
callq 0x9130
jmp 0x8872
leaq 0x1be29(%rip), %rdi     # 0x24694
movb $0x0, %al
callq 0x4680
jmp 0x8874
jmp 0x8876
jmp 0x8878
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw %cs:(%rax,%rax)