// File: /workspace/github_cpp_makefile_star2_O2/IsaacLaw12[P]RayTracer/./src/SceneObject.cpp
// Function: SceneObject::load_material(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void SceneObject::load_material(std::string material_file){
    std::ifstream in(material_file);
    if (!in){
        std::cerr << "Could not open material file " << material_file << std::endl;
        return;
    }
    std::string obj_line;
    std::string line_type = "";

    double k1, k2, k3;
    while (std::getline(in, obj_line)){
        std::stringstream obj_read(obj_line);
        obj_read >> line_type;

        if (line_type[0] == 'K' && line_type[1] == 'a'){
            obj_read >> k1 >> k2 >> k3;
            ambient_color(0, 0) = k1;
            ambient_color(1, 1) = k2;
            ambient_color(2, 2) = k3;
        }

        if (line_type[0] == 'K' && line_type[1] == 'd'){
            obj_read >> k1 >> k2 >> k3;
            diffuse_color(0, 0) = k1;
            diffuse_color(1, 1) = k2;
            diffuse_color(2, 2) = k3;
        }

        if (line_type[0] == 'K' && line_type[1] == 's'){
            obj_read >> k1 >> k2 >> k3;
            specular_color(0, 0) = k1;
            specular_color(1, 1) = k2;
            specular_color(2, 2) = k3;
        }

        if (line_type[0] == 'K' && line_type[1] == 'o'){
            obj_read >> k1 >> k2 >> k3;
            refract_color(0, 0) = k1;
            refract_color(1, 1) = k2;
            refract_color(2, 2) = k3;
        }

        if (line_type[0] == 'e'){
            if (line_type[1] == 't'){
                if (line_type[2] == 'a'){
                    obj_read >> k1;
                    eta = k1;
                }
            }
        }

        if (line_type[0] == 'N' && line_type[1] == 's'){
            obj_read >> phong;
        }

    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f8, %rsp            # imm = 0x3F8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x68(%rsp), %r15
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x3400
movq (%r15), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x88(%rsp,%rax)
je 0x119f7
movq 0x1861d(%rip), %rdi     # 0x29ff0
leaq 0x97b3(%rip), %rsi      # 0x1b18d
callq 0x32a0
movq %rax, %rdi
movq %r14, %rsi
callq 0x3280
movq %rax, %rdi
callq 0x3120
jmp 0x11c79
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x77bf(%rip), %rsi      # 0x191ce
leaq 0x20(%rsp), %rdi
leaq 0x270(%rsp), %rdx
callq 0x61f6
leaq 0x8(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0x68(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x270(%rsp), %r13
pushq $0x18
popq %rbp
leaq 0x20(%rsp), %r14
movq %r15, %rdi
movq %r12, %rsi
callq 0x3070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x11c65
movq %r13, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x33e0
movq %r13, %rdi
movq %r14, %rsi
callq 0x3320
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4b, %cl
jne 0x11c10
cmpb $0x61, 0x1(%rax)
jne 0x11ae7
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x31b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x20(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x40(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x60(%rbx)
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4b, %cl
jne 0x11c10
cmpb $0x64, 0x1(%rax)
jne 0x11b4b
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x31b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x68(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x88(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0xa8(%rbx)
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4b, %cl
jne 0x11c10
cmpb $0x73, 0x1(%rax)
jne 0x11bae
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x31b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0xb0(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0xd0(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0xf0(%rbx)
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4b, %cl
jne 0x11c10
cmpb $0x6f, 0x1(%rax)
jne 0x11c58
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x18(%rsp), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x31b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x140(%rbx)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x160(%rbx)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x180(%rbx)
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x65, %cl
jne 0x11c40
cmpb $0x74, 0x1(%rax)
jne 0x11c58
cmpb $0x61, 0x2(%rax)
jne 0x11c58
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x31b0
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rbx)
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4e, %cl
jne 0x11c58
cmpb $0x73, 0x1(%rax)
jne 0x11c58
movq %r13, %rdi
movq 0x40(%rsp), %rsi
callq 0x31b0
movq %r13, %rdi
callq 0x3200
jmp 0x11a44
leaq 0x20(%rsp), %rdi
callq 0x3100
leaq 0x48(%rsp), %rdi
callq 0x3100
leaq 0x68(%rsp), %rdi
callq 0x30a0
addq $0x3f8, %rsp            # imm = 0x3F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x11cc0
movq %rax, %rbx
jmp 0x11cca
jmp 0x11ca1
movq %rax, %rbx
jmp 0x11cb6
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x3200
leaq 0x20(%rsp), %rdi
callq 0x3100
leaq 0x48(%rsp), %rdi
callq 0x3100
leaq 0x68(%rsp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x3490