// File: /workspace/github_cpp_makefile_star2_O3/Lut99[P]RayTracer/src/lib/Camera.cpp
// Function: RayTracer::Camera::recompute()
void Camera::recompute() {
    double ratio = (double) this->width / (double) this->height;
    double focus_dist = (this->lookfrom - this->lookat).length();
    this->lens_radius = this->aperture / 2;

    double theta = this->vfov * M_PI / 180;
    double half_height = tan(theta/2);
    double half_width = ratio * half_height;

    this->origin = this->lookfrom;
    this->w = (this->lookfrom - this->lookat).normalize();
    this->u = cross(this->up, this->w).normalize();
    this->v = cross(this->w, this->u);

    this->lower_left_corner = this->origin - half_width * focus_dist * this->u - half_height * focus_dist *  this->v - focus_dist * this->w;
    this->horizontal = 2 * half_width * focus_dist * this->u;
    this->vertical = 2 * half_height * focus_dist * this->v;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
cvtdq2pd 0x8(%rdi), %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
leaq 0x20(%rdi), %r14
leaq 0x40(%rdi), %r15
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x72b05
movq %r12, %rdi
callq 0x72322
movsd 0x9f2c(%rip), %xmm2     # 0x83020
movsd 0x88(%rbx), %xmm1
mulsd %xmm2, %xmm1
movsd %xmm1, 0x170(%rbx)
movsd 0x80(%rbx), %xmm1
mulsd 0x11600(%rip), %xmm1    # 0x8a718
movsd %xmm0, (%rsp)
divsd 0x115fb(%rip), %xmm1    # 0x8a720
mulsd %xmm2, %xmm1
movapd %xmm1, %xmm0
callq 0x3a270
movapd %xmm0, %xmm1
movsd %xmm0, 0x8(%rsp)
movapd 0x10(%rsp), %xmm0
mulsd %xmm1, %xmm0
movapd %xmm0, 0x10(%rsp)
leaq 0xf0(%rbx), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x71ec8
leaq 0x48(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x72b05
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x7237a
leaq 0x130(%rbx), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x71ec8
leaq 0x60(%rbx), %rsi
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %r12, %rdx
callq 0x72cd0
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x7237a
leaq 0x110(%rbx), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0x71ec8
leaq 0x28(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x72cd0
leaq 0x150(%rbx), %r14
movq %r14, %rdi
movq %rbp, %rsi
callq 0x71ec8
movsd (%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
leaq 0xc8(%rsp), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x72bef
leaq 0x68(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x72b05
movsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
leaq 0xa8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x72bef
leaq 0x48(%rsp), %r13
movq %r13, %rdi
leaq 0x68(%rsp), %rsi
movq %rbp, %rdx
callq 0x72b05
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
movsd (%rsp), %xmm0
movq %r12, %rsi
callq 0x72bef
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x72b05
leaq 0x90(%rbx), %rdi
movq %r12, %rsi
callq 0x71ec8
movapd 0x10(%rsp), %xmm0
addsd %xmm0, %xmm0
mulsd (%rsp), %xmm0
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x72bef
leaq 0xb0(%rbx), %rdi
movq %r12, %rsi
callq 0x71ec8
movsd 0x8(%rsp), %xmm0
addsd %xmm0, %xmm0
mulsd (%rsp), %xmm0
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x72bef
addq $0xd0, %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x71ec8
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq