LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/texture.cpp
// Function: image_texture::value_at_uv(float, float, vec3 const&) const
vec3 image_texture::value_at_uv(float _u, float _v, const vec3& _hit_point) const
{
    // do some repeating and fraction
    // _u *= 5.0f;
    // _v *= 5.0f;

    // _u = _u -(long)_u;
    // _v = _v -(long)_v;

    int width_index = _u * width;
    //int height_index = _v * height;
    int height_index = ( 1 - _v ) * height - 0.001f;

    width_index = std::clamp(width_index, 0, width - 1);
    height_index = std::clamp(height_index, 0, height - 1);

    float normalized_r = int(data[ height_index * width * 3 + width_index * 3 + 0 ]) / 255.0f;
    float normalized_g = int(data[ height_index * width * 3 + width_index * 3 + 1 ]) / 255.0f;
    float normalized_b = int(data[ height_index * width * 3 + width_index * 3 + 2 ]) / 255.0f;

    //std::cout << "input uv = " << _u << " , " << _v << std::endl;
    //std::cout << "width_index = " << width_index << " , height_index = " << height_index << std::endl;

    return vec3(normalized_r, normalized_g, normalized_b);
}

// Assembly:
movl 0x10(%rdi), %eax
cvtsi2ss %eax, %xmm2
mulss %xmm0, %xmm2
cvttss2si %xmm2, %ecx
movss 0x337c7(%rip), %xmm0    # 0x3c228
subss %xmm1, %xmm0
movl 0x14(%rdi), %edx
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm0, %xmm1
addss 0x337b5(%rip), %xmm1    # 0x3c230
cvttss2si %xmm1, %esi
leal -0x1(%rax), %r8d
cmpl %ecx, %r8d
cmovgel %ecx, %r8d
xorl %r9d, %r9d
testl %ecx, %ecx
cmovsl %r9d, %r8d
decl %edx
cmpl %esi, %edx
cmovgel %esi, %edx
testl %esi, %esi
cmovsl %r9d, %edx
movq 0x8(%rdi), %rcx
imull %eax, %edx
addl %r8d, %edx
leal (%rdx,%rdx,2), %eax
cltq
movzbl (%rcx,%rax), %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss 0x33772(%rip), %xmm2    # 0x3c234
divss %xmm2, %xmm0
movzbl 0x1(%rcx,%rax), %edx
cvtsi2ss %edx, %xmm3
divss %xmm2, %xmm3
movzbl 0x2(%rcx,%rax), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
unpcklps %xmm3, %xmm0            # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
divss %xmm2, %xmm1
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/hitable_list.cpp
// Function: hitable_list::hit(ray const&, float, float, hit_record&) const
bool hitable_list::hit(const ray& _ray, float t_min, float t_max, hit_record& rec) const
{
    hit_record temp_rec;
    bool is_anything_hit = false;
    double closest_so_far = t_max;

    for(int i = 0; i < list_size; i++)
    {
        if(list[i]->hit(_ray, t_min, closest_so_far, temp_rec))
        {
            is_anything_hit = true;
            closest_so_far = temp_rec.t;
            rec = temp_rec;
        }
    }

    return is_anything_hit;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movss %xmm0, 0xc(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rsp)
cmpl $0x0, 0x20(%rdi)
jle 0x8bb1
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x30(%rdx), %rax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x8(%r15), %rax
movq (%rax,%r12), %rdi
xorps %xmm1, %xmm1
cvtsd2ss 0x10(%rsp), %xmm1
movq (%rdi), %rax
movq %r14, %rsi
movss 0xc(%rsp), %xmm0
leaq 0x20(%rsp), %rdx
callq *(%rax)
testb %al, %al
je 0x8b9f
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x40(%rsp), %eax
movl %eax, 0x20(%rbx)
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rbx)
movq 0x18(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x7a04
movb $0x1, %bpl
incq %r13
movslq 0x20(%r15), %rax
addq $0x10, %r12
cmpq %rax, %r13
jl 0x8b35
jmp 0x8bb3
xorl %ebp, %ebp
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8bc2
callq 0x7768
andb $0x1, %bpl
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x8be9
callq 0x7768
movq %rbx, %rdi
callq 0x66e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/hitable_list.cpp
// Function: hitable_list::bounding_box(float, float, aabb&) const
bool hitable_list::bounding_box(float t0, float t1, aabb& _box) const
{
    if(list_size < 1) return false;
    aabb result;
    bool first_true = list[0]->bounding_box(t0, t1, result);
    if(!first_true)
    {
        return false;
    }
    else
    {
        _box = result;
    }
    
    for(int i = 1; i < list_size; i++)
    {
        // TODO : Is this correct?
        // Reference to github issue page : https://github.com/RayTracing/raytracingthenextweek/issues/2
        // it should be list[i] rather than list[0]
        if(list[i]->bounding_box(t0, t1, result))
        {
            _box = surrounding_box(_box, result);
        }
        else
        {
            return false;
        }
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
cmpl $0x0, 0x20(%rdi)
jle 0x8d22
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq (%rax), %rdi
movq (%rdi), %rax
leaq 0x38(%rsp), %rsi
movss %xmm0, 0x30(%rsp)
movss %xmm1, 0x34(%rsp)
callq *0x8(%rax)
testb %al, %al
je 0x8d22
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rbx)
movups 0x38(%rsp), %xmm0
movups %xmm0, (%rbx)
cmpl $0x2, 0x20(%r14)
setl %bpl
jl 0x8d24
movq 0x8(%r14), %rax
movq 0x10(%rax), %rdi
movq (%rdi), %rax
leaq 0x38(%rsp), %rsi
movss 0x30(%rsp), %xmm0
movss 0x34(%rsp), %xmm1
callq *0x8(%rax)
testb %al, %al
je 0x8d24
movl $0x1, %r13d
movl $0x20, %r12d
leaq 0x70(%rsp), %r15
movups (%rbx), %xmm0
movaps %xmm0, 0x50(%rsp)
movq 0x10(%rbx), %rax
movq %rax, 0x60(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x38(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movaps 0x50(%rsp), %xmm0
movups %xmm0, (%rsp)
movq %r15, %rdi
callq 0xc52e
movq 0x80(%rsp), %rax
movq %rax, 0x10(%rbx)
movups 0x70(%rsp), %xmm0
movups %xmm0, (%rbx)
incq %r13
movslq 0x20(%r14), %rax
cmpq %rax, %r13
setge %bpl
jge 0x8d24
movq 0x8(%r14), %rax
movq (%rax,%r12), %rdi
addq $0x10, %r12
movq (%rdi), %rax
movss 0x30(%rsp), %xmm0
movss 0x34(%rsp), %xmm1
leaq 0x38(%rsp), %rsi
callq *0x8(%rax)
testb %al, %al
jne 0x8c91
jmp 0x8d24
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/sphere.cpp
// Function: moving_sphere::bounding_box(float, float, aabb&) const
bool moving_sphere::bounding_box(float t0, float t1, aabb& _box) const
{
    vec3 radius_vector(radius, radius, radius);
    aabb box_at_t0( center(t0) - radius_vector, center(t0) + radius_vector );
    aabb box_at_t1( center(t1) - radius_vector, center(t1) + radius_vector );

    _box = surrounding_box(box_at_t0, box_at_t1);
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movss 0x28(%rdi), %xmm2
movss 0x20(%rdi), %xmm9
subss %xmm9, %xmm0
movss 0x24(%rdi), %xmm10
subss %xmm9, %xmm10
divss %xmm10, %xmm0
movss 0x14(%rdi), %xmm3
movss 0x8(%rdi), %xmm7
movss 0xc(%rdi), %xmm6
subss %xmm7, %xmm3
movss 0x18(%rdi), %xmm5
subss %xmm6, %xmm5
movss 0x1c(%rdi), %xmm12
movss 0x10(%rdi), %xmm11
subss %xmm11, %xmm12
movaps %xmm0, %xmm4
mulss %xmm3, %xmm4
movaps %xmm0, %xmm13
mulss %xmm5, %xmm13
mulss %xmm12, %xmm0
addss %xmm7, %xmm4
addss %xmm6, %xmm13
addss %xmm11, %xmm0
movaps %xmm2, %xmm8
addss %xmm4, %xmm8
subss %xmm2, %xmm4
movaps %xmm2, %xmm14
addss %xmm13, %xmm14
subss %xmm2, %xmm13
unpcklps %xmm13, %xmm4           # xmm4 = xmm4[0],xmm13[0],xmm4[1],xmm13[1]
unpcklps %xmm14, %xmm8           # xmm8 = xmm8[0],xmm14[0],xmm8[1],xmm14[1]
movaps %xmm2, %xmm13
addss %xmm0, %xmm13
subss %xmm2, %xmm0
subss %xmm9, %xmm1
divss %xmm10, %xmm1
mulss %xmm1, %xmm3
mulss %xmm1, %xmm5
mulss %xmm12, %xmm1
addss %xmm7, %xmm3
addss %xmm6, %xmm5
addss %xmm11, %xmm1
movaps %xmm2, %xmm6
addss %xmm3, %xmm6
subss %xmm2, %xmm3
movaps %xmm2, %xmm7
addss %xmm5, %xmm7
subss %xmm2, %xmm5
unpcklps %xmm5, %xmm3            # xmm3 = xmm3[0],xmm5[0],xmm3[1],xmm5[1]
movaps %xmm1, %xmm5
subss %xmm2, %xmm5
unpcklps %xmm7, %xmm6            # xmm6 = xmm6[0],xmm7[0],xmm6[1],xmm7[1]
addss %xmm2, %xmm1
movlps %xmm4, 0x48(%rsp)
movss %xmm0, 0x50(%rsp)
movlps %xmm8, 0x54(%rsp)
movss %xmm13, 0x5c(%rsp)
movlps %xmm3, 0x30(%rsp)
movss %xmm5, 0x38(%rsp)
movlps %xmm6, 0x3c(%rsp)
movss %xmm1, 0x44(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x28(%rsp)
movups 0x30(%rsp), %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x10(%rsp)
movups 0x48(%rsp), %xmm0
movups %xmm0, (%rsp)
leaq 0x60(%rsp), %r14
movq %r14, %rdi
callq 0xc52e
movq 0x10(%r14), %rax
movq %rax, 0x10(%rbx)
movups (%r14), %xmm0
movups %xmm0, (%rbx)
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/bvh.cpp
// Function: bvh_node::box_x_compare::operator()(std::shared_ptr<hitable> const&, std::shared_ptr<hitable> const&) const
bool bvh_node::box_x_compare::operator() (const hitable_reference& a, const hitable_reference& b) const
{
    aabb box_left, box_right;
    if(a->bounding_box(0, 0, box_left) == false || b->bounding_box(0, 0, box_right) == false)
    {
        std::cerr << "No bounding box in bvh_node constructor!\n";
    }

    // IMPORTANT !!!
    // Reference : https://stackoverflow.com/questions/1541817/sort-function-c-segmentation-fault
    // In C++, your "compare" predicate must be a strict weak ordering.
    // In particular, "compare(X,X)" must return "false" for any X.
    // ... (Otherwise) Therefore, this "compare" predicate does not impose a strict weak ordering,
    // and the result of passing it to "sort" is undefined.

    if(box_left.get_min().x() - box_right.get_min().x() <= 0.0f)
    {
        return false;
    }
    else
    {
        return true;
    }
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
movq (%rsi), %rdi
movq (%rdi), %rax
leaq 0x18(%rsp), %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
je 0x9a1e
movq (%rbx), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
jne 0x9a36
movq 0x455bb(%rip), %rdi     # 0x4efe0
leaq 0x3298c(%rip), %rsi     # 0x3c3b8
movl $0x29, %edx
callq 0x6470
movss 0x18(%rsp), %xmm0
subss (%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
setb %al
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/bvh.cpp
// Function: bvh_node::box_y_compare::operator()(std::shared_ptr<hitable> const&, std::shared_ptr<hitable> const&) const
bool bvh_node::box_y_compare::operator() (const hitable_reference& a, const hitable_reference& b) const
{
    aabb box_left, box_right;
    if(a->bounding_box(0, 0, box_left) == false || b->bounding_box(0, 0, box_right) == false)
    {
        std::cerr << "No bounding box in bvh_node constructor!\n";
    }

    if(box_left.get_min().y() - box_right.get_min().y() <= 0.0f)
    {
        return false;
    }
    else
    {
        return true;
    }
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
movq (%rsi), %rdi
movq (%rdi), %rax
leaq 0x18(%rsp), %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
je 0x9a86
movq (%rbx), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
jne 0x9a9e
movq 0x45553(%rip), %rdi     # 0x4efe0
leaq 0x32924(%rip), %rsi     # 0x3c3b8
movl $0x29, %edx
callq 0x6470
movss 0x1c(%rsp), %xmm0
subss 0x4(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
setb %al
addq $0x30, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/bvh.cpp
// Function: bvh_node::box_z_compare::operator()(std::shared_ptr<hitable> const&, std::shared_ptr<hitable> const&) const
bool bvh_node::box_z_compare::operator() (const hitable_reference& a, const hitable_reference& b) const
{
    aabb box_left, box_right;
    if(a->bounding_box(0, 0, box_left) == false || b->bounding_box(0, 0, box_right) == false)
    {
        std::cerr << "No bounding box in bvh_node constructor!\n";
    }

    if(box_left.get_min().z() - box_right.get_min().z() <= 0.0f)
    {
        return false;
    }
    else
    {
        return true;
    }
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
movq (%rsi), %rdi
movq (%rdi), %rax
leaq 0x18(%rsp), %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
je 0x9af0
movq (%rbx), %rdi
movq (%rdi), %rax
movq %rsp, %rsi
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq *0x8(%rax)
testb %al, %al
jne 0x9b08
movq 0x454e9(%rip), %rdi     # 0x4efe0
leaq 0x328ba(%rip), %rsi     # 0x3c3b8
movl $0x29, %edx
callq 0x6470
movss 0x20(%rsp), %xmm0
subss 0x8(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm0, %xmm1
setb %al
addq $0x30, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/bvh.cpp
// Function: bvh_node::hit(ray const&, float, float, hit_record&) const
bool bvh_node::hit(const ray& _ray, float t_min, float t_max, hit_record& rec) const
{
    if(box.hit(_ray, t_min, t_max))
    {
        hit_record left_record, right_record;
        bool hit_left = left->hit(_ray, t_min, t_max, left_record);
        bool hit_right = right->hit(_ray, t_min, t_max, right_record);

        if(hit_left && hit_right)
        {
            if(left_record.t < right_record.t)
            {
                rec = left_record;
                return true;
            }
            else
            {
                rec = right_record;
                return true;
            }
        }
        else if(hit_left)
        {
            rec = left_record;
            return true;
        }
        else if(hit_right)
        {
            rec = right_record;
            return true;
        }
        else
        {
            return false;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
addq $0x28, %rdi
movss %xmm0, (%rsp)
movss %xmm1, 0x4(%rsp)
callq 0xc440
testb %al, %al
je 0x9f55
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdx
movups %xmm0, 0x28(%rdx)
movups %xmm0, 0x30(%rsp)
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
movss (%rsp), %xmm0
movss 0x4(%rsp), %xmm1
callq *(%rax)
movl %eax, %ebp
movq 0x18(%r15), %rdi
movq (%rdi), %rax
leaq 0x8(%rsp), %rdx
movq %r14, %rsi
movss (%rsp), %xmm0
movss 0x4(%rsp), %xmm1
callq *(%rax)
leaq 0x38(%rsp), %rcx
leaq 0x70(%rsp), %rsi
movl %ebp, %edx
andb %al, %dl
cmpb $0x1, %dl
jne 0x9f59
movss 0x8(%rsp), %xmm0
ucomiss 0x40(%rsp), %xmm0
ja 0x9f5e
jmp 0x9f85
xorl %ebx, %ebx
jmp 0x9fd5
testb %bpl, %bpl
je 0x9f81
movl 0x60(%rsp), %eax
movl %eax, 0x20(%rbx)
movups 0x40(%rsp), %xmm0
movups 0x50(%rsp), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
movq 0x68(%rsp), %rax
movq %rax, 0x28(%rbx)
jmp 0x9fa9
testb %al, %al
je 0x9fe2
movl 0x28(%rsp), %eax
movl %eax, 0x20(%rbx)
movups 0x8(%rsp), %xmm0
movups 0x18(%rsp), %xmm1
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
movq 0x30(%rsp), %rax
movq %rax, 0x28(%rbx)
movq %rcx, %rsi
addq $0x30, %rbx
movq %rbx, %rdi
callq 0x7a04
movb $0x1, %bl
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9fc6
callq 0x7768
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x9fd5
callq 0x7768
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x9fb7
jmp 0x9fe8
movq %rax, %rbx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9ffa
callq 0x7768
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xa009
callq 0x7768
movq %rbx, %rdi
callq 0x66e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/perlin.cpp
// Function: perlin::get_noise(vec3 const&)
float perlin::get_noise(const vec3& _p)
{
    float u = _p.x() - std::floor(_p.x());
    float v = _p.y() - std::floor(_p.y());
    float w = _p.z() - std::floor(_p.z());
    int i = std::floor(_p.x());
    int j = std::floor(_p.y());
    int k = std::floor(_p.z());

    vec3 data[2][2][2];
    for(int di = 0; di < 2; di++)
    {
        for(int dj = 0; dj < 2; dj++)
        {
            for(int dk = 0; dk < 2; dk++)
            {
                data[di][dj][dk] = 
                    random_vecs[perm_x[(i + di) & 255] ^ perm_y[(j + dj) & 255] ^ perm_z[(k + dk) & 255]];
            }
        }
    }

    return perlin_interpolate(data, u, v, w);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movss (%rdi), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x4(%rdi), %xmm0
movss %xmm0, 0x1c(%rsp)
callq 0x6150
movss %xmm0, 0xc(%rsp)
movss 0x8(%rbx), %xmm0
movss %xmm0, 0x18(%rsp)
callq 0x6150
movss %xmm0, 0x14(%rsp)
cvttss2si 0xc(%rsp), %ebx
movss 0x10(%rsp), %xmm0
callq 0x6150
movss 0x14(%rsp), %xmm1
cvttss2si %xmm0, %eax
movq %rax, 0x20(%rsp)
cvttss2si %xmm1, %ecx
movq 0x4388b(%rip), %rdx     # 0x4f490
movq 0x4389c(%rip), %rsi     # 0x4f4a8
movq 0x438ad(%rip), %rdi     # 0x4f4c0
leaq 0x30(%rsp), %r8
movq 0x43859(%rip), %r9      # 0x4f478
xorl %r11d, %r11d
movq 0x20(%rsp), %rax
movq %r11, 0x28(%rsp)
addl %eax, %r11d
movzbl %r11b, %r11d
movq %r8, %r14
xorl %r15d, %r15d
leal (%r15,%rbx), %ebp
movzbl %bpl, %r12d
xorl %r13d, %r13d
movl %ecx, %ebp
movl (%rsi,%r12,4), %eax
xorl (%rdx,%r11,4), %eax
movzbl %bpl, %r10d
xorl (%rdi,%r10,4), %eax
cltq
leaq (%rax,%rax,2), %rax
movl 0x8(%r9,%rax,4), %r10d
movl %r10d, 0x8(%r14,%r13)
movq (%r9,%rax,4), %rax
movq %rax, (%r14,%r13)
incl %ebp
addq $0xc, %r13
cmpq $0xc, %r13
je 0xbc46
leaq 0x1(%r15), %r12
addq $0x18, %r14
testq %r15, %r15
movq %r12, %r15
je 0xbc39
movq 0x28(%rsp), %rax
leaq 0x1(%rax), %r11
addq $0x30, %r8
testq %rax, %rax
je 0xbc22
movss 0x18(%rsp), %xmm2
subss %xmm1, %xmm2
movss 0x1c(%rsp), %xmm1
subss 0xc(%rsp), %xmm1
movss 0x10(%rsp), %xmm3
subss %xmm0, %xmm3
leaq 0x30(%rsp), %rdi
movaps %xmm3, %xmm0
callq 0x155d8
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/perlin.cpp
// Function: perlin::turb(vec3 const&, int)
float perlin::turb(const vec3& _p, int depth)
{
    float accum = 0.0f;
    vec3 temp_p = _p;
    float weight = 1.0f;
    for(int i = 0; i < depth; i++)
    {
        accum += weight * get_noise(temp_p);
        weight *= 0.5;
        temp_p *= 2;
    }

    //if(accum > 1.0f)
    // adding this line will produce what the book demonstrated
    accum -= 1.0f;

    return std::abs(accum);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl 0x8(%rdi), %eax
movl %eax, 0x8(%rsp)
movq (%rdi), %rax
movq %rax, (%rsp)
testl %esi, %esi
jle 0xbda1
movl %esi, %ebx
movq %rsp, %r14
movss (%r14), %xmm1
movss 0x4(%r14), %xmm2
xorps %xmm0, %xmm0
movss 0x30514(%rip), %xmm3    # 0x3c228
movss 0x8(%r14), %xmm4
movss %xmm4, 0x10(%rsp)
movss %xmm3, 0x14(%rsp)
movss %xmm2, 0x18(%rsp)
movss %xmm1, 0x1c(%rsp)
movaps %xmm0, 0x20(%rsp)
movq %r14, %rdi
callq 0xbb90
movss 0x10(%rsp), %xmm4
movss 0x14(%rsp), %xmm3
movss 0x18(%rsp), %xmm2
mulss %xmm3, %xmm0
movaps 0x20(%rsp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
movss 0x1c(%rsp), %xmm1
movaps 0x20(%rsp), %xmm0
mulss 0x304b6(%rip), %xmm3    # 0x3c22c
addss %xmm1, %xmm1
movss %xmm1, (%rsp)
addss %xmm2, %xmm2
movss %xmm2, 0x4(%rsp)
addss %xmm4, %xmm4
movss %xmm4, 0x8(%rsp)
decl %ebx
jne 0xbd1a
addss 0x305a9(%rip), %xmm0    # 0x3c348
jmp 0xbda9
movss 0x3059f(%rip), %xmm0    # 0x3c348
andps 0x306c0(%rip), %xmm0    # 0x3c470
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/perlin.cpp
// Function: perlin::perlin_generate()
std::vector<vec3> perlin::perlin_generate()
{
    std::vector<vec3> result;
    result.reserve(256);
    for(int i = 0; i < 256; i++)
    {
        // IMPORTANT : it has to be unit_vector here.
        result.push_back(unit_vector(vec3(-1 + 2 * drand48(), -1 + 2 * drand48(), -1 + 2 * drand48())));
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x100, %esi            # imm = 0x100
callq 0xbfea
movl $0x100, %ebp            # imm = 0x100
leaq 0x10(%rsp), %r14
callq 0x63a0
addsd %xmm0, %xmm0
movsd 0x306a0(%rip), %xmm1    # 0x3c498
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
callq 0x63a0
addsd %xmm0, %xmm0
addsd 0x30682(%rip), %xmm0    # 0x3c498
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
callq 0x63a0
movaps 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm2
addsd %xmm0, %xmm0
addsd 0x3065e(%rip), %xmm0    # 0x3c498
xorps %xmm4, %xmm4
cvtsd2ss %xmm0, %xmm4
movaps %xmm3, %xmm0
mulss %xmm3, %xmm0
movaps %xmm2, %xmm1
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
ucomiss 0x3062b(%rip), %xmm0    # 0x3c490
jb 0xbe6d
sqrtss %xmm0, %xmm0
jmp 0xbe88
movss %xmm4, 0xc(%rsp)
callq 0x6710
movss 0xc(%rsp), %xmm4
movaps 0x20(%rsp), %xmm3
movaps 0x30(%rsp), %xmm2
divss %xmm0, %xmm2
divss %xmm0, %xmm3
unpcklps %xmm3, %xmm2            # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
divss %xmm0, %xmm4
movlps %xmm2, 0x10(%rsp)
movss %xmm4, 0x18(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xbec2
movl 0x18(%rsp), %eax
movl %eax, 0x8(%rsi)
movq 0x10(%rsp), %rax
movq %rax, (%rsi)
addq $0xc, 0x8(%rbx)
jmp 0xbecd
movq %rbx, %rdi
movq %r14, %rdx
callq 0xc198
decl %ebp
jne 0xbde7
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xbee3
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xbefa
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x6400
movq %r14, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/perlin.cpp
// Function: perlin::permute(std::vector<int, std::allocator<int>>&, int)
void perlin::permute(std::vector<int>& _p, int _n)
{
    for(int i = _n - 1; i > 0; i--)
    {
        int target = int(drand48() * (i+1));
        int tmp = _p[i];
        _p[i] = _p[target];
        _p[target] = tmp;
    }
    return;
}

// Assembly:
cmpl $0x2, %esi
jl 0xbf4e
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
leaq -0x1(%r14), %r15
callq 0x63a0
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
mulsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movq (%rbx), %rcx
movl -0x4(%rcx,%r14,4), %edx
cltq
movl (%rcx,%rax,4), %esi
movl %esi, -0x4(%rcx,%r14,4)
movl %edx, (%rcx,%rax,4)
cmpq $0x2, %r14
movq %r15, %r14
jg 0xbf12
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/perlin.cpp
// Function: perlin::perlin_generate_perm()
std::vector<int> perlin::perlin_generate_perm()
{
    std::vector<int> result;
    result.reserve(256);

    for(int i = 0; i < 256; i++)
    {
        result.push_back(i);
    }
    permute(result, 256);
    return result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl $0x100, %esi            # imm = 0x100
callq 0xc0c4
leaq 0x4(%rsp), %r14
movl $0x0, (%r14)
xorl %eax, %eax
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xbf93
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0xbf9e
movq %rbx, %rdi
movq %r14, %rdx
callq 0xc31e
movl 0x4(%rsp), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x4(%rsp)
cmpl $0xff, %ecx
jl 0xbf7d
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
callq 0xbf02
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
jmp 0xbfcb
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xbfe2
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x6400
movq %r14, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/aabb.cpp
// Function: aabb::hit(ray const&, float, float) const
bool aabb::hit(const ray& _ray, float t_min, float t_max) const
{
    for (int a = 0; a < 3; a++)
    {
        float t0 = ffmin((min[a] - _ray.origin()[a]) / _ray.direction()[a],
                        (max[a] - _ray.origin()[a]) / _ray.direction()[a]);
        float t1 = ffmax((min[a] - _ray.origin()[a]) / _ray.direction()[a],
                        (max[a] - _ray.origin()[a]) / _ray.direction()[a]);
        t_min = ffmax(t0, t_min);
        t_max = ffmin(t1, t_max);
        if (t_max <= t_min)
        {
            return false;
        }
    }
    return true;

    // Reference : Andrew Kensler at Pixar ( mentioned in Ray Tracing: The Next Week, page 11 )

    // for (int a = 0; a < 3; a++)
    // {
    //     float invD = 1.0f / _ray.direction()[a];
    //     float t0 = (min[a] - _ray.origin()[a]) * invD;
    //     float t1 = (max[a] - _ray.origin()[a]) * invD;

    //     if(invD < 0.0f)
    //     {
    //         std::swap(t0, t1);
    //     }

    //     t_min = t0 > t_min ? t0 : t_min;
    //     t_max = t1 > t_max ? t1 : t_max;
        
    //     if(t_max <= t_min)
    //     {
    //         return false;
    //     }
    // }
    // return true;
}

// Assembly:
movsd (%rsi), %xmm2
movss 0x8(%rsi), %xmm3
movsd 0xc(%rsi), %xmm4
movss 0x14(%rsi), %xmm5
xorl %ecx, %ecx
xorl %eax, %eax
movaps %xmm1, %xmm6
movaps %xmm0, %xmm7
movss (%rdi,%rcx,4), %xmm1
movlps %xmm2, -0x10(%rsp)
movss %xmm3, -0x8(%rsp)
movaps %xmm1, %xmm0
subss -0x10(%rsp,%rcx,4), %xmm0
movlps %xmm4, -0x20(%rsp)
movss %xmm5, -0x18(%rsp)
divss -0x20(%rsp,%rcx,4), %xmm0
movss 0xc(%rdi,%rcx,4), %xmm8
movlps %xmm2, -0x30(%rsp)
movss %xmm3, -0x28(%rsp)
movaps %xmm8, %xmm9
subss -0x30(%rsp,%rcx,4), %xmm9
movlps %xmm4, -0x40(%rsp)
movss %xmm5, -0x38(%rsp)
divss -0x40(%rsp,%rcx,4), %xmm9
minss %xmm9, %xmm0
maxss %xmm7, %xmm0
movlps %xmm2, -0x10(%rsp)
movss %xmm3, -0x8(%rsp)
subss -0x10(%rsp,%rcx,4), %xmm1
movlps %xmm4, -0x20(%rsp)
movss %xmm5, -0x18(%rsp)
divss -0x20(%rsp,%rcx,4), %xmm1
movlps %xmm2, -0x30(%rsp)
movss %xmm3, -0x28(%rsp)
subss -0x30(%rsp,%rcx,4), %xmm8
movlps %xmm4, -0x40(%rsp)
movss %xmm5, -0x38(%rsp)
divss -0x40(%rsp,%rcx,4), %xmm8
maxss %xmm8, %xmm1
minss %xmm6, %xmm1
ucomiss %xmm1, %xmm0
jae 0xc52b
cmpq $0x2, %rcx
leaq 0x1(%rcx), %rdx
setae %al
movq %rdx, %rcx
cmpq $0x3, %rdx
jne 0xc457
andb $0x1, %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/aabb.cpp
// Function: surrounding_box(aabb, aabb)
aabb surrounding_box(aabb box0, aabb box1)
{
    vec3 minimum( fmin(box0.get_min().x(), box1.get_min().x() ),
                  fmin(box0.get_min().y(), box1.get_min().y() ),
                  fmin(box0.get_min().z(), box1.get_min().z() ));
    vec3 maximum( fmax(box0.get_max().x(), box1.get_max().x() ),
                  fmax(box0.get_max().y(), box1.get_max().y() ),
                  fmax(box0.get_max().z(), box1.get_max().z() ));
    
    return aabb(minimum, maximum);
}

// Assembly:
movq %rdi, %rax
movsd 0x8(%rsp), %xmm2
movss 0x10(%rsp), %xmm3
movsd 0x20(%rsp), %xmm5
movss 0x28(%rsp), %xmm4
movaps %xmm2, %xmm0
cmpunordss %xmm2, %xmm0
movaps %xmm0, %xmm1
andps %xmm5, %xmm1
movaps %xmm5, %xmm6
minss %xmm2, %xmm6
andnps %xmm6, %xmm0
orps %xmm1, %xmm0
shufps $0x55, %xmm2, %xmm2     # xmm2 = xmm2[1,1,1,1]
shufps $0x55, %xmm5, %xmm5     # xmm5 = xmm5[1,1,1,1]
movaps %xmm2, %xmm1
cmpunordss %xmm2, %xmm1
movaps %xmm1, %xmm6
andps %xmm5, %xmm6
minss %xmm2, %xmm5
andnps %xmm5, %xmm1
orps %xmm6, %xmm1
movaps %xmm3, %xmm2
cmpunordss %xmm3, %xmm2
movaps %xmm2, %xmm5
andps %xmm4, %xmm5
minss %xmm3, %xmm4
andnps %xmm4, %xmm2
orps %xmm5, %xmm2
movsd 0x14(%rsp), %xmm6
movss 0x1c(%rsp), %xmm4
movsd 0x2c(%rsp), %xmm7
movss 0x34(%rsp), %xmm5
movaps %xmm6, %xmm3
cmpunordss %xmm6, %xmm3
movaps %xmm3, %xmm8
andps %xmm7, %xmm8
movaps %xmm7, %xmm9
maxss %xmm6, %xmm9
andnps %xmm9, %xmm3
orps %xmm8, %xmm3
shufps $0x55, %xmm6, %xmm6     # xmm6 = xmm6[1,1,1,1]
shufps $0x55, %xmm7, %xmm7     # xmm7 = xmm7[1,1,1,1]
movaps %xmm6, %xmm8
cmpunordss %xmm6, %xmm8
movaps %xmm8, %xmm9
andps %xmm7, %xmm9
maxss %xmm6, %xmm7
andnps %xmm7, %xmm8
orps %xmm9, %xmm8
movaps %xmm4, %xmm6
cmpunordss %xmm4, %xmm6
movaps %xmm6, %xmm7
andps %xmm5, %xmm7
maxss %xmm4, %xmm5
andnps %xmm5, %xmm6
orps %xmm7, %xmm6
movss %xmm0, (%rdi)
movss %xmm1, 0x4(%rdi)
movss %xmm2, 0x8(%rdi)
movss %xmm3, 0xc(%rdi)
movss %xmm8, 0x10(%rdi)
movss %xmm6, 0x14(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::safeGetline(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
static std::istream &safeGetline(std::istream &is, std::string &t) {
  t.clear();

  // The characters in the stream are read one-by-one using a std::streambuf.
  // That is faster than reading them one-by-one using the std::istream.
  // Code that uses streambuf this way must be guarded by a sentry object.
  // The sentry object performs various tasks,
  // such as thread synchronization and updating the stream state.

  std::istream::sentry se(is, true);
  std::streambuf *sb = is.rdbuf();

  if (se) {
    for (;;) {
      int c = sb->sbumpc();
      switch (c) {
        case '\n':
          return is;
        case '\r':
          if (sb->sgetc() == '\n') sb->sbumpc();
          return is;
        case EOF:
          // Also handle the case when the last line has no line ending
          if (t.empty()) is.setstate(std::ios::eofbit);
          return is;
        default:
          t += static_cast<char>(c);
      }
    }
  }

  return is;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %r14
movq $0x0, 0x8(%rsi)
movq (%rsi), %rax
movb $0x0, (%rax)
leaq 0xf(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x6600
cmpb $0x1, (%rbx)
jne 0xf00b
movq (%r14), %rax
movq -0x18(%rax), %rax
movq 0xe8(%r14,%rax), %rbx
movq 0x10(%rbx), %rcx
cmpq 0x18(%rbx), %rcx
jae 0xefbc
movzbl (%rcx), %eax
incq %rcx
movq %rcx, 0x10(%rbx)
cmpl $-0x1, %eax
je 0xefc7
cmpl $0xa, %eax
je 0xf00b
cmpl $0xd, %eax
je 0xefe8
movsbl %al, %esi
movq %r15, %rdi
callq 0x6360
jmp 0xef8c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
jmp 0xefa0
cmpq $0x0, 0x8(%r15)
jne 0xf00b
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x2, %esi
callq 0x6680
jmp 0xf00b
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jae 0xf015
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0xf00b
movq 0x10(%rbx), %rax
cmpq 0x18(%rbx), %rax
jae 0xf020
incq %rax
movq %rax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
jmp 0xeff5
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
jmp 0xf00b
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::parseInt(char const**)
static inline int parseInt(const char **token) {
  (*token) += strspn((*token), " \t");
  int i = atoi((*token));
  (*token) += strcspn((*token), " \t\r");
  return i;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0x2d609(%rip), %rsi     # 0x3c648
movq %r14, %rdi
callq 0x6190
movq %rax, %r15
addq %r14, %r15
movq %r15, (%rbx)
movq %r15, %rdi
callq 0x65e0
movl %eax, %ebp
leaq 0x2dbf5(%rip), %rsi     # 0x3cc56
movq %r15, %rdi
callq 0x6060
addq %r15, %rax
movq %rax, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::MaterialStreamReader::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<tinyobj::material_t, std::allocator<tinyobj::material_t>>*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, int>>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*)
bool MaterialStreamReader::operator()(const std::string &matId,
                                      std::vector<material_t> *materials,
                                      std::map<std::string, int> *matMap,
                                      std::string *warn, std::string *err) {
  (void)err;
  (void)matId;
  if (!m_inStream) {
    std::stringstream ss;
    ss << "Material stream in error state. " << std::endl;
    if (warn) {
      (*warn) += ss.str();
    }
    return false;
  }

  LoadMtl(matMap, materials, &m_inStream, warn, err);

  return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %r8, %rbx
movq 0x8(%rdi), %rax
movq (%rax), %rsi
movq -0x18(%rsi), %rsi
movl 0x20(%rax,%rsi), %ebp
testb $0x5, %bpl
je 0xf45e
leaq 0x28(%rsp), %rdi
callq 0x62a0
leaq 0x38(%rsp), %r14
leaq 0x2d469(%rip), %rsi     # 0x3c830
movl $0x20, %edx
movq %r14, %rdi
callq 0x6470
movq 0x38(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x63d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x6040
movq %rax, %rdi
callq 0x6280
testq %rbx, %rbx
je 0xf43e
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x6620
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x60f0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf43e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x3fb1b(%rip), %rsi     # 0x4ef60
leaq 0x28(%rsp), %rdi
callq 0x62e0
leaq 0xa8(%rsp), %rdi
callq 0x6100
jmp 0xf46f
movq %rcx, %rdi
movq %rdx, %rsi
movq %rax, %rdx
movq %rbx, %rcx
callq 0xd142
testb $0x5, %bpl
sete %al
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xf4a7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
jmp 0xf4a7
jmp 0xf4a4
movq %rax, %rbx
movq 0x3fab2(%rip), %rsi     # 0x4ef60
leaq 0x28(%rsp), %rdi
callq 0x62e0
leaq 0xa8(%rsp), %rdi
callq 0x6100
movq %rbx, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::parseTriple(char const**, int, int, int, tinyobj::vertex_index_t*)
static bool parseTriple(const char **token, int vsize, int vnsize, int vtsize,
                        vertex_index_t *ret) {
  if (!ret) {
    return false;
  }

  vertex_index_t vi(-1);

  if (!fixIndex(atoi((*token)), vsize, &(vi.v_idx))) {
    return false;
  }

  (*token) += strcspn((*token), "/ \t\r");
  if ((*token)[0] != '/') {
    (*ret) = vi;
    return true;
  }
  (*token)++;

  // i//k
  if ((*token)[0] == '/') {
    (*token)++;
    if (!fixIndex(atoi((*token)), vnsize, &(vi.vn_idx))) {
      return false;
    }
    (*token) += strcspn((*token), "/ \t\r");
    (*ret) = vi;
    return true;
  }

  // i/j/k or i/j
  if (!fixIndex(atoi((*token)), vtsize, &(vi.vt_idx))) {
    return false;
  }

  (*token) += strcspn((*token), "/ \t\r");
  if ((*token)[0] != '/') {
    (*ret) = vi;
    return true;
  }

  // i/j/k
  (*token)++;  // skip '/'
  if (!fixIndex(atoi((*token)), vnsize, &(vi.vn_idx))) {
    return false;
  }
  (*token) += strcspn((*token), "/ \t\r");

  (*ret) = vi;

  return true;
}

// Assembly:
testq %r8, %r8
je 0x12c8f
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movl %ecx, %r13d
movl %edx, %r12d
movl %esi, %ebp
movq (%rdi), %r14
movq %rdi, %r15
movq %r14, %rdi
callq 0x65e0
addl %eax, %ebp
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl $0x1, %eax
cmovbl %ecx, %ebp
cmovgel %eax, %ebp
jae 0x12c92
xorl %eax, %eax
jmp 0x12d98
xorl %eax, %eax
retq
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
movl %r12d, 0xc(%rsp)
leaq 0x29faf(%rip), %rsi     # 0x3cc55
movq %r14, %rdi
callq 0x6060
leaq (%r14,%rax), %r12
movq %r12, (%r15)
cmpb $0x2f, (%r14,%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
jne 0x12d89
leaq 0x1(%r12), %rdi
movq %rdi, (%r15)
cmpb $0x2f, 0x1(%r12)
movq %r15, 0x10(%rsp)
jne 0x12d25
addq $0x2, %r12
movq %r12, (%r15)
movq %r12, %rdi
callq 0x65e0
testl %eax, %eax
je 0x12c88
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
testl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl 0xc(%rsp), %r14d
cmovgl %ecx, %r14d
addl %eax, %r14d
leaq 0x29f45(%rip), %rsi     # 0x3cc55
movq %r12, %rdi
callq 0x6060
addq %r12, %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x12d89
movq %rdi, %r15
callq 0x65e0
addl %eax, %r13d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
subl $0x1, %eax
cmovbl %r14d, %r13d
cmovgel %eax, %r13d
jb 0x12c88
movl %r13d, 0x8(%rsp)
leaq 0x29f02(%rip), %rsi     # 0x3cc55
movq %r15, %rdi
callq 0x6060
leaq (%r15,%rax), %r12
movq 0x10(%rsp), %rcx
movq %r12, (%rcx)
cmpb $0x2f, (%r15,%rax)
jne 0x12d89
incq %r12
movq %r12, (%rcx)
movq %r12, %rdi
callq 0x65e0
testl %eax, %eax
jne 0x12cf6
jmp 0x12c88
movl %ebp, (%rbx)
movl 0x8(%rsp), %eax
movl %eax, 0x4(%rbx)
movl %r14d, 0x8(%rbx)
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::SplitString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
static void SplitString(const std::string &s, char delim,
                        std::vector<std::string> &elems) {
  std::stringstream ss;
  ss.str(s);
  std::string item;
  while (std::getline(ss, item, delim)) {
    elems.push_back(item);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rsp), %rdi
callq 0x62a0
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x6580
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movq %r14, %rdi
movq %r15, %rsi
movl $0x20, %edx
callq 0x6730
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x13b4d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1b884
jmp 0x13b22
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x13b63
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x3b3f6(%rip), %rsi     # 0x4ef60
leaq 0x20(%rsp), %rdi
callq 0x62e0
leaq 0xa0(%rsp), %rdi
callq 0x6100
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
jmp 0x13bae
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x13bae
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6400
movq 0x3b3ab(%rip), %rsi     # 0x4ef60
leaq 0x20(%rsp), %rdi
callq 0x62e0
leaq 0xa0(%rsp), %rdi
callq 0x6100
movq %rbx, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/tiny_obj_loader.h
// Function: tinyobj::ObjReader::ParseFromFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, tinyobj::ObjReaderConfig const&)
bool ObjReader::ParseFromFile(const std::string &filename,
                              const ObjReaderConfig &config) {
  std::string mtl_search_path;

  if (config.mtl_search_path.empty()) {
    //
    // split at last '/'(for unixish system) or '\\'(for windows) to get
    // the base directory of .obj file
    //
    if (filename.find_last_of("/\\") != std::string::npos) {
      mtl_search_path = filename.substr(0, filename.find_last_of("/\\"));
    }
  }

  valid_ = LoadObj(&attrib_, &shapes_, &materials_, &warning_, &error_,
                   filename.c_str(), mtl_search_path.c_str(),
                   config.triangulate, config.vertex_color);

  return valid_;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
cmpq $0x0, 0x10(%rdx)
je 0x14d94
leaq 0x8(%rbx), %rdi
leaq 0x98(%rbx), %rsi
leaq 0xb0(%rbx), %rdx
leaq 0xc8(%rbx), %rcx
leaq 0xe8(%rbx), %r8
movq (%r15), %r9
movzbl (%r14), %eax
movzbl 0x1(%r14), %r10d
subq $0x8, %rsp
pushq %r10
pushq %rax
pushq 0x20(%rsp)
callq 0xf4cd
addq $0x20, %rsp
movl %eax, %ebp
movb %al, (%rbx)
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x14d83
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x27e10(%rip), %rsi     # 0x3cbab
movl $0x2, %ecx
movq %r15, %rdi
movq $-0x1, %rdx
callq 0x6780
cmpq $-0x1, %rax
je 0x14d28
leaq 0x27deb(%rip), %rsi     # 0x3cbab
movl $0x2, %ecx
movq %r15, %rdi
movq $-0x1, %rdx
callq 0x6780
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %rax, %rcx
callq 0x6420
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %r12
movq %r12, %rsi
callq 0x64a0
movq (%r12), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x14d28
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6400
jmp 0x14d28
jmp 0x14e1e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x14e38
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6400
movq %rbx, %rdi
callq 0x66e0
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/util.cpp
// Function: random_in_unit_sphere()
vec3 random_in_unit_sphere()
{
    // This is a rejection method, which i s not that good for performance

    // vec3 p;
    // do
    // {
    //     p = 2 * vec3(drand48(), drand48(), drand48()) - vec3(1.0f, 1.0f, 1.0f);
    // } while (p.squared_length() >= 1.0f);
    // return p;

    // Reference : 
    // https://karthikkaranth.me/blog/generating-random-points-in-a-sphere/#using-normally-distributed-random-numbers
    //
    // Update :
    // This will cause visual bug in lighting, reason to be found.
    // Update :
    // This is actually caused by the difference of drand48() and 2 * drand48() - 1.
    // Which maps to the range of [0, 1) and [-1, 1) , respectively.
    
    vec3 direction = 2 * vec3(drand48(), drand48(), drand48()) - vec3(1.0f, 1.0f, 1.0f);
    float mag = std::cbrtf(drand48());

    return mag * unit_vector(direction);
}

// Assembly:
subq $0x38, %rsp
callq 0x63a0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
callq 0x63a0
cvtsd2ss %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
callq 0x63a0
cvtsd2ss %xmm0, %xmm2
movaps 0x20(%rsp), %xmm1
addss %xmm1, %xmm1
movaps 0x10(%rsp), %xmm3
addss %xmm3, %xmm3
addss %xmm2, %xmm2
movss 0x271c1(%rip), %xmm0    # 0x3c348
addss %xmm0, %xmm1
movaps %xmm1, 0x20(%rsp)
addss %xmm0, %xmm3
movaps %xmm3, 0x10(%rsp)
addss %xmm0, %xmm2
movss %xmm2, 0x8(%rsp)
callq 0x63a0
cvtsd2ss %xmm0, %xmm0
callq 0x6170
movaps %xmm0, %xmm4
movaps 0x10(%rsp), %xmm0
mulss %xmm0, %xmm0
movaps 0x20(%rsp), %xmm1
mulss %xmm1, %xmm1
addss %xmm0, %xmm1
movss 0x8(%rsp), %xmm0
mulss %xmm0, %xmm0
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x151e6
sqrtss %xmm0, %xmm0
jmp 0x151f7
movss %xmm4, 0xc(%rsp)
callq 0x6710
movss 0xc(%rsp), %xmm4
movaps 0x20(%rsp), %xmm3
divss %xmm0, %xmm3
movaps 0x10(%rsp), %xmm2
divss %xmm0, %xmm2
movss 0x8(%rsp), %xmm1
divss %xmm0, %xmm1
mulss %xmm4, %xmm3
mulss %xmm4, %xmm2
unpcklps %xmm2, %xmm3            # xmm3 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
mulss %xmm4, %xmm1
movaps %xmm3, %xmm0
addq $0x38, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/util.cpp
// Function: refract(vec3 const&, vec3 const&, float, vec3&)
bool refract(const vec3& _ray_direction, const vec3& _normal, float ni_over_nt, vec3& refracted)
{
    vec3 unit_direction = unit_vector(_ray_direction);
    float dt = dot(unit_direction, _normal);
    float discriminant = 1.0f - ni_over_nt * ni_over_nt * (1 - dt * dt);
    if(discriminant > 0.0f)
    {
        refracted = ni_over_nt * (unit_direction - _normal * dt) - _normal * sqrt(discriminant);
        return true;
    }
    return false;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movaps %xmm0, %xmm9
movq %rsi, %r14
movsd (%rdi), %xmm6
movss 0x8(%rdi), %xmm7
movaps %xmm6, %xmm8
shufps $0x55, %xmm6, %xmm8     # xmm8 = xmm8[1,1],xmm6[1,1]
movaps %xmm8, %xmm0
mulss %xmm8, %xmm0
movaps %xmm6, %xmm1
mulss %xmm6, %xmm1
addss %xmm0, %xmm1
movaps %xmm7, %xmm0
mulss %xmm7, %xmm0
addss %xmm1, %xmm0
xorps %xmm11, %xmm11
ucomiss %xmm11, %xmm0
jb 0x1538c
sqrtss %xmm0, %xmm0
jmp 0x153c5
movaps %xmm6, 0x20(%rsp)
movss %xmm7, 0xc(%rsp)
movaps %xmm8, 0x10(%rsp)
movss %xmm9, 0x8(%rsp)
callq 0x6710
xorps %xmm11, %xmm11
movss 0x8(%rsp), %xmm9
movaps 0x10(%rsp), %xmm8
movss 0xc(%rsp), %xmm7
movaps 0x20(%rsp), %xmm6
divss %xmm0, %xmm6
divss %xmm0, %xmm8
divss %xmm0, %xmm7
movss (%r14), %xmm1
movss 0x4(%r14), %xmm0
movaps %xmm8, %xmm2
mulss %xmm0, %xmm2
movaps %xmm6, %xmm4
mulss %xmm1, %xmm4
addss %xmm2, %xmm4
movss 0x8(%r14), %xmm2
movaps %xmm7, %xmm3
mulss %xmm2, %xmm3
addss %xmm4, %xmm3
movaps %xmm3, %xmm4
mulss %xmm3, %xmm4
movss 0x26e17(%rip), %xmm10   # 0x3c228
movaps %xmm10, %xmm5
subss %xmm4, %xmm5
movaps %xmm9, %xmm4
mulss %xmm9, %xmm4
mulss %xmm5, %xmm4
subss %xmm4, %xmm10
ucomiss %xmm11, %xmm10
jbe 0x154db
mulss %xmm3, %xmm1
mulss %xmm3, %xmm0
mulss %xmm3, %xmm2
subss %xmm1, %xmm6
subss %xmm0, %xmm8
subss %xmm2, %xmm7
mulss %xmm9, %xmm6
mulss %xmm9, %xmm8
mulss %xmm9, %xmm7
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm10
jb 0x15470
xorps %xmm0, %xmm0
sqrtss %xmm10, %xmm0
jmp 0x154a9
movaps %xmm10, %xmm0
movaps %xmm6, 0x20(%rsp)
movss %xmm7, 0xc(%rsp)
movaps %xmm8, 0x10(%rsp)
movss %xmm10, 0x8(%rsp)
callq 0x6710
movss 0x8(%rsp), %xmm10
movaps 0x10(%rsp), %xmm8
movss 0xc(%rsp), %xmm7
movaps 0x20(%rsp), %xmm6
movss (%r14), %xmm1
mulss %xmm0, %xmm1
movss 0x4(%r14), %xmm2
mulss %xmm0, %xmm2
mulss 0x8(%r14), %xmm0
subss %xmm0, %xmm7
subss %xmm1, %xmm6
subss %xmm2, %xmm8
unpcklps %xmm8, %xmm6            # xmm6 = xmm6[0],xmm8[0],xmm6[1],xmm8[1]
movlps %xmm6, (%rbx)
movss %xmm7, 0x8(%rbx)
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm10
seta %al
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/src/util.cpp
// Function: get_sphere_uv(vec3 const&, float&, float&)
void get_sphere_uv(const vec3& point_on_surface, float& _u, float& _v)
{
    float phi = std::atan2(point_on_surface.z(), point_on_surface.x());
    float theta = std::asin(point_on_surface.y());
    _u = 1 - (phi + M_PI) / (2.0f * M_PI);
    _v = (theta + M_PI / 2.0f) / M_PI;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movss (%rdi), %xmm1
movss 0x8(%rdi), %xmm0
callq 0x64f0
movss %xmm0, 0xc(%rsp)
movss 0x4(%r15), %xmm0
callq 0x6610
xorps %xmm1, %xmm1
cvtss2sd 0xc(%rsp), %xmm1
movsd 0x2705f(%rip), %xmm2    # 0x3c5f8
addsd %xmm2, %xmm1
divsd 0x2705b(%rip), %xmm1    # 0x3c600
addsd 0x2705b(%rip), %xmm1    # 0x3c608
cvtsd2ss %xmm1, %xmm1
movss %xmm1, (%r14)
cvtss2sd %xmm0, %xmm0
addsd 0x2704e(%rip), %xmm0    # 0x3c610
divsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq