// File: /workspace/github_cpp_makefile_star2_O1/2TallTim[P]modern-raytracing/raytrace.cpp
// Function: color(ray const&, std::shared_ptr<hitable>, int)
vec3 color(const ray &r, hitable::Ptr world, int depth = 0)
{
    hit_record rec;
    if(world->hit(r, 0.001, MAXFLOAT, rec)){
        ray scattered;
        vec3 attenuation;
        vec3 emitted = rec.mat_ptr->emitted();
        if (depth < 5 && rec.mat_ptr->scatter(r, rec, attenuation, scattered)) {
            return emitted + attenuation * color(scattered, world, depth+1);
        }else{
            return emitted;
        }
    } else {
        vec3 unit_direction = unit_vector(r.direction());
        double t = 0.5 * (unit_direction.y() + 1.0);
        return (1.0 - t) * vec3(1.0, 1.0, 1.0) + t * vec3(0.5, 0.7, 1.0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rdx
movups %xmm0, 0x38(%rdx)
movups %xmm0, 0x28(%rdx)
movups %xmm0, 0x18(%rdx)
movups %xmm0, 0x8(%rdx)
movq (%r14), %rdi
movq (%rdi), %rax
movsd 0x5d97(%rip), %xmm0     # 0xa0d8
movsd 0x5d97(%rip), %xmm1     # 0xa0e0
callq *(%rax)
testb %al, %al
je 0x43e5
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0xc8(%rsp), %rsi
movq (%rsi), %rax
leaq 0x30(%rsp), %rdi
callq *0x8(%rax)
cmpl $0x4, %ebp
jg 0x441f
leaq 0x90(%rsp), %rdx
movq 0x38(%rdx), %rdi
movq (%rdi), %rax
leaq 0x10(%rsp), %rcx
leaq 0x60(%rsp), %r8
movq %r15, %rsi
callq *(%rax)
testb %al, %al
je 0x441f
movq (%r14), %rax
movq %rax, (%rsp)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x44b6
movq 0x9bf4(%rip), %rcx      # 0xdfc8
cmpb $0x0, (%rcx)
je 0x44b2
incl 0x8(%rax)
jmp 0x44b6
movsd 0x18(%r15), %xmm1
movsd 0x20(%r15), %xmm3
movsd 0x28(%r15), %xmm0
movapd %xmm3, %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4434
sqrtsd %xmm0, %xmm0
jmp 0x4445
movq 0x40(%rsp), %rax
movq %rax, 0x10(%rbx)
movupd 0x30(%rsp), %xmm0
movupd %xmm0, (%rbx)
jmp 0x448f
movsd %xmm3, 0x28(%rsp)
callq 0x3150
movsd 0x28(%rsp), %xmm3
divsd %xmm0, %xmm3
movsd 0x5c17(%rip), %xmm0     # 0xa068
addsd %xmm0, %xmm3
movsd 0x5c8b(%rip), %xmm1     # 0xa0e8
mulsd %xmm1, %xmm3
subsd %xmm3, %xmm0
mulsd %xmm3, %xmm1
movsd 0x5c7f(%rip), %xmm2     # 0xa0f0
mulsd %xmm3, %xmm2
addsd %xmm0, %xmm1
addsd %xmm0, %xmm2
addsd %xmm3, %xmm0
movsd %xmm1, (%rbx)
movsd %xmm2, 0x8(%rbx)
movsd %xmm0, 0x10(%rbx)
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x44a1
callq 0x37ec
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
lock
incl 0x8(%rax)
incl %ebp
leaq 0x48(%rsp), %rdi
leaq 0x60(%rsp), %rsi
movq %rsp, %rdx
movl %ebp, %ecx
callq 0x4300
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
mulsd 0x48(%rsp), %xmm0
mulsd 0x50(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
mulsd 0x58(%rsp), %xmm2
addsd 0x30(%rsp), %xmm0
addsd 0x38(%rsp), %xmm1
addsd 0x40(%rsp), %xmm2
movsd %xmm0, (%rbx)
movsd %xmm1, 0x8(%rbx)
movsd %xmm2, 0x10(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x448f
callq 0x37ec
jmp 0x448f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x4541
callq 0x37ec
jmp 0x4541
jmp 0x453e
movq %rax, %rbx
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x4553
callq 0x37ec
movq %rbx, %rdi
callq 0x32e0