// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x328, %rsp            # imm = 0x328
movq %rsi, %rbx
movl %edi, %r14d
xorps %xmm0, %xmm0
leaq -0x80(%rbp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x3d1c
cmpl $0x2, %r14d
jl 0x249e
movl %r14d, %r13d
movl $0x1, %r15d
leaq -0x338(%rbp), %r14
leaq -0x80(%rbp), %r12
movq (%rbx,%r15,8), %rsi
testq %rsi, %rsi
je 0x249e
movq %r14, %rdi
leaq -0xe0(%rbp), %rdx
callq 0x20b0
movq %r12, %rdi
movq %r14, %rsi
callq 0x4152
movq -0x338(%rbp), %rdi
leaq -0x328(%rbp), %rax
cmpq %rax, %rdi
je 0x2496
movq -0x328(%rbp), %rsi
incq %rsi
callq 0x2180
incq %r15
cmpq %r15, %r13
jne 0x2451
movq -0x38(%rbp), %rax
movq %rax, %rcx
subq -0x58(%rbp), %rcx
shrq $0x3, %rcx
cmpq $0x1, %rax
adcq $-0x1, %rcx
movq -0x50(%rbp), %rax
subq -0x48(%rbp), %rax
shlq $0x4, %rcx
sarq $0x5, %rax
addq %rcx, %rax
movq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rcx
subq %rdi, %rcx
sarq $0x5, %rcx
addq %rax, %rcx
jne 0x24e1
xorl %r14d, %r14d
jmp 0x24f3
leaq 0x3b38(%rip), %rsi      # 0x6020
callq 0x2070
testl %eax, %eax
sete %r14b
testb %r14b, %r14b
je 0x2501
leaq -0x80(%rbp), %rdi
callq 0x2b2c
movq -0x38(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
cmpq $0x1, %rcx
adcq $-0x1, %rdx
shlq $0x4, %rdx
movq -0x50(%rbp), %rcx
subq -0x48(%rbp), %rcx
sarq $0x5, %rcx
movq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
sarq $0x5, %rsi
addq %rcx, %rsi
addq %rdx, %rsi
cmpq $0x2, %rsi
jb 0x259b
movq %rdi, %rcx
subq -0x68(%rbp), %rcx
sarq $0x5, %rcx
cmpq $0x10, %rcx
jb 0x2587
movq %rcx, %rdx
shrq $0x4, %rdx
movabsq $-0x1000000000000000, %rsi # imm = 0xF000000000000000
orq %rdx, %rsi
testq %rcx, %rcx
cmovgq %rdx, %rsi
movq %rsi, %rdx
shlq $0x4, %rdx
subq %rdx, %rcx
shlq $0x5, %rcx
addq (%rax,%rsi,8), %rcx
movq %rcx, %rdi
leaq 0x3a95(%rip), %rsi      # 0x6023
callq 0x2070
testl %eax, %eax
je 0x2794
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq -0x38(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, %rdx
subq %rax, %rdx
shrq $0x3, %rdx
cmpq $0x1, %rcx
adcq $-0x1, %rdx
shlq $0x4, %rdx
movq -0x50(%rbp), %rcx
subq -0x48(%rbp), %rcx
sarq $0x5, %rcx
movq -0x70(%rbp), %rdi
movq -0x60(%rbp), %rsi
subq %rdi, %rsi
sarq $0x5, %rsi
addq %rcx, %rsi
addq %rdx, %rsi
cmpq $0x4, %rsi
jne 0x2656
movq %rdi, %rdx
subq -0x68(%rbp), %rdx
sarq $0x5, %rdx
leaq 0x2(%rdx), %rcx
cmpq $0xf, %rcx
ja 0x2611
addq $0x40, %rdi
jmp 0x2642
movq %rcx, %rsi
shrq $0x4, %rsi
movabsq $-0x1000000000000000, %rdi # imm = 0xF000000000000000
orq %rsi, %rdi
cmpq $-0x1, %rdx
cmovgeq %rsi, %rdi
movq %rdi, %rdx
shlq $0x4, %rdx
subq %rdx, %rcx
shlq $0x5, %rcx
addq (%rax,%rdi,8), %rcx
movq %rcx, %rdi
leaq 0x39dd(%rip), %rsi      # 0x6026
callq 0x2070
testl %eax, %eax
je 0x27b3
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x90(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
cmpq $0x0, -0xd8(%rbp)
je 0x2701
movl -0x60(%rbp), %eax
movl -0x50(%rbp), %ecx
subl -0x48(%rbp), %ecx
subl -0x70(%rbp), %eax
shrl $0x5, %ecx
shrl $0x5, %eax
addl %ecx, %eax
testb $0x1, %al
jne 0x2701
cmpq $0x0, -0xb8(%rbp)
je 0x2964
movq -0xc0(%rbp), %rsi
leaq -0x338(%rbp), %rdi
movl $0xc, %edx
callq 0x2290
movq -0x338(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x318(%rbp,%rax)
je 0x288a
movq 0x6905(%rip), %rdi      # 0x8ff0
leaq 0x396f(%rip), %rsi      # 0x6061
movl $0x1b, %edx
callq 0x21c0
jmp 0x2919
movl $0x1, %ebx
movq 0x68e3(%rip), %rdi      # 0x8ff0
leaq 0x3915(%rip), %rsi      # 0x6029
movl $0x37, %edx
callq 0x21c0
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x2739
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2758
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2777
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x80(%rbp), %rdi
callq 0x3cce
movl %ebx, %eax
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
subq -0x68(%rbp), %rdx
sarq $0x5, %rdx
leaq 0x1(%rdx), %rax
cmpq $0xf, %rax
ja 0x27d5
addq $0x20, %rcx
jmp 0x2809
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
subq -0x68(%rbp), %rdx
sarq $0x5, %rdx
leaq 0x3(%rdx), %rax
cmpq $0xf, %rax
ja 0x282f
addq $0x60, %rcx
jmp 0x2864
movq %rax, %rcx
shrq $0x4, %rcx
movabsq $-0x1000000000000000, %rsi # imm = 0xF000000000000000
orq %rcx, %rsi
testq %rdx, %rdx
cmovnsq %rcx, %rsi
movq -0x58(%rbp), %rcx
movq %rsi, %rdx
shlq $0x4, %rdx
subq %rdx, %rax
shlq $0x5, %rax
addq (%rcx,%rsi,8), %rax
movq %rax, %rcx
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x3eb6
jmp 0x25b1
movq %rax, %rcx
shrq $0x4, %rcx
movabsq $-0x1000000000000000, %rsi # imm = 0xF000000000000000
orq %rcx, %rsi
cmpq $-0x2, %rdx
cmovgeq %rcx, %rsi
movq -0x58(%rbp), %rcx
movq %rsi, %rdx
shlq $0x4, %rdx
subq %rdx, %rax
shlq $0x5, %rax
addq (%rcx,%rsi,8), %rax
movq %rax, %rcx
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rcx), %rsi
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x3eb6
jmp 0x266c
movq -0x250(%rbp,%rax), %rcx
leaq -0xa0(%rbp), %rdi
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
movq $0x0, -0x130(%rbp)
movl $0xffffffff, -0x128(%rbp) # imm = 0xFFFFFFFF
movups -0x130(%rbp), %xmm0
movups %xmm0, (%rsp)
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x445a
movq -0x338(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x318(%rbp,%rax), %eax
testl %eax, %eax
sete %cl
andl $0x2, %eax
shrl %eax
orb %cl, %al
je 0x2901
leaq -0x338(%rbp), %rdi
callq 0x2040
xorl %ebx, %ebx
movb $0x1, %r12b
jmp 0x294f
movq 0x66e8(%rip), %rdi      # 0x8ff0
leaq 0x3771(%rip), %rsi      # 0x6080
movl $0x16, %edx
callq 0x21c0
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq 0x66c2(%rip), %rdi      # 0x8ff0
callq 0x21c0
leaq 0x3743(%rip), %rsi      # 0x607d
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
movl $0x1, %ebx
xorl %r12d, %r12d
leaq -0x338(%rbp), %rdi
callq 0x2050
testb %r12b, %r12b
je 0x271e
leaq -0x110(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xe0(%rbp), %rsi
movq -0xd8(%rbp), %rdx
addq %rsi, %rdx
leaq -0x120(%rbp), %rdi
callq 0x3eb6
leaq -0xf0(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0xa0(%rbp), %rax
cmpq %r15, %rax
je 0x29bb
movq %rax, -0x100(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x29c4
movups (%r15), %xmm0
movups %xmm0, (%r13)
movq -0x98(%rbp), %rax
leaq -0x100(%rbp), %rdx
movq %rax, 0x8(%rdx)
movq %r15, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
movb $0x0, -0x90(%rbp)
movzbl %r14b, %esi
leaq -0x120(%rbp), %rdi
callq 0x2b78
movl %eax, %ebx
movq -0x100(%rbp), %rdi
cmpq %r13, %rdi
je 0x2a1c
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x120(%rbp), %rdi
cmpq %r12, %rdi
je 0x271e
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x271e
movq %rax, %rbx
jmp 0x2ad8
jmp 0x2b18
jmp 0x2a9b
movq %rax, %rbx
movq -0x100(%rbp), %rdi
cmpq %r13, %rdi
je 0x2a6d
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x120(%rbp), %rdi
cmpq %r12, %rdi
je 0x2a9e
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2a9e
movq %rax, %rbx
leaq -0x338(%rbp), %rdi
callq 0x2050
jmp 0x2a9e
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r15, %rdi
je 0x2ab9
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ad8
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b1b
movq -0xd0(%rbp), %rsi
jmp 0x2b0e
movq %rax, %rbx
movq -0x338(%rbp), %rdi
leaq -0x328(%rbp), %rax
cmpq %rax, %rdi
je 0x2b1b
movq -0x328(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2b1b
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3cce
movq %rbx, %rdi
callq 0x2270