void fn6(void) {
  double a[4][3], b[12];
  int i;
  bar(b);
  for (i = 0; i < 12; i++)
    a[0][i] = b[i] / 10000.0;
  bar(a);
}


x86 assembly (clang, -O0):
<fn6>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    -0xc0(%rbp),%rdi
mov    $0x0,%al
call   1030 <bar@plt>
movl   $0x0,-0xc4(%rbp)
cmpl   $0xc,-0xc4(%rbp)
jge    117d <fn6+0x6d>
movslq -0xc4(%rbp),%rax
movsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0xc4(%rbp),%rax
movsd  %xmm0,-0x60(%rbp,%rax,8)
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    1133 <fn6+0x23>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1030 <bar@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn6>:
sub    $0xc8,%rsp
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <bar@plt>
movapd 0xed7(%rip),%xmm0
movapd (%rsp),%xmm1
movapd 0x10(%rsp),%xmm2
movapd 0x20(%rsp),%xmm3
movapd 0x30(%rsp),%xmm4
divpd  %xmm0,%xmm1
movapd %xmm1,0x60(%rsp)
divpd  %xmm0,%xmm2
movapd %xmm2,0x70(%rsp)
divpd  %xmm0,%xmm3
movapd %xmm3,0x80(%rsp)
divpd  %xmm0,%xmm4
movapd %xmm4,0x90(%rsp)
movapd 0x40(%rsp),%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0xa0(%rsp)
movapd 0x50(%rsp),%xmm1
divpd  %xmm0,%xmm1
movapd %xmm1,0xb0(%rsp)
lea    0x60(%rsp),%rdi
xor    %eax,%eax
call   1030 <bar@plt>
add    $0xc8,%rsp
ret

LLVM IR (-O0):
define void @fn6() {
%1 = alloca [4 x [3 x double]]
%2 = alloca [12 x double]
%3 = alloca i32
%4 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 0
%5 = call i32 (double*, ...) bitcast (i32 (...)* @bar to i32 (double*, ...)*)(double* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 12
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 %11
%13 = load double, double* %12
%14 = fdiv double %13, 1.000000e+04
%15 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [3 x double], [3 x double]* %15, i64 0, i64 %17
store double %14, double* %18
br label %19
19: ; preds = %9
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %6
22: ; preds = %6
%23 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0
%24 = call i32 ([3 x double]*, ...) bitcast (i32 (...)* @bar to i32 ([3 x double]*, ...)*)([3 x double]* %23)
ret void
}

LLVM IR (-O2):
define void @fn6() {
%1 = alloca [4 x [3 x double]]
%2 = alloca [12 x double]
%3 = bitcast [4 x [3 x double]]* %1 to i8*
%4 = bitcast [12 x double]* %2 to i8*
%5 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 0
%6 = call i32 (double*, ...) bitcast (i32 (...)* @bar to i32 (double*, ...)*)(double* %5)
%7 = bitcast [12 x double]* %2 to <2 x double>*
%8 = load <2 x double>, <2 x double>* %7
%9 = fdiv <2 x double> %8, <double 1.000000e+04, double 1.000000e+04>
%10 = bitcast [4 x [3 x double]]* %1 to <2 x double>*
store <2 x double> %9, <2 x double>* %10
%11 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 2
%12 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 2
%13 = bitcast double* %11 to <2 x double>*
%14 = load <2 x double>, <2 x double>* %13
%15 = fdiv <2 x double> %14, <double 1.000000e+04, double 1.000000e+04>
%16 = bitcast double* %12 to <2 x double>*
store <2 x double> %15, <2 x double>* %16
%17 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 4
%18 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 4
%19 = bitcast double* %17 to <2 x double>*
%20 = load <2 x double>, <2 x double>* %19
%21 = fdiv <2 x double> %20, <double 1.000000e+04, double 1.000000e+04>
%22 = bitcast double* %18 to <2 x double>*
store <2 x double> %21, <2 x double>* %22
%23 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 6
%24 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 6
%25 = bitcast double* %23 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = fdiv <2 x double> %26, <double 1.000000e+04, double 1.000000e+04>
%28 = bitcast double* %24 to <2 x double>*
store <2 x double> %27, <2 x double>* %28
%29 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 8
%30 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 8
%31 = bitcast double* %29 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fdiv <2 x double> %32, <double 1.000000e+04, double 1.000000e+04>
%34 = bitcast double* %30 to <2 x double>*
store <2 x double> %33, <2 x double>* %34
%35 = getelementptr inbounds [12 x double], [12 x double]* %2, i64 0, i64 10
%36 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0, i64 10
%37 = bitcast double* %35 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = fdiv <2 x double> %38, <double 1.000000e+04, double 1.000000e+04>
%40 = bitcast double* %36 to <2 x double>*
store <2 x double> %39, <2 x double>* %40
%41 = getelementptr inbounds [4 x [3 x double]], [4 x [3 x double]]* %1, i64 0, i64 0
%42 = call i32 ([3 x double]*, ...) bitcast (i32 (...)* @bar to i32 ([3 x double]*, ...)*)([3 x double]* %41)
ret void
}