void mat_copy(mata, matb, dimens) double mata[10][4], matb[10][4];
int dimens;
{
  int ii, jj;
  for (ii = 1; ii < dimens + 1; ii++)
    for (jj = 1; jj < 4; jj++)
      mata[ii][jj] = matb[ii][jj];
}


x86 assembly (clang, -O0):
<mat_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1189 <mat_copy+0x89>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1176 <mat_copy+0x76>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112e <mat_copy+0x2e>
jmp    117b <mat_copy+0x7b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1116 <mat_copy+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_copy>:
test   %edx,%edx
jle    113d <mat_copy+0x3d>
mov    %edx,%eax
shl    $0x5,%rax
xor    %ecx,%ecx
nopl   0x0(%rax)
movsd  0x28(%rsi,%rcx,1),%xmm0
movsd  %xmm0,0x28(%rdi,%rcx,1)
movsd  0x30(%rsi,%rcx,1),%xmm0
movsd  %xmm0,0x30(%rdi,%rcx,1)
movsd  0x38(%rsi,%rcx,1),%xmm0
movsd  %xmm0,0x38(%rdi,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%rax
jne    1110 <mat_copy+0x10>
ret

LLVM IR (-O0):
define void @mat_copy([4 x double]* %0, [4 x double]* %1, i32 %2) {
%4 = alloca [4 x double]*
%5 = alloca [4 x double]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [4 x double]* %0, [4 x double]** %4
store [4 x double]* %1, [4 x double]** %5
store i32 %2, i32* %6
store i32 1, i32* %7
br label %9
9: ; preds = %38, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %41
14: ; preds = %9
store i32 1, i32* %8
br label %15
15: ; preds = %34, %14
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %37
18: ; preds = %15
%19 = load [4 x double]*, [4 x double]** %5
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [4 x double], [4 x double]* %19, i64 %21
%23 = load i32, i32* %8
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [4 x double], [4 x double]* %22, i64 0, i64 %24
%26 = load double, double* %25
%27 = load [4 x double]*, [4 x double]** %4
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [4 x double], [4 x double]* %27, i64 %29
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [4 x double], [4 x double]* %30, i64 0, i64 %32
store double %26, double* %33
br label %34
34: ; preds = %18
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %15
37: ; preds = %15
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %9
41: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @mat_copy([4 x double]* nocapture writeonly %0, [4 x double]* nocapture %1, i32 %2) {
%4 = icmp slt i32 %2, 1
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = add nuw i32 %2, 1
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ 1, %5 ], [ %19, %8 ]
%10 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 %9, i64 1
%11 = load double, double* %10
%12 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %9, i64 1
store double %11, double* %12
%13 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 %9, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %9, i64 2
store double %14, double* %15
%16 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 %9, i64 3
%17 = load double, double* %16
%18 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 %9, i64 3
store double %17, double* %18
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, %7
br i1 %20, label %21, label %8
21: ; preds = %8, %3
ret void
}