// File: IsaacLaw12[P]RayTracer/./src/RenderImage.cpp
// Function: RenderImage::render_tile(image_tile)
void RenderImage::render_tile(image_tile img_t){
    Eigen::Vector3d ray_pt, ray_dir, color, ampl;
    Ray ray;
    double t_value = 0;
    for (int i=img_t.x; i<img_t.x + img_t.x_len; i++){
        for (int j=img_t.y; j<img_t.y + img_t.y_len; j++){
            ray_pt = scene->get_camera().get_pixel_position(i, j);
            ray_dir = (ray_pt - scene->get_camera().get_eye()).normalized();
            ray = Ray(ray_pt, ray_dir);
            color << 0,0,0;
            ampl << 1,1,1;
            ray_trace(ray, color, ampl, scene->get_recursion(), t_value);
            scene->get_image().write_pixel(i, j, color);
            scene->get_image().write_t_value(i, j, t_value);
        }
     }
}

// Assembly:
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rsi, 0x298(%rsp)
movq %rdx, 0x2a0(%rsp)
movq %rdi, 0x290(%rsp)
movq 0x290(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0x278(%rsp), %rdi
callq 0x11e20
leaq 0x260(%rsp), %rdi
callq 0x11e20
leaq 0x248(%rsp), %rdi
callq 0x11e20
leaq 0x230(%rsp), %rdi
callq 0x11e20
leaq 0x1f8(%rsp), %rdi
callq 0x5ca20
xorps %xmm0, %xmm0
movsd %xmm0, 0x1f0(%rsp)
movl 0x298(%rsp), %eax
movl %eax, 0x1ec(%rsp)
movl 0x1ec(%rsp), %eax
movl 0x298(%rsp), %ecx
addl 0x2a0(%rsp), %ecx
cmpl %ecx, %eax
jge 0x30a44
movl 0x29c(%rsp), %eax
movl %eax, 0x1e8(%rsp)
movl 0x1e8(%rsp), %eax
movl 0x29c(%rsp), %ecx
addl 0x2a4(%rsp), %ecx
cmpl %ecx, %eax
jge 0x30a2c
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x3f610
movq %rax, %rsi
movl 0x1ec(%rsp), %edx
movl 0x1e8(%rsp), %ecx
leaq 0x1d0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x9a20
movq 0x28(%rsp), %rsi
leaq 0x278(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x9d10
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x3f610
movq %rax, %rsi
leaq 0x188(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x9bd0
movq 0x30(%rsp), %rdx
movq 0x48(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x9e80
movq 0x38(%rsp), %rsi
leaq 0x1b8(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x9ef0
movq 0x40(%rsp), %rsi
leaq 0x260(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x9e50
movq 0x48(%rsp), %rsi
leaq 0x138(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0xa4f0
movq 0x50(%rsp), %rsi
leaq 0x120(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0xa4f0
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
leaq 0x150(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x5ca90
movq 0x68(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0x31a80
movq $0x0, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
movq %rdi, 0x70(%rsp)
leaq 0x248(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0x11f20
movq 0x70(%rsp), %rdi
movq $0x0, 0xf0(%rsp)
leaq 0xf0(%rsp), %rsi
callq 0x11f60
movq %rax, 0x78(%rsp)
jmp 0x3084a
movq 0x78(%rsp), %rdi
movq $0x0, 0xd8(%rsp)
leaq 0xd8(%rsp), %rsi
callq 0x11f60
jmp 0x3086a
leaq 0x100(%rsp), %rdi
callq 0x120e0
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsp)
movq %rax, 0xb0(%rsp)
leaq 0xb8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
leaq 0x230(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x11f20
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdi
movq %rax, 0xa8(%rsp)
leaq 0xa8(%rsp), %rsi
callq 0x11f60
movq %rax, 0x20(%rsp)
jmp 0x308d6
movq 0x20(%rsp), %rdi
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xa0(%rsp)
leaq 0xa0(%rsp), %rsi
callq 0x11f60
jmp 0x308fc
leaq 0xb8(%rsp), %rdi
callq 0x120e0
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x3f660
movq 0x80(%rsp), %rdi
movl %eax, %r8d
leaq 0x1f8(%rsp), %rsi
leaq 0x248(%rsp), %rdx
leaq 0x230(%rsp), %rcx
leaq 0x1f0(%rsp), %r9
callq 0x30a60
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x3f620
movq %rax, (%rsp)
movl 0x1ec(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x1e8(%rsp), %eax
movl %eax, 0xc(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0xa4f0
movq (%rsp), %rdi
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
leaq 0x88(%rsp), %rcx
callq 0x50e0
movq 0x80(%rsp), %rax
movq (%rax), %rdi
callq 0x3f620
movq %rax, %rdi
movl 0x1ec(%rsp), %esi
movl 0x1e8(%rsp), %edx
movsd 0x1f0(%rsp), %xmm0
callq 0x51c0
movl 0x1e8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e8(%rsp)
jmp 0x306c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x120e0
jmp 0x30a4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x120e0
jmp 0x30a4c
jmp 0x30a2e
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0x3069a
addq $0x2a8, %rsp            # imm = 0x2A8
retq
movq 0xe8(%rsp), %rdi
callq 0x45e0
nopl (%rax)