#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
void finn_mat4_scale(float *mat, float *vec) {
  memset(mat, 0, sizeof(float) * 16);
  mat[0] = vec[0];
  mat[5] = vec[1];
  mat[10] = vec[2];
  mat[15] = 1.0f;
}


x86 assembly (clang, -O0):
<finn_mat4_scale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x14(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
movss  0xe90(%rip),%xmm0
movss  %xmm0,0x3c(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finn_mat4_scale>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movss  (%r14),%xmm0
movss  %xmm0,(%rbx)
movss  0x4(%r14),%xmm0
movss  %xmm0,0x14(%rbx)
movss  0x8(%r14),%xmm0
movss  %xmm0,0x28(%rbx)
movl   $0x3f800000,0x3c(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @finn_mat4_scale(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = call i32 @memset(float* %5, i32 0, i32 64)
%7 = load float*, float** %4
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 0
store float %9, float* %11
%12 = load float*, float** %4
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float*, float** %3
%16 = getelementptr inbounds float, float* %15, i64 5
store float %14, float* %16
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 10
store float %19, float* %21
%22 = load float*, float** %3
%23 = getelementptr inbounds float, float* %22, i64 15
store float 1.000000e+00, float* %23
ret void
}

LLVM IR (-O2):
define void @finn_mat4_scale(float* %0, float* nocapture %1) {
%3 = tail call i32 @memset(float* %0, i32 0, i32 64)
%4 = load float, float* %1
store float %4, float* %0
%5 = getelementptr inbounds float, float* %1, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %0, i64 5
store float %6, float* %7
%8 = getelementptr inbounds float, float* %1, i64 2
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %0, i64 10
store float %9, float* %10
%11 = getelementptr inbounds float, float* %0, i64 15
store float 1.000000e+00, float* %11
ret void
}