#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*/ generate_delta_coefficients(double *, double *, int, double);
void generate_delta_coefficients_with_base(double vetor[], double out[], int n,
                                           double delta) {
  generate_delta_coefficients(vetor, out, n, delta);
  int i;
  double base = out[0];
  for (i = 0; i < n; i++) {
    out[i] = out[i] / base;
  }
}


x86 assembly (clang, -O0):
<generate_delta_coefficients_with_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
call   1030 <generate_delta_coefficients@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118a <generate_delta_coefficients_with_base+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1151 <generate_delta_coefficients_with_base+0x41>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_delta_coefficients_with_base>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1030 <generate_delta_coefficients@plt>
test   %ebp,%ebp
jle    11f7 <generate_delta_coefficients_with_base+0xe7>
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
cmp    $0x1,%ebp
je     11f7 <generate_delta_coefficients_with_base+0xe7>
mov    %ebp,%eax
lea    -0x1(%rax),%rcx
mov    $0x1,%edx
cmp    $0x2,%rcx
jb     11e0 <generate_delta_coefficients_with_base+0xd0>
mov    %rcx,%rdx
and    $0xfffffffffffffffe,%rdx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x2(%rdx),%rsi
mov    %rsi,%rbp
shr    %rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     11fe <generate_delta_coefficients_with_base+0xee>
mov    %rbp,%rsi
and    $0xfffffffffffffffe,%rsi
mov    $0x1,%edi
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%rbx,%rdi,8),%xmm2
movupd 0x10(%rbx,%rdi,8),%xmm3
divpd  %xmm1,%xmm2
movupd %xmm2,(%rbx,%rdi,8)
divpd  %xmm1,%xmm3
movupd %xmm3,0x10(%rbx,%rdi,8)
add    $0x4,%rdi
add    $0xfffffffffffffffe,%rsi
jne    1190 <generate_delta_coefficients_with_base+0x80>
test   $0x1,%bpl
je     11cc <generate_delta_coefficients_with_base+0xbc>
movupd (%rbx,%rdi,8),%xmm2
divpd  %xmm1,%xmm2
movupd %xmm2,(%rbx,%rdi,8)
cmp    %rdx,%rcx
je     11f7 <generate_delta_coefficients_with_base+0xe7>
or     $0x1,%rcx
mov    %rcx,%rdx
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rdx,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rax
jne    11e0 <generate_delta_coefficients_with_base+0xd0>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x1,%edi
test   $0x1,%bpl
jne    11be <generate_delta_coefficients_with_base+0xae>
jmp    11cc <generate_delta_coefficients_with_base+0xbc>

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

LLVM IR (-O2):
define void @generate_delta_coefficients_with_base(double* %0, double* %1, i32 %2, double %3) {
%5 = tail call i32 @generate_delta_coefficients(double* %0, double* %1, i32 %2, double %3)
%6 = load double, double* %1
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %68
8: ; preds = %4
%9 = zext i32 %2 to i64
%10 = fdiv double %6, %6
store double %10, double* %1
%11 = icmp eq i32 %2, 1
br i1 %11, label %68, label %12
12: ; preds = %8
%13 = add nsw i64 %9, -1
%14 = icmp ult i64 %13, 2
br i1 %14, label %58, label %15
15: ; preds = %12
%16 = and i64 %13, -2
%17 = or i64 %13, 1
%18 = insertelement <2 x double> poison, double %6, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = add nsw i64 %16, -2
%21 = lshr exact i64 %20, 1
%22 = add nuw i64 %21, 1
%23 = and i64 %22, 1
%24 = icmp eq i64 %20, 0
br i1 %24, label %47, label %25
25: ; preds = %15
%26 = and i64 %22, -2
br label %27
27: ; preds = %27, %25
%28 = phi i64 [ 0, %25 ], [ %42, %27 ]
%29 = phi i64 [ 0, %25 ], [ %43, %27 ]
%30 = or i64 %28, 1
%31 = getelementptr inbounds double, double* %1, i64 %30
%32 = bitcast double* %31 to <2 x double>*
%33 = load <2 x double>, <2 x double>* %32
%34 = fdiv <2 x double> %33, %19
%35 = bitcast double* %31 to <2 x double>*
store <2 x double> %34, <2 x double>* %35
%36 = or i64 %28, 3
%37 = getelementptr inbounds double, double* %1, i64 %36
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fdiv <2 x double> %39, %19
%41 = bitcast double* %37 to <2 x double>*
store <2 x double> %40, <2 x double>* %41
%42 = add nuw i64 %28, 4
%43 = add nuw i64 %29, 2
%44 = icmp eq i64 %43, %26
br i1 %44, label %45, label %27
45: ; preds = %27
%46 = or i64 %42, 1
br label %47
47: ; preds = %45, %15
%48 = phi i64 [ 1, %15 ], [ %46, %45 ]
%49 = icmp eq i64 %23, 0
br i1 %49, label %56, label %50
50: ; preds = %47
%51 = getelementptr inbounds double, double* %1, i64 %48
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = fdiv <2 x double> %53, %19
%55 = bitcast double* %51 to <2 x double>*
store <2 x double> %54, <2 x double>* %55
br label %56
56: ; preds = %47, %50
%57 = icmp eq i64 %13, %16
br i1 %57, label %68, label %58
58: ; preds = %12, %56
%59 = phi i64 [ 1, %12 ], [ %17, %56 ]
br label %60
60: ; preds = %58, %60
%61 = phi i64 [ %66, %60 ], [ %59, %58 ]
%62 = getelementptr inbounds double, double* %1, i64 %61
%63 = load double, double* %62
%64 = getelementptr inbounds double, double* %1, i64 %61
%65 = fdiv double %63, %6
store double %65, double* %64
%66 = add nuw nsw i64 %61, 1
%67 = icmp eq i64 %66, %9
br i1 %67, label %68, label %60
68: ; preds = %60, %8, %56, %4
ret void
}