// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Graphics/R3Brdf.cpp
// Function: gaps::R3Brdf::Draw(int) const
void R3Brdf::
Draw(RNBoolean force) const
{
    // Check if same brdf
    static const R3Brdf *R3current_brdf = NULL;
    if (!force && (this == R3current_brdf)) return;

    // Set brdf attributes
    GLfloat c[4];
    c[0] = Ambient().R();
    c[1] = Ambient().G();
    c[2] = Ambient().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, c);
    c[0] = Diffuse().R();
    c[1] = Diffuse().G();
    c[2] = Diffuse().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, c);
    c[0] = Specular().R();
    c[1] = Specular().G();
    c[2] = Specular().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, c);
    c[0] = Emission().R();
    c[1] = Emission().G();
    c[2] = Emission().B();
    c[3] = Opacity();
    glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, c);
    glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Shininess());
    if (IsTransparent()) {
      glDepthMask(FALSE);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glEnable(GL_BLEND);
    }
    else {
      glDisable(GL_BLEND);
      glBlendFunc(GL_ONE, GL_ZERO);
      glDepthMask(TRUE);
    }

    // Remember brdf
    R3current_brdf = this;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testl %esi, %esi
jne 0x4470d
cmpq %rbx, 0xff941(%rip)     # 0x144048
je 0x44932
movupd 0x20(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x95df9(%rip), %xmm1    # 0xda518
movsd 0x68(%rbx), %xmm2
mulsd 0x95df4(%rip), %xmm2    # 0xda520
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x95deb(%rip), %xmm1    # 0xda528
addsd %xmm2, %xmm1
movsd 0x958cf(%rip), %xmm2    # 0xda018
subsd %xmm1, %xmm2
movsd 0x30(%rbx), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
cvtpd2ps %xmm1, %xmm1
cvtpd2ps %xmm0, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movq %rsp, %r14
movapd %xmm0, (%r14)
movl $0x408, %edi            # imm = 0x408
movl $0x1200, %esi           # imm = 0x1200
movq %r14, %rdx
callq 0x222b0
movupd 0x38(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x95d8a(%rip), %xmm1    # 0xda518
movsd 0x68(%rbx), %xmm2
mulsd 0x95d85(%rip), %xmm2    # 0xda520
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x95d7c(%rip), %xmm1    # 0xda528
addsd %xmm2, %xmm1
movsd 0x95860(%rip), %xmm2    # 0xda018
subsd %xmm1, %xmm2
movsd 0x48(%rbx), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
cvtpd2ps %xmm1, %xmm1
cvtpd2ps %xmm0, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm0, (%r14)
movl $0x408, %edi            # imm = 0x408
movl $0x1201, %esi           # imm = 0x1201
movq %r14, %rdx
callq 0x222b0
movupd 0x50(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x95d1e(%rip), %xmm1    # 0xda518
movsd 0x68(%rbx), %xmm2
mulsd 0x95d19(%rip), %xmm2    # 0xda520
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x95d10(%rip), %xmm1    # 0xda528
addsd %xmm2, %xmm1
movsd 0x957f4(%rip), %xmm2    # 0xda018
subsd %xmm1, %xmm2
movsd 0x60(%rbx), %xmm1
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
cvtpd2ps %xmm1, %xmm1
cvtpd2ps %xmm0, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm0, (%r14)
movl $0x408, %edi            # imm = 0x408
movl $0x1202, %esi           # imm = 0x1202
movq %r14, %rdx
callq 0x222b0
movsd 0x95cbc(%rip), %xmm2    # 0xda518
mulsd 0x70(%rbx), %xmm2
movupd 0x80(%rbx), %xmm0
movsd 0x95caf(%rip), %xmm1    # 0xda520
mulsd 0x68(%rbx), %xmm1
addsd %xmm2, %xmm1
movsd 0x95ca6(%rip), %xmm2    # 0xda528
mulsd 0x78(%rbx), %xmm2
addsd %xmm1, %xmm2
movsd 0x95785(%rip), %xmm3    # 0xda018
subsd %xmm2, %xmm3
movsd 0x90(%rbx), %xmm1
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
cvtpd2ps %xmm1, %xmm1
cvtpd2ps %xmm0, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
movapd %xmm0, (%r14)
movl $0x408, %edi            # imm = 0x408
movl $0x1600, %esi           # imm = 0x1600
movq %r14, %rdx
callq 0x222b0
xorps %xmm0, %xmm0
cvtsd2ss 0x98(%rbx), %xmm0
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x218a0
testb $0x20, 0xa8(%rbx)
jne 0x4490b
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x211f0
movl $0x1, %edi
xorl %esi, %esi
callq 0x216d0
movl $0x1, %edi
callq 0x21520
jmp 0x4492b
xorl %edi, %edi
callq 0x21520
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x216d0
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x21810
movq %rbx, 0xff716(%rip)     # 0x144048
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop