#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 */
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ plintf(char *, int, int, double);
int /*<<< orphan*/ rhs_only(double *, double *);
void make_gill_nu(double *nu, int n, int m, double *v) {
  double *y, *yp, *yold;
  int ir, iy;
  y = (double *)malloc(n * sizeof(double));
  yold = (double *)malloc(n * sizeof(double));
  yp = (double *)malloc(n * sizeof(double));
  for (ir = 0; ir < m; ir++)
    v[ir + 1] = 0;
  rhs_only(y, yold);
  for (ir = 0; ir < m; ir++) {
    v[ir + 1] = 1;
    rhs_only(y, yp);
    for (iy = 0; iy < n; iy++) {
      nu[ir + m * iy] = yp[iy];
      plintf("ir=%d iy=%d nu=%g\n", ir + 1, iy, yp[iy] - yold[iy]);
    }
    v[ir + 1] = 0;
  }
  free(y);
  free(yp);
  free(yold);
}


x86 assembly (clang, -O0):
<make_gill_nu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11c5 <make_gill_nu+0x85>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1196 <make_gill_nu+0x56>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <rhs_only@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12a4 <make_gill_nu+0x164>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xe06(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <rhs_only@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1281 <make_gill_nu+0x141>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   -0x38(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%esi
add    $0x1,%esi
mov    -0x38(%rbp),%edx
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
lea    0xd9a(%rip),%rdi
call   1060 <plintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1213 <make_gill_nu+0xd3>
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d9 <make_gill_nu+0x99>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_gill_nu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
mov    %edx,%r12d
mov    %rdi,0x10(%rsp)
mov    %rsi,(%rsp)
lea    0x0(,%rsi,8),%ebp
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
test   %r12d,%r12d
mov    %rbx,0x8(%rsp)
jle    129f <make_gill_nu+0x14f>
lea    0x8(%r14),%rdi
mov    %r12d,%eax
mov    %rax,0x20(%rsp)
lea    0x0(,%rax,8),%rdx
xor    %r12d,%r12d
xor    %esi,%esi
mov    %rdx,0x40(%rsp)
call   1050 <memset@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <rhs_only@plt>
mov    (%rsp),%rbx
mov    %ebx,%eax
mov    %rax,0x18(%rsp)
mov    %r14,0x30(%rsp)
mov    %r13,0x28(%rsp)
mov    %r15,0x38(%rsp)
mov    0x18(%rsp),%rbp
jmp    121a <make_gill_nu+0xca>
nop
mov    0x30(%rsp),%r14
movq   $0x0,(%r14,%r12,8)
addq   $0x8,0x10(%rsp)
cmp    0x20(%rsp),%r12
mov    0x28(%rsp),%r13
mov    (%rsp),%rbx
mov    %rdi,%r15
je     12aa <make_gill_nu+0x15a>
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%r14,%r12,8)
add    $0x1,%r12
mov    %r13,%rdi
mov    %r15,%rsi
call   1040 <rhs_only@plt>
test   %ebx,%ebx
mov    0x8(%rsp),%r14
mov    %r15,%rdi
lea    0xdb7(%rip),%r15
jle    11f0 <make_gill_nu+0xa0>
mov    0x10(%rsp),%rbx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdi,%r13,8),%xmm0
movsd  %xmm0,(%rbx)
movsd  (%rdi,%r13,8),%xmm0
subsd  (%r14,%r13,8),%xmm0
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r13d,%edx
call   1070 <plintf@plt>
mov    0x38(%rsp),%rdi
mov    0x40(%rsp),%rdx
add    $0x1,%r13
add    %rdx,%rbx
cmp    %r13,%rbp
jne    1260 <make_gill_nu+0x110>
jmp    11f0 <make_gill_nu+0xa0>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <rhs_only@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"ir=%d iy=%d nu=%g\0A\00"
define void @make_gill_nu(double* %0, i32 %1, i32 %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double* %3, double** %8
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = mul i64 %15, 8
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to double*
store double* %19, double** %9
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 8
%23 = trunc i64 %22 to i32
%24 = call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** %11
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = mul i64 %27, 8
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to double*
store double* %31, double** %10
store i32 0, i32* %12
br label %32
32: ; preds = %42, %4
%33 = load i32, i32* %12
%34 = load i32, i32* %7
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load double*, double** %8
%38 = load i32, i32* %12
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %37, i64 %40
store double 0.000000e+00, double* %41
br label %42
42: ; preds = %36
%43 = load i32, i32* %12
%44 = add nsw i32 %43, 1
store i32 %44, i32* %12
br label %32
45: ; preds = %32
%46 = load double*, double** %9
%47 = load double*, double** %11
%48 = call i32 @rhs_only(double* %46, double* %47)
store i32 0, i32* %12
br label %49
49: ; preds = %104, %45
%50 = load i32, i32* %12
%51 = load i32, i32* %7
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %107
53: ; preds = %49
%54 = load double*, double** %8
%55 = load i32, i32* %12
%56 = add nsw i32 %55, 1
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %54, i64 %57
store double 1.000000e+00, double* %58
%59 = load double*, double** %9
%60 = load double*, double** %10
%61 = call i32 @rhs_only(double* %59, double* %60)
store i32 0, i32* %13
br label %62
62: ; preds = %95, %53
%63 = load i32, i32* %13
%64 = load i32, i32* %6
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %98
66: ; preds = %62
%67 = load double*, double** %10
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double*, double** %5
%73 = load i32, i32* %12
%74 = load i32, i32* %7
%75 = load i32, i32* %13
%76 = mul nsw i32 %74, %75
%77 = add nsw i32 %73, %76
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %72, i64 %78
store double %71, double* %79
%80 = load i32, i32* %12
%81 = add nsw i32 %80, 1
%82 = load i32, i32* %13
%83 = load double*, double** %10
%84 = load i32, i32* %13
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %83, i64 %85
%87 = load double, double* %86
%88 = load double*, double** %11
%89 = load i32, i32* %13
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds double, double* %88, i64 %90
%92 = load double, double* %91
%93 = fsub double %87, %92
%94 = call i32 @plintf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %81, i32 %82, double %93)
br label %95
95: ; preds = %66
%96 = load i32, i32* %13
%97 = add nsw i32 %96, 1
store i32 %97, i32* %13
br label %62
98: ; preds = %62
%99 = load double*, double** %8
%100 = load i32, i32* %12
%101 = add nsw i32 %100, 1
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %99, i64 %102
store double 0.000000e+00, double* %103
br label %104
104: ; preds = %98
%105 = load i32, i32* %12
%106 = add nsw i32 %105, 1
store i32 %106, i32* %12
br label %49
107: ; preds = %49
%108 = load double*, double** %9
%109 = call i32 @free(double* %108)
%110 = load double*, double** %10
%111 = call i32 @free(double* %110)
%112 = load double*, double** %11
%113 = call i32 @free(double* %112)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"ir=%d iy=%d nu=%g\0A\00"
define void @make_gill_nu(double* nocapture writeonly %0, i32 %1, i32 %2, double* nocapture writeonly %3) {
%5 = shl i32 %1, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
%8 = tail call i64 @malloc(i32 %5)
%9 = inttoptr i64 %8 to double*
%10 = tail call i64 @malloc(i32 %5)
%11 = inttoptr i64 %10 to double*
%12 = icmp sgt i32 %2, 0
br i1 %12, label %15, label %13
13: ; preds = %4
%14 = tail call i32 @rhs_only(double* %7, double* %9)
br label %49
15: ; preds = %4
%16 = getelementptr double, double* %3, i64 1
%17 = bitcast double* %16 to i8*
%18 = zext i32 %2 to i64
%19 = shl nuw nsw i64 %18, 3
%20 = tail call i32 @rhs_only(double* %7, double* %9)
%21 = icmp sgt i32 %1, 0
%22 = zext i32 %2 to i64
%23 = zext i32 %2 to i64
%24 = zext i32 %1 to i64
br label %25
25: ; preds = %15, %47
%26 = phi i64 [ 0, %15 ], [ %27, %47 ]
%27 = add nuw nsw i64 %26, 1
%28 = getelementptr inbounds double, double* %3, i64 %27
store double 1.000000e+00, double* %28
%29 = tail call i32 @rhs_only(double* %7, double* %11)
br i1 %21, label %30, label %47
30: ; preds = %25
%31 = trunc i64 %27 to i32
br label %32
32: ; preds = %30, %32
%33 = phi i64 [ 0, %30 ], [ %45, %32 ]
%34 = getelementptr inbounds double, double* %11, i64 %33
%35 = load double, double* %34
%36 = mul nsw i64 %33, %22
%37 = add nuw nsw i64 %36, %26
%38 = getelementptr inbounds double, double* %0, i64 %37
store double %35, double* %38
%39 = load double, double* %34
%40 = getelementptr inbounds double, double* %9, i64 %33
%41 = load double, double* %40
%42 = fsub double %39, %41
%43 = trunc i64 %33 to i32
%44 = tail call i32 @plintf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %31, i32 %43, double %42)
%45 = add nuw nsw i64 %33, 1
%46 = icmp eq i64 %45, %24
br i1 %46, label %47, label %32
47: ; preds = %32, %25
store double 0.000000e+00, double* %28
%48 = icmp eq i64 %27, %23
br i1 %48, label %49, label %25
49: ; preds = %47, %13
%50 = tail call i32 @free(double* %7)
%51 = tail call i32 @free(double* %11)
%52 = tail call i32 @free(double* %9)
ret void
}