void mat4_mul_vec3(const float m[4][4], const float v[3], float out[3]) {
  float v4[4] = {v[0], v[1], v[2], 1.0f};
  mat4_mul_vec4(m, v4, v4);
  vec3_copy(v4, out);
}


x86 assembly (clang, -O0):
<mat4_mul_vec3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xe9b(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    $0x0,%al
call   1030 <mat4_mul_vec4@plt>
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <vec3_copy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat4_mul_vec3>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
movss  (%rsi),%xmm0
movss  %xmm0,(%rsp)
movss  0x4(%rsi),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rsp)
movl   $0x3f800000,0xc(%rsp)
3f
mov    %rsp,%rbx
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <mat4_mul_vec4@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <vec3_copy@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @mat4_mul_vec3([4 x float]* %0, float* %1, float* %2) {
%4 = alloca [4 x float]*
%5 = alloca float*
%6 = alloca float*
%7 = alloca [4 x float]
store [4 x float]* %0, [4 x float]** %4
store float* %1, float** %5
store float* %2, float** %6
%8 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%9 = load float*, float** %5
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
store float %11, float* %8
%12 = getelementptr inbounds float, float* %8, i64 1
%13 = load float*, float** %5
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
store float %15, float* %12
%16 = getelementptr inbounds float, float* %12, i64 1
%17 = load float*, float** %5
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
store float %19, float* %16
%20 = getelementptr inbounds float, float* %16, i64 1
store float 1.000000e+00, float* %20
%21 = load [4 x float]*, [4 x float]** %4
%22 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%23 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%24 = call i32 ([4 x float]*, float*, float*, ...) bitcast (i32 (...)* @mat4_mul_vec4 to i32 ([4 x float]*, float*, float*, ...)*)([4 x float]* %21, float* %22, float* %23)
%25 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%26 = load float*, float** %6
%27 = call i32 (float*, float*, ...) bitcast (i32 (...)* @vec3_copy to i32 (float*, float*, ...)*)(float* %25, float* %26)
ret void
}

LLVM IR (-O2):
define void @mat4_mul_vec3([4 x float]* %0, float* nocapture %1, float* %2) {
%4 = alloca [4 x float]
%5 = bitcast [4 x float]* %4 to i8*
%6 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 0
%7 = load float, float* %1
store float %7, float* %6
%8 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 1
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
store float %10, float* %8
%11 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 2
%12 = getelementptr inbounds float, float* %1, i64 2
%13 = load float, float* %12
store float %13, float* %11
%14 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 3
store float 1.000000e+00, float* %14
%15 = call i32 ([4 x float]*, float*, float*, ...) bitcast (i32 (...)* @mat4_mul_vec4 to i32 ([4 x float]*, float*, float*, ...)*)([4 x float]* %0, float* %6, float* %6)
%16 = call i32 (float*, float*, ...) bitcast (i32 (...)* @vec3_copy to i32 (float*, float*, ...)*)(float* %6, float* %2)
ret void
}