// File: /workspace/github_cpp_makefile_star2_O3/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, %r15
movq %rdi, %rbx
leaq 0x1f0(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x3420
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x210(%rsp,%rax)
je 0x108b3
movq 0xf790(%rip), %rdi      # 0x1fff0
leaq 0x7660(%rip), %rsi      # 0x17ec7
movl $0x1d, %edx
callq 0x32f0
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xf771(%rip), %rdi      # 0x1fff0
callq 0x32f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31d0
jmp 0x10b8b
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x639d(%rip), %rdx      # 0x16c74
leaq 0x20(%rsp), %rdi
movq %rdx, %rsi
callq 0x5bde
leaq 0x8(%rbx), %rax
movq %rax, 0x40(%rsp)
leaq 0x48(%rsp), %r13
leaq 0x68(%rsp), %rbp
leaq 0x20(%rsp), %r12
movq 0xf695(%rip), %r15      # 0x1ff98
movq 0x1f0(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x34e0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x10b53
movq %rbp, %rdi
movq %r13, %rsi
movl $0x18, %edx
callq 0x3400
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3340
movq 0x20(%rsp), %rax
movb (%rax), %cl
cmpb $0x4b, %cl
jne 0x10aee
cmpb $0x61, 0x1(%rax)
jne 0x109c5
movq %rbp, %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 0x10aee
cmpb $0x64, 0x1(%rax)
jne 0x10a29
movq %rbp, %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 0x10aee
cmpb $0x73, 0x1(%rax)
jne 0x10a8c
movq %rbp, %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 0x10aee
cmpb $0x6f, 0x1(%rax)
jne 0x10b36
movq %rbp, %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 0x10b1e
cmpb $0x74, 0x1(%rax)
jne 0x10b36
cmpb $0x61, 0x2(%rax)
jne 0x10b36
movq %rbp, %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 0x10b36
cmpb $0x73, 0x1(%rax)
jne 0x10b36
movq %rbp, %rdi
movq 0x40(%rsp), %rsi
callq 0x31b0
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3210
leaq 0xe8(%rsp), %rdi
callq 0x30e0
jmp 0x10903
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x10b6f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x10b8b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x1f0(%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 0x10bf8
movq %rax, %rbx
jmp 0x10c14
jmp 0x10bb6
movq %rax, %rbx
jmp 0x10bdc
movq %rax, %rbx
movq 0xf3d3(%rip), %rsi      # 0x1ff98
leaq 0x68(%rsp), %rdi
callq 0x3210
leaq 0xe8(%rsp), %rdi
callq 0x30e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x10bf8
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x10c14
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x1f0(%rsp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x34b0
nopl (%rax)