void dcopy_codegen_0(double *A, double *C) {
  const int n = 4 + 0 * 40 + 0 * 4;
  const int lda = 4 + 0 * 40 + 0 * 4;
  int ii, jj;
  for (jj = 0; jj < n; jj++) {
    for (ii = jj; ii < n; ii++) {
      C[ii + lda * jj] = A[ii + lda * jj];
    }
  }
}


x86 assembly (clang, -O0):
<dcopy_codegen_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jge    118a <dcopy_codegen_0+0x8a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1177 <dcopy_codegen_0+0x77>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%edx
shl    $0x2,%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%edx
shl    $0x2,%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1131 <dcopy_codegen_0+0x31>
jmp    117c <dcopy_codegen_0+0x7c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1121 <dcopy_codegen_0+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcopy_codegen_0>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
movsd  0x28(%rdi),%xmm0
movsd  %xmm0,0x28(%rsi)
movsd  0x30(%rdi),%xmm0
movsd  %xmm0,0x30(%rsi)
movsd  0x38(%rdi),%xmm0
movsd  %xmm0,0x38(%rsi)
movsd  0x50(%rdi),%xmm0
movsd  %xmm0,0x50(%rsi)
movsd  0x58(%rdi),%xmm0
movsd  %xmm0,0x58(%rsi)
movsd  0x78(%rdi),%xmm0
movsd  %xmm0,0x78(%rsi)
ret

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

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