; LLVM IR from CLASS-SZ/class_sz :: class-sz/tools (quadrature)

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

@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@__func__.gk_adapt = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [11 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @gk_adapt(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, i32 noundef %5, double noundef %6, double noundef %7, i32 noundef %8, ptr noundef %9) #3 {
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca [2048 x i8], align 16
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca [2048 x i8], align 16
  %28 = alloca i32, align 4
  %29 = alloca [2048 x i8], align 16
  store ptr %0, ptr %12, align 8, !tbaa !5
  store ptr %1, ptr %13, align 8, !tbaa !5
  store ptr %2, ptr %14, align 8, !tbaa !5
  store ptr %3, ptr %15, align 8, !tbaa !5
  store double %4, ptr %16, align 8, !tbaa !9
  store i32 %5, ptr %17, align 4, !tbaa !11
  store double %6, ptr %18, align 8, !tbaa !9
  store double %7, ptr %19, align 8, !tbaa !9
  store i32 %8, ptr %20, align 4, !tbaa !11
  store ptr %9, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %30 = call noalias ptr @malloc(i64 noundef 56) #6
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %30, ptr %31, align 8, !tbaa !5
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %40

35:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 56, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %24) #5
  %36 = getelementptr inbounds [2048 x i8], ptr %24, i64 0, i64 0
  %37 = load i32, ptr %23, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %36, ptr noundef @.str, ptr noundef @.str.10, i32 noundef %37)
  %38 = load ptr, ptr %21, align 8, !tbaa !5
  %39 = getelementptr inbounds [2048 x i8], ptr %24, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %38, ptr noundef @.str.2, ptr noundef @__func__.gk_adapt, i32 noundef 509, ptr noundef %39)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %24) #5
  store i32 1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %146

40:                                               ; preds = %10
  %41 = load i32, ptr %17, align 4, !tbaa !11
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %50

43:                                               ; preds = %40
  %44 = load ptr, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %45, i32 0, i32 2
  store ptr null, ptr %46, align 8, !tbaa !13
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %48, i32 0, i32 3
  store ptr null, ptr %49, align 8, !tbaa !15
  br label %81

50:                                               ; preds = %40
  %51 = call noalias ptr @malloc(i64 noundef 120) #6
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %53, i32 0, i32 2
  store ptr %51, ptr %54, align 8, !tbaa !13
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %65

60:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 120, ptr %26, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %27) #5
  %61 = getelementptr inbounds [2048 x i8], ptr %27, i64 0, i64 0
  %62 = load i32, ptr %26, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %61, ptr noundef @.str, ptr noundef @.str.11, i32 noundef %62)
  %63 = load ptr, ptr %21, align 8, !tbaa !5
  %64 = getelementptr inbounds [2048 x i8], ptr %27, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %63, ptr noundef @.str.2, ptr noundef @__func__.gk_adapt, i32 noundef 515, ptr noundef %64)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %27) #5
  store i32 1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %146

65:                                               ; preds = %50
  %66 = call noalias ptr @malloc(i64 noundef 120) #6
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %68, i32 0, i32 3
  store ptr %66, ptr %69, align 8, !tbaa !15
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %80

75:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  store i32 120, ptr %28, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %29) #5
  %76 = getelementptr inbounds [2048 x i8], ptr %29, i64 0, i64 0
  %77 = load i32, ptr %28, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %76, ptr noundef @.str, ptr noundef @.str.12, i32 noundef %77)
  %78 = load ptr, ptr %21, align 8, !tbaa !5
  %79 = getelementptr inbounds [2048 x i8], ptr %29, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %78, ptr noundef @.str.2, ptr noundef @__func__.gk_adapt, i32 noundef 516, ptr noundef %79)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %29) #5
  store i32 1, ptr %11, align 4
  store i32 1, ptr %25, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  br label %146

80:                                               ; preds = %65
  br label %81

81:                                               ; preds = %80, %43
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %83, i32 0, i32 5
  store ptr null, ptr %84, align 8, !tbaa !16
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %86, i32 0, i32 6
  store ptr null, ptr %87, align 8, !tbaa !17
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = load ptr, ptr %15, align 8, !tbaa !5
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  %93 = load double, ptr %18, align 8, !tbaa !9
  %94 = load double, ptr %19, align 8, !tbaa !9
  %95 = load i32, ptr %20, align 4, !tbaa !11
  %96 = call i32 @gk_quad(ptr noundef %88, ptr noundef %89, ptr noundef %90, ptr noundef %92, double noundef %93, double noundef %94, i32 noundef %95)
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = load ptr, ptr %97, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %98, i32 0, i32 1
  %100 = load double, ptr %99, align 8, !tbaa !18
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %102, i32 0, i32 0
  %104 = load double, ptr %103, align 8, !tbaa !19
  %105 = fdiv double %100, %104
  %106 = call double @llvm.fabs.f64(double %105)
  %107 = load double, ptr %16, align 8, !tbaa !9
  %108 = fcmp olt double %106, %107
  br i1 %108, label %112, label %109

109:                                              ; preds = %81
  %110 = load double, ptr %16, align 8, !tbaa !9
  %111 = fcmp oge double %110, 1.000000e+00
  br i1 %111, label %112, label %113

112:                                              ; preds = %109, %81
  store i32 0, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %146

113:                                              ; preds = %109
  %114 = load double, ptr %18, align 8, !tbaa !9
  %115 = load double, ptr %19, align 8, !tbaa !9
  %116 = fadd double %114, %115
  %117 = fmul double 5.000000e-01, %116
  store double %117, ptr %22, align 8, !tbaa !9
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %119, i32 0, i32 5
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = load ptr, ptr %14, align 8, !tbaa !5
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = load double, ptr %16, align 8, !tbaa !9
  %125 = fmul double 1.500000e+00, %124
  %126 = load i32, ptr %17, align 4, !tbaa !11
  %127 = load double, ptr %18, align 8, !tbaa !9
  %128 = load double, ptr %22, align 8, !tbaa !9
  %129 = load i32, ptr %20, align 4, !tbaa !11
  %130 = load ptr, ptr %21, align 8, !tbaa !5
  %131 = call i32 @gk_adapt(ptr noundef %120, ptr noundef %121, ptr noundef %122, ptr noundef %123, double noundef %125, i32 noundef %126, double noundef %127, double noundef %128, i32 noundef %129, ptr noundef %130)
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = load ptr, ptr %132, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.adaptive_integration_tree_node, ptr %133, i32 0, i32 6
  %135 = load ptr, ptr %13, align 8, !tbaa !5
  %136 = load ptr, ptr %14, align 8, !tbaa !5
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  %138 = load double, ptr %16, align 8, !tbaa !9
  %139 = fmul double 1.500000e+00, %138
  %140 = load i32, ptr %17, align 4, !tbaa !11
  %141 = load double, ptr %22, align 8, !tbaa !9
  %142 = load double, ptr %19, align 8, !tbaa !9
  %143 = load i32, ptr %20, align 4, !tbaa !11
  %144 = load ptr, ptr %21, align 8, !tbaa !5
  %145 = call i32 @gk_adapt(ptr noundef %134, ptr noundef %135, ptr noundef %136, ptr noundef %137, double noundef %139, i32 noundef %140, double noundef %141, double noundef %142, i32 noundef %143, ptr noundef %144)
  store i32 0, ptr %11, align 4
  store i32 1, ptr %25, align 4
  br label %146

146:                                              ; preds = %113, %112, %75, %60, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  %147 = load i32, ptr %11, align 4
  ret i32 %147
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @gk_quad(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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}
!13 = !{!14, !6, i64 16}
!14 = !{!"adaptive_integration_tree_node", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!14, !6, i64 24}
!16 = !{!14, !6, i64 40}
!17 = !{!14, !6, i64 48}
!18 = !{!14, !10, i64 8}
!19 = !{!14, !10, 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 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@__func__.gk_adapt = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [11 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @gk_adapt(ptr nocapture noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, i32 noundef %5, double noundef %6, double noundef %7, i32 noundef %8, ptr noundef %9) local_unnamed_addr #3 {
  %11 = alloca [2048 x i8], align 16
  %12 = alloca [2048 x i8], align 16
  %13 = alloca [2048 x i8], align 16
  %14 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store ptr %14, ptr %0, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %.lr.ph, label %tailrecurse._crit_edge

.lr.ph:                                           ; preds = %10
  %16 = icmp eq i32 %5, 0
  br i1 %16, label %.lr.ph.split.us.preheader, label %.lr.ph.split.preheader

.lr.ph.split.preheader:                           ; preds = %.lr.ph
  %17 = tail call noalias dereferenceable_or_null(120) ptr @malloc(i64 noundef 120) #6
  %18 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr %17, ptr %18, align 8, !tbaa !9
  %19 = icmp ne ptr %17, null
  br i1 %19, label %20, label %.loopexit91

20:                                               ; preds = %.lr.ph.split.preheader
  %21 = tail call noalias dereferenceable_or_null(120) ptr @malloc(i64 noundef 120) #6
  %22 = getelementptr inbounds i8, ptr %14, i64 24
  store ptr %21, ptr %22, align 8, !tbaa !13
  %23 = icmp ne ptr %21, null
  br i1 %23, label %24, label %.loopexit92

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %14, i64 40
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %25, i8 0, i64 16, i1 false)
  %26 = tail call i32 @gk_quad(ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef nonnull %14, double noundef %6, double noundef %7, i32 noundef %8)
  %27 = load ptr, ptr %0, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = load double, ptr %28, align 8, !tbaa !14
  %30 = load double, ptr %27, align 8, !tbaa !15
  %31 = fdiv double %29, %30
  %32 = tail call double @llvm.fabs.f64(double %31)
  %33 = fcmp uge double %32, %4
  %34 = fcmp ult double %4, 1.000000e+00
  %or.cond.peel.not = and i1 %34, %33
  br i1 %or.cond.peel.not, label %tailrecurse.peel, label %.loopexit

tailrecurse.peel:                                 ; preds = %24
  %35 = fadd double %6, %7
  %36 = fmul double %35, 5.000000e-01
  %37 = getelementptr inbounds i8, ptr %27, i64 40
  %38 = fmul double %4, 1.500000e+00
  %39 = tail call i32 @gk_adapt(ptr noundef nonnull %37, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %38, i32 noundef %5, double noundef %6, double noundef %36, i32 noundef %8, ptr noundef %9)
  %40 = load ptr, ptr %0, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 48
  %42 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store ptr %42, ptr %41, align 8, !tbaa !5
  %43 = icmp eq ptr %42, null
  br i1 %43, label %tailrecurse._crit_edge, label %.lr.ph.split

.lr.ph.split.us.preheader:                        ; preds = %.lr.ph
  %44 = getelementptr inbounds i8, ptr %14, i64 16
  %45 = getelementptr inbounds i8, ptr %14, i64 40
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %44, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %45, i8 0, i64 16, i1 false)
  %46 = tail call i32 @gk_quad(ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef nonnull %14, double noundef %6, double noundef %7, i32 noundef %8)
  %47 = load ptr, ptr %0, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load double, ptr %48, align 8, !tbaa !14
  %50 = load double, ptr %47, align 8, !tbaa !15
  %51 = fdiv double %49, %50
  %52 = tail call double @llvm.fabs.f64(double %51)
  %53 = fcmp uge double %52, %4
  %54 = fcmp ult double %4, 1.000000e+00
  %or.cond.us.peel.not = and i1 %54, %53
  br i1 %or.cond.us.peel.not, label %tailrecurse.us.peel, label %.loopexit

tailrecurse.us.peel:                              ; preds = %.lr.ph.split.us.preheader
  %55 = fadd double %6, %7
  %56 = fmul double %55, 5.000000e-01
  %57 = getelementptr inbounds i8, ptr %47, i64 40
  %58 = fmul double %4, 1.500000e+00
  %59 = tail call i32 @gk_adapt(ptr noundef nonnull %57, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %58, i32 noundef 0, double noundef %6, double noundef %56, i32 noundef %8, ptr noundef %9)
  %60 = load ptr, ptr %0, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 48
  %62 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store ptr %62, ptr %61, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %tailrecurse._crit_edge, label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %tailrecurse.us.peel, %tailrecurse.us
  %64 = phi ptr [ %87, %tailrecurse.us ], [ %62, %tailrecurse.us.peel ]
  %.tr5873.us = phi double [ %81, %tailrecurse.us ], [ %56, %tailrecurse.us.peel ]
  %.tr5672.us = phi double [ %83, %tailrecurse.us ], [ %58, %tailrecurse.us.peel ]
  %.tr71.us = phi ptr [ %86, %tailrecurse.us ], [ %61, %tailrecurse.us.peel ]
  %65 = getelementptr inbounds i8, ptr %64, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %65, i8 0, i64 16, i1 false)
  %66 = load ptr, ptr %.tr71.us, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %66, i64 40
  store ptr null, ptr %67, align 8, !tbaa !16
  %68 = load ptr, ptr %.tr71.us, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 48
  store ptr null, ptr %69, align 8, !tbaa !17
  %70 = load ptr, ptr %.tr71.us, align 8, !tbaa !5
  %71 = tail call i32 @gk_quad(ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %70, double noundef %.tr5873.us, double noundef %7, i32 noundef %8)
  %72 = load ptr, ptr %.tr71.us, align 8, !tbaa !5
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load double, ptr %73, align 8, !tbaa !14
  %75 = load double, ptr %72, align 8, !tbaa !15
  %76 = fdiv double %74, %75
  %77 = tail call double @llvm.fabs.f64(double %76)
  %78 = fcmp olt double %77, %.tr5672.us
  %79 = fcmp oge double %.tr5672.us, 1.000000e+00
  %or.cond.us = or i1 %79, %78
  br i1 %or.cond.us, label %.loopexit, label %tailrecurse.us

tailrecurse.us:                                   ; preds = %.lr.ph.split.us
  %80 = fadd double %.tr5873.us, %7
  %81 = fmul double %80, 5.000000e-01
  %82 = getelementptr inbounds i8, ptr %72, i64 40
  %83 = fmul double %.tr5672.us, 1.500000e+00
  %84 = tail call i32 @gk_adapt(ptr noundef nonnull %82, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %83, i32 noundef 0, double noundef %.tr5873.us, double noundef %81, i32 noundef %8, ptr noundef %9)
  %85 = load ptr, ptr %.tr71.us, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 48
  %87 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store ptr %87, ptr %86, align 8, !tbaa !5
  %88 = icmp eq ptr %87, null
  br i1 %88, label %tailrecurse._crit_edge, label %.lr.ph.split.us, !llvm.loop !18

tailrecurse._crit_edge:                           ; preds = %tailrecurse, %tailrecurse.us, %tailrecurse.peel, %tailrecurse.us.peel, %10
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %11) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %11, ptr noundef nonnull @.str, ptr noundef nonnull @.str.10, i32 noundef 56) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %9, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.gk_adapt, i32 noundef 509, ptr noundef nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %11) #7
  br label %.loopexit

.lr.ph.split:                                     ; preds = %tailrecurse.peel, %tailrecurse
  %89 = phi ptr [ %119, %tailrecurse ], [ %42, %tailrecurse.peel ]
  %.tr5873 = phi double [ %113, %tailrecurse ], [ %36, %tailrecurse.peel ]
  %.tr5672 = phi double [ %115, %tailrecurse ], [ %38, %tailrecurse.peel ]
  %.tr71 = phi ptr [ %118, %tailrecurse ], [ %41, %tailrecurse.peel ]
  %90 = tail call noalias dereferenceable_or_null(120) ptr @malloc(i64 noundef 120) #6
  %91 = getelementptr inbounds i8, ptr %89, i64 16
  store ptr %90, ptr %91, align 8, !tbaa !9
  %92 = icmp eq ptr %90, null
  br i1 %92, label %.loopexit91, label %93

