// File: /workspace/github_cpp_makefile_star2_O3/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 0x3c70
cmpl $0x9, %ebp
jne 0x3d84
movq 0x8(%rbx), %rsi
leaq 0x70(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x411e
movq 0x10(%rbx), %rsi
leaq 0x50(%rsp), %rdi
leaq 0x90(%rsp), %rdx
callq 0x411e
movq 0x18(%rbx), %rsi
leaq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x411e
movq 0x20(%rbx), %rdi
callq 0x2250
movsd %xmm0, 0x10(%rsp)
movq 0x28(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x411e
xorpd %xmm0, %xmm0
ucomisd 0x10(%rsp), %xmm0
ja 0x3ced
movsd 0x10(%rsp), %xmm0
ucomisd 0x123cd(%rip), %xmm0    # 0x160b8
jbe 0x3d50
movq 0x182dc(%rip), %r14     # 0x1bfd0
leaq 0x1271a(%rip), %rsi     # 0x16415
movl $0x27, %edx
movq %r14, %rdi
callq 0x2220
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq 0x182aa(%rip), %rdi     # 0x1bfd0
callq 0x2040
movq %rax, %rdi
callq 0x2140
movsd 0x1237d(%rip), %xmm0    # 0x160b8
movapd %xmm0, %xmm1
cmpltsd 0x10(%rsp), %xmm1
andpd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
cmpl $0x9, %ebp
jne 0x3dca
movq 0x30(%rbx), %rdi
callq 0x2250
movsd %xmm0, 0x28(%rsp)
movq 0x38(%rbx), %rdi
callq 0x2250
movsd %xmm0, 0x20(%rsp)
movq 0x40(%rbx), %rdi
callq 0x2250
movsd %xmm0, 0x18(%rsp)
jmp 0x3df4
movq 0x18245(%rip), %r14     # 0x1bfd0
leaq 0x1263e(%rip), %rsi     # 0x163d0
movl $0x7, %edx
movq %r14, %rdi
callq 0x2220
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x4025
movq %rbx, %rdi
callq 0x20d0
movq 0x18216(%rip), %rdi     # 0x1bfd0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2220
jmp 0x403d
movsd 0x122ee(%rip), %xmm0    # 0x160c0
movsd %xmm0, 0x18(%rsp)
movsd 0x122d8(%rip), %xmm0    # 0x160b8
movsd %xmm0, 0x20(%rsp)
movsd 0x122da(%rip), %xmm0    # 0x160c8
movsd %xmm0, 0x28(%rsp)
movq 0x181d5(%rip), %rdi     # 0x1bfd0
leaq 0x1263b(%rip), %rsi     # 0x1643d
movl $0x9, %edx
callq 0x2220
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
movq 0x181b3(%rip), %rdi     # 0x1bfd0
callq 0x2220
movq %rax, %rbx
leaq 0x1261b(%rip), %rsi     # 0x16447
movl $0x6, %edx
movq %rax, %rdi
callq 0x2220
movq 0x50(%rsp), %rsi
movq 0x58(%rsp), %rdx
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
leaq 0x125f9(%rip), %rsi     # 0x1644e
movl $0xd, %edx
movq %rax, %rdi
callq 0x2220
movq %rbx, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x2300
movq %rax, %rbx
leaq 0x125e2(%rip), %rsi     # 0x1645c
movl $0xd, %edx
movq %rax, %rdi
callq 0x2220
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbx, %rdi
callq 0x2220
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movq 0x18106(%rip), %rdi     # 0x1bfd0
leaq 0x12599(%rip), %rsi     # 0x1646a
movl $0x17, %edx
callq 0x2220
movq 0x180ee(%rip), %rdi     # 0x1bfd0
movsd 0x28(%rsp), %xmm0
callq 0x2300
movq %rax, %rbx
leaq 0x1258b(%rip), %rsi     # 0x16482
movl $0x6, %edx
movq %rax, %rdi
callq 0x2220
movq %rbx, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x2300
movq %rax, %rbx
leaq 0x1256d(%rip), %rsi     # 0x16489
movl $0x6, %edx
movq %rax, %rdi
callq 0x2220
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x2300
movq %rax, %rbx
leaq 0x1254f(%rip), %rsi     # 0x16490
movl $0x2, %edx
movq %rax, %rdi
callq 0x2220
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
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 0x3923
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3fc4
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3fe5
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4000
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4021
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
xorl %eax, %eax
jmp 0x407d
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2350
leaq 0x12394(%rip), %rsi     # 0x163d8
movl $0x3c, %edx
movq %r14, %rdi
callq 0x2220
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2140
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
jmp 0x40b8
movq %rax, %rbx
jmp 0x40d9
movq %rax, %rbx
jmp 0x40f4
jmp 0x409a
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40b8
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0xa0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40d9
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40f4
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x21d0
leaq 0x80(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4115
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2390
nop