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


x86 assembly (clang, -O0):
<init_mat4D_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11d3 <init_mat4D_double+0xd3>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    11c0 <init_mat4D_double+0xc0>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    11ad <init_mat4D_double+0xad>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    119a <init_mat4D_double+0x9a>
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
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    115a <init_mat4D_double+0x5a>
jmp    119f <init_mat4D_double+0x9f>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1147 <init_mat4D_double+0x47>
jmp    11b2 <init_mat4D_double+0xb2>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1134 <init_mat4D_double+0x34>
jmp    11c5 <init_mat4D_double+0xc5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1121 <init_mat4D_double+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_mat4D_double>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %ecx,-0x1c(%rsp)
mov    %edx,-0x20(%rsp)
test   %esi,%esi
je     12d4 <init_mat4D_double+0x1d4>
mov    %esi,%eax
mov    %rax,-0x18(%rsp)
mov    -0x20(%rsp),%eax
mov    %rax,-0x10(%rsp)
mov    -0x1c(%rsp),%eax
mov    %r8d,%esi
mov    %esi,%r11d
and    $0xfffffffc,%r11d
lea    -0x4(%r11),%r15
mov    %r15,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
movaps %xmm0,%xmm1
movlhps %xmm0,%xmm1
mov    %ecx,%r12d
and    $0x7,%r12d
and    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x8(%rsp)
mov    %r12,%rbx
shl    $0x5,%rbx
xor    %r13d,%r13d
jmp    117f <init_mat4D_double+0x7f>
nopl   0x0(%rax)
add    $0x1,%r13
cmp    -0x18(%rsp),%r13
je     12d4 <init_mat4D_double+0x1d4>
cmpl   $0x0,-0x20(%rsp)
je     1170 <init_mat4D_double+0x70>
xor    %ebp,%ebp
jmp    119b <init_mat4D_double+0x9b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    -0x10(%rsp),%rbp
je     1170 <init_mat4D_double+0x70>
cmpl   $0x0,-0x1c(%rsp)
je     1190 <init_mat4D_double+0x90>
xor    %r9d,%r9d
jmp    11b9 <init_mat4D_double+0xb9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r9
cmp    %rax,%r9
je     1190 <init_mat4D_double+0x90>
test   %r8d,%r8d
je     11b0 <init_mat4D_double+0xb0>
mov    (%rdi,%r13,8),%rcx
mov    (%rcx,%rbp,8),%rcx
mov    (%rcx,%r9,8),%r10
cmp    $0x4,%r8d
jae    11e0 <init_mat4D_double+0xe0>
xor    %edx,%edx
jmp    12c0 <init_mat4D_double+0x1c0>
nopw   0x0(%rax,%rax,1)
cmp    $0x1c,%r15
jae    11ed <init_mat4D_double+0xed>
xor    %edx,%edx
jmp    1285 <init_mat4D_double+0x185>
mov    -0x8(%rsp),%r14
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm1,(%r10,%rdx,8)
movups %xmm1,0x10(%r10,%rdx,8)
movups %xmm1,0x20(%r10,%rdx,8)
movups %xmm1,0x30(%r10,%rdx,8)
movups %xmm1,0x40(%r10,%rdx,8)
movups %xmm1,0x50(%r10,%rdx,8)
movups %xmm1,0x60(%r10,%rdx,8)
movups %xmm1,0x70(%r10,%rdx,8)
movups %xmm1,0x80(%r10,%rdx,8)
movups %xmm1,0x90(%r10,%rdx,8)
movups %xmm1,0xa0(%r10,%rdx,8)
movups %xmm1,0xb0(%r10,%rdx,8)
movups %xmm1,0xc0(%r10,%rdx,8)
movups %xmm1,0xd0(%r10,%rdx,8)
movups %xmm1,0xe0(%r10,%rdx,8)
movups %xmm1,0xf0(%r10,%rdx,8)
add    $0x20,%rdx
add    $0xfffffffffffffff8,%r14
jne    1200 <init_mat4D_double+0x100>
test   %r12,%r12
je     12b2 <init_mat4D_double+0x1b2>
lea    (%r10,%rdx,8),%rdx
add    $0x10,%rdx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movups %xmm1,-0x10(%rdx,%rcx,1)
movups %xmm1,(%rdx,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%rbx
jne    12a0 <init_mat4D_double+0x1a0>
mov    %r11,%rdx
cmp    %rsi,%r11
je     11b0 <init_mat4D_double+0xb0>
xchg   %ax,%ax
movsd  %xmm0,(%r10,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rsi
jne    12c0 <init_mat4D_double+0x1c0>
jmp    11b0 <init_mat4D_double+0xb0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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