; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src/ap.ll (ZN6alglib13arraytostringB5cxx11EPKdli)

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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.13 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.13 = type { i64, [8 x i8] }

@_ZTIN6alglib8ap_errorE = external dso_local constant { ptr, ptr }, align 8
@.str.67 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [6 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_free_exception(ptr)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6alglib8ap_errorD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib8fp_isnanEd(double noundef) #2

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib13arraytostringB5cxx11EPKdli(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #1 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i1, align 1
  %10 = alloca i64, align 8
  %11 = alloca [64 x i8], align 16
  %12 = alloca [64 x i8], align 16
  %13 = alloca [80 x i8], align 16
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  store i1 false, ptr %9, align 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 80, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %17 = load i32, ptr %8, align 4, !tbaa !11
  %18 = icmp sge i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %4
  %20 = load i32, ptr %8, align 4, !tbaa !11
  br label %24

21:                                               ; preds = %4
  %22 = load i32, ptr %8, align 4, !tbaa !11
  %23 = sub nsw i32 0, %22
  br label %24

24:                                               ; preds = %21, %19
  %25 = phi i32 [ %20, %19 ], [ %23, %21 ]
  store i32 %25, ptr %14, align 4, !tbaa !11
  %26 = load i32, ptr %14, align 4, !tbaa !11
  %27 = icmp sle i32 %26, 50
  br i1 %27, label %28, label %30

28:                                               ; preds = %24
  %29 = load i32, ptr %14, align 4, !tbaa !11
  br label %31

30:                                               ; preds = %24
  br label %31

31:                                               ; preds = %30, %28
  %32 = phi i32 [ %29, %28 ], [ 50, %30 ]
  store i32 %32, ptr %14, align 4, !tbaa !11
  %33 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef @.str.99)
          to label %34 unwind label %49

34:                                               ; preds = %31
  %35 = getelementptr inbounds [64 x i8], ptr %12, i64 0, i64 0
  %36 = load i32, ptr %14, align 4, !tbaa !11
  %37 = load i32, ptr %8, align 4, !tbaa !11
  %38 = icmp sge i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  br label %41

40:                                               ; preds = %34
  br label %41

41:                                               ; preds = %40, %39
  %42 = phi ptr [ @.str.70, %39 ], [ @.str.71, %40 ]
  %43 = getelementptr inbounds [2 x i8], ptr %42, i64 0, i64 0
  %44 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %35, ptr noundef @.str.69, i32 noundef %36, ptr noundef %43) #5
  %45 = icmp sge i32 %44, 64
  br i1 %45, label %46, label %57

46:                                               ; preds = %41
  %47 = call ptr @__cxa_allocate_exception(i64 32) #5
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %47, ptr noundef @.str.112)
          to label %48 unwind label %53

48:                                               ; preds = %46
  invoke void @__cxa_throw(ptr %47, ptr @_ZTIN6alglib8ap_errorE, ptr @_ZN6alglib8ap_errorD2Ev) #6
          to label %170 unwind label %49

49:                                               ; preds = %158, %151, %134, %120, %106, %100, %74, %64, %48, %31
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %15, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %16, align 4
  br label %162

53:                                               ; preds = %46
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %15, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %16, align 4
  call void @__cxa_free_exception(ptr %47) #5
  br label %162

57:                                               ; preds = %41
  %58 = getelementptr inbounds [80 x i8], ptr %13, i64 0, i64 0
  %59 = getelementptr inbounds [64 x i8], ptr %12, i64 0, i64 0
  %60 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %58, ptr noundef @.str.113, ptr noundef %59) #5
  %61 = icmp sge i32 %60, 80
  br i1 %61, label %62, label %69

62:                                               ; preds = %57
  %63 = call ptr @__cxa_allocate_exception(i64 32) #5
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %63, ptr noundef @.str.112)
          to label %64 unwind label %65

64:                                               ; preds = %62
  invoke void @__cxa_throw(ptr %63, ptr @_ZTIN6alglib8ap_errorE, ptr @_ZN6alglib8ap_errorD2Ev) #6
          to label %170 unwind label %49

65:                                               ; preds = %62
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %15, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %16, align 4
  call void @__cxa_free_exception(ptr %63) #5
  br label %162

69:                                               ; preds = %57
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %155, %69
  %71 = load i64, ptr %10, align 8, !tbaa !9
  %72 = load i64, ptr %7, align 8, !tbaa !9
  %73 = icmp slt i64 %71, %72
  br i1 %73, label %74, label %158

74:                                               ; preds = %70
  %75 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  store i8 0, ptr %75, align 16, !tbaa !13
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load i64, ptr %10, align 8, !tbaa !9
  %78 = getelementptr inbounds double, ptr %76, i64 %77
  %79 = load double, ptr %78, align 8, !tbaa !14
  %80 = invoke noundef zeroext i1 @_ZN6alglib11fp_isfiniteEd(double noundef %79)
          to label %81 unwind label %49

81:                                               ; preds = %74
  br i1 %80, label %82, label %106

82:                                               ; preds = %81
  %83 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  %84 = load i64, ptr %10, align 8, !tbaa !9
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %82
  %87 = getelementptr inbounds [64 x i8], ptr %12, i64 0, i64 0
  br label %90

88:                                               ; preds = %82
  %89 = getelementptr inbounds [80 x i8], ptr %13, i64 0, i64 0
  br label %90

90:                                               ; preds = %88, %86
  %91 = phi ptr [ %87, %86 ], [ %89, %88 ]
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load i64, ptr %10, align 8, !tbaa !9
  %94 = getelementptr inbounds double, ptr %92, i64 %93
  %95 = load double, ptr %94, align 8, !tbaa !14
  %96 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %83, ptr noundef %91, double noundef %95) #5
  %97 = icmp sge i32 %96, 64
  br i1 %97, label %98, label %105

98:                                               ; preds = %90
  %99 = call ptr @__cxa_allocate_exception(i64 32) #5
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %99, ptr noundef @.str.112)
          to label %100 unwind label %101

100:                                              ; preds = %98
  invoke void @__cxa_throw(ptr %99, ptr @_ZTIN6alglib8ap_errorE, ptr @_ZN6alglib8ap_errorD2Ev) #6
          to label %170 unwind label %49

101:                                              ; preds = %98
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %15, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %16, align 4
  call void @__cxa_free_exception(ptr %99) #5
  br label %162

105:                                              ; preds = %90
  br label %151

106:                                              ; preds = %81
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = load i64, ptr %10, align 8, !tbaa !9
  %109 = getelementptr inbounds double, ptr %107, i64 %108
  %110 = load double, ptr %109, align 8, !tbaa !14
  %111 = invoke noundef zeroext i1 @_ZN6alglib8fp_isnanEd(double noundef %110)
          to label %112 unwind label %49

112:                                              ; preds = %106
  br i1 %111, label %113, label %120

113:                                              ; preds = %112
  %114 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  %115 = load i64, ptr %10, align 8, !tbaa !9
  %116 = icmp eq i64 %115, 0
  %117 = zext i1 %116 to i64
  %118 = select i1 %116, ptr @.str.67, ptr @.str.114
  %119 = call ptr @strcpy(ptr noundef %114, ptr noundef %118) #5
  br label %150

120:                                              ; preds = %112
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = load i64, ptr %10, align 8, !tbaa !9
  %123 = getelementptr inbounds double, ptr %121, i64 %122
  %124 = load double, ptr %123, align 8, !tbaa !14
  %125 = invoke noundef zeroext i1 @_ZN6alglib11fp_isposinfEd(double noundef %124)
          to label %126 unwind label %49

126:                                              ; preds = %120
  br i1 %125, label %127, label %134

127:                                              ; preds = %126
  %128 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  %129 = load i64, ptr %10, align 8, !tbaa !9
  %130 = icmp eq i64 %129, 0
  %131 = zext i1 %130 to i64
  %132 = select i1 %130, ptr @.str.115, ptr @.str.116
  %133 = call ptr @strcpy(ptr noundef %128, ptr noundef %132) #5
  br label %149

134:                                              ; preds = %126
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = load i64, ptr %10, align 8, !tbaa !9
  %137 = getelementptr inbounds double, ptr %135, i64 %136
  %138 = load double, ptr %137, align 8, !tbaa !14
  %139 = invoke noundef zeroext i1 @_ZN6alglib11fp_isneginfEd(double noundef %138)
          to label %140 unwind label %49

140:                                              ; preds = %134
  br i1 %139, label %141, label %148

141:                                              ; preds = %140
  %142 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  %143 = load i64, ptr %10, align 8, !tbaa !9
  %144 = icmp eq i64 %143, 0
  %145 = zext i1 %144 to i64
  %146 = select i1 %144, ptr @.str.117, ptr @.str.118
  %147 = call ptr @strcpy(ptr noundef %142, ptr noundef %146) #5
  br label %148

148:                                              ; preds = %141, %140
  br label %149

149:                                              ; preds = %148, %127
  br label %150

150:                                              ; preds = %149, %113
  br label %151

151:                                              ; preds = %150, %105
  %152 = getelementptr inbounds [64 x i8], ptr %11, i64 0, i64 0
  %153 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %152)
          to label %154 unwind label %49

154:                                              ; preds = %151
  br label %155

155:                                              ; preds = %154
  %156 = load i64, ptr %10, align 8, !tbaa !9
  %157 = add nsw i64 %156, 1
  store i64 %157, ptr %10, align 8, !tbaa !9
  br label %70, !llvm.loop !16

158:                                              ; preds = %70
  %159 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef @.str.100)
          to label %160 unwind label %49

160:                                              ; preds = %158
  store i1 true, ptr %9, align 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %161 = load i1, ptr %9, align 1
  br i1 %161, label %164, label %163

162:                                              ; preds = %101, %65, %53, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %165

163:                                              ; preds = %160
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %164

164:                                              ; preds = %163, %160
  ret void

165:                                              ; preds = %162
  %166 = load ptr, ptr %15, align 8
  %167 = load i32, ptr %16, align 4
  %168 = insertvalue { ptr, i32 } poison, ptr %166, 0
  %169 = insertvalue { ptr, i32 } %168, i32 %167, 1
  resume { ptr, i32 } %169

170:                                              ; preds = %100, %64, %48
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isfiniteEd(double noundef) #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isposinfEd(double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isneginfEd(double noundef) #2

declare void @_ZN6alglib8ap_errorC1EPKc(ptr, ptr)

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

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.13 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.13 = type { i64, [8 x i8] }

@_ZTIN6alglib8ap_errorE = external dso_local constant { ptr, ptr }, align 8
@.str.67 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6alglib8ap_errorD2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib8fp_isnanEd(double noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6alglib13arraytostringB5cxx11EPKdli(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr nocapture noundef readonly %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %5 = alloca [64 x i8], align 16
  %6 = alloca [64 x i8], align 16
  %7 = alloca [80 x i8], align 16
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #7
  %8 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.99)
          to label %9 unwind label %.loopexit.split-lp

9:                                                ; preds = %4
  %10 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
  %11 = tail call i32 @llvm.umin.i32(i32 %10, i32 50)
  %12 = icmp sgt i32 %3, -1
  %.str.70..str.71 = select i1 %12, ptr @.str.70, ptr @.str.71
  %13 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.69, i32 noundef %11, ptr noundef nonnull %.str.70..str.71) #7
  %14 = icmp sgt i32 %13, 63
  br i1 %14, label %15, label %20

15:                                               ; preds = %9
  %16 = tail call ptr @__cxa_allocate_exception(i64 32) #7
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull @.str.112)
          to label %.invoke unwind label %18

.invoke:                                          ; preds = %15, %.loopexit31, %42
  %17 = phi ptr [ %43, %42 ], [ %53, %.loopexit31 ], [ %16, %15 ]
  invoke void @__cxa_throw(ptr %17, ptr nonnull @_ZTIN6alglib8ap_errorE, ptr nonnull @_ZN6alglib8ap_errorD2Ev) #8
          to label %.cont unwind label %.loopexit.split-lp

.cont:                                            ; preds = %.invoke
  unreachable

.loopexit.loopexit:                               ; preds = %65
  %lpad.loopexit32 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit.loopexit.split-lp:                      ; preds = %39
  %lpad.loopexit.split-lp33 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

.loopexit.split-lp:                               ; preds = %.invoke, %4, %._crit_edge
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

18:                                               ; preds = %15
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %16) #7
  br label %.loopexit

20:                                               ; preds = %9
  %21 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.113, ptr noundef nonnull %6) #7
  %22 = icmp sgt i32 %21, 79
  br i1 %22, label %42, label %.preheader

.preheader:                                       ; preds = %20
  %23 = icmp sgt i64 %2, 0
  br i1 %23, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader
  store i8 0, ptr %5, align 16, !tbaa !5
  %24 = load double, ptr %1, align 8, !tbaa !8
  %25 = call noundef zeroext i1 @_ZN6alglib11fp_isfiniteEd(double noundef %24)
  %26 = load double, ptr %1, align 8, !tbaa !8
  br i1 %25, label %35, label %27

27:                                               ; preds = %.lr.ph.preheader
  %28 = call noundef zeroext i1 @_ZN6alglib8fp_isnanEd(double noundef %26)
  br i1 %28, label %.sink.split, label %29

29:                                               ; preds = %27
  %30 = load double, ptr %1, align 8, !tbaa !8
  %31 = call noundef zeroext i1 @_ZN6alglib11fp_isposinfEd(double noundef %30)
  br i1 %31, label %.sink.split, label %32

32:                                               ; preds = %29
  %33 = load double, ptr %1, align 8, !tbaa !8
  %34 = call noundef zeroext i1 @_ZN6alglib11fp_isneginfEd(double noundef %33)
  br i1 %34, label %.sink.split, label %39

35:                                               ; preds = %.lr.ph.preheader
  %36 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) %6, double noundef %26) #7
  %37 = icmp sgt i32 %36, 63
  br i1 %37, label %.loopexit31, label %39

.sink.split:                                      ; preds = %27, %29, %32
  %.str.67.sink = phi ptr [ @.str.117, %32 ], [ @.str.115, %29 ], [ @.str.67, %27 ]
  %38 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) %.str.67.sink) #7
  br label %39

39:                                               ; preds = %.sink.split, %35, %32
  %40 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %5)
          to label %41 unwind label %.loopexit.loopexit.split-lp

41:                                               ; preds = %39
  %exitcond.peel.not = icmp eq i64 %2, 1
  br i1 %exitcond.peel.not, label %._crit_edge, label %.lr.ph

42:                                               ; preds = %20
  %43 = call ptr @__cxa_allocate_exception(i64 32) #7
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %43, ptr noundef nonnull @.str.112)
          to label %.invoke unwind label %44

44:                                               ; preds = %42
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %43) #7
  br label %.loopexit

.lr.ph:                                           ; preds = %41, %67
  %.02729 = phi i64 [ %68, %67 ], [ 1, %41 ]
  store i8 0, ptr %5, align 16, !tbaa !5
  %46 = getelementptr inbounds double, ptr %1, i64 %.02729
  %47 = load double, ptr %46, align 8, !tbaa !8
  %48 = call noundef zeroext i1 @_ZN6alglib11fp_isfiniteEd(double noundef %47)
  %49 = load double, ptr %46, align 8, !tbaa !8
  br i1 %48, label %50, label %56

50:                                               ; preds = %.lr.ph
  %51 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) %7, double noundef %49) #7
  %52 = icmp sgt i32 %51, 63
  br i1 %52, label %.loopexit31, label %65

.loopexit31:                                      ; preds = %50, %35
  %53 = call ptr @__cxa_allocate_exception(i64 32) #7
  invoke void @_ZN6alglib8ap_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(32) %53, ptr noundef nonnull @.str.112)
          to label %.invoke unwind label %54

54:                                               ; preds = %.loopexit31
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %53) #7
  br label %.loopexit

56:                                               ; preds = %.lr.ph
  %57 = call noundef zeroext i1 @_ZN6alglib8fp_isnanEd(double noundef %49)
  br i1 %57, label %.sink.split34, label %58

58:                                               ; preds = %56
  %59 = load double, ptr %46, align 8, !tbaa !8
  %60 = call noundef zeroext i1 @_ZN6alglib11fp_isposinfEd(double noundef %59)
  br i1 %60, label %.sink.split34, label %61

61:                                               ; preds = %58
  %62 = load double, ptr %46, align 8, !tbaa !8
  %63 = call noundef zeroext i1 @_ZN6alglib11fp_isneginfEd(double noundef %62)
  br i1 %63, label %.sink.split34, label %65

.sink.split34:                                    ; preds = %61, %58, %56
  %.str.114.sink = phi ptr [ @.str.114, %56 ], [ @.str.116, %58 ], [ @.str.118, %61 ]
  %64 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) %.str.114.sink) #7
  br label %65

65:                                               ; preds = %.sink.split34, %61, %50
  %66 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %5)
          to label %67 unwind label %.loopexit.loopexit

67:                                               ; preds = %65
  %68 = add nuw nsw i64 %.02729, 1
  %exitcond.not = icmp eq i64 %68, %2
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

._crit_edge:                                      ; preds = %67, %41, %.preheader
  %69 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull @.str.100)
          to label %70 unwind label %.loopexit.split-lp

70:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #7
  ret void

.loopexit:                                        ; preds = %.loopexit.loopexit, %.loopexit.loopexit.split-lp, %.loopexit.split-lp, %54, %44, %18
  %.pn = phi { ptr, i32 } [ %19, %18 ], [ %45, %44 ], [ %55, %54 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ], [ %lpad.loopexit32, %.loopexit.loopexit ], [ %lpad.loopexit.split-lp33, %.loopexit.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isfiniteEd(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isposinfEd(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6alglib11fp_isneginfEd(double noundef) local_unnamed_addr #2

declare void @_ZN6alglib8ap_errorC1EPKc(ptr, ptr) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress 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 #3 = { inlinehint mustprogress 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !6, i64 0}
!10 = distinct !{!10, !11, !12}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass