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

@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@__func__.quadrature_in_rectangle = external hidden unnamed_addr constant [24 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [91 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 @quadrature_in_rectangle(double noundef %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #3 {
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca [2048 x i8], align 16
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca [2048 x i8], align 16
  %30 = alloca i32, align 4
  %31 = alloca [2048 x i8], align 16
  %32 = alloca [2048 x i8], align 16
  store double %0, ptr %11, align 8, !tbaa !5
  store double %1, ptr %12, align 8, !tbaa !5
  store double %2, ptr %13, align 8, !tbaa !5
  store double %3, ptr %14, align 8, !tbaa !5
  store ptr %4, ptr %15, align 8, !tbaa !9
  store ptr %5, ptr %16, align 8, !tbaa !9
  store ptr %6, ptr %17, align 8, !tbaa !9
  store ptr %7, ptr %18, align 8, !tbaa !9
  store ptr %8, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 24, ptr %24, align 4, !tbaa !11
  %33 = load double, ptr %11, align 8, !tbaa !5
  store double %33, ptr %20, align 8, !tbaa !5
  %34 = load double, ptr %12, align 8, !tbaa !5
  store double %34, ptr %21, align 8, !tbaa !5
  %35 = load double, ptr %13, align 8, !tbaa !5
  store double %35, ptr %22, align 8, !tbaa !5
  %36 = load double, ptr %14, align 8, !tbaa !5
  store double %36, ptr %23, align 8, !tbaa !5
  %37 = load i32, ptr %24, align 4, !tbaa !11
  %38 = load ptr, ptr %15, align 8, !tbaa !9
  store i32 %37, ptr %38, align 4, !tbaa !11
  %39 = load i32, ptr %24, align 4, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = mul i64 8, %40
  %42 = call noalias ptr @malloc(i64 noundef %41) #5
  %43 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %42, ptr %43, align 8, !tbaa !9
  %44 = load ptr, ptr %16, align 8, !tbaa !9
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %56

47:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  %48 = load i32, ptr %24, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = mul i64 8, %49
  %51 = trunc i64 %50 to i32
  store i32 %51, ptr %25, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %26) #4
  %52 = getelementptr inbounds [2048 x i8], ptr %26, i64 0, i64 0
  %53 = load i32, ptr %25, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %52, ptr noundef @.str, ptr noundef @.str.16, i32 noundef %53)
  %54 = load ptr, ptr %19, align 8, !tbaa !9
  %55 = getelementptr inbounds [2048 x i8], ptr %26, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %54, ptr noundef @.str.2, ptr noundef @__func__.quadrature_in_rectangle, i32 noundef 807, ptr noundef %55)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %26) #4
  store i32 1, ptr %10, align 4
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %115

56:                                               ; preds = %9
  %57 = load i32, ptr %24, align 4, !tbaa !11
  %58 = sext i32 %57 to i64
  %59 = mul i64 8, %58
  %60 = call noalias ptr @malloc(i64 noundef %59) #5
  %61 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %60, ptr %61, align 8, !tbaa !9
  %62 = load ptr, ptr %17, align 8, !tbaa !9
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %74

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  %66 = load i32, ptr %24, align 4, !tbaa !11
  %67 = sext i32 %66 to i64
  %68 = mul i64 8, %67
  %69 = trunc i64 %68 to i32
  store i32 %69, ptr %28, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %29) #4
  %70 = getelementptr inbounds [2048 x i8], ptr %29, i64 0, i64 0
  %71 = load i32, ptr %28, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %70, ptr noundef @.str, ptr noundef @.str.17, i32 noundef %71)
  %72 = load ptr, ptr %19, align 8, !tbaa !9
  %73 = getelementptr inbounds [2048 x i8], ptr %29, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %72, ptr noundef @.str.2, ptr noundef @__func__.quadrature_in_rectangle, i32 noundef 808, ptr noundef %73)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %29) #4
  store i32 1, ptr %10, align 4
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  br label %115

74:                                               ; preds = %56
  %75 = load i32, ptr %24, align 4, !tbaa !11
  %76 = sext i32 %75 to i64
  %77 = mul i64 8, %76
  %78 = call noalias ptr @malloc(i64 noundef %77) #5
  %79 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %78, ptr %79, align 8, !tbaa !9
  %80 = load ptr, ptr %18, align 8, !tbaa !9
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = icmp eq ptr %81, null
  br i1 %82, label %83, label %92

83:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #4
  %84 = load i32, ptr %24, align 4, !tbaa !11
  %85 = sext i32 %84 to i64
  %86 = mul i64 8, %85
  %87 = trunc i64 %86 to i32
  store i32 %87, ptr %30, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2048, ptr %31) #4
  %88 = getelementptr inbounds [2048 x i8], ptr %31, i64 0, i64 0
  %89 = load i32, ptr %30, align 4, !tbaa !11
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %88, ptr noundef @.str, ptr noundef @.str.18, i32 noundef %89)
  %90 = load ptr, ptr %19, align 8, !tbaa !9
  %91 = getelementptr inbounds [2048 x i8], ptr %31, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %90, ptr noundef @.str.2, ptr noundef @__func__.quadrature_in_rectangle, i32 noundef 809, ptr noundef %91)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %31) #4
  store i32 1, ptr %10, align 4
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #4
  br label %115

92:                                               ; preds = %74
  %93 = load double, ptr %20, align 8, !tbaa !5
  %94 = load double, ptr %21, align 8, !tbaa !5
  %95 = load double, ptr %22, align 8, !tbaa !5
  %96 = load double, ptr %23, align 8, !tbaa !5
  %97 = load ptr, ptr %16, align 8, !tbaa !9
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  %99 = getelementptr inbounds double, ptr %98, i64 0
  %100 = load ptr, ptr %17, align 8, !tbaa !9
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = getelementptr inbounds double, ptr %101, i64 0
  %103 = load ptr, ptr %18, align 8, !tbaa !9
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = getelementptr inbounds double, ptr %104, i64 0
  %106 = load ptr, ptr %19, align 8, !tbaa !9
  %107 = call i32 @cubature_order_eleven(double noundef %93, double noundef %94, double noundef %95, double noundef %96, ptr noundef %99, ptr noundef %102, ptr noundef %105, ptr noundef %106)
  %108 = icmp eq i32 %107, 1
  br i1 %108, label %109, label %114

109:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 2048, ptr %32) #4
  %110 = getelementptr inbounds [2048 x i8], ptr %32, i64 0, i64 0
  %111 = load ptr, ptr %19, align 8, !tbaa !9
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %110, ptr noundef @.str.19, ptr noundef @.str.20, ptr noundef %111)
  %112 = load ptr, ptr %19, align 8, !tbaa !9
  %113 = getelementptr inbounds [2048 x i8], ptr %32, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %112, ptr noundef @.str.2, ptr noundef @__func__.quadrature_in_rectangle, i32 noundef 819, ptr noundef %113)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %32) #4
  store i32 1, ptr %10, align 4
  store i32 1, ptr %27, align 4
  br label %115

114:                                              ; preds = %92
  store i32 0, ptr %10, align 4
  store i32 1, ptr %27, align 4
  br label %115

115:                                              ; preds = %114, %109, %83, %65, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  %116 = load i32, ptr %10, align 4
  ret i32 %116
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @cubature_order_eleven(double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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 = { nounwind }
attributes #5 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, 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.16 = external hidden unnamed_addr constant [3 x i8], align 1
@__func__.quadrature_in_rectangle = external hidden unnamed_addr constant [24 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [91 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 @quadrature_in_rectangle(double noundef %0, double noundef %1, double noundef %2, double noundef %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef %5, ptr nocapture noundef %6, ptr nocapture noundef writeonly %7, ptr noundef %8) local_unnamed_addr #3 {
  %10 = alloca [2048 x i8], align 16
  %11 = alloca [2048 x i8], align 16
  %12 = alloca [2048 x i8], align 16
  %13 = alloca [2048 x i8], align 16
  store i32 24, ptr %4, align 4, !tbaa !5
  %14 = tail call noalias dereferenceable_or_null(192) ptr @malloc(i64 noundef 192) #4
  store ptr %14, ptr %5, align 8, !tbaa !9
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %10) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %10, ptr noundef nonnull @.str, ptr noundef nonnull @.str.16, i32 noundef 192) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.quadrature_in_rectangle, i32 noundef 807, ptr noundef nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %10) #5
  br label %31

17:                                               ; preds = %9
  %18 = tail call noalias dereferenceable_or_null(192) ptr @malloc(i64 noundef 192) #4
  store ptr %18, ptr %6, align 8, !tbaa !9
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %11) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %11, ptr noundef nonnull @.str, ptr noundef nonnull @.str.17, i32 noundef 192) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.quadrature_in_rectangle, i32 noundef 808, ptr noundef nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %11) #5
  br label %31

21:                                               ; preds = %17
  %22 = tail call noalias dereferenceable_or_null(192) ptr @malloc(i64 noundef 192) #4
  store ptr %22, ptr %7, align 8, !tbaa !9
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %12) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %12, ptr noundef nonnull @.str, ptr noundef nonnull @.str.18, i32 noundef 192) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.quadrature_in_rectangle, i32 noundef 809, ptr noundef nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %12) #5
  br label %31

25:                                               ; preds = %21
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  %28 = tail call i32 @cubature_order_eleven(double noundef %0, double noundef %1, double noundef %2, double noundef %3, ptr noundef %26, ptr noundef %27, ptr noundef nonnull %22, ptr noundef %8)
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %13) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %13, ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.20, ptr noundef %8) #5
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %8, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__.quadrature_in_rectangle, i32 noundef 819, ptr noundef nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %13) #5
  br label %31

31:                                               ; preds = %25, %30, %24, %20, %16
  %.0 = phi i32 [ 1, %16 ], [ 1, %20 ], [ 1, %24 ], [ 1, %30 ], [ 0, %25 ]
  ret i32 %.0
}

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

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 = { nounwind allocsize(0) }
attributes #5 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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