// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonglmath/src/viewing.c
// Function: moonglmath_ortho
int ortho(mat_t dst, double l, double r, double b, double t, double near, double far)
/* ortho(left, right, bottom, top, near,  far)
 * near=-1 and far=1 give a 2D projection
 *
 * Rfr. RTR3/4.6.1
 *
 * The viewing parallelepiped is: 
 * x: left .. right
 * y: bottom .. up
 * z: -near .. -far
 *
 * The camera is positioned at the origin, pointing to the -z axis (x=right, y=up)
 * and the projection plane is the x-y plane (or, equivalently, any plane parallel
 * to x-y, since the projectors are parallel to the z axis).
 *
 * M =  |2/(r-l)  0    0     0| |1 0 0 -(l+r)/2| = |2/(r-l)  0     0    -(r+l)/(r-l)|
 *      |  0   2/(t-b) 0     0|*|0 1 0 -(t+b)/2|   |  0   2/(t-b)  0    -(t+b)/(t-b)|
 *      |  0      0  2/(f-n) 0| |0 0 1 -(f+n)/2|   |  0     0   2/(f-n) -(f+n)/(f-n)|
 *      |  0      0    0     1| |0 0 0     1   |   |  0     0      0         1      |
 *           scaling               translation
 */
    {
    double n, f;
    n = -near;
    f = -far;
    mat_clear(dst);
    dst[0][0] = 2.0/(r-l);
    dst[0][3] = -(r+l)/(r-l);
    dst[1][1] = 2.0/(t-b);
    dst[1][3] = -(t+b)/(t-b);
    dst[2][2] = 2.0/(f-n);
    dst[2][3] = -(f+n)/(f-n);
    dst[3][3] = 1.0;
    return 0;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movsd %xmm1, 0x30(%rsp)
movsd %xmm2, 0x28(%rsp)
movsd %xmm3, 0x20(%rsp)
movsd %xmm4, 0x18(%rsp)
movsd %xmm5, 0x10(%rsp)
movsd 0x18(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x10(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, (%rsp)
movq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x8530
movsd 0x30(%rsp), %xmm1
subsd 0x38(%rsp), %xmm1
movsd 0x2149(%rip), %xmm0     # 0x23700
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, (%rax)
movsd 0x30(%rsp), %xmm0
addsd 0x38(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x30(%rsp), %xmm1
subsd 0x38(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x18(%rax)
movsd 0x20(%rsp), %xmm1
subsd 0x28(%rsp), %xmm1
movsd 0x20eb(%rip), %xmm0     # 0x23700
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x28(%rax)
movsd 0x20(%rsp), %xmm0
addsd 0x28(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd 0x20(%rsp), %xmm1
subsd 0x28(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x38(%rax)
movsd (%rsp), %xmm1
subsd 0x8(%rsp), %xmm1
movsd 0x208d(%rip), %xmm0     # 0x23700
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x50(%rax)
movsd (%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd (%rsp), %xmm1
subsd 0x8(%rsp), %xmm1
divsd %xmm1, %xmm0
movq 0x40(%rsp), %rax
movsd %xmm0, 0x58(%rax)
movq 0x40(%rsp), %rax
movsd 0x19f7(%rip), %xmm0     # 0x230c0
movsd %xmm0, 0x78(%rax)
xorl %eax, %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)