; LLVM IR from chrr/libECP :: src (getIntegrals)

; 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.libECP_params = type { ptr, i32, ptr, i32 }

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

; Function Attrs: nounwind uwtable
declare dso_local void @libECP_callback0(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @getIntegrals(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, i32 noundef %13, double noundef %14, double noundef %15, i32 noundef %16, ptr noundef %17) #0 {
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca i32, align 4
  %34 = alloca double, align 8
  %35 = alloca double, align 8
  %36 = alloca i32, align 4
  %37 = alloca ptr, align 8
  %38 = alloca ptr, align 8
  %39 = alloca ptr, align 8
  %40 = alloca ptr, align 8
  %41 = alloca i32, align 4
  %42 = alloca i32, align 4
  %43 = alloca i32, align 4
  %44 = alloca i32, align 4
  %45 = alloca i32, align 4
  %46 = alloca i32, align 4
  %47 = alloca i32, align 4
  store i32 %0, ptr %20, align 4, !tbaa !5
  store ptr %1, ptr %21, align 8, !tbaa !9
  store ptr %2, ptr %22, align 8, !tbaa !9
  store ptr %3, ptr %23, align 8, !tbaa !9
  store ptr %4, ptr %24, align 8, !tbaa !9
  store ptr %5, ptr %25, align 8, !tbaa !9
  store ptr %6, ptr %26, align 8, !tbaa !9
  store ptr %7, ptr %27, align 8, !tbaa !9
  store ptr %8, ptr %28, align 8, !tbaa !9
  store ptr %9, ptr %29, align 8, !tbaa !9
  store ptr %10, ptr %30, align 8, !tbaa !9
  store ptr %11, ptr %31, align 8, !tbaa !9
  store ptr %12, ptr %32, align 8, !tbaa !9
  store i32 %13, ptr %33, align 4, !tbaa !5
  store double %14, ptr %34, align 8, !tbaa !11
  store double %15, ptr %35, align 8, !tbaa !11
  store i32 %16, ptr %36, align 4, !tbaa !5
  store ptr %17, ptr %37, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #6
  %48 = call noalias ptr @malloc(i64 noundef 32) #7
  store ptr %48, ptr %38, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %39) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #6
  store i32 0, ptr %42, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #6
  store i32 0, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #6
  store i32 0, ptr %46, align 4, !tbaa !5
  store i32 0, ptr %43, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %68, %18
  %50 = load i32, ptr %43, align 4, !tbaa !5
  %51 = load i32, ptr %20, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %71

53:                                               ; preds = %49
  %54 = load ptr, ptr %28, align 8, !tbaa !9
  %55 = load i32, ptr %43, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %54, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = load i32, ptr %42, align 4, !tbaa !5
  %60 = icmp sgt i32 %58, %59
  br i1 %60, label %61, label %67

61:                                               ; preds = %53
  %62 = load ptr, ptr %28, align 8, !tbaa !9
  %63 = load i32, ptr %43, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr %42, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %61, %53
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %43, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %43, align 4, !tbaa !5
  br label %49, !llvm.loop !13

71:                                               ; preds = %49
  %72 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %72, ptr %41, align 4, !tbaa !5
  %73 = load i32, ptr %20, align 4, !tbaa !5
  %74 = load i32, ptr %41, align 4, !tbaa !5
  %75 = mul nsw i32 %73, %74
  %76 = sext i32 %75 to i64
  %77 = call noalias ptr @calloc(i64 noundef %76, i64 noundef 4) #8
  store ptr %77, ptr %40, align 8, !tbaa !9
  store i32 0, ptr %43, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %123, %71
  %79 = load i32, ptr %43, align 4, !tbaa !5
  %80 = load i32, ptr %20, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %126

82:                                               ; preds = %78
  store i32 0, ptr %44, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %119, %82
  %84 = load i32, ptr %44, align 4, !tbaa !5
  %85 = load ptr, ptr %28, align 8, !tbaa !9
  %86 = load i32, ptr %43, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %85, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp slt i32 %84, %89
  br i1 %90, label %91, label %122

91:                                               ; preds = %83
  %92 = load i32, ptr %45, align 4, !tbaa !5
  %93 = load ptr, ptr %40, align 8, !tbaa !9
  %94 = load i32, ptr %43, align 4, !tbaa !5
  %95 = load i32, ptr %41, align 4, !tbaa !5
  %96 = mul nsw i32 %94, %95
  %97 = load i32, ptr %44, align 4, !tbaa !5
  %98 = add nsw i32 %96, %97
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr %93, i64 %99
  store i32 %92, ptr %100, align 4, !tbaa !5
  %101 = load ptr, ptr %29, align 8, !tbaa !9
  %102 = load i32, ptr %46, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %101, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  %107 = load ptr, ptr %29, align 8, !tbaa !9
  %108 = load i32, ptr %46, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %107, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %111, 2
  %113 = mul nsw i32 %106, %112
  %114 = sdiv i32 %113, 2
  %115 = load i32, ptr %45, align 4, !tbaa !5
  %116 = add nsw i32 %115, %114
  store i32 %116, ptr %45, align 4, !tbaa !5
  %117 = load i32, ptr %46, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %46, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %91
  %120 = load i32, ptr %44, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %44, align 4, !tbaa !5
  br label %83, !llvm.loop !15

122:                                              ; preds = %83
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %43, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %43, align 4, !tbaa !5
  br label %78, !llvm.loop !16

126:                                              ; preds = %78
  %127 = load ptr, ptr %37, align 8, !tbaa !9
  %128 = load ptr, ptr %38, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.libECP_params, ptr %128, i32 0, i32 0
  store ptr %127, ptr %129, align 8, !tbaa !17
  %130 = load i32, ptr %36, align 4, !tbaa !5
  %131 = load ptr, ptr %38, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct.libECP_params, ptr %131, i32 0, i32 1
  store i32 %130, ptr %132, align 8, !tbaa !19
  %133 = load ptr, ptr %40, align 8, !tbaa !9
  %134 = load ptr, ptr %38, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.libECP_params, ptr %134, i32 0, i32 2
  store ptr %133, ptr %135, align 8, !tbaa !20
  %136 = load i32, ptr %41, align 4, !tbaa !5
  %137 = load ptr, ptr %38, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct.libECP_params, ptr %137, i32 0, i32 3
  store i32 %136, ptr %138, align 8, !tbaa !21
  %139 = load i32, ptr %20, align 4, !tbaa !5
  %140 = load ptr, ptr %21, align 8, !tbaa !9
  %141 = load ptr, ptr %22, align 8, !tbaa !9
  %142 = load ptr, ptr %24, align 8, !tbaa !9
  %143 = load ptr, ptr %23, align 8, !tbaa !9
  %144 = load ptr, ptr %25, align 8, !tbaa !9
  %145 = load ptr, ptr %26, align 8, !tbaa !9
  %146 = load ptr, ptr %27, align 8, !tbaa !9
  %147 = load ptr, ptr %28, align 8, !tbaa !9
  %148 = load ptr, ptr %29, align 8, !tbaa !9
  %149 = load ptr, ptr %30, align 8, !tbaa !9
  %150 = load ptr, ptr %31, align 8, !tbaa !9
  %151 = load ptr, ptr %32, align 8, !tbaa !9
  %152 = load i32, ptr %33, align 4, !tbaa !5
  %153 = load double, ptr %34, align 8, !tbaa !11
  %154 = load double, ptr %35, align 8, !tbaa !11
  %155 = call ptr @libECP_init(i32 noundef %139, ptr noundef %140, ptr noundef %141, ptr noundef %142, ptr noundef %143, ptr noundef %144, ptr noundef %145, ptr noundef %146, ptr noundef %147, ptr noundef %148, ptr noundef %149, ptr noundef %150, ptr noundef %151, i32 noundef 0, i32 noundef -1, ptr noundef null, i32 noundef %152, double noundef %153, double noundef %154)
  store ptr %155, ptr %39, align 8, !tbaa !9
  %156 = load ptr, ptr %39, align 8, !tbaa !9
  %157 = icmp eq ptr null, %156
  br i1 %157, label %158, label %160

158:                                              ; preds = %126
  %159 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %19, align 4
  store i32 1, ptr %47, align 4
  br label %167

160:                                              ; preds = %126
  %161 = load ptr, ptr %39, align 8, !tbaa !9
  %162 = load ptr, ptr %38, align 8, !tbaa !9
  %163 = call i32 @calculateECPIntegrals(ptr noundef %161, ptr noundef @libECP_callback0, ptr noundef %162)
  %164 = load ptr, ptr %39, align 8, !tbaa !9
  call void @libECP_free(ptr noundef %164)
  %165 = load ptr, ptr %40, align 8, !tbaa !9
  call void @free(ptr noundef %165) #6
  %166 = load ptr, ptr %38, align 8, !tbaa !9
  call void @free(ptr noundef %166) #6
  store i32 0, ptr %19, align 4
  store i32 1, ptr %47, align 4
  br label %167

167:                                              ; preds = %160, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %39) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #6
  %168 = load i32, ptr %19, align 4
  ret i32 %168
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

declare ptr @libECP_init(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, double noundef) #4

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

declare i32 @calculateECPIntegrals(ptr noundef, ptr noundef, ptr noundef) #4

declare void @libECP_free(ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

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 = { nounwind allocsize(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 = { nounwind allocsize(0,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 #4 = { "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 "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 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }

!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 = !{!"int", !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 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0, !6, i64 8, !10, i64 16, !6, i64 24}
!19 = !{!18, !6, i64 8}
!20 = !{!18, !10, i64 16}
!21 = !{!18, !6, i64 24}


; 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 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @libECP_callback0(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @getIntegrals(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, i32 noundef %13, double noundef %14, double noundef %15, i32 noundef %16, ptr noundef %17) local_unnamed_addr #0 {
  %19 = tail call noalias dereferenceable_or_null(32) ptr @malloc(i64 noundef 32) #7
  %20 = icmp sgt i32 %0, 0
  br i1 %20, label %.lr.ph.preheader, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %18
  %21 = tail call noalias ptr @calloc(i64 noundef 0, i64 noundef 4) #8
  br label %._crit_edge82

.lr.ph.preheader:                                 ; preds = %18
  %wide.trip.count = zext nneg i32 %0 to i64
  %min.iters.check = icmp ult i32 %0, 8
  br i1 %min.iters.check, label %.lr.ph.preheader103, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %24, %vector.body ]
  %vec.phi101 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %25, %vector.body ]
  %22 = getelementptr inbounds i32, ptr %8, i64 %index
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %wide.load = load <4 x i32>, ptr %22, align 4, !tbaa !5
  %wide.load102 = load <4 x i32>, ptr %23, align 4, !tbaa !5
  %24 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %25 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load102, <4 x i32> %vec.phi101)
  %index.next = add nuw i64 %index, 8
  %26 = icmp eq i64 %index.next, %n.vec
  br i1 %26, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %24, <4 x i32> %25)
  %27 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader103

.lr.ph.preheader103:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.06470.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %27, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader103, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader103 ]
  %.06470 = phi i32 [ %spec.select, %.lr.ph ], [ %.06470.ph, %.lr.ph.preheader103 ]
  %28 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %spec.select = tail call i32 @llvm.smax.i32(i32 %29, i32 %.06470)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %middle.block
  %spec.select.lcssa = phi i32 [ %27, %middle.block ], [ %spec.select, %.lr.ph ]
  %30 = mul nsw i32 %spec.select.lcssa, %0
  %31 = sext i32 %30 to i64
  %32 = tail call noalias ptr @calloc(i64 noundef %31, i64 noundef 4) #8
  br i1 %20, label %.preheader.preheader, label %._crit_edge82

.preheader.preheader:                             ; preds = %._crit_edge
  %33 = zext nneg i32 %spec.select.lcssa to i64
  %wide.trip.count97 = zext nneg i32 %0 to i64
  %invariant.gep113 = getelementptr i8, ptr %9, i64 4
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge76
  %indvars.iv94 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next95, %._crit_edge76 ]
  %.081 = phi i32 [ 0, %.preheader.preheader ], [ %.1.lcssa, %._crit_edge76 ]
  %.05980 = phi i32 [ 0, %.preheader.preheader ], [ %.160.lcssa, %._crit_edge76 ]
  %34 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv94
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph75, label %._crit_edge76

.lr.ph75:                                         ; preds = %.preheader
  %37 = mul nuw nsw i64 %indvars.iv94, %33
  %38 = sext i32 %.081 to i64
  %wide.trip.count92 = zext nneg i32 %35 to i64
  %invariant.gep = getelementptr inbounds i32, ptr %32, i64 %37
  %xtraiter = and i64 %wide.trip.count92, 1
  %39 = icmp eq i32 %35, 1
  br i1 %39, label %._crit_edge76.loopexit.unr-lcssa, label %.lr.ph75.new

.lr.ph75.new:                                     ; preds = %.lr.ph75
  %unroll_iter = and i64 %wide.trip.count92, 2147483646
  br label %40

40:                                               ; preds = %40, %.lr.ph75.new
  %indvars.iv87 = phi i64 [ 0, %.lr.ph75.new ], [ %indvars.iv.next88.1, %40 ]
  %indvars.iv85 = phi i64 [ %38, %.lr.ph75.new ], [ %indvars.iv.next86.1, %40 ]
  %.16073 = phi i32 [ %.05980, %.lr.ph75.new ], [ %53, %40 ]
  %niter = phi i64 [ 0, %.lr.ph75.new ], [ %niter.next.1, %40 ]
  %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv87
  store i32 %.16073, ptr %gep, align 4, !tbaa !5
  %41 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv85
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  %44 = add nsw i32 %42, 2
  %45 = mul nsw i32 %43, %44
  %46 = sdiv i32 %45, 2
  %47 = add nsw i32 %46, %.16073
  %indvars.iv.next88 = or disjoint i64 %indvars.iv87, 1
  %gep.1 = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv.next88
  store i32 %47, ptr %gep.1, align 4, !tbaa !5
  %gep114 = getelementptr i32, ptr %invariant.gep113, i64 %indvars.iv85
  %48 = load i32, ptr %gep114, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = add nsw i32 %48, 2
  %51 = mul nsw i32 %49, %50
  %52 = sdiv i32 %51, 2
  %53 = add nsw i32 %52, %47
  %indvars.iv.next86.1 = add nsw i64 %indvars.iv85, 2
  %indvars.iv.next88.1 = add nuw nsw i64 %indvars.iv87, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge76.loopexit.unr-lcssa, label %40, !llvm.loop !14

