// File: /workspace/github_c_makefile_star2_O3/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 0x3d34
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 0x4184
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
je 0x24ec
leaq 0x3b21(%rip), %rsi      # 0x6004
callq 0x2070
testl %eax, %eax
je 0x2552
xorl %ebx, %ebx
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 0x258c
movq %rdi, %rdx
subq -0x68(%rbp), %rdx
movq %rdx, %rcx
sarq $0x5, %rcx
js 0x255f
cmpq $0x10, %rcx
jb 0x2578
movq %rcx, %rdx
shrq $0x4, %rdx
jmp 0x2563
leaq -0x80(%rbp), %rdi
callq 0x2b1a
movb $0x1, %bl
jmp 0x24ee
sarq $0x9, %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
subq %rsi, %rcx
shlq $0x5, %rcx
addq (%rax,%rdx,8), %rcx
movq %rcx, %rdi
leaq 0x3a88(%rip), %rsi      # 0x6007
callq 0x2070
testl %eax, %eax
je 0x2618
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), %rsi
subq -0x48(%rbp), %rsi
sarq $0x5, %rsi
movq -0x70(%rbp), %rcx
movq -0x60(%rbp), %rdi
subq %rcx, %rdi
sarq $0x5, %rdi
addq %rsi, %rdi
addq %rdx, %rdi
cmpq $0x4, %rdi
jne 0x267c
movq %rcx, %rdx
subq -0x68(%rbp), %rdx
sarq $0x5, %rdx
leaq 0x2(%rdx), %rdi
cmpq $-0x2, %rdx
jl 0x260f
cmpq $0xf, %rdi
ja 0x264f
addq $0x40, %rcx
movq %rcx, %rdi
jmp 0x2668
movq %rdi, %rcx
sarq $0x4, %rcx
jmp 0x2656
movq -0x70(%rbp), %rdx
movq %rdx, %rsi
subq -0x68(%rbp), %rsi
movq -0x58(%rbp), %rcx
sarq $0x5, %rsi
leaq 0x1(%rsi), %rax
cmpq $-0x1, %rsi
jl 0x27e3
cmpq $0xf, %rax
ja 0x2956
addq $0x20, %rdx
movq %rdx, %rax
jmp 0x296f
movq %rdi, %rcx
shrq $0x4, %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
subq %rdx, %rdi
shlq $0x5, %rdi
addq (%rax,%rcx,8), %rdi
leaq 0x399b(%rip), %rsi      # 0x600a
callq 0x2070
testl %eax, %eax
je 0x27b0
leaq -0xb0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
movq -0xd8(%rbp), %rdx
testq %rdx, %rdx
je 0x271d
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 0x271d
cmpq $0x0, -0xb8(%rbp)
je 0x2882
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 0x27fb
movl $0x1b, %edx
leaq 0x392d(%rip), %rsi      # 0x6045
jmp 0x29e0
movl $0x1, %ebx
movq 0x68c7(%rip), %rdi      # 0x8ff0
leaq 0x38dd(%rip), %rsi      # 0x600d
movl $0x37, %edx
callq 0x21c0
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2755
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2774
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2793
movq -0xd0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x80(%rbp), %rdi
callq 0x3ce6
movl %ebx, %eax
addq $0x328, %rsp            # imm = 0x328
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x70(%rbp), %rdx
movq %rdx, %rsi
subq -0x68(%rbp), %rsi
movq -0x58(%rbp), %rcx
sarq $0x5, %rsi
leaq 0x3(%rsi), %rax
cmpq $-0x3, %rsi
jl 0x27ef
cmpq $0xf, %rax
ja 0x2995
addq $0x60, %rdx
movq %rdx, %rax
jmp 0x29ae
movq %rax, %rdx
sarq $0x4, %rdx
jmp 0x295d
movq %rax, %rdx
sarq $0x4, %rdx
jmp 0x299c
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 0x448c
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 0x29d4
leaq -0x338(%rbp), %rdi
callq 0x2040
leaq -0x338(%rbp), %rdi
callq 0x2050
movq -0xd8(%rbp), %rdx
leaq -0x110(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0xe0(%rbp), %rsi
addq %rsi, %rdx
leaq -0x120(%rbp), %rdi
callq 0x3ece
leaq -0xf0(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xa0(%rbp), %rax
cmpq %r14, %rax
je 0x28d2
movq %rax, -0x100(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0xf0(%rbp)
jmp 0x28db
movups (%r14), %xmm0
movups %xmm0, (%r12)
movq -0x98(%rbp), %rax
leaq -0x100(%rbp), %rdx
movq %rax, 0x8(%rdx)
movq %r14, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
movb $0x0, -0x90(%rbp)
movzbl %bl, %esi
leaq -0x120(%rbp), %rdi
callq 0x2b6c
movl %eax, %ebx
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x2932
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x120(%rbp), %rdi
cmpq %r15, %rdi
je 0x273a
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x273a
movq %rax, %rdx
shrq $0x4, %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
subq %rsi, %rax
shlq $0x5, %rax
addq (%rcx,%rdx,8), %rax
leaq -0xd0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x3ece
jmp 0x25a2
movq %rax, %rdx
shrq $0x4, %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
subq %rsi, %rax
shlq $0x5, %rax
addq (%rcx,%rdx,8), %rax
leaq -0xb0(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x3ece
jmp 0x2692
movl $0x16, %edx
leaq 0x3684(%rip), %rsi      # 0x6064
movq 0x6609(%rip), %rdi      # 0x8ff0
callq 0x21c0
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq 0x65ef(%rip), %rdi      # 0x8ff0
callq 0x21c0
leaq 0x3654(%rip), %rsi      # 0x6061
movl $0x2, %edx
movq %rax, %rdi
callq 0x21c0
leaq -0x338(%rbp), %rdi
callq 0x2050
movl $0x1, %ebx
jmp 0x273a
movq %rax, %rbx
movq -0x100(%rbp), %rdi
cmpq %r12, %rdi
je 0x2a4e
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x120(%rbp), %rdi
cmpq %r15, %rdi
je 0x2a8b
movq -0x110(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2a8b
movq %rax, %rbx
jmp 0x2ac5
jmp 0x2b05
jmp 0x2a88
movq %rax, %rbx
leaq -0x338(%rbp), %rdi
callq 0x2050
jmp 0x2a8b
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x2aa6
movq -0x90(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ac5
movq -0xb0(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xd0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b08
movq -0xd0(%rbp), %rsi
jmp 0x2afb
movq %rax, %rbx
movq -0x338(%rbp), %rdi
leaq -0x328(%rbp), %rax
cmpq %rax, %rdi
je 0x2b08
movq -0x328(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x2b08
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x3ce6
movq %rbx, %rdi
callq 0x2270
nop