// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testl %esi, %esi
jne 0x3f8c4
cmpq %rbx, 0xf57aa(%rip)     # 0x135068
je 0x3fae3
movupd 0x20(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x85c32(%rip), %xmm1    # 0xc5508
movsd 0x68(%rbx), %xmm2
mulsd 0x85c2d(%rip), %xmm2    # 0xc5510
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x85c24(%rip), %xmm1    # 0xc5518
addsd %xmm2, %xmm1
movsd 0x85718(%rip), %xmm2    # 0xc5018
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 0x222e0
movupd 0x38(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x85bc3(%rip), %xmm1    # 0xc5508
movsd 0x68(%rbx), %xmm2
mulsd 0x85bbe(%rip), %xmm2    # 0xc5510
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x85bb5(%rip), %xmm1    # 0xc5518
addsd %xmm2, %xmm1
movsd 0x856a9(%rip), %xmm2    # 0xc5018
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 0x222e0
movupd 0x50(%rbx), %xmm0
movsd 0x70(%rbx), %xmm1
mulsd 0x85b57(%rip), %xmm1    # 0xc5508
movsd 0x68(%rbx), %xmm2
mulsd 0x85b52(%rip), %xmm2    # 0xc5510
addsd %xmm1, %xmm2
movsd 0x78(%rbx), %xmm1
mulsd 0x85b49(%rip), %xmm1    # 0xc5518
addsd %xmm2, %xmm1
movsd 0x8563d(%rip), %xmm2    # 0xc5018
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 0x222e0
movsd 0x85af5(%rip), %xmm2    # 0xc5508
mulsd 0x70(%rbx), %xmm2
movupd 0x80(%rbx), %xmm0
movsd 0x85ae8(%rip), %xmm1    # 0xc5510
mulsd 0x68(%rbx), %xmm1
addsd %xmm2, %xmm1
movsd 0x85adf(%rip), %xmm2    # 0xc5518
mulsd 0x78(%rbx), %xmm2
addsd %xmm1, %xmm2
movsd 0x855ce(%rip), %xmm3    # 0xc5018
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 0x222e0
cvtsd2ss 0x98(%rbx), %xmm0
movl $0x408, %edi            # imm = 0x408
movl $0x1601, %esi           # imm = 0x1601
callq 0x218a0
testb $0x20, 0xa8(%rbx)
jne 0x3fabc
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x21210
pushq $0x1
popq %rbp
movl %ebp, %edi
xorl %esi, %esi
callq 0x216d0
movl %ebp, %edi
callq 0x21520
jmp 0x3fadc
xorl %edi, %edi
callq 0x21520
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x216d0
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x21820
movq %rbx, 0xf5585(%rip)     # 0x135068
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq