// File: IsaacLaw12[P]RayTracer/./src/Sphere.cpp
// Function: Sphere::Sphere(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Sphere::Sphere(std::string driver_line){
    double x, y, z, rad, ka_red, ka_blue, ka_green, kd_red, kd_blue, kd_green,
        ks_red, ks_blue, ks_green, katt_red, katt_blue, katt_green;

    // If driver file does not include refraction constants default to 1, no refraction;
    double ref_red, ref_green, ref_blue;
    ref_red = 1; ref_green = 1; ref_blue = 1;

    std::string driver_type;

    std::stringstream read_sphere(driver_line);
    read_sphere >> driver_type >> x >> y >> z >> rad >> ka_red >> ka_blue >> ka_green >> kd_red >> kd_blue >> kd_green >>
        ks_red >> ks_blue >> ks_green>> katt_red>> katt_blue>> katt_green >> ref_red >> ref_green >> ref_blue >> phong >> eta >> lighting_group >> animation_file;

    sphere_center << x, y, z;
    radius = rad;
    // Just a constant used for spheres


    ambient_color(0, 0) = ka_red;
    ambient_color(1, 1) = ka_blue;
    ambient_color(2, 2) = ka_green;

    diffuse_color(0, 0) = kd_red;
    diffuse_color(1, 1) = kd_blue;
    diffuse_color(2, 2) = kd_green;

    specular_color(0, 0) = ks_red;
    specular_color(1, 1) = ks_blue;
    specular_color(2, 2) = ks_green;

    attenuation_color(0, 0) = katt_red;
    attenuation_color(1, 1) = katt_blue;
    attenuation_color(2, 2) = katt_green;

    refract_color(0, 0) = ref_red;
    refract_color(1, 1) = ref_green;
    refract_color(2, 2) = ref_blue;
}

// Assembly:
subq $0x498, %rsp            # imm = 0x498
movq %rsi, 0x1c8(%rsp)
movq %rdi, 0x490(%rsp)
movq %rsi, 0x488(%rsp)
movq 0x490(%rsp), %rdi
movq %rdi, 0x1d0(%rsp)
callq 0x1d060
movq 0x1d0(%rsp), %rax
leaq 0x5f06d(%rip), %rcx     # 0x9acc0
movq %rcx, (%rax)
addq $0x198, %rax            # imm = 0x198
movq %rax, 0x1d8(%rsp)
leaq 0x487(%rsp), %rdi
movq %rdi, 0x1e0(%rsp)
callq 0x45f0
movq 0x1d8(%rsp), %rdi
movq 0x1e0(%rsp), %rdx
leaq 0x2616e(%rip), %rsi     # 0x61dfe
callq 0x11e60
jmp 0x3bc97
leaq 0x487(%rsp), %rdi
callq 0x43c0
movq 0x1d0(%rsp), %rax
addq $0x1b8, %rax            # imm = 0x1B8
movq %rax, 0x1c0(%rsp)
leaq 0x448(%rsp), %rdi
callq 0x11e20
jmp 0x3bcc9
leaq 0x460(%rsp), %rdi
callq 0x9c00
jmp 0x3bcd8
movq 0x1c0(%rsp), %rdi
leaq 0x460(%rsp), %rsi
callq 0x9c30
jmp 0x3bcef
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x3c0(%rsp)
movq %rax, 0x3b8(%rsp)
movq %rax, 0x3b0(%rsp)
leaq 0x390(%rsp), %rdi
callq 0x4490
movl $0x10, %edi
movl $0x8, %esi
callq 0x11e40
movl %eax, 0x1bc(%rsp)
jmp 0x3bd36
movl 0x1bc(%rsp), %edx
movq 0x1c8(%rsp), %rsi
leaq 0x208(%rsp), %rdi
callq 0x4520
jmp 0x3bd54
leaq 0x208(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x4450
movq %rax, 0x1b0(%rsp)
jmp 0x3bd73
movq 0x1b0(%rsp), %rdi
leaq 0x440(%rsp), %rsi
callq 0x42e0
movq %rax, 0x1a8(%rsp)
jmp 0x3bd92
movq 0x1a8(%rsp), %rdi
leaq 0x438(%rsp), %rsi
callq 0x42e0
movq %rax, 0x1a0(%rsp)
jmp 0x3bdb1
movq 0x1a0(%rsp), %rdi
leaq 0x430(%rsp), %rsi
callq 0x42e0
movq %rax, 0x198(%rsp)
jmp 0x3bdd0
movq 0x198(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x42e0
movq %rax, 0x190(%rsp)
jmp 0x3bdef
movq 0x190(%rsp), %rdi
leaq 0x420(%rsp), %rsi
callq 0x42e0
movq %rax, 0x188(%rsp)
jmp 0x3be0e
movq 0x188(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x42e0
movq %rax, 0x180(%rsp)
jmp 0x3be2d
movq 0x180(%rsp), %rdi
leaq 0x410(%rsp), %rsi
callq 0x42e0
movq %rax, 0x178(%rsp)
jmp 0x3be4c
movq 0x178(%rsp), %rdi
leaq 0x408(%rsp), %rsi
callq 0x42e0
movq %rax, 0x170(%rsp)
jmp 0x3be6b
movq 0x170(%rsp), %rdi
leaq 0x400(%rsp), %rsi
callq 0x42e0
movq %rax, 0x168(%rsp)
jmp 0x3be8a
movq 0x168(%rsp), %rdi
leaq 0x3f8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x160(%rsp)
jmp 0x3bea9
movq 0x160(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x42e0
movq %rax, 0x158(%rsp)
jmp 0x3bec8
movq 0x158(%rsp), %rdi
leaq 0x3e8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x150(%rsp)
jmp 0x3bee7
movq 0x150(%rsp), %rdi
leaq 0x3e0(%rsp), %rsi
callq 0x42e0
movq %rax, 0x148(%rsp)
jmp 0x3bf06
movq 0x148(%rsp), %rdi
leaq 0x3d8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x140(%rsp)
jmp 0x3bf25
movq 0x140(%rsp), %rdi
leaq 0x3d0(%rsp), %rsi
callq 0x42e0
movq %rax, 0x138(%rsp)
jmp 0x3bf44
movq 0x138(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x130(%rsp)
jmp 0x3bf63
movq 0x130(%rsp), %rdi
leaq 0x3c0(%rsp), %rsi
callq 0x42e0
movq %rax, 0x128(%rsp)
jmp 0x3bf82
movq 0x128(%rsp), %rdi
leaq 0x3b8(%rsp), %rsi
callq 0x42e0
movq %rax, 0x120(%rsp)
jmp 0x3bfa1
movq 0x120(%rsp), %rdi
leaq 0x3b0(%rsp), %rsi
callq 0x42e0
movq %rax, 0x118(%rsp)
jmp 0x3bfc0
movq 0x118(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
addq $0x8, %rsi
callq 0x42e0
movq %rax, 0x110(%rsp)
jmp 0x3bfe3
movq 0x110(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
addq $0x10, %rsi
callq 0x42e0
movq %rax, 0x108(%rsp)
jmp 0x3c006
movq 0x108(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
addq $0x18, %rsi
callq 0x41f0
movq %rax, 0x100(%rsp)
jmp 0x3c029
movq 0x100(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
addq $0x198, %rsi            # imm = 0x198
callq 0x4450
jmp 0x3c047
movq 0x1d0(%rsp), %rsi
addq $0x1b8, %rsi            # imm = 0x1B8
leaq 0x1e8(%rsp), %rdi
leaq 0x440(%rsp), %rdx
callq 0x11f20
jmp 0x3c06d
leaq 0x1e8(%rsp), %rdi
leaq 0x438(%rsp), %rsi
callq 0x11f60
movq %rax, 0xf8(%rsp)
jmp 0x3c08c
movq 0xf8(%rsp), %rdi
leaq 0x430(%rsp), %rsi
callq 0x11f60
jmp 0x3c0a3
leaq 0x1e8(%rsp), %rdi
callq 0x120e0
movq 0x1d0(%rsp), %rdi
movsd 0x428(%rsp), %xmm0
movsd %xmm0, 0x190(%rdi)
movsd 0x420(%rsp), %xmm0
movsd %xmm0, 0xe8(%rsp)
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xf0(%rsp)
jmp 0x3c0f5
movq 0x1d0(%rsp), %rdi
movq 0xf0(%rsp), %rax
movsd 0xe8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x418(%rsp), %xmm0
movsd %xmm0, 0xd8(%rsp)
addq $0x20, %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xe0(%rsp)
jmp 0x3c13f
movq 0x1d0(%rsp), %rdi
movq 0xe0(%rsp), %rax
movsd 0xd8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x410(%rsp), %xmm0
movsd %xmm0, 0xc8(%rsp)
addq $0x20, %rdi
movl $0x2, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xd0(%rsp)
jmp 0x3c189
movq 0x1d0(%rsp), %rdi
movq 0xd0(%rsp), %rax
movsd 0xc8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x408(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
addq $0x68, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xc0(%rsp)
jmp 0x3c1d2
movq 0x1d0(%rsp), %rdi
movq 0xc0(%rsp), %rax
movsd 0xb8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x400(%rsp), %xmm0
movsd %xmm0, 0xa8(%rsp)
addq $0x68, %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xb0(%rsp)
jmp 0x3c21c
movq 0x1d0(%rsp), %rdi
movq 0xb0(%rsp), %rax
movsd 0xa8(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3f8(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
addq $0x68, %rdi
movl $0x2, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0xa0(%rsp)
jmp 0x3c266
movq 0x1d0(%rsp), %rdi
movq 0xa0(%rsp), %rax
movsd 0x98(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3f0(%rsp), %xmm0
movsd %xmm0, 0x88(%rsp)
addq $0xb0, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x90(%rsp)
jmp 0x3c2b2
movq 0x1d0(%rsp), %rdi
movq 0x90(%rsp), %rax
movsd 0x88(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3e8(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
addq $0xb0, %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x80(%rsp)
jmp 0x3c2fc
movq 0x1d0(%rsp), %rdi
movq 0x80(%rsp), %rax
movsd 0x78(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3e0(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
addq $0xb0, %rdi
movl $0x2, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x70(%rsp)
jmp 0x3c340
movq 0x1d0(%rsp), %rdi
movq 0x70(%rsp), %rax
movsd 0x68(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3d8(%rsp), %xmm0
movsd %xmm0, 0x58(%rsp)
addq $0xf8, %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x60(%rsp)
jmp 0x3c380
movq 0x1d0(%rsp), %rdi
movq 0x60(%rsp), %rax
movsd 0x58(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3d0(%rsp), %xmm0
movsd %xmm0, 0x48(%rsp)
addq $0xf8, %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x50(%rsp)
jmp 0x3c3c1
movq 0x1d0(%rsp), %rdi
movq 0x50(%rsp), %rax
movsd 0x48(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3c8(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
addq $0xf8, %rdi
movl $0x2, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x40(%rsp)
jmp 0x3c402
movq 0x1d0(%rsp), %rdi
movq 0x40(%rsp), %rax
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3c0(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
addq $0x140, %rdi            # imm = 0x140
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x30(%rsp)
jmp 0x3c442
movq 0x1d0(%rsp), %rdi
movq 0x30(%rsp), %rax
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3b8(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
addq $0x140, %rdi            # imm = 0x140
movl $0x1, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x20(%rsp)
jmp 0x3c483
movq 0x1d0(%rsp), %rdi
movq 0x20(%rsp), %rax
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movsd 0x3b0(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
addq $0x140, %rdi            # imm = 0x140
movl $0x2, %edx
movq %rdx, %rsi
callq 0x1eaf0
movq %rax, 0x10(%rsp)
jmp 0x3c4c4
movq 0x10(%rsp), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0x208(%rsp), %rdi
callq 0x4290
leaq 0x390(%rsp), %rdi
callq 0x4200
addq $0x498, %rsp            # imm = 0x498
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
leaq 0x487(%rsp), %rdi
callq 0x43c0
jmp 0x3c5a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
jmp 0x3c598
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
jmp 0x3c58b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
jmp 0x3c57e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x478(%rsp)
movl %eax, 0x474(%rsp)
leaq 0x1e8(%rsp), %rdi
callq 0x120e0
leaq 0x208(%rsp), %rdi
callq 0x4290
leaq 0x390(%rsp), %rdi
callq 0x4200
movq 0x1d8(%rsp), %rdi
callq 0x4200
movq 0x1d0(%rsp), %rdi
callq 0x1f000
movq 0x478(%rsp), %rdi
callq 0x45e0
nop