// File: /workspace/github_cpp_makefile_star2_O1/srajangarg[P]image-morph/src/morph.cpp
// Function: main
int
main(int argc, char * argv[])
{
  if (argc != 6 && argc != 9)
  {
    std::cout << "Usage: " << argv[0] << " image1 image2 segments_file time[0..1] output.png [a  b  p]" << std::endl;
    return -1;
  }

  std::string img1_path  =  argv[1];
  std::string img2_path  =  argv[2];
  std::string seg_path   =  argv[3];
  double t               =  std::atof(argv[4]);
  std::string out_path   =  argv[5];

  // sanity checks
  if (t < 0.0 || t > 1.0)
  {
    std::cout << "Time t out of range: clamping to [0..1]" << std::endl;
    if (t > 1.0)
      t = 1.0;
    else
      t = 0.0;
  }

  double a = 0.5;
  double b = 1;
  double p = 0.2;
  if (argc == 9)
  {
    a = std::atof(argv[6]);
    b = std::atof(argv[7]);
    p = std::atof(argv[8]);
  }

  std::cout << "Morphing " << img1_path << " into " << img2_path << " at time t = " << t << ", generating " << out_path
            << std::endl;
  std::cout << "Using parameters { a : " << a << ", b : " << b << ", p : " << p << " }" << std::endl;

  morphDriver(img1_path, img2_path, seg_path, t, out_path, a, b, p);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
movq %rsi, %rbx
movl %edi, %ebp
cmpl $0x6, %edi
je 0x3e80
cmpl $0x9, %ebp
jne 0x3f94
movq 0x8(%rbx), %rsi
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x432e
movq 0x10(%rbx), %rsi
leaq 0x50(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x432e
movq 0x18(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x432e
movq 0x20(%rbx), %rdi
callq 0x2270
movsd %xmm0, 0x10(%rsp)
movq 0x28(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x432e
xorpd %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x3efd
movsd 0x10(%rsp), %xmm0
ucomisd 0x121bd(%rip), %xmm0    # 0x160b8
jbe 0x3f60
movq 0x180cc(%rip), %r14     # 0x1bfd0
leaq 0x1250a(%rip), %rsi     # 0x16415
movl $0x27, %edx
movq %r14, %rdi
callq 0x2240
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x1809a(%rip), %rdi     # 0x1bfd0
callq 0x2040
movq %rax, %rdi
callq 0x2150
movsd 0x1216d(%rip), %xmm0    # 0x160b8
movapd %xmm0, %xmm1
cmpltsd 0x10(%rsp), %xmm1
andpd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
cmpl $0x9, %ebp
jne 0x3fda
movq 0x30(%rbx), %rdi
callq 0x2270
movsd %xmm0, 0x28(%rsp)
movq 0x38(%rbx), %rdi
callq 0x2270
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rbx), %rdi
callq 0x2270
movsd %xmm0, 0x18(%rsp)
jmp 0x4004
movq 0x18035(%rip), %r14     # 0x1bfd0
leaq 0x1242e(%rip), %rsi     # 0x163d0
movl $0x7, %edx
movq %r14, %rdi
callq 0x2240
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4235
movq %rbx, %rdi
callq 0x20d0
movq 0x18006(%rip), %rdi     # 0x1bfd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2240
jmp 0x424d
movsd 0x120de(%rip), %xmm0    # 0x160c0
movsd %xmm0, 0x18(%rsp)
movsd 0x120c8(%rip), %xmm0    # 0x160b8
movsd %xmm0, 0x20(%rsp)
movsd 0x120ca(%rip), %xmm0    # 0x160c8
movsd %xmm0, 0x28(%rsp)
movq 0x17fc5(%rip), %rdi     # 0x1bfd0
leaq 0x1242b(%rip), %rsi     # 0x1643d
movl $0x9, %edx
callq 0x2240
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x17fa3(%rip), %rdi     # 0x1bfd0
callq 0x2240
movq %rax, %rbx
leaq 0x1240b(%rip), %rsi     # 0x16447
movl $0x6, %edx
movq %rax, %rdi
callq 0x2240
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
leaq 0x123e9(%rip), %rsi     # 0x1644e
movl $0xd, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x2320
movq %rax, %rbx
leaq 0x123d2(%rip), %rsi     # 0x1645c
movl $0xd, %edx
movq %rax, %rdi
callq 0x2240
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x2240
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq 0x17ef6(%rip), %rdi     # 0x1bfd0
leaq 0x12389(%rip), %rsi     # 0x1646a
movl $0x17, %edx
callq 0x2240
movq 0x17ede(%rip), %rdi     # 0x1bfd0
movsd 0x28(%rsp), %xmm0
callq 0x2320
movq %rax, %rbx
leaq 0x1237b(%rip), %rsi     # 0x16482
movl $0x6, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x2320
movq %rax, %rbx
leaq 0x1235d(%rip), %rsi     # 0x16489
movl $0x6, %edx
movq %rax, %rdi
callq 0x2240
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x2320
movq %rax, %rbx
leaq 0x1233f(%rip), %rsi     # 0x16490
movl $0x2, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x30(%rsp), %rcx
movsd 0x10(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
movsd 0x18(%rsp), %xmm3
callq 0x3b33
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41d4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41f5
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4210
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4231
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21f0
xorl %eax, %eax
jmp 0x428d
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2370
leaq 0x12184(%rip), %rsi     # 0x163d8
movl $0x3c, %edx
movq %r14, %rdi
callq 0x2240
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
jmp 0x42c8
movq %rax, %rbx
jmp 0x42e9
movq %rax, %rbx
jmp 0x4304
jmp 0x42aa
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x42c8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x42e9
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4304
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21f0
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4325
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21f0
movq %rbx, %rdi
callq 0x23b0
nop