.loopexit91:                                      ; preds = %.lr.ph.split, %.lr.ph.split.preheader
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %12) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %12, ptr noundef nonnull @.str, ptr noundef nonnull @.str.11, i32 noundef 120) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %9, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.gk_adapt, i32 noundef 515, ptr noundef nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %12) #7
  br label %.loopexit

93:                                               ; preds = %.lr.ph.split
  %94 = tail call noalias dereferenceable_or_null(120) ptr @malloc(i64 noundef 120) #6
  %95 = getelementptr inbounds i8, ptr %89, i64 24
  store ptr %94, ptr %95, align 8, !tbaa !13
  %96 = icmp eq ptr %94, null
  br i1 %96, label %.loopexit92, label %97

.loopexit92:                                      ; preds = %93, %20
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %13) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %13, ptr noundef nonnull @.str, ptr noundef nonnull @.str.12, i32 noundef 120) #7
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %9, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.gk_adapt, i32 noundef 516, ptr noundef nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %13) #7
  br label %.loopexit

97:                                               ; preds = %93
  %98 = load ptr, ptr %.tr71, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 40
  store ptr null, ptr %99, align 8, !tbaa !16
  %100 = load ptr, ptr %.tr71, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %100, i64 48
  store ptr null, ptr %101, align 8, !tbaa !17
  %102 = load ptr, ptr %.tr71, align 8, !tbaa !5
  %103 = tail call i32 @gk_quad(ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %102, double noundef %.tr5873, double noundef %7, i32 noundef %8)
  %104 = load ptr, ptr %.tr71, align 8, !tbaa !5
  %105 = getelementptr inbounds i8, ptr %104, i64 8
  %106 = load double, ptr %105, align 8, !tbaa !14
  %107 = load double, ptr %104, align 8, !tbaa !15
  %108 = fdiv double %106, %107
  %109 = tail call double @llvm.fabs.f64(double %108)
  %110 = fcmp olt double %109, %.tr5672
  %111 = fcmp oge double %.tr5672, 1.000000e+00
  %or.cond = or i1 %111, %110
  br i1 %or.cond, label %.loopexit, label %tailrecurse

tailrecurse:                                      ; preds = %97
  %112 = fadd double %.tr5873, %7
  %113 = fmul double %112, 5.000000e-01
  %114 = getelementptr inbounds i8, ptr %104, i64 40
  %115 = fmul double %.tr5672, 1.500000e+00
  %116 = tail call i32 @gk_adapt(ptr noundef nonnull %114, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %115, i32 noundef %5, double noundef %.tr5873, double noundef %113, i32 noundef %8, ptr noundef %9)
  %117 = load ptr, ptr %.tr71, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %117, i64 48
  %119 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #6
  store ptr %119, ptr %118, align 8, !tbaa !5
  %120 = icmp eq ptr %119, null
  br i1 %120, label %tailrecurse._crit_edge, label %.lr.ph.split, !llvm.loop !20

.loopexit:                                        ; preds = %97, %.lr.ph.split.us, %24, %.lr.ph.split.us.preheader, %.loopexit92, %.loopexit91, %tailrecurse._crit_edge
  %ret.known.tr66 = phi i1 [ %15, %tailrecurse._crit_edge ], [ %19, %.loopexit91 ], [ %23, %.loopexit92 ], [ false, %.lr.ph.split.us.preheader ], [ false, %24 ], [ %or.cond.us.peel.not, %.lr.ph.split.us ], [ %or.cond.peel.not, %97 ]
  %.0 = phi i32 [ 1, %tailrecurse._crit_edge ], [ 1, %.loopexit91 ], [ 1, %.loopexit92 ], [ 0, %.lr.ph.split.us.preheader ], [ 0, %24 ], [ 0, %.lr.ph.split.us ], [ 0, %97 ]
  %current.ret.tr62 = select i1 %ret.known.tr66, i32 0, i32 %.0
  ret i32 %current.ret.tr62
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @gk_quad(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, i32 noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind allocsize(0) }
attributes #7 = { 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, !6, i64 16}
!10 = !{!"adaptive_integration_tree_node", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"double", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !11, i64 0}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 48}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}
!20 = distinct !{!20, !19}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass