// File: /workspace/github_cpp_makefile_star2_O2/srajangarg[P]raytracer/src/main.cpp
// Function: main
int
main(int argc, char ** argv)
{
  if (argc < 3)
  {
    std::cout << "Usage: " << argv[0] << " scene.scd output.png [max_trace_depth]" << std::endl;
    return -1;
  }

  if (argc >= 4)
    max_trace_depth = atoi(argv[3]);
  if (argc >= 5)
    smooth_normals = (atoi(argv[4]) == 1);

  cout << "Max trace depth = " << max_trace_depth << endl;
  if (smooth_normals)
    cout << "Using smooth normals for triangle meshes" << endl;

  // Load the scene from the disk file
  scene = new Scene(argv[1]);

  // Setup the world object, containing the data from the scene
  world = new World();
  importSceneToWorld(scene->getRoot(), identity3D(), 0);
  world->printStats();

  // Set up the output framebuffer
  frame = new Frame(IMAGE_WIDTH, IMAGE_HEIGHT);

  // Render the world
  renderWithRaytracing();

  // Save the output to an image file
  frame->save(argv[2]);
  std::cout << "Image saved!" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
cmpl $0x2, %edi
jg 0x200ce
movq 0xef38(%rip), %rdi      # 0x2efd0
leaq 0x3404(%rip), %rsi      # 0x234a3
callq 0x4300
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x4300
leaq 0x33f5(%rip), %rsi      # 0x234ab
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4190
pushq $-0x1
popq %rax
jmp 0x20246
movl %edi, %ebp
cmpl $0x3, %edi
je 0x200fc
movq 0x18(%rbx), %rdi
callq 0x44e0
movl %eax, 0xf2cc(%rip)      # 0x2f3b0
cmpl $0x5, %ebp
jb 0x200fc
movq 0x20(%rbx), %rdi
callq 0x44e0
cmpl $0x1, %eax
sete 0xf4e4(%rip)            # 0x2f5e0
movq 0xeecd(%rip), %rdi      # 0x2efd0
leaq 0x33c9(%rip), %rsi      # 0x234d3
callq 0x4300
movl 0xf29b(%rip), %esi      # 0x2f3b0
movq %rax, %rdi
callq 0x4590
movq %rax, %rdi
callq 0x4190
cmpb $0x1, 0xf4b4(%rip)      # 0x2f5e0
jne 0x20149
movq 0xee9b(%rip), %rdi      # 0x2efd0
leaq 0x33aa(%rip), %rsi      # 0x234e6
callq 0x4300
movq %rax, %rdi
callq 0x4190
pushq $0x10
popq %rdi
callq 0x4320
movq %rax, %r14
movq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x9c50
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x561e
movq %r14, 0xf3c5(%rip)      # 0x2f540
leaq 0x8(%rsp), %rdi
callq 0x4170
pushq $0x70
popq %rdi
callq 0x4320
movq %rax, %r14
movq %rax, %rdi
callq 0x1ea50
movq %r14, 0xf3a9(%rip)      # 0x2f548
movq 0xf39a(%rip), %rax      # 0x2f540
movq (%rax), %r14
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x6138
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x1f874
movq 0xf37e(%rip), %rdi      # 0x2f548
callq 0x1eb78
pushq $0x20
popq %rdi
callq 0x4320
movq %rax, %r14
movq %rax, %rdi
movl $0x200, %esi            # imm = 0x200
movl $0x200, %edx            # imm = 0x200
callq 0x1cb60
movq %r14, 0xf3e5(%rip)      # 0x2f5d8
callq 0x1f6c6
movq 0xf3d9(%rip), %r14      # 0x2f5d8
movq 0x10(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x9c50
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x1cc60
leaq 0x8(%rsp), %rdi
callq 0x4170
movq 0xeda0(%rip), %rdi      # 0x2efd0
leaq 0x32d8(%rip), %rsi      # 0x2350f
callq 0x4300
movq %rax, %rdi
callq 0x4190
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4170
jmp 0x20293
movq %rax, %rbx
jmp 0x20293
movq %rax, %rbx
pushq $0x20
jmp 0x2028a
movq %rax, %rbx
pushq $0x70
jmp 0x2028a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4170
jmp 0x20288
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x4330
movq %rbx, %rdi
callq 0x45c0
nop