// File: logicx24[P]RayTracer/raytracer.cpp
// Function: Triangle::normal(vec3)
vec3 normal(vec3 point) {
        if (needInterpolate) {
            vec3 normal = (edge2 ^ edge1).normalize();
            float a1 = normal * ((vertex2 - vertex1) ^ (vertex3 - vertex1));
            float a2 = normal * ((vertex2 - point) ^ (vertex3 - point));
            float a3 = normal * ((vertex3 - point) ^ (vertex1 - point));
            float alpha = a2 / a1;
            float beta = a3 / a1;
            float gamma = 1.0f - alpha - beta;
            vec3 iNormal = alpha * normal1 + beta * normal2 + gamma * normal3;
            return iNormal;
        } else {
        	return edge2 ^ edge1;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdx, -0x1c8(%rbp)
movq %rdi, -0x1c0(%rbp)
movq %rdi, %rax
movq %rax, -0x1b8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1b0(%rbp)
testb $0x1, 0x2b0(%rax)
je 0xa74e
movq -0x1b0(%rbp), %rdx
movq %rdx, %rsi
addq $0x250, %rsi            # imm = 0x250
addq $0x238, %rdx            # imm = 0x238
leaq -0x48(%rbp), %rdi
callq 0xadc0
leaq -0x48(%rbp), %rdi
callq 0xaeb0
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
callq 0x7e40
movq -0x1b0(%rbp), %rdx
movq %rdx, %rsi
addq $0x208, %rsi            # imm = 0x208
addq $0x1f0, %rdx            # imm = 0x1F0
leaq -0x80(%rbp), %rdi
callq 0xa040
movq -0x1b0(%rbp), %rdx
movq %rdx, %rsi
addq $0x220, %rsi            # imm = 0x220
addq $0x1f0, %rdx            # imm = 0x1F0
leaq -0x98(%rbp), %rdi
callq 0xa040
leaq -0x68(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0xadc0
leaq -0x30(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xaee0
movq -0x1c8(%rbp), %rdx
movq -0x1b0(%rbp), %rsi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4c(%rbp)
addq $0x208, %rsi            # imm = 0x208
leaq -0xd0(%rbp), %rdi
callq 0xa040
movq -0x1c8(%rbp), %rdx
movq -0x1b0(%rbp), %rsi
addq $0x220, %rsi            # imm = 0x220
leaq -0xe8(%rbp), %rdi
callq 0xa040
leaq -0xb8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xe8(%rbp), %rdx
callq 0xadc0
leaq -0x30(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0xaee0
movq -0x1c8(%rbp), %rdx
movq -0x1b0(%rbp), %rsi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x9c(%rbp)
addq $0x220, %rsi            # imm = 0x220
leaq -0x120(%rbp), %rdi
callq 0xa040
movq -0x1c8(%rbp), %rdx
movq -0x1b0(%rbp), %rsi
addq $0x1f0, %rsi            # imm = 0x1F0
leaq -0x138(%rbp), %rdi
callq 0xa040
leaq -0x108(%rbp), %rdi
leaq -0x120(%rbp), %rsi
leaq -0x138(%rbp), %rdx
callq 0xadc0
leaq -0x30(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xaee0
movq -0x1b0(%rbp), %rsi
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xec(%rbp)
movss -0x9c(%rbp), %xmm0
divss -0x4c(%rbp), %xmm0
movss %xmm0, -0x13c(%rbp)
movss -0xec(%rbp), %xmm0
divss -0x4c(%rbp), %xmm0
movss %xmm0, -0x140(%rbp)
movss 0x1a9a3(%rip), %xmm0    # 0x25038
subss -0x13c(%rbp), %xmm0
subss -0x140(%rbp), %xmm0
movss %xmm0, -0x144(%rbp)
movss -0x13c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addq $0x268, %rsi            # imm = 0x268
leaq -0x178(%rbp), %rdi
callq 0xb0d0
movq -0x1b0(%rbp), %rsi
movss -0x140(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addq $0x280, %rsi            # imm = 0x280
leaq -0x190(%rbp), %rdi
callq 0xb0d0
leaq -0x160(%rbp), %rdi
leaq -0x178(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0xb070
movq -0x1b0(%rbp), %rsi
movss -0x144(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
addq $0x298, %rsi            # imm = 0x298
leaq -0x1a8(%rbp), %rdi
callq 0xb0d0
movq -0x1c0(%rbp), %rdi
leaq -0x160(%rbp), %rsi
leaq -0x1a8(%rbp), %rdx
callq 0xb070
jmp 0xa772
movq -0x1c0(%rbp), %rdi
movq -0x1b0(%rbp), %rdx
movq %rdx, %rsi
addq $0x250, %rsi            # imm = 0x250
addq $0x238, %rdx            # imm = 0x238
callq 0xadc0
movq -0x1b8(%rbp), %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)