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


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

x86 assembly (clang, -O2):
<doubles_mat44_translate>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <doubles_mat44_identity@plt>
movsd  (%r14),%xmm0
addsd  0x18(%rbx),%xmm0
movsd  %xmm0,0x18(%rbx)
movsd  0x8(%r14),%xmm0
addsd  0x38(%rbx),%xmm0
movsd  %xmm0,0x38(%rbx)
movsd  0x10(%r14),%xmm0
addsd  0x58(%rbx),%xmm0
movsd  %xmm0,0x58(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @doubles_mat44_translate(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca i32
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %4
%7 = call i32 @doubles_mat44_identity(double* %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 double*, double** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double*, double** %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 double, double* %17, i64 %21
%23 = load double, double* %22
%24 = fadd double %23, %16
store double %24, double* %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 @doubles_mat44_translate(double* nocapture %0, double* %1) {
%3 = tail call i32 @doubles_mat44_identity(double* %1)
%4 = load double, double* %0
%5 = getelementptr inbounds double, double* %1, i64 3
%6 = load double, double* %5
%7 = fadd double %4, %6
store double %7, double* %5
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %1, i64 7
%11 = load double, double* %10
%12 = fadd double %9, %11
store double %12, double* %10
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 11
%16 = load double, double* %15
%17 = fadd double %14, %16
store double %17, double* %15
ret void
}