// File: /workspace/github_cpp_makefile_star2_O1/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 0x44ceb
cmpq %rbx, 0x101363(%rip)    # 0x146048
je 0x44f10
movupd 0x20(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x97813(%rip), %xmm1    # 0xdc510
movsd 0x68(%rbx), %xmm2
mulsd 0x9780e(%rip), %xmm2    # 0xdc518
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x97805(%rip), %xmm1    # 0xdc520
addsd %xmm2, %xmm1
movsd 0x972f1(%rip), %xmm2    # 0xdc018
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 0x222c0
movupd 0x38(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x977a4(%rip), %xmm1    # 0xdc510
movsd 0x68(%rbx), %xmm2
mulsd 0x9779f(%rip), %xmm2    # 0xdc518
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x97796(%rip), %xmm1    # 0xdc520
addsd %xmm2, %xmm1
movsd 0x97282(%rip), %xmm2    # 0xdc018
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 0x222c0
movupd 0x50(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x97738(%rip), %xmm1    # 0xdc510
movsd 0x68(%rbx), %xmm2
mulsd 0x97733(%rip), %xmm2    # 0xdc518
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x9772a(%rip), %xmm1    # 0xdc520
addsd %xmm2, %xmm1
movsd 0x97216(%rip), %xmm2    # 0xdc018
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 0x222c0
movsd 0x976d6(%rip), %xmm2    # 0xdc510
mulsd 0x70(%rbx), %xmm2
movupd 0x80(%rbx), %xmm0
movsd 0x976c9(%rip), %xmm1    # 0xdc518
mulsd 0x68(%rbx), %xmm1
addsd %xmm2, %xmm1
movsd 0x976c0(%rip), %xmm2    # 0xdc520
mulsd 0x78(%rbx), %xmm2
addsd %xmm1, %xmm2
movsd 0x971a7(%rip), %xmm3    # 0xdc018
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 0x222c0
xorps %xmm0, %xmm0
cvtsd2ss 0x98(%rbx), %xmm0
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x218a0
testb $0x20, 0xa8(%rbx)
jne 0x44ee9
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x211f0
movl $0x1, %edi
xorl %esi, %esi
callq 0x216d0
movl $0x1, %edi
callq 0x21520
jmp 0x44f09
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, 0x101138(%rip)    # 0x146048
addq $0x18, %rsp
popq %rbx
popq %r14
retq