; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (optimization)

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

%"struct.alglib_impl::qqpsettings" = type { double, double, double, i64, i8, i8, i64, i64, i64, i64 }

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

declare noundef i64 @_ZN11alglib_impl9ae_maxintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl15qqploaddefaultsElPNS_11qqpsettingsEPNS_8ae_stateE(i64 noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store i64 %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %5, align 8, !tbaa !9
  %8 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %7, i32 0, i32 0
  store double 0.000000e+00, ptr %8, align 8, !tbaa !11
  %9 = load ptr, ptr %5, align 8, !tbaa !9
  %10 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %9, i32 0, i32 1
  store double 0.000000e+00, ptr %10, align 8, !tbaa !15
  %11 = load ptr, ptr %5, align 8, !tbaa !9
  %12 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %11, i32 0, i32 2
  store double 0x3EB0C6F7A0B5ED8D, ptr %12, align 8, !tbaa !16
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %13, i32 0, i32 3
  store i64 0, ptr %14, align 8, !tbaa !17
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %15, i32 0, i32 4
  store i8 1, ptr %16, align 8, !tbaa !18
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %17, i32 0, i32 5
  store i8 1, ptr %18, align 1, !tbaa !19
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %19, i32 0, i32 6
  store i64 5, ptr %20, align 8, !tbaa !20
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %21, i32 0, i32 6
  %23 = load i64, ptr %22, align 8, !tbaa !20
  %24 = load i64, ptr %4, align 8, !tbaa !5
  %25 = sitofp i64 %24 to double
  %26 = call double @llvm.fmuladd.f64(double 3.300000e-01, double %25, double 1.000000e+00)
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  %28 = call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %26, ptr noundef %27)
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  %30 = call noundef i64 @_ZN11alglib_impl9ae_maxintEllPNS_8ae_stateE(i64 noundef %23, i64 noundef %28, ptr noundef %29)
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %31, i32 0, i32 7
  store i64 %30, ptr %32, align 8, !tbaa !21
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  %34 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %33, i32 0, i32 9
  store i64 0, ptr %34, align 8, !tbaa !22
  %35 = load i64, ptr %4, align 8, !tbaa !5
  %36 = sitofp i64 %35 to double
  %37 = call double @llvm.fmuladd.f64(double 1.000000e-01, double %36, double 1.000000e+00)
  %38 = load ptr, ptr %6, align 8, !tbaa !9
  %39 = call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %37, ptr noundef %38)
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  %41 = getelementptr inbounds %"struct.alglib_impl::qqpsettings", ptr %40, i32 0, i32 8
  store i64 %39, ptr %41, align 8, !tbaa !23
  ret void
}

declare noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { "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 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" }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN11alglib_impl11qqpsettingsE", !13, i64 0, !13, i64 8, !13, i64 16, !6, i64 24, !14, i64 32, !14, i64 33, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!13 = !{!"double", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !13, i64 8}
!16 = !{!12, !13, i64 16}
!17 = !{!12, !6, i64 24}
!18 = !{!12, !14, i64 32}
!19 = !{!12, !14, i64 33}
!20 = !{!12, !6, i64 40}
!21 = !{!12, !6, i64 48}
!22 = !{!12, !6, i64 64}
!23 = !{!12, !6, i64 56}


; 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

declare noundef i64 @_ZN11alglib_impl9ae_maxintEllPNS_8ae_stateE(i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl15qqploaddefaultsElPNS_11qqpsettingsEPNS_8ae_stateE(i64 noundef %0, ptr nocapture noundef writeonly %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %1, i8 0, i64 16, i1 false)
  store double 0x3EB0C6F7A0B5ED8D, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  store i64 0, ptr %5, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  store i8 1, ptr %6, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %1, i64 33
  store i8 1, ptr %7, align 1, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 5, ptr %8, align 8, !tbaa !15
  %9 = sitofp i64 %0 to double
  %10 = tail call double @llvm.fmuladd.f64(double %9, double 3.300000e-01, double 1.000000e+00)
  %11 = tail call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %10, ptr noundef %2)
  %12 = tail call noundef i64 @_ZN11alglib_impl9ae_maxintEllPNS_8ae_stateE(i64 noundef 5, i64 noundef %11, ptr noundef %2)
  %13 = getelementptr inbounds i8, ptr %1, i64 48
  store i64 %12, ptr %13, align 8, !tbaa !16
  %14 = getelementptr inbounds i8, ptr %1, i64 64
  store i64 0, ptr %14, align 8, !tbaa !17
  %15 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e-01, double 1.000000e+00)
  %16 = tail call noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef %15, ptr noundef %2)
  %17 = getelementptr inbounds i8, ptr %1, i64 56
  store i64 %16, ptr %17, align 8, !tbaa !18
  ret void
}

declare noundef i64 @_ZN11alglib_impl8ae_roundEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #1

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

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

!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, !7, i64 16}
!6 = !{!"_ZTSN11alglib_impl11qqpsettingsE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !11, i64 32, !11, i64 33, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !11, i64 32}
!14 = !{!6, !11, i64 33}
!15 = !{!6, !10, i64 40}
!16 = !{!6, !10, i64 48}
!17 = !{!6, !10, i64 64}
!18 = !{!6, !10, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass