// File: wcochran[P]pano_to_cube/pano2cube.cpp
// Function: main
int main(int argc, char *argv[]) {
  if (argc != 3) {
    std::cerr << "usage: " << argv[0] << " pano.ppm cube.ppm" << std::endl;
    exit(1);
  }

  try {
    PPM inImage(argv[1]);
    PPM outImage(inImage.W, inImage.H);
    cylindricalPanoramaToCube(inImage, outImage);
    outImage.write(argv[2]);
  } catch (BogusPPM &e) {
    std::cerr << e.what() << std::endl;
    exit(2);
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x28e9
movq 0x674a(%rip), %rdi      # 0x8ff0
leaq 0x379b(%rip), %rsi      # 0x6048
callq 0x21e0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x21e0
movq %rax, %rdi
leaq 0x3785(%rip), %rsi      # 0x6050
callq 0x21e0
movq %rax, %rdi
movq 0x66ee(%rip), %rsi      # 0x8fc8
callq 0x2220
movl $0x1, %edi
callq 0x2280
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xc8(%rbp)
leaq -0x51(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x2350
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x2b60
jmp 0x2921
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3a30
jmp 0x2930
leaq -0x50(%rbp), %rdi
callq 0x2110
leaq -0x51(%rbp), %rdi
callq 0x2240
movl -0x30(%rbp), %esi
movl -0x2c(%rbp), %edx
leaq -0x88(%rbp), %rdi
callq 0x2c10
jmp 0x2956
leaq -0x30(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x2540
jmp 0x2968
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xd8(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x2350
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x2b60
jmp 0x29a6
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x42c0
jmp 0x29bb
leaq -0xa8(%rbp), %rdi
callq 0x2110
leaq -0xa9(%rbp), %rdi
callq 0x2240
leaq -0x88(%rbp), %rdi
callq 0x2d00
leaq -0x30(%rbp), %rdi
callq 0x2d00
jmp 0x2af6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2a10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x2110
leaq -0x51(%rbp), %rdi
callq 0x2240
jmp 0x2a7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2a75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2a69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0x2a5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x2110
leaq -0xa9(%rbp), %rdi
callq 0x2240
leaq -0x88(%rbp), %rdi
callq 0x2d00
leaq -0x30(%rbp), %rdi
callq 0x2d00
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x2b01
movq -0x60(%rbp), %rdi
callq 0x20a0
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, %rsi
movq 0x653c(%rip), %rdi      # 0x8ff0
callq 0x21e0
movq %rax, -0xe0(%rbp)
jmp 0x2ac2
movq -0xe0(%rbp), %rdi
movq 0x64f8(%rip), %rsi      # 0x8fc8
callq 0x2220
jmp 0x2ad7
movl $0x2, %edi
callq 0x2280
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
callq 0x2310
jmp 0x2af4
jmp 0x2b01
xorl %eax, %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x2330
movq %rax, %rdi
callq 0x2d20
nopw %cs:(%rax,%rax)
nopl (%rax)