#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
void dary2d_set(size_t n1, size_t n2, double **a, double val) {
  size_t i, j;
  for (i = 0; i < n1; i++)
    for (j = 0; j < n2; j++)
      a[i][j] = val;
}


x86 assembly (clang, -O0):
<dary2d_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1182 <dary2d_set+0x82>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116c <dary2d_set+0x6c>
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1133 <dary2d_set+0x33>
jmp    1171 <dary2d_set+0x71>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111d <dary2d_set+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dary2d_set>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1243 <dary2d_set+0x143>
lea    -0x4(%rsi),%r8
mov    %r8,%r9
shr    $0x2,%r9
add    $0x1,%r9
mov    %rsi,%r11
and    $0xfffffffffffffffc,%r11
movaps %xmm0,%xmm1
movlhps %xmm0,%xmm1
mov    %r9d,%r10d
and    $0x7,%r10d
and    $0xfffffffffffffff8,%r9
mov    %r10,%r14
shl    $0x5,%r14
xor    %r15d,%r15d
jmp    115d <dary2d_set+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %rdi,%r15
je     1243 <dary2d_set+0x143>
test   %rsi,%rsi
je     1150 <dary2d_set+0x50>
mov    (%rdx,%r15,8),%rbx
cmp    $0x4,%rsi
jae    1180 <dary2d_set+0x80>
xor    %eax,%eax
jmp    1230 <dary2d_set+0x130>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1c,%r8
jae    118a <dary2d_set+0x8a>
xor    %ecx,%ecx
jmp    1201 <dary2d_set+0x101>
mov    %r9,%rax
xor    %ecx,%ecx
nop
movups %xmm1,(%rbx,%rcx,8)
movups %xmm1,0x10(%rbx,%rcx,8)
movups %xmm1,0x20(%rbx,%rcx,8)
movups %xmm1,0x30(%rbx,%rcx,8)
movups %xmm1,0x40(%rbx,%rcx,8)
movups %xmm1,0x50(%rbx,%rcx,8)
movups %xmm1,0x60(%rbx,%rcx,8)
movups %xmm1,0x70(%rbx,%rcx,8)
movups %xmm1,0x80(%rbx,%rcx,8)
movups %xmm1,0x90(%rbx,%rcx,8)
movups %xmm1,0xa0(%rbx,%rcx,8)
movups %xmm1,0xb0(%rbx,%rcx,8)
movups %xmm1,0xc0(%rbx,%rcx,8)
movups %xmm1,0xd0(%rbx,%rcx,8)
movups %xmm1,0xe0(%rbx,%rcx,8)
movups %xmm1,0xf0(%rbx,%rcx,8)
add    $0x20,%rcx
add    $0xfffffffffffffff8,%rax
jne    1190 <dary2d_set+0x90>
test   %r10,%r10
je     1222 <dary2d_set+0x122>
lea    (%rbx,%rcx,8),%rax
add    $0x10,%rax
xor    %ecx,%ecx
movups %xmm1,-0x10(%rax,%rcx,1)
movups %xmm1,(%rax,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%r14
jne    1210 <dary2d_set+0x110>
mov    %r11,%rax
cmp    %rsi,%r11
je     1150 <dary2d_set+0x50>
xchg   %ax,%ax
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%rax
cmp    %rax,%rsi
jne    1230 <dary2d_set+0x130>
jmp    1150 <dary2d_set+0x50>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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