; LLVM IR from bonamarton/phys_num :: RK4_attractors (RK4adaptiveAttractors)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local double @aizawa(ptr noundef %0, ptr noundef %1, double noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store double 0.000000e+00, ptr %9, align 8, !tbaa !9
  %10 = load i32, ptr %8, align 4, !tbaa !11
  switch i32 %10, label %11 [
    i32 0, label %13
    i32 1, label %33
    i32 2, label %52
  ]

11:                                               ; preds = %4
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %101

13:                                               ; preds = %4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %14, i64 2
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %17, i64 5
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fsub double %16, %19
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds double, ptr %21, i64 0
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds double, ptr %24, i64 4
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds double, ptr %27, i64 1
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = fmul double %26, %29
  %31 = fneg double %30
  %32 = call double @llvm.fmuladd.f64(double %20, double %23, double %31)
  store double %32, ptr %9, align 8, !tbaa !9
  br label %101

33:                                               ; preds = %4
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %34, i64 2
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds double, ptr %37, i64 5
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fsub double %36, %39
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds double, ptr %41, i64 1
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %44, i64 4
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds double, ptr %47, i64 0
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = fmul double %46, %49
  %51 = call double @llvm.fmuladd.f64(double %40, double %43, double %50)
  store double %51, ptr %9, align 8, !tbaa !9
  br label %101

52:                                               ; preds = %4
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %53, i64 3
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds double, ptr %56, i64 2
  %58 = load double, ptr %57, align 8, !tbaa !9
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %59, i64 2
  %61 = load double, ptr %60, align 8, !tbaa !9
  %62 = call double @llvm.fmuladd.f64(double %58, double %61, double %55)
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds double, ptr %63, i64 2
  %65 = load double, ptr %64, align 8, !tbaa !9
  %66 = call double @pow(double noundef %65, double noundef 3.000000e+00) #5
  %67 = fdiv double %66, 3.000000e+00
  %68 = fsub double %62, %67
  store double %68, ptr %9, align 8, !tbaa !9
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds double, ptr %69, i64 0
  %71 = load double, ptr %70, align 8, !tbaa !9
  %72 = call double @pow(double noundef %71, double noundef 2.000000e+00) #5
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds double, ptr %73, i64 1
  %75 = load double, ptr %74, align 8, !tbaa !9
  %76 = call double @pow(double noundef %75, double noundef 2.000000e+00) #5
  %77 = fadd double %72, %76
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds double, ptr %78, i64 1
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds double, ptr %81, i64 2
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = call double @llvm.fmuladd.f64(double %80, double %83, double 1.000000e+00)
  %85 = load double, ptr %9, align 8, !tbaa !9
  %86 = fneg double %77
  %87 = call double @llvm.fmuladd.f64(double %86, double %84, double %85)
  store double %87, ptr %9, align 8, !tbaa !9
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds double, ptr %88, i64 6
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds double, ptr %91, i64 2
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = fmul double %90, %93
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds double, ptr %95, i64 0
  %97 = load double, ptr %96, align 8, !tbaa !9
  %98 = call double @pow(double noundef %97, double noundef 3.000000e+00) #5
  %99 = load double, ptr %9, align 8, !tbaa !9
  %100 = call double @llvm.fmuladd.f64(double %94, double %98, double %99)
  store double %100, ptr %9, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %52, %33, %13, %11
  %102 = load double, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret double %102
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local double @aizawa(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, double noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  switch i32 %3, label %5 [
    i32 0, label %7
    i32 1, label %21
    i32 2, label %34
  ]

5:                                                ; preds = %4
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %61

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load double, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = load double, ptr %10, align 8, !tbaa !5
  %12 = fsub double %9, %11
  %13 = load double, ptr %1, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fneg double %15
  %19 = fmul double %17, %18
  %20 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %19)
  br label %61

21:                                               ; preds = %4
  %22 = getelementptr inbounds i8, ptr %1, i64 16
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = fsub double %23, %25
  %27 = getelementptr inbounds i8, ptr %1, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 32
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = load double, ptr %1, align 8, !tbaa !5
  %32 = fmul double %30, %31
  %33 = tail call double @llvm.fmuladd.f64(double %26, double %28, double %32)
  br label %61

34:                                               ; preds = %4
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  %36 = load double, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %0, i64 16
  %38 = load double, ptr %37, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %1, i64 16
  %40 = load double, ptr %39, align 8, !tbaa !5
  %41 = tail call double @llvm.fmuladd.f64(double %38, double %40, double %36)
  %42 = tail call double @pow(double noundef %40, double noundef 3.000000e+00) #4
  %43 = fdiv double %42, 3.000000e+00
  %44 = fsub double %41, %43
  %45 = load <2 x double>, ptr %1, align 8, !tbaa !5
  %46 = fmul <2 x double> %45, %45
  %shift = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %47 = fadd <2 x double> %46, %shift
  %48 = extractelement <2 x double> %47, i64 0
  %49 = getelementptr inbounds i8, ptr %0, i64 8
  %50 = load double, ptr %49, align 8, !tbaa !5
  %51 = load double, ptr %39, align 8, !tbaa !5
  %52 = tail call double @llvm.fmuladd.f64(double %50, double %51, double 1.000000e+00)
  %53 = fneg double %48
  %54 = tail call double @llvm.fmuladd.f64(double %53, double %52, double %44)
  %55 = getelementptr inbounds i8, ptr %0, i64 48
  %56 = load double, ptr %55, align 8, !tbaa !5
  %57 = fmul double %51, %56
  %58 = extractelement <2 x double> %45, i64 0
  %59 = tail call double @pow(double noundef %58, double noundef 3.000000e+00) #4
  %60 = tail call double @llvm.fmuladd.f64(double %57, double %59, double %54)
  br label %61

61:                                               ; preds = %34, %21, %7, %5
  %.0 = phi double [ 0.000000e+00, %5 ], [ %60, %34 ], [ %33, %21 ], [ %20, %7 ]
  ret double %.0
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #3

attributes #0 = { nofree nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass