// File: /workspace/github_c_makefile_star2_O0/stfwi[P]duktape-cc/build/duktape/mod/ext/app_attachment/app_attachment.cc
// Function: main
int main(int argc, const char** argv)
{
  using namespace std;
  auto args = deque<string>();
  for(int i=1; (i<argc) && (argv[i]); ++i) args.push_back(argv[i]);
  const auto verbose = (args.size() > 0) && (args.front() == "-v");
  if(verbose) args.pop_front();
  const auto binary_path = ((args.size() >= 2) && (args[0] == "-p")) ? string(args[1]) : string();
  const auto script_path = ((args.size() == 4) && (args[2] == "-a")) ? string(args[3]) : string();
  auto script_contents = string();
  if(binary_path.empty() || (args.size() & 0x1)) {
    cerr << "Expected -p <path-to-binary> [-a <path-to-attachment>]\n";
    return 1;
  }
  if(!script_path.empty()) {
    std::ifstream fis(script_path.c_str(), std::ios::in|std::ios::binary);
    if(!fis.good()) { cerr << "Failed to open data file: '" << script_path << "'\n"; return 1; }
    script_contents.assign((std::istreambuf_iterator<char>(fis)), std::istreambuf_iterator<char>());
    if(!fis.good() && !fis.eof()) { cerr << "Failed to read data: '" << script_path << "'\n"; return 1; }
    fis.close();
  }
  return sw::util::detail::basic_executable_attachment<>::patch_application(binary_path, verbose, move(script_contents));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3e0, %rsp            # imm = 0x3E0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x3160
leaq -0x60(%rbp), %rdi
callq 0x3cc0
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %ecx
xorl %eax, %eax
cmpl -0x8(%rbp), %ecx
movb %al, -0x371(%rbp)
jge 0x368f
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x371(%rbp)
movb -0x371(%rbp), %al
testb $0x1, %al
jne 0x369e
jmp 0x375b
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x388(%rbp)
leaq -0x89(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x3450
movq -0x388(%rbp), %rsi
movq -0x380(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x3310
jmp 0x36e0
leaq -0x60(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3ce0
jmp 0x36f2
leaq -0x88(%rbp), %rdi
callq 0x31a0
leaq -0x89(%rbp), %rdi
callq 0x32a0
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x3669
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x374a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x31a0
leaq -0x89(%rbp), %rdi
callq 0x32a0
jmp 0x3c9c
leaq -0x60(%rbp), %rdi
callq 0x3d10
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
movb %al, -0x389(%rbp)
jbe 0x37a3
leaq -0x60(%rbp), %rdi
callq 0x3d70
movq %rax, %rdi
leaq 0x988c(%rip), %rsi      # 0xd014
callq 0x3d40
movb %al, -0x38a(%rbp)
jmp 0x3795
movb -0x38a(%rbp), %al
movb %al, -0x389(%rbp)
jmp 0x37a3
movb -0x389(%rbp), %al
andb $0x1, %al
movb %al, -0x9d(%rbp)
testb $0x1, -0x9d(%rbp)
je 0x37dc
leaq -0x60(%rbp), %rdi
callq 0x3da0
jmp 0x37dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c9c
leaq -0x60(%rbp), %rdi
callq 0x3d10
cmpq $0x2, %rax
jb 0x383c
xorl %eax, %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
callq 0x3e10
movq %rax, %rdi
leaq 0x9815(%rip), %rsi      # 0xd017
callq 0x3d40
movb %al, -0x38b(%rbp)
jmp 0x380f
movb -0x38b(%rbp), %al
testb $0x1, %al
jne 0x381b
jmp 0x383c
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
callq 0x3e10
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x3100
jmp 0x383a
jmp 0x3848
leaq -0xc0(%rbp), %rdi
callq 0x3320
leaq -0x60(%rbp), %rdi
callq 0x3d10
cmpq $0x4, %rax
jne 0x38a9
leaq -0x60(%rbp), %rdi
movl $0x2, %esi
callq 0x3e10
movq %rax, %rdi
leaq 0x97ab(%rip), %rsi      # 0xd01a
callq 0x3d40
movb %al, -0x38c(%rbp)
jmp 0x387c
movb -0x38c(%rbp), %al
testb $0x1, %al
jne 0x3888
jmp 0x38a9
leaq -0x60(%rbp), %rdi
movl $0x3, %esi
callq 0x3e10
movq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x3100
jmp 0x38a7
jmp 0x38b5
leaq -0xe0(%rbp), %rdi
callq 0x3320
leaq -0x100(%rbp), %rdi
callq 0x3320
leaq -0xc0(%rbp), %rdi
callq 0x3400
testb $0x1, %al
jne 0x38e4
leaq -0x60(%rbp), %rdi
callq 0x3d10
andq $0x1, %rax
cmpq $0x0, %rax
je 0x393d
movq 0xf705(%rip), %rdi      # 0x12ff0
leaq 0x972b(%rip), %rsi      # 0xd01d
callq 0x3260
jmp 0x38f9
movl $0x1, -0x4(%rbp)
movl $0x1, -0x104(%rbp)
jmp 0x3c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c90
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
jmp 0x3c78
leaq -0xe0(%rbp), %rdi
callq 0x3400
testb $0x1, %al
jne 0x3b86
leaq -0xe0(%rbp), %rdi
callq 0x30f0
movq %rax, -0x398(%rbp)
movl $0x8, %edi
movl $0x4, %esi
callq 0x3e40
movl %eax, -0x390(%rbp)
jmp 0x397b
movl -0x390(%rbp), %edx
movq -0x398(%rbp), %rsi
leaq -0x310(%rbp), %rdi
callq 0x3480
jmp 0x3996
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x310(%rbp,%rax), %rdi
callq 0x3410
movb %al, -0x399(%rbp)
jmp 0x39b6
movb -0x399(%rbp), %al
testb $0x1, %al
jne 0x3a4c
jmp 0x39c6
movq 0xf623(%rip), %rdi      # 0x12ff0
leaq 0x9681(%rip), %rsi      # 0xd055
callq 0x3260
movq %rax, -0x3a8(%rbp)
jmp 0x39e2
movq -0x3a8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x3230
movq %rax, -0x3b0(%rbp)
jmp 0x39fe
movq -0x3b0(%rbp), %rdi
leaq 0x9665(%rip), %rsi      # 0xd071
callq 0x3260
jmp 0x3a13
movl $0x1, -0x4(%rbp)
movl $0x1, -0x104(%rbp)
jmp 0x3b68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x3080
jmp 0x3c78
leaq -0x320(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x3f10
leaq -0x330(%rbp), %rdi
callq 0x3f70
movq -0x320(%rbp), %rsi
movl -0x318(%rbp), %edx
movq -0x330(%rbp), %rcx
movl -0x328(%rbp), %r8d
leaq -0x100(%rbp), %rdi
callq 0x3e60
jmp 0x3a94
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x310(%rbp,%rax), %rdi
callq 0x3410
movb %al, -0x3b1(%rbp)
jmp 0x3ab4
movb -0x3b1(%rbp), %al
testb $0x1, %al
jne 0x3b50
jmp 0x3ac4
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x310(%rbp,%rax), %rdi
callq 0x3490
movb %al, -0x3b2(%rbp)
jmp 0x3ae4
movb -0x3b2(%rbp), %al
testb $0x1, %al
jne 0x3b50
jmp 0x3af0
movq 0xf4f9(%rip), %rdi      # 0x12ff0
leaq 0x9576(%rip), %rsi      # 0xd074
callq 0x3260
movq %rax, -0x3c0(%rbp)
jmp 0x3b0c
movq -0x3c0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x3230
movq %rax, -0x3c8(%rbp)
jmp 0x3b28
movq -0x3c8(%rbp), %rdi
leaq 0x953b(%rip), %rsi      # 0xd071
callq 0x3260
jmp 0x3b3d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x104(%rbp)
jmp 0x3b68
leaq -0x310(%rbp), %rdi
callq 0x3060
jmp 0x3b5e
movl $0x0, -0x104(%rbp)
leaq -0x310(%rbp), %rdi
callq 0x3080
movl -0x104(%rbp), %eax
testl %eax, %eax
jne 0x3c3f
jmp 0x3b84
jmp 0x3b86
leaq -0x350(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3100
jmp 0x3b9b
movzbl -0x9d(%rbp), %eax
movl %eax, -0x3dc(%rbp)
leaq -0x370(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
leaq -0x100(%rbp), %rsi
callq 0x3190
movl -0x3dc(%rbp), %esi
movq -0x3d8(%rbp), %rdx
andl $0x1, %esi
leaq -0x350(%rbp), %rdi
callq 0x3fa0
movl %eax, -0x3cc(%rbp)
jmp 0x3be6
movl -0x3cc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x31a0
leaq -0x350(%rbp), %rdi
callq 0x31a0
movl $0x1, -0x104(%rbp)
jmp 0x3c3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x98(%rbp)
movl %eax, -0x9c(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x31a0
leaq -0x350(%rbp), %rdi
callq 0x31a0
jmp 0x3c78
leaq -0x100(%rbp), %rdi
callq 0x31a0
leaq -0xe0(%rbp), %rdi
callq 0x31a0
leaq -0xc0(%rbp), %rdi
callq 0x31a0
leaq -0x60(%rbp), %rdi
callq 0x5330
movl -0x4(%rbp), %eax
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbp
retq
leaq -0x100(%rbp), %rdi
callq 0x31a0
leaq -0xe0(%rbp), %rdi
callq 0x31a0
leaq -0xc0(%rbp), %rdi
callq 0x31a0
leaq -0x60(%rbp), %rdi
callq 0x5330
movq -0x98(%rbp), %rdi
callq 0x3440
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)