#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*/ floats_mat44_identity(float *);
void floats_mat44_translate(const float txyz[3], float out[16]) {
  floats_mat44_identity(out);
  for (int i = 0; i < 3; i++)
    out[4 * i + 3] += txyz[i];
}


x86 assembly (clang, -O0):
<floats_mat44_translate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <floats_mat44_identity@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    116f <floats_mat44_translate+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
addss  (%rax,%rcx,4),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <floats_mat44_translate+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floats_mat44_translate>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <floats_mat44_identity@plt>
movss  (%r14),%xmm0
addss  0xc(%rbx),%xmm0
movss  %xmm0,0xc(%rbx)
movss  0x4(%r14),%xmm0
addss  0x1c(%rbx),%xmm0
movss  %xmm0,0x1c(%rbx)
movss  0x8(%r14),%xmm0
addss  0x2c(%rbx),%xmm0
movss  %xmm0,0x2c(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @floats_mat44_translate(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca i32
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %4
%7 = call i32 @floats_mat44_identity(float* %6)
store i32 0, i32* %5
br label %8
8: ; preds = %25, %2
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = load float*, float** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds float, float* %12, i64 %14
%16 = load float, float* %15
%17 = load float*, float** %4
%18 = load i32, i32* %5
%19 = mul nsw i32 4, %18
%20 = add nsw i32 %19, 3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %17, i64 %21
%23 = load float, float* %22
%24 = fadd float %23, %16
store float %24, float* %22
br label %25
25: ; preds = %11
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %8
28: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @floats_mat44_translate(float* nocapture %0, float* %1) {
%3 = tail call i32 @floats_mat44_identity(float* %1)
%4 = load float, float* %0
%5 = getelementptr inbounds float, float* %1, i64 3
%6 = load float, float* %5
%7 = fadd float %4, %6
store float %7, float* %5
%8 = getelementptr inbounds float, float* %0, i64 1
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %1, i64 7
%11 = load float, float* %10
%12 = fadd float %9, %11
store float %12, float* %10
%13 = getelementptr inbounds float, float* %0, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %1, i64 11
%16 = load float, float* %15
%17 = fadd float %14, %16
store float %17, float* %15
ret void
}