._crit_edge76.loopexit.unr-lcssa:                 ; preds = %40, %.lr.ph75
  %.lcssa.ph = phi i32 [ poison, %.lr.ph75 ], [ %53, %40 ]
  %indvars.iv.next86.lcssa.ph = phi i64 [ poison, %.lr.ph75 ], [ %indvars.iv.next86.1, %40 ]
  %indvars.iv87.unr = phi i64 [ 0, %.lr.ph75 ], [ %indvars.iv.next88.1, %40 ]
  %indvars.iv85.unr = phi i64 [ %38, %.lr.ph75 ], [ %indvars.iv.next86.1, %40 ]
  %.16073.unr = phi i32 [ %.05980, %.lr.ph75 ], [ %53, %40 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge76.loopexit, label %._crit_edge76.loopexit.epilog-lcssa

._crit_edge76.loopexit.epilog-lcssa:              ; preds = %._crit_edge76.loopexit.unr-lcssa
  %gep.epil = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv87.unr
  store i32 %.16073.unr, ptr %gep.epil, align 4, !tbaa !5
  %54 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv85.unr
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = add nsw i32 %55, 2
  %58 = mul nsw i32 %56, %57
  %59 = sdiv i32 %58, 2
  %60 = add nsw i32 %59, %.16073.unr
  %indvars.iv.next86.epil = add nsw i64 %indvars.iv85.unr, 1
  br label %._crit_edge76.loopexit

._crit_edge76.loopexit:                           ; preds = %._crit_edge76.loopexit.unr-lcssa, %._crit_edge76.loopexit.epilog-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge76.loopexit.unr-lcssa ], [ %60, %._crit_edge76.loopexit.epilog-lcssa ]
  %indvars.iv.next86.lcssa = phi i64 [ %indvars.iv.next86.lcssa.ph, %._crit_edge76.loopexit.unr-lcssa ], [ %indvars.iv.next86.epil, %._crit_edge76.loopexit.epilog-lcssa ]
  %61 = trunc nsw i64 %indvars.iv.next86.lcssa to i32
  br label %._crit_edge76

._crit_edge76:                                    ; preds = %._crit_edge76.loopexit, %.preheader
  %.160.lcssa = phi i32 [ %.05980, %.preheader ], [ %.lcssa, %._crit_edge76.loopexit ]
  %.1.lcssa = phi i32 [ %.081, %.preheader ], [ %61, %._crit_edge76.loopexit ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
  br i1 %exitcond98.not, label %._crit_edge82, label %.preheader, !llvm.loop !15

._crit_edge82:                                    ; preds = %._crit_edge76, %._crit_edge.thread, %._crit_edge
  %62 = phi ptr [ %21, %._crit_edge.thread ], [ %32, %._crit_edge ], [ %32, %._crit_edge76 ]
  %.064.lcssa100 = phi i32 [ 0, %._crit_edge.thread ], [ %spec.select.lcssa, %._crit_edge ], [ %spec.select.lcssa, %._crit_edge76 ]
  store ptr %17, ptr %19, align 8, !tbaa !16
  %63 = getelementptr inbounds i8, ptr %19, i64 8
  store i32 %16, ptr %63, align 8, !tbaa !19
  %64 = getelementptr inbounds i8, ptr %19, i64 16
  store ptr %62, ptr %64, align 8, !tbaa !20
  %65 = getelementptr inbounds i8, ptr %19, i64 24
  store i32 %.064.lcssa100, ptr %65, align 8, !tbaa !21
  %66 = tail call ptr @libECP_init(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %4, ptr noundef %3, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, i32 noundef 0, i32 noundef -1, ptr noundef null, i32 noundef %13, double noundef %14, double noundef %15) #9
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %70

68:                                               ; preds = %._crit_edge82
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %72

70:                                               ; preds = %._crit_edge82
  %71 = tail call i32 @calculateECPIntegrals(ptr noundef nonnull %66, ptr noundef nonnull @libECP_callback0, ptr noundef nonnull %19) #9
  tail call void @libECP_free(ptr noundef nonnull %66) #9
  tail call void @free(ptr noundef %62) #9
  tail call void @free(ptr noundef nonnull %19) #9
  br label %72

72:                                               ; preds = %70, %68
  %.066 = phi i32 [ 1, %68 ], [ 0, %70 ]
  ret i32 %.066
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

declare ptr @libECP_init(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, double noundef, double noundef) local_unnamed_addr #3

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

declare i32 @calculateECPIntegrals(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @libECP_free(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #6

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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 allocsize(0) }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = !{!17, !18, i64 0}
!17 = !{!"", !18, i64 0, !6, i64 8, !18, i64 16, !6, i64 24}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!17, !6, i64 8}
!20 = !{!17, !18, i64 16}
!21 = !{!17, !6, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass