#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 */
scalar_t__ malloc(int);
double (*make_data(int Np))[2] {
  double(*x)[2] = (double(*)[2])malloc(Np * sizeof(double[2]));
  int i;
  for (i = 0; i < Np; i++) {
    x[i][0] = i * 3 / 2;
    x[i][1] = 0;
  }
  return x;
}


x86 assembly (clang, -O0):
<make_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x4,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1189 <make_data+0x79>
imul   $0x3,-0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <make_data+0x25>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_data>:
push   %rbx
mov    %edi,%ebx
shl    $0x4,%edi
call   1030 <malloc@plt>
test   %ebx,%ebx
jle    11b4 <make_data+0xa4>
mov    %ebx,%r8d
cmp    $0x1,%ebx
jne    112f <make_data+0x1f>
xor    %edx,%edx
jmp    1190 <make_data+0x80>
mov    %r8d,%esi
and    $0xfffffffe,%esi
mov    %rax,%rdi
add    $0x18,%rdi
mov    $0x3,%ebx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    -0x3(%rbx),%ecx
shr    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,-0x18(%rdi)
movq   $0x0,-0x10(%rdi)
mov    %ebx,%ecx
shr    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
movsd  %xmm0,-0x8(%rdi)
movq   $0x0,(%rdi)
add    $0x2,%rdx
add    $0x6,%ebx
add    $0x20,%rdi
cmp    %rdx,%rsi
jne    1150 <make_data+0x40>
test   $0x1,%r8b
je     11b4 <make_data+0xa4>
lea    (%rdx,%rdx,2),%ecx
shr    %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
shl    $0x4,%rdx
movsd  %xmm0,(%rax,%rdx,1)
movq   $0x0,0x8(%rax,%rdx,1)
pop    %rbx
ret

LLVM IR (-O0):
define [2 x double]* @make_data(i32 %0) {
%2 = alloca i32
%3 = alloca [2 x double]*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 16
%8 = trunc i64 %7 to i32
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to [2 x double]*
store [2 x double]* %10, [2 x double]** %3
store i32 0, i32* %4
br label %11
11: ; preds = %30, %1
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, 3
%18 = sdiv i32 %17, 2
%19 = sitofp i32 %18 to double
%20 = load [2 x double]*, [2 x double]** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [2 x double], [2 x double]* %20, i64 %22
%24 = getelementptr inbounds [2 x double], [2 x double]* %23, i64 0, i64 0
store double %19, double* %24
%25 = load [2 x double]*, [2 x double]** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [2 x double], [2 x double]* %25, i64 %27
%29 = getelementptr inbounds [2 x double], [2 x double]* %28, i64 0, i64 1
store double 0.000000e+00, double* %29
br label %30
30: ; preds = %15
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %11
33: ; preds = %11
%34 = load [2 x double]*, [2 x double]** %3
ret [2 x double]* %34
}

LLVM IR (-O2):
define [2 x double]* @make_data(i32 %0) {
%2 = shl i32 %0, 4
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to [2 x double]*
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %41
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %0, 1
br i1 %9, label %31, label %10
10: ; preds = %6
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %28, %12 ]
%14 = phi i64 [ 0, %10 ], [ %29, %12 ]
%15 = trunc i64 %13 to i32
%16 = mul nsw i32 %15, 3
%17 = lshr exact i32 %16, 1
%18 = sitofp i32 %17 to double
%19 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %13, i64 0
store double %18, double* %19
%20 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %13, i64 1
store double 0.000000e+00, double* %20
%21 = or i64 %13, 1
%22 = trunc i64 %21 to i32
%23 = mul nsw i32 %22, 3
%24 = lshr i32 %23, 1
%25 = sitofp i32 %24 to double
%26 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %21, i64 0
store double %25, double* %26
%27 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %21, i64 1
store double 0.000000e+00, double* %27
%28 = add nuw nsw i64 %13, 2
%29 = add i64 %14, 2
%30 = icmp eq i64 %29, %11
br i1 %30, label %31, label %12
31: ; preds = %12, %6
%32 = phi i64 [ 0, %6 ], [ %28, %12 ]
%33 = icmp eq i64 %8, 0
br i1 %33, label %41, label %34
34: ; preds = %31
%35 = trunc i64 %32 to i32
%36 = mul nsw i32 %35, 3
%37 = lshr i32 %36, 1
%38 = sitofp i32 %37 to double
%39 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %32, i64 0
store double %38, double* %39
%40 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 %32, i64 1
store double 0.000000e+00, double* %40
br label %41
41: ; preds = %34, %31, %1
ret [2 x double]* %4
}