void local4x4From3x3(input, output) double input[3][3];
double output[4][4];
{
  register int j, k;
  for (j = 0; j < 3; j++) {
    for (k = 0; k < 3; k++) {
      output[j + 1][k + 1] = input[j][k];
    }
  }
}


x86 assembly (clang, -O0):
<local4x4From3x3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1189 <local4x4From3x3+0x89>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1176 <local4x4From3x3+0x76>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x5,%rcx
add    %rcx,%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1124 <local4x4From3x3+0x24>
jmp    117b <local4x4From3x3+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <local4x4From3x3+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<local4x4From3x3>:
movsd  (%rdi),%xmm0
movsd  %xmm0,0x28(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x30(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x38(%rsi)
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x48(%rsi)
movsd  0x20(%rdi),%xmm0
movsd  %xmm0,0x50(%rsi)
movsd  0x28(%rdi),%xmm0
movsd  %xmm0,0x58(%rsi)
movsd  0x30(%rdi),%xmm0
movsd  %xmm0,0x68(%rsi)
movsd  0x38(%rdi),%xmm0
movsd  %xmm0,0x70(%rsi)
movsd  0x40(%rdi),%xmm0
movsd  %xmm0,0x78(%rsi)
ret

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

LLVM IR (-O2):
define void @local4x4From3x3([3 x double]* nocapture %0, [4 x double]* nocapture writeonly %1) {
%3 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 0
%4 = load double, double* %3
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 1
store double %4, double* %5
%6 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 2
store double %7, double* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 0, i64 2
%10 = load double, double* %9
%11 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 1, i64 3
store double %10, double* %11
%12 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 0
%13 = load double, double* %12
%14 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 1
store double %13, double* %14
%15 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 1
%16 = load double, double* %15
%17 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 2
store double %16, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 1, i64 2
%19 = load double, double* %18
%20 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 3
store double %19, double* %20
%21 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 0
%22 = load double, double* %21
%23 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 1
store double %22, double* %23
%24 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 1
%25 = load double, double* %24
%26 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 2
store double %25, double* %26
%27 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 3, i64 3
store double %28, double* %29
ret void
}