void mat3_projection(float *dst, float width, float height) {
  dst[0] = 2 / width;
  dst[1] = 0;
  dst[2] = 0;
  dst[3] = 0;
  dst[4] = -2 / height;
  dst[5] = 0;
  dst[6] = -1;
  dst[7] = 1;
  dst[8] = 1;
}


x86 assembly (clang, -O0):
<mat3_projection>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  0xef2(%rip),%xmm0
divss  -0xc(%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)
movss  0xeb5(%rip),%xmm0
divss  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rax)
mov    -0x8(%rbp),%rax
movss  0xe8b(%rip),%xmm0
movss  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
movss  0xe76(%rip),%xmm0
movss  %xmm0,0x1c(%rax)
mov    -0x8(%rbp),%rax
movss  0xe65(%rip),%xmm0
movss  %xmm0,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat3_projection>:
movss  0xef8(%rip),%xmm2
divss  %xmm0,%xmm2
movss  %xmm2,(%rdi)
movq   $0x0,0x4(%rdi)
movl   $0x0,0xc(%rdi)
movss  0xedd(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x10(%rdi)
movaps 0xed9(%rip),%xmm0
movups %xmm0,0x14(%rdi)
ret

LLVM IR (-O0):
define void @mat3_projection(float* %0, float %1, float %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float
store float* %0, float** %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = fdiv float 2.000000e+00, %7
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
store float %8, float* %10
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 1
store float 0.000000e+00, float* %12
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 2
store float 0.000000e+00, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 3
store float 0.000000e+00, float* %16
%17 = load float, float* %6
%18 = fdiv float -2.000000e+00, %17
%19 = load float*, float** %4
%20 = getelementptr inbounds float, float* %19, i64 4
store float %18, float* %20
%21 = load float*, float** %4
%22 = getelementptr inbounds float, float* %21, i64 5
store float 0.000000e+00, float* %22
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 6
store float -1.000000e+00, float* %24
%25 = load float*, float** %4
%26 = getelementptr inbounds float, float* %25, i64 7
store float 1.000000e+00, float* %26
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 8
store float 1.000000e+00, float* %28
ret void
}

LLVM IR (-O2):
define void @mat3_projection(float* nocapture writeonly %0, float %1, float %2) {
%4 = fdiv float 2.000000e+00, %1
store float %4, float* %0
%5 = getelementptr inbounds float, float* %0, i64 1
store float 0.000000e+00, float* %5
%6 = getelementptr inbounds float, float* %0, i64 2
store float 0.000000e+00, float* %6
%7 = getelementptr inbounds float, float* %0, i64 3
store float 0.000000e+00, float* %7
%8 = fdiv float -2.000000e+00, %2
%9 = getelementptr inbounds float, float* %0, i64 4
store float %8, float* %9
%10 = getelementptr inbounds float, float* %0, i64 5
%11 = bitcast float* %10 to <4 x float>*
store <4 x float> <float 0.000000e+00, float -1.000000e+00, float 1.000000e+00, float 1.000000e+00>, <4 x float>* %11
ret void
}