; LLVM IR from CactiLab/Sherloc-Cortex-M-CFVD :: Sherloc_runtime/evaluation/src/cubic (basicmath_small)

; 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"

; Function Attrs: nounwind uwtable
define dso_local i32 @benchmark_cubic() #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca [48 x double], align 16
  %19 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  store double 1.000000e+00, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  store double -1.050000e+01, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store double 3.200000e+01, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store double -3.000000e+01, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store double 1.000000e+00, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store double -4.500000e+00, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store double 1.700000e+01, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store double -3.000000e+01, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store double 1.000000e+00, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store double -3.500000e+00, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store double 2.200000e+01, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store double -3.100000e+01, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store double 1.000000e+00, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store double -1.370000e+01, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store double 1.000000e+00, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store double -3.500000e+01, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 384, ptr %18) #4
  call void @llvm.memset.p0.i64(ptr align 16 %18, i8 0, i64 384, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %20 = getelementptr inbounds [48 x double], ptr %18, i64 0, i64 0
  store ptr %20, ptr %19, align 8, !tbaa !9
  %21 = load double, ptr %1, align 8, !tbaa !5
  %22 = load double, ptr %2, align 8, !tbaa !5
  %23 = load double, ptr %3, align 8, !tbaa !5
  %24 = load double, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds [48 x double], ptr %18, i64 0, i64 0
  call void @SolveCubic(double noundef %21, double noundef %22, double noundef %23, double noundef %24, ptr noundef %17, ptr noundef %25)
  %26 = load double, ptr %5, align 8, !tbaa !5
  %27 = load double, ptr %6, align 8, !tbaa !5
  %28 = load double, ptr %7, align 8, !tbaa !5
  %29 = load double, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds [48 x double], ptr %18, i64 0, i64 0
  call void @SolveCubic(double noundef %26, double noundef %27, double noundef %28, double noundef %29, ptr noundef %17, ptr noundef %30)
  %31 = load double, ptr %9, align 8, !tbaa !5
  %32 = load double, ptr %10, align 8, !tbaa !5
  %33 = load double, ptr %11, align 8, !tbaa !5
  %34 = load double, ptr %12, align 8, !tbaa !5
  %35 = getelementptr inbounds [48 x double], ptr %18, i64 0, i64 0
  call void @SolveCubic(double noundef %31, double noundef %32, double noundef %33, double noundef %34, ptr noundef %17, ptr noundef %35)
  %36 = load double, ptr %13, align 8, !tbaa !5
  %37 = load double, ptr %14, align 8, !tbaa !5
  %38 = load double, ptr %15, align 8, !tbaa !5
  %39 = load double, ptr %16, align 8, !tbaa !5
  %40 = getelementptr inbounds [48 x double], ptr %18, i64 0, i64 0
  call void @SolveCubic(double noundef %36, double noundef %37, double noundef %38, double noundef %39, ptr noundef %17, ptr noundef %40)
  store double 1.000000e+00, ptr %1, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %74, %0
  %42 = load double, ptr %1, align 8, !tbaa !5
  %43 = fcmp olt double %42, 3.000000e+00
  br i1 %43, label %44, label %77

44:                                               ; preds = %41
  store double 1.000000e+01, ptr %2, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %70, %44
  %46 = load double, ptr %2, align 8, !tbaa !5
  %47 = fcmp ogt double %46, 8.000000e+00
  br i1 %47, label %48, label %73

48:                                               ; preds = %45
  store double 5.000000e+00, ptr %3, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %66, %48
  %50 = load double, ptr %3, align 8, !tbaa !5
  %51 = fcmp olt double %50, 6.000000e+00
  br i1 %51, label %52, label %69

52:                                               ; preds = %49
  store double -1.000000e+00, ptr %4, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %62, %52
  %54 = load double, ptr %4, align 8, !tbaa !5
  %55 = fcmp ogt double %54, -3.000000e+00
  br i1 %55, label %56, label %65

56:                                               ; preds = %53
  %57 = load double, ptr %1, align 8, !tbaa !5
  %58 = load double, ptr %2, align 8, !tbaa !5
  %59 = load double, ptr %3, align 8, !tbaa !5
  %60 = load double, ptr %4, align 8, !tbaa !5
  %61 = load ptr, ptr %19, align 8, !tbaa !9
  call void @SolveCubic(double noundef %57, double noundef %58, double noundef %59, double noundef %60, ptr noundef %17, ptr noundef %61)
  br label %62

62:                                               ; preds = %56
  %63 = load double, ptr %4, align 8, !tbaa !5
  %64 = fadd double %63, -1.000000e+00
  store double %64, ptr %4, align 8, !tbaa !5
  br label %53, !llvm.loop !11

65:                                               ; preds = %53
  br label %66

66:                                               ; preds = %65
  %67 = load double, ptr %3, align 8, !tbaa !5
  %68 = fadd double %67, 5.000000e-01
  store double %68, ptr %3, align 8, !tbaa !5
  br label %49, !llvm.loop !13

69:                                               ; preds = %49
  br label %70

70:                                               ; preds = %69
  %71 = load double, ptr %2, align 8, !tbaa !5
  %72 = fadd double %71, -1.000000e+00
  store double %72, ptr %2, align 8, !tbaa !5
  br label %45, !llvm.loop !14

73:                                               ; preds = %45
  br label %74

74:                                               ; preds = %73
  %75 = load double, ptr %1, align 8, !tbaa !5
  %76 = fadd double %75, 1.000000e+00
  store double %76, ptr %1, align 8, !tbaa !5
  br label %41, !llvm.loop !15

77:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 384, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @SolveCubic(double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) #3

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

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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"

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @benchmark_cubic() local_unnamed_addr #0 {
.preheader33:
  %0 = alloca i32, align 4
  %1 = alloca [48 x double], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #4
  call void @llvm.lifetime.start.p0(i64 384, ptr nonnull %1) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(384) %1, i8 0, i64 384, i1 false)
  call void @SolveCubic(double noundef 1.000000e+00, double noundef -1.050000e+01, double noundef 3.200000e+01, double noundef -3.000000e+01, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef -4.500000e+00, double noundef 1.700000e+01, double noundef -3.000000e+01, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef -3.500000e+00, double noundef 2.200000e+01, double noundef -3.100000e+01, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef -1.370000e+01, double noundef 1.000000e+00, double noundef -3.500000e+01, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 1.000000e+01, double noundef 5.000000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 1.000000e+01, double noundef 5.000000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 1.000000e+01, double noundef 5.500000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 1.000000e+01, double noundef 5.500000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 9.000000e+00, double noundef 5.000000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 9.000000e+00, double noundef 5.000000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 9.000000e+00, double noundef 5.500000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 1.000000e+00, double noundef 9.000000e+00, double noundef 5.500000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 1.000000e+01, double noundef 5.000000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 1.000000e+01, double noundef 5.000000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 1.000000e+01, double noundef 5.500000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 1.000000e+01, double noundef 5.500000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 9.000000e+00, double noundef 5.000000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 9.000000e+00, double noundef 5.000000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 9.000000e+00, double noundef 5.500000e+00, double noundef -1.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @SolveCubic(double noundef 2.000000e+00, double noundef 9.000000e+00, double noundef 5.500000e+00, double noundef -2.000000e+00, ptr noundef nonnull %0, ptr noundef nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #4
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @SolveCubic(double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass