void init_mat3D_double(double ***mat3D_double, int x, int y, int z,
                       double val) {
  unsigned int i, j, k;
  for (i = 0; i < x; ++i)
    for (j = 0; j < y; ++j)
      for (k = 0; k < z; ++k)
        mat3D_double[i][j][k] = val;
}


x86 assembly (clang, -O0):
<init_mat3D_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11a2 <init_mat3D_double+0xa2>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    118f <init_mat3D_double+0x8f>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    117c <init_mat3D_double+0x7c>
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x2c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1143 <init_mat3D_double+0x43>
jmp    1181 <init_mat3D_double+0x81>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1130 <init_mat3D_double+0x30>
jmp    1194 <init_mat3D_double+0x94>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111d <init_mat3D_double+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_mat3D_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,-0xc(%rsp)
test   %esi,%esi
je     1273 <init_mat3D_double+0x173>
mov    %esi,%eax
mov    %rax,-0x8(%rsp)
mov    -0xc(%rsp),%r15d
mov    %ecx,%eax
mov    %eax,%r9d
and    $0xfffffffc,%r9d
lea    -0x4(%r9),%r10
mov    %r10,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
movaps %xmm0,%xmm1
movlhps %xmm0,%xmm1
mov    %edx,%r14d
and    $0x7,%r14d
and    $0xfffffffffffffff8,%rdx
mov    %r14,%r13
shl    $0x5,%r13
xor    %r12d,%r12d
jmp    116f <init_mat3D_double+0x6f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    -0x8(%rsp),%r12
je     1273 <init_mat3D_double+0x173>
cmpl   $0x0,-0xc(%rsp)
je     1160 <init_mat3D_double+0x60>
xor    %r8d,%r8d
jmp    1189 <init_mat3D_double+0x89>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r8
cmp    %r15,%r8
je     1160 <init_mat3D_double+0x60>
test   %ecx,%ecx
je     1180 <init_mat3D_double+0x80>
mov    (%rdi,%r12,8),%rsi
mov    (%rsi,%r8,8),%rbx
cmp    $0x4,%ecx
jae    11b0 <init_mat3D_double+0xb0>
xor    %ebp,%ebp
jmp    1260 <init_mat3D_double+0x160>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x1c,%r10
jae    11ba <init_mat3D_double+0xba>
xor    %ebp,%ebp
jmp    1231 <init_mat3D_double+0x131>
mov    %rdx,%r11
xor    %ebp,%ebp
nop
movups %xmm1,(%rbx,%rbp,8)
movups %xmm1,0x10(%rbx,%rbp,8)
movups %xmm1,0x20(%rbx,%rbp,8)
movups %xmm1,0x30(%rbx,%rbp,8)
movups %xmm1,0x40(%rbx,%rbp,8)
movups %xmm1,0x50(%rbx,%rbp,8)
movups %xmm1,0x60(%rbx,%rbp,8)
movups %xmm1,0x70(%rbx,%rbp,8)
movups %xmm1,0x80(%rbx,%rbp,8)
movups %xmm1,0x90(%rbx,%rbp,8)
movups %xmm1,0xa0(%rbx,%rbp,8)
movups %xmm1,0xb0(%rbx,%rbp,8)
movups %xmm1,0xc0(%rbx,%rbp,8)
movups %xmm1,0xd0(%rbx,%rbp,8)
movups %xmm1,0xe0(%rbx,%rbp,8)
movups %xmm1,0xf0(%rbx,%rbp,8)
add    $0x20,%rbp
add    $0xfffffffffffffff8,%r11
jne    11c0 <init_mat3D_double+0xc0>
test   %r14,%r14
je     1253 <init_mat3D_double+0x153>
lea    (%rbx,%rbp,8),%rbp
add    $0x10,%rbp
xor    %esi,%esi
movups %xmm1,-0x10(%rbp,%rsi,1)
movups %xmm1,0x0(%rbp,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r13
jne    1240 <init_mat3D_double+0x140>
mov    %r9,%rbp
cmp    %rax,%r9
je     1180 <init_mat3D_double+0x80>
nop
movsd  %xmm0,(%rbx,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rax
jne    1260 <init_mat3D_double+0x160>
jmp    1180 <init_mat3D_double+0x80>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @init_mat3D_double(double*** %0, i32 %1, i32 %2, i32 %3, double %4) {
%6 = alloca double***
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store double*** %0, double**** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double %4, double* %10
store i32 0, i32* %11
br label %14
14: ; preds = %50, %5
%15 = load i32, i32* %11
%16 = load i32, i32* %7
%17 = icmp ult i32 %15, %16
br i1 %17, label %18, label %53
18: ; preds = %14
store i32 0, i32* %12
br label %19
19: ; preds = %46, %18
%20 = load i32, i32* %12
%21 = load i32, i32* %8
%22 = icmp ult i32 %20, %21
br i1 %22, label %23, label %49
23: ; preds = %19
store i32 0, i32* %13
br label %24
24: ; preds = %42, %23
%25 = load i32, i32* %13
%26 = load i32, i32* %9
%27 = icmp ult i32 %25, %26
br i1 %27, label %28, label %45
28: ; preds = %24
%29 = load double, double* %10
%30 = load double***, double**** %6
%31 = load i32, i32* %11
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds double**, double*** %30, i64 %32
%34 = load double**, double*** %33
%35 = load i32, i32* %12
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds double*, double** %34, i64 %36
%38 = load double*, double** %37
%39 = load i32, i32* %13
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
store double %29, double* %41
br label %42
42: ; preds = %28
%43 = load i32, i32* %13
%44 = add i32 %43, 1
store i32 %44, i32* %13
br label %24
45: ; preds = %24
br label %46
46: ; preds = %45
%47 = load i32, i32* %12
%48 = add i32 %47, 1
store i32 %48, i32* %12
br label %19
49: ; preds = %19
br label %50
50: ; preds = %49
%51 = load i32, i32* %11
%52 = add i32 %51, 1
store i32 %52, i32* %11
br label %14
53: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @init_mat3D_double(double*** nocapture %0, i32 %1, i32 %2, i32 %3, double %4) {
%6 = icmp eq i32 %1, 0
br i1 %6, label %110, label %7
7: ; preds = %5
%8 = icmp eq i32 %2, 0
%9 = icmp eq i32 %3, 0
%10 = zext i32 %1 to i64
%11 = zext i32 %2 to i64
%12 = zext i32 %3 to i64
%13 = and i64 %12, 4294967292
%14 = add nsw i64 %13, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = icmp ult i32 %3, 4
%18 = and i64 %12, 4294967292
%19 = insertelement <2 x double> poison, double %4, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %4, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = and i64 %16, 7
%24 = icmp ult i64 %14, 28
%25 = and i64 %16, 9223372036854775800
%26 = icmp eq i64 %23, 0
%27 = icmp eq i64 %18, %12
br label %28
28: ; preds = %7, %107
%29 = phi i64 [ 0, %7 ], [ %108, %107 ]
br i1 %8, label %107, label %30
30: ; preds = %28
%31 = getelementptr inbounds double**, double*** %0, i64 %29
br label %32
32: ; preds = %30, %104
%33 = phi i64 [ 0, %30 ], [ %105, %104 ]
br i1 %9, label %104, label %34
34: ; preds = %32
%35 = load double**, double*** %31
%36 = getelementptr inbounds double*, double** %35, i64 %33
%37 = load double*, double** %36
br i1 %17, label %97, label %38
38: ; preds = %34
br i1 %24, label %84, label %39
39: ; preds = %38, %39
%40 = phi i64 [ %81, %39 ], [ 0, %38 ]
%41 = phi i64 [ %82, %39 ], [ 0, %38 ]
%42 = getelementptr inbounds double, double* %37, i64 %40
%43 = bitcast double* %42 to <2 x double>*
store <2 x double> %20, <2 x double>* %43
%44 = getelementptr inbounds double, double* %42, i64 2
%45 = bitcast double* %44 to <2 x double>*
store <2 x double> %22, <2 x double>* %45
%46 = or i64 %40, 4
%47 = getelementptr inbounds double, double* %37, i64 %46
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %20, <2 x double>* %48
%49 = getelementptr inbounds double, double* %47, i64 2
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> %22, <2 x double>* %50
%51 = or i64 %40, 8
%52 = getelementptr inbounds double, double* %37, i64 %51
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %20, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %22, <2 x double>* %55
%56 = or i64 %40, 12
%57 = getelementptr inbounds double, double* %37, i64 %56
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %20, <2 x double>* %58
%59 = getelementptr inbounds double, double* %57, i64 2
%60 = bitcast double* %59 to <2 x double>*
store <2 x double> %22, <2 x double>* %60
%61 = or i64 %40, 16
%62 = getelementptr inbounds double, double* %37, i64 %61
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %20, <2 x double>* %63
%64 = getelementptr inbounds double, double* %62, i64 2
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %22, <2 x double>* %65
%66 = or i64 %40, 20
%67 = getelementptr inbounds double, double* %37, i64 %66
%68 = bitcast double* %67 to <2 x double>*
store <2 x double> %20, <2 x double>* %68
%69 = getelementptr inbounds double, double* %67, i64 2
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %22, <2 x double>* %70
%71 = or i64 %40, 24
%72 = getelementptr inbounds double, double* %37, i64 %71
%73 = bitcast double* %72 to <2 x double>*
store <2 x double> %20, <2 x double>* %73
%74 = getelementptr inbounds double, double* %72, i64 2
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %22, <2 x double>* %75
%76 = or i64 %40, 28
%77 = getelementptr inbounds double, double* %37, i64 %76
%78 = bitcast double* %77 to <2 x double>*
store <2 x double> %20, <2 x double>* %78
%79 = getelementptr inbounds double, double* %77, i64 2
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %22, <2 x double>* %80
%81 = add nuw i64 %40, 32
%82 = add i64 %41, 8
%83 = icmp eq i64 %82, %25
br i1 %83, label %84, label %39
84: ; preds = %39, %38
%85 = phi i64 [ 0, %38 ], [ %81, %39 ]
br i1 %26, label %96, label %86
86: ; preds = %84, %86
%87 = phi i64 [ %93, %86 ], [ %85, %84 ]
%88 = phi i64 [ %94, %86 ], [ 0, %84 ]
%89 = getelementptr inbounds double, double* %37, i64 %87
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %20, <2 x double>* %90
%91 = getelementptr inbounds double, double* %89, i64 2
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %22, <2 x double>* %92
%93 = add nuw i64 %87, 4
%94 = add i64 %88, 1
%95 = icmp eq i64 %94, %23
br i1 %95, label %96, label %86
96: ; preds = %86, %84
br i1 %27, label %104, label %97
97: ; preds = %34, %96
%98 = phi i64 [ 0, %34 ], [ %18, %96 ]
br label %99
99: ; preds = %97, %99
%100 = phi i64 [ %102, %99 ], [ %98, %97 ]
%101 = getelementptr inbounds double, double* %37, i64 %100
store double %4, double* %101
%102 = add nuw nsw i64 %100, 1
%103 = icmp eq i64 %102, %12
br i1 %103, label %104, label %99
104: ; preds = %99, %96, %32
%105 = add nuw nsw i64 %33, 1
%106 = icmp eq i64 %105, %11
br i1 %106, label %107, label %32
107: ; preds = %104, %28
%108 = add nuw nsw i64 %29, 1
%109 = icmp eq i64 %108, %10
br i1 %109, label %110, label %28
110: ; preds = %107, %5
ret void
}