#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 ones(size_t n, double X[n][n]) {
  size_t i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++)
      X[i][j] = 1;
  }
}


x86 assembly (clang, -O0):
<ones>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    118c <ones+0x8c>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1176 <ones+0x76>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
movsd  0xea0(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1132 <ones+0x32>
jmp    117b <ones+0x7b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111c <ones+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ones>:
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdi,%rdi
je     1252 <ones+0x152>
lea    -0x4(%rdi),%r9
mov    %r9,%r8
shr    $0x2,%r8
add    $0x1,%r8
mov    %rdi,%r11
and    $0xfffffffffffffffc,%r11
mov    %r8d,%r10d
and    $0x7,%r10d
and    $0xfffffffffffffff8,%r8
lea    0xf0(%rsi),%rax
lea    0x0(,%rdi,8),%r14
mov    %r10,%r12
shl    $0x5,%r12
xor    %r15d,%r15d
movabs $0x3ff0000000000000,%rcx
movaps 0xea5(%rip),%xmm0
jmp    1173 <ones+0x73>
nopl   (%rax)
add    $0x1,%r15
add    %r14,%rax
add    %r14,%rsi
cmp    %rdi,%r15
je     1252 <ones+0x152>
cmp    $0x4,%rdi
jae    1180 <ones+0x80>
xor    %edx,%edx
jmp    1240 <ones+0x140>
cmp    $0x1c,%r9
jae    1190 <ones+0x90>
xor    %ebx,%ebx
jmp    120e <ones+0x10e>
nopl   (%rax)
mov    %r8,%rdx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movups %xmm0,-0xf0(%rax,%rbx,8)
ff
movups %xmm0,-0xe0(%rax,%rbx,8)
ff
movups %xmm0,-0xd0(%rax,%rbx,8)
ff
movups %xmm0,-0xc0(%rax,%rbx,8)
ff
movups %xmm0,-0xb0(%rax,%rbx,8)
ff
movups %xmm0,-0xa0(%rax,%rbx,8)
ff
movups %xmm0,-0x90(%rax,%rbx,8)
ff
movups %xmm0,-0x80(%rax,%rbx,8)
movups %xmm0,-0x70(%rax,%rbx,8)
movups %xmm0,-0x60(%rax,%rbx,8)
movups %xmm0,-0x50(%rax,%rbx,8)
movups %xmm0,-0x40(%rax,%rbx,8)
movups %xmm0,-0x30(%rax,%rbx,8)
movups %xmm0,-0x20(%rax,%rbx,8)
movups %xmm0,-0x10(%rax,%rbx,8)
movups %xmm0,(%rax,%rbx,8)
add    $0x20,%rbx
add    $0xfffffffffffffff8,%rdx
jne    11a0 <ones+0xa0>
test   %r10,%r10
je     1232 <ones+0x132>
lea    (%rsi,%rbx,8),%rdx
xor    %ebx,%ebx
nopl   0x0(%rax)
movups %xmm0,(%rdx,%rbx,1)
movups %xmm0,0x10(%rdx,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%r12
jne    1220 <ones+0x120>
mov    %r11,%rdx
cmp    %rdi,%r11
je     1160 <ones+0x60>
xchg   %ax,%ax
mov    %rcx,(%rsi,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rdi
jne    1240 <ones+0x140>
jmp    1160 <ones+0x60>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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