#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*/ assert(double **);
int /*<<< orphan*/ memcpy(double **, double **, int);
void matrix3_concatenate(double dest[4][4], double src[4][4]) {
  register int i, j;
  double t[4][4];
  assert(dest);
  assert(src);
  memcpy(t, dest, 16 * sizeof(double));
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      dest[i][j] = t[i][0] * src[0][j] + t[i][1] * src[1][j] +
                   t[i][2] * src[2][j] + t[i][3] * src[3][j];
    }
  }
}


x86 assembly (clang, -O0):
<matrix3_concatenate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x80,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    125f <matrix3_concatenate+0x13f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    124c <matrix3_concatenate+0x12c>
movslq -0x14(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movslq -0x14(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mulsd  0x20(%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x14(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0x40(%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movslq -0x14(%rbp),%rcx
lea    -0xa0(%rbp),%rax
shl    $0x5,%rcx
add    %rcx,%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0x60(%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <matrix3_concatenate+0x52>
jmp    1251 <matrix3_concatenate+0x131>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1161 <matrix3_concatenate+0x41>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix3_concatenate>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1030 <assert@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
mov    $0x80,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
nop
movsd  (%rsp,%rax,1),%xmm2
movsd  0x8(%rsp,%rax,1),%xmm3
movsd  0x10(%rsp,%rax,1),%xmm0
movsd  0x18(%rsp,%rax,1),%xmm1
movsd  0x20(%rbx),%xmm4
mulsd  %xmm3,%xmm4
movsd  (%rbx),%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
movsd  0x40(%rbx),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm5,%xmm4
movsd  0x60(%rbx),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,(%r14,%rax,1)
movsd  0x28(%rbx),%xmm4
mulsd  %xmm3,%xmm4
movsd  0x8(%rbx),%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
movsd  0x48(%rbx),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm5,%xmm4
movsd  0x68(%rbx),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,0x8(%r14,%rax,1)
movsd  0x30(%rbx),%xmm4
mulsd  %xmm3,%xmm4
movsd  0x10(%rbx),%xmm5
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
movsd  0x50(%rbx),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm5,%xmm4
movsd  0x70(%rbx),%xmm5
mulsd  %xmm1,%xmm5
addsd  %xmm4,%xmm5
movsd  %xmm5,0x10(%r14,%rax,1)
mulsd  0x38(%rbx),%xmm3
mulsd  0x18(%rbx),%xmm2
mulsd  0x58(%rbx),%xmm0
addsd  %xmm3,%xmm2
addsd  %xmm2,%xmm0
mulsd  0x78(%rbx),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%r14,%rax,1)
add    $0x20,%rax
cmp    $0x80,%rax
jne    1150 <matrix3_concatenate+0x30>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @matrix3_concatenate([4 x double]* %0, [4 x double]* %1) {
%3 = alloca [4 x double]*
%4 = alloca [4 x double]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x [4 x double]]
store [4 x double]* %0, [4 x double]** %3
store [4 x double]* %1, [4 x double]** %4
%8 = load [4 x double]*, [4 x double]** %3
%9 = bitcast [4 x double]* %8 to double**
%10 = call i32 @assert(double** %9)
%11 = load [4 x double]*, [4 x double]** %4
%12 = bitcast [4 x double]* %11 to double**
%13 = call i32 @assert(double** %12)
%14 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %7, i64 0, i64 0
%15 = bitcast [4 x double]* %14 to double**
%16 = load [4 x double]*, [4 x double]** %3
%17 = bitcast [4 x double]* %16 to double**
%18 = call i32 @memcpy(double** %15, double** %17, i32 128)
store i32 0, i32* %5
br label %19
19: ; preds = %86, %2
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 4
br i1 %21, label %22, label %89
22: ; preds = %19
store i32 0, i32* %6
br label %23
23: ; preds = %82, %22
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 4
br i1 %25, label %26, label %85
26: ; preds = %23
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %7, i64 0, i64 %28
%30 = getelementptr inbounds [4 x double], [4 x double]* %29, i64 0, i64 0
%31 = load double, double* %30
%32 = load [4 x double]*, [4 x double]** %4
%33 = getelementptr inbounds [4 x double], [4 x double]* %32, i64 0
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x double], [4 x double]* %33, i64 0, i64 %35
%37 = load double, double* %36
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %7, i64 0, i64 %39
%41 = getelementptr inbounds [4 x double], [4 x double]* %40, i64 0, i64 1
%42 = load double, double* %41
%43 = load [4 x double]*, [4 x double]** %4
%44 = getelementptr inbounds [4 x double], [4 x double]* %43, i64 1
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [4 x double], [4 x double]* %44, i64 0, i64 %46
%48 = load double, double* %47
%49 = fmul double %42, %48
%50 = call double @llvm.fmuladd.f64(double %31, double %37, double %49)
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %7, i64 0, i64 %52
%54 = getelementptr inbounds [4 x double], [4 x double]* %53, i64 0, i64 2
%55 = load double, double* %54
%56 = load [4 x double]*, [4 x double]** %4
%57 = getelementptr inbounds [4 x double], [4 x double]* %56, i64 2
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [4 x double], [4 x double]* %57, i64 0, i64 %59
%61 = load double, double* %60
%62 = call double @llvm.fmuladd.f64(double %55, double %61, double %50)
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %7, i64 0, i64 %64
%66 = getelementptr inbounds [4 x double], [4 x double]* %65, i64 0, i64 3
%67 = load double, double* %66
%68 = load [4 x double]*, [4 x double]** %4
%69 = getelementptr inbounds [4 x double], [4 x double]* %68, i64 3
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [4 x double], [4 x double]* %69, i64 0, i64 %71
%73 = load double, double* %72
%74 = call double @llvm.fmuladd.f64(double %67, double %73, double %62)
%75 = load [4 x double]*, [4 x double]** %3
%76 = load i32, i32* %5
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [4 x double], [4 x double]* %75, i64 %77
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [4 x double], [4 x double]* %78, i64 0, i64 %80
store double %74, double* %81
br label %82
82: ; preds = %26
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
store i32 %84, i32* %6
br label %23
85: ; preds = %23
br label %86
86: ; preds = %85
%87 = load i32, i32* %5
%88 = add nsw i32 %87, 1
store i32 %88, i32* %5
br label %19
89: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @matrix3_concatenate([4 x double]* %0, [4 x double]* %1) {
%3 = alloca [4 x [4 x double]]
%4 = bitcast [4 x [4 x double]]* %3 to i8*
%5 = bitcast [4 x double]* %0 to double**
%6 = tail call i32 @assert(double** %5)
%7 = bitcast [4 x double]* %1 to double**
%8 = tail call i32 @assert(double** %7)
%9 = bitcast [4 x [4 x double]]* %3 to double**
%10 = call i32 @memcpy(double** %9, double** %5, i32 128)
%11 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%12 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 0
%13 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
%14 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 0
%15 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 1
%16 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
%17 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
%18 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 1
%19 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 2
%20 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 2
%21 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
%22 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 2
%23 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 3
%24 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
%25 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
%26 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
br label %27
27: ; preds = %2, %27
%28 = phi i64 [ 0, %2 ], [ %73, %27 ]
%29 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %3, i64 0, i64 %28, i64 0
%30 = load double, double* %29
%31 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %3, i64 0, i64 %28, i64 1
%32 = load double, double* %31
%33 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %3, i64 0, i64 %28, i64 2
%34 = load double, double* %33
%35 = getelementptr inbounds [4 x [4 x double]], [4 x [4 x double]]* %3, i64 0, i64 %28, i64 3
%36 = load double, double* %35
%37 = load double, double* %11
%38 = load double, double* %12
%39 = fmul double %32, %38
%40 = call double @llvm.fmuladd.f64(double %30, double %37, double %39)
%41 = load double, double* %13
%42 = call double @llvm.fmuladd.f64(double %34, double %41, double %40)
%43 = load double, double* %14
%44 = call double @llvm.fmuladd.f64(double %36, double %43, double %42)
%45 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %28, i64 0
store double %44, double* %45
%46 = load double, double* %15
%47 = load double, double* %16
%48 = fmul double %32, %47
%49 = call double @llvm.fmuladd.f64(double %30, double %46, double %48)
%50 = load double, double* %17
%51 = call double @llvm.fmuladd.f64(double %34, double %50, double %49)
%52 = load double, double* %18
%53 = call double @llvm.fmuladd.f64(double %36, double %52, double %51)
%54 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %28, i64 1
store double %53, double* %54
%55 = load double, double* %19
%56 = load double, double* %20
%57 = fmul double %32, %56
%58 = call double @llvm.fmuladd.f64(double %30, double %55, double %57)
%59 = load double, double* %21
%60 = call double @llvm.fmuladd.f64(double %34, double %59, double %58)
%61 = load double, double* %22
%62 = call double @llvm.fmuladd.f64(double %36, double %61, double %60)
%63 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %28, i64 2
store double %62, double* %63
%64 = load double, double* %23
%65 = load double, double* %24
%66 = fmul double %32, %65
%67 = call double @llvm.fmuladd.f64(double %30, double %64, double %66)
%68 = load double, double* %25
%69 = call double @llvm.fmuladd.f64(double %34, double %68, double %67)
%70 = load double, double* %26
%71 = call double @llvm.fmuladd.f64(double %36, double %70, double %69)
%72 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %28, i64 3
store double %71, double* %72
%73 = add nuw nsw i64 %28, 1
%74 = icmp eq i64 %73, 4
br i1 %74, label %75, label %27
75: ; preds = %27
ret void
}