#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 */
struct dataSet {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freeDataSet(struct dataSet *);
struct dataSet *initialiseDataSetFromArrays(int, int, int, double *, double *);
int /*<<< orphan*/ saveDataSet(struct dataSet *, char *);
double symbolicEq1(double);
int main(void) {
  int i;
  struct dataSet *data = NULL;
  double inputs[101][1];
  double outputs[101][1];
  double inputTemp;
  double outputTemp;
  for (i = 0; i < 101; i++) {
    inputTemp = (i * (10.0 / (101 - 1))) - 10.0 / 2;
    outputTemp = symbolicEq1(inputTemp);
    inputs[i][0] = inputTemp;
    outputs[i][0] = outputTemp;
  }
  data = initialiseDataSetFromArrays(1, 1, 101, inputs[0], outputs[0]);
  saveDataSet(data, "symbolic.data");
  freeDataSet(data);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x680,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x65,-0x8(%rbp)
jge    11dd <main+0x9d>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe88(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe84(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x678(%rbp)
ff
movsd  -0x678(%rbp),%xmm0
ff
call   1060 <symbolicEq1@plt>
movsd  %xmm0,-0x680(%rbp)
ff
movsd  -0x678(%rbp),%xmm0
ff
movslq -0x8(%rbp),%rax
movsd  %xmm0,-0x340(%rbp,%rax,8)
ff ff
movsd  -0x680(%rbp),%xmm0
ff
movslq -0x8(%rbp),%rax
movsd  %xmm0,-0x670(%rbp,%rax,8)
ff ff
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1161 <main+0x21>
lea    -0x340(%rbp),%rcx
lea    -0x670(%rbp),%r8
mov    $0x1,%esi
mov    $0x65,%edx
mov    %esi,%edi
call   1050 <initialiseDataSetFromArrays@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   1030 <saveDataSet@plt>
mov    -0x10(%rbp),%rdi
call   1040 <freeDataSet@plt>
xor    %eax,%eax
add    $0x680,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x670,%rsp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xea1(%rip),%xmm0
addsd  0xea1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1060 <symbolicEq1@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x340(%rsp,%rbx,8)
movsd  %xmm0,0x10(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1150 <main+0x10>
lea    0x340(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x65,%edx
call   1050 <initialiseDataSetFromArrays@plt>
mov    %rax,%rbx
lea    0xe54(%rip),%rsi
mov    %rax,%rdi
call   1030 <saveDataSet@plt>
mov    %rbx,%rdi
call   1040 <freeDataSet@plt>
xor    %eax,%eax
add    $0x670,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.dataSet = type { i32 }
@.str = [14 x i8] c"symbolic.data\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.dataSet*
%4 = alloca [101 x [1 x double]]
%5 = alloca [101 x [1 x double]]
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
store %struct.dataSet* null, %struct.dataSet** %3
store i32 0, i32* %2
br label %8
8: ; preds = %27, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 101
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 1.000000e-01, double -5.000000e+00)
store double %14, double* %6
%15 = load double, double* %6
%16 = call double @symbolicEq1(double %15)
store double %16, double* %7
%17 = load double, double* %6
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %4, i64 0, i64 %19
%21 = getelementptr inbounds [1 x double], [1 x double]* %20, i64 0, i64 0
store double %17, double* %21
%22 = load double, double* %7
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %5, i64 0, i64 %24
%26 = getelementptr inbounds [1 x double], [1 x double]* %25, i64 0, i64 0
store double %22, double* %26
br label %27
27: ; preds = %11
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %8
30: ; preds = %8
%31 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %4, i64 0, i64 0
%32 = getelementptr inbounds [1 x double], [1 x double]* %31, i64 0, i64 0
%33 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %5, i64 0, i64 0
%34 = getelementptr inbounds [1 x double], [1 x double]* %33, i64 0, i64 0
%35 = call %struct.dataSet* @initialiseDataSetFromArrays(i32 1, i32 1, i32 101, double* %32, double* %34)
store %struct.dataSet* %35, %struct.dataSet** %3
%36 = load %struct.dataSet*, %struct.dataSet** %3
%37 = call i32 @saveDataSet(%struct.dataSet* %36, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%38 = load %struct.dataSet*, %struct.dataSet** %3
%39 = call i32 @freeDataSet(%struct.dataSet* %38)
ret i32 0
}

LLVM IR (-O2):
%struct.dataSet = type { i32 }
@.str = [14 x i8] c"symbolic.data\00"
define i32 @main() {
%1 = alloca [101 x [1 x double]]
%2 = alloca [101 x [1 x double]]
%3 = bitcast [101 x [1 x double]]* %1 to i8*
%4 = bitcast [101 x [1 x double]]* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %13, %5 ]
%7 = trunc i64 %6 to i32
%8 = sitofp i32 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 1.000000e-01, double -5.000000e+00)
%10 = tail call double @symbolicEq1(double %9)
%11 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %1, i64 0, i64 %6, i64 0
store double %9, double* %11
%12 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %2, i64 0, i64 %6, i64 0
store double %10, double* %12
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 101
br i1 %14, label %15, label %5
15: ; preds = %5
%16 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %1, i64 0, i64 0, i64 0
%17 = getelementptr inbounds [101 x [1 x double]], [101 x [1 x double]]* %2, i64 0, i64 0, i64 0
%18 = call %struct.dataSet* @initialiseDataSetFromArrays(i32 1, i32 1, i32 101, double* %16, double* %17)
%19 = call i32 @saveDataSet(%struct.dataSet* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @freeDataSet(%struct.dataSet* %18)
ret i32 0
}