extern void warp_mat4_fill_orthographic(float *matrix, float width,
                                        float height, float near, float far) {
  const float left = -width / 2, right = width / 2;
  const float top = height / 2, bottom = -height / 2;
  const float tz = -(far + near) / (far - near);
  const float m00 = 2.0f / (right - left);
  const float m11 = 2.0f / (top - bottom);
  const float m22 = -2.0f / (far - near);
  matrix[0] = m00;
  matrix[1] = 0;
  matrix[2] = 0;
  matrix[3] = 0;
  matrix[4] = 0;
  matrix[5] = m11;
  matrix[6] = 0;
  matrix[7] = 0;
  matrix[8] = 0;
  matrix[9] = 0;
  matrix[10] = m22;
  matrix[11] = 0;
  matrix[12] = 0;
  matrix[13] = 0;
  matrix[14] = tz;
  matrix[15] = 1;
}


x86 assembly (clang, -O0):
<warp_mat4_fill_orthographic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xed2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xebc(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xea6(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe83(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm1
subss  -0x1c(%rbp),%xmm1
movss  0xe3e(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm1
subss  -0x28(%rbp),%xmm1
movss  0xe23(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
movss  0xe04(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rax)
movss  -0x34(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x24(%rax)
movss  -0x38(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x2c(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x34(%rax)
movss  -0x2c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x38(%rax)
mov    -0x8(%rbp),%rax
movss  0xd30(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<warp_mat4_fill_orthographic>:
movss  0xef8(%rip),%xmm4
mulss  %xmm4,%xmm0
movaps %xmm2,%xmm5
addss  %xmm3,%xmm5
xorps  0xef6(%rip),%xmm5
mulss  %xmm4,%xmm1
subss  %xmm2,%xmm3
divss  %xmm3,%xmm5
addss  %xmm0,%xmm0
movss  0xed2(%rip),%xmm2
movaps %xmm2,%xmm4
divss  %xmm0,%xmm4
addss  %xmm1,%xmm1
divss  %xmm1,%xmm2
movss  0xebf(%rip),%xmm0
divss  %xmm3,%xmm0
movss  %xmm4,(%rdi)
xorps  %xmm1,%xmm1
movups %xmm1,0x4(%rdi)
movss  %xmm2,0x14(%rdi)
movups %xmm1,0x18(%rdi)
movss  %xmm0,0x28(%rdi)
movq   $0x0,0x2c(%rdi)
movl   $0x0,0x34(%rdi)
movss  %xmm5,0x38(%rdi)
movl   $0x3f800000,0x3c(%rdi)
ret

LLVM IR (-O0):
define void @warp_mat4_fill_orthographic(float* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
store float* %0, float** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%19 = load float, float* %7
%20 = fneg float %19
%21 = fdiv float %20, 2.000000e+00
store float %21, float* %11
%22 = load float, float* %7
%23 = fdiv float %22, 2.000000e+00
store float %23, float* %12
%24 = load float, float* %8
%25 = fdiv float %24, 2.000000e+00
store float %25, float* %13
%26 = load float, float* %8
%27 = fneg float %26
%28 = fdiv float %27, 2.000000e+00
store float %28, float* %14
%29 = load float, float* %10
%30 = load float, float* %9
%31 = fadd float %29, %30
%32 = fneg float %31
%33 = load float, float* %10
%34 = load float, float* %9
%35 = fsub float %33, %34
%36 = fdiv float %32, %35
store float %36, float* %15
%37 = load float, float* %12
%38 = load float, float* %11
%39 = fsub float %37, %38
%40 = fdiv float 2.000000e+00, %39
store float %40, float* %16
%41 = load float, float* %13
%42 = load float, float* %14
%43 = fsub float %41, %42
%44 = fdiv float 2.000000e+00, %43
store float %44, float* %17
%45 = load float, float* %10
%46 = load float, float* %9
%47 = fsub float %45, %46
%48 = fdiv float -2.000000e+00, %47
store float %48, float* %18
%49 = load float, float* %16
%50 = load float*, float** %6
%51 = getelementptr inbounds float, float* %50, i64 0
store float %49, float* %51
%52 = load float*, float** %6
%53 = getelementptr inbounds float, float* %52, i64 1
store float 0.000000e+00, float* %53
%54 = load float*, float** %6
%55 = getelementptr inbounds float, float* %54, i64 2
store float 0.000000e+00, float* %55
%56 = load float*, float** %6
%57 = getelementptr inbounds float, float* %56, i64 3
store float 0.000000e+00, float* %57
%58 = load float*, float** %6
%59 = getelementptr inbounds float, float* %58, i64 4
store float 0.000000e+00, float* %59
%60 = load float, float* %17
%61 = load float*, float** %6
%62 = getelementptr inbounds float, float* %61, i64 5
store float %60, float* %62
%63 = load float*, float** %6
%64 = getelementptr inbounds float, float* %63, i64 6
store float 0.000000e+00, float* %64
%65 = load float*, float** %6
%66 = getelementptr inbounds float, float* %65, i64 7
store float 0.000000e+00, float* %66
%67 = load float*, float** %6
%68 = getelementptr inbounds float, float* %67, i64 8
store float 0.000000e+00, float* %68
%69 = load float*, float** %6
%70 = getelementptr inbounds float, float* %69, i64 9
store float 0.000000e+00, float* %70
%71 = load float, float* %18
%72 = load float*, float** %6
%73 = getelementptr inbounds float, float* %72, i64 10
store float %71, float* %73
%74 = load float*, float** %6
%75 = getelementptr inbounds float, float* %74, i64 11
store float 0.000000e+00, float* %75
%76 = load float*, float** %6
%77 = getelementptr inbounds float, float* %76, i64 12
store float 0.000000e+00, float* %77
%78 = load float*, float** %6
%79 = getelementptr inbounds float, float* %78, i64 13
store float 0.000000e+00, float* %79
%80 = load float, float* %15
%81 = load float*, float** %6
%82 = getelementptr inbounds float, float* %81, i64 14
store float %80, float* %82
%83 = load float*, float** %6
%84 = getelementptr inbounds float, float* %83, i64 15
store float 1.000000e+00, float* %84
ret void
}

LLVM IR (-O2):
define void @warp_mat4_fill_orthographic(float* nocapture writeonly %0, float %1, float %2, float %3, float %4) {
%6 = fmul float %1, 5.000000e-01
%7 = fmul float %2, 5.000000e-01
%8 = fadd float %3, %4
%9 = fneg float %8
%10 = fsub float %4, %3
%11 = fdiv float %9, %10
%12 = fadd float %6, %6
%13 = fdiv float 2.000000e+00, %12
%14 = fadd float %7, %7
%15 = fdiv float 2.000000e+00, %14
%16 = fdiv float -2.000000e+00, %10
store float %13, float* %0
%17 = getelementptr inbounds float, float* %0, i64 1
%18 = getelementptr inbounds float, float* %0, i64 5
%19 = bitcast float* %17 to i8*
store float %15, float* %18
%20 = getelementptr inbounds float, float* %0, i64 6
%21 = getelementptr inbounds float, float* %0, i64 10
%22 = bitcast float* %20 to i8*
store float %16, float* %21
%23 = getelementptr inbounds float, float* %0, i64 11
store float 0.000000e+00, float* %23
%24 = getelementptr inbounds float, float* %0, i64 12
store float 0.000000e+00, float* %24
%25 = getelementptr inbounds float, float* %0, i64 13
store float 0.000000e+00, float* %25
%26 = getelementptr inbounds float, float* %0, i64 14
store float %11, float* %26
%27 = getelementptr inbounds float, float* %0, i64 15
store float 1.000000e+00, float* %27
ret void
}