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

; 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.29 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.array_integrate_ratio = external hidden unnamed_addr constant [22 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @array_integrate_ratio(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7) #3 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !9
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i32 %5, ptr %15, align 4, !tbaa !9
  store i32 %6, ptr %16, align 4, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %21 = load i32, ptr %16, align 4, !tbaa !9
  %22 = load i32, ptr %13, align 4, !tbaa !9
  %23 = icmp eq i32 %21, %22
  br i1 %23, label %32, label %24

24:                                               ; preds = %8
  %25 = load i32, ptr %16, align 4, !tbaa !9
  %26 = load i32, ptr %14, align 4, !tbaa !9
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %32, label %28

28:                                               ; preds = %24
  %29 = load i32, ptr %16, align 4, !tbaa !9
  %30 = load i32, ptr %15, align 4, !tbaa !9
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %39

32:                                               ; preds = %28, %24, %8
  %33 = load ptr, ptr %17, align 8, !tbaa !5
  %34 = load i32, ptr %16, align 4, !tbaa !9
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = load i32, ptr %14, align 4, !tbaa !9
  %37 = load i32, ptr %15, align 4, !tbaa !9
  %38 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %33, ptr noundef @.str.29, ptr noundef @__func__.array_integrate_ratio, i32 noundef 1580, i32 noundef %34, i32 noundef %35, i32 noundef %36, i32 noundef %37) #4
  store i32 1, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %138

39:                                               ; preds = %28
  store double 0.000000e+00, ptr %19, align 8, !tbaa !11
  %40 = load double, ptr %19, align 8, !tbaa !11
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = mul nsw i32 0, %42
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds double, ptr %41, i64 %44
  %46 = load i32, ptr %16, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds double, ptr %45, i64 %47
  store double %40, ptr %48, align 8, !tbaa !11
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %134, %39
  %50 = load i32, ptr %18, align 4, !tbaa !9
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %137

53:                                               ; preds = %49
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = load i32, ptr %18, align 4, !tbaa !9
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = mul nsw i32 %55, %56
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %54, i64 %58
  %60 = load i32, ptr %14, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds double, ptr %59, i64 %61
  %63 = load double, ptr %62, align 8, !tbaa !11
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = load i32, ptr %11, align 4, !tbaa !9
  %67 = mul nsw i32 %65, %66
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %64, i64 %68
  %70 = load i32, ptr %15, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds double, ptr %69, i64 %71
  %73 = load double, ptr %72, align 8, !tbaa !11
  %74 = fdiv double %63, %73
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load i32, ptr %18, align 4, !tbaa !9
  %77 = sub nsw i32 %76, 1
  %78 = load i32, ptr %11, align 4, !tbaa !9
  %79 = mul nsw i32 %77, %78
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds double, ptr %75, i64 %80
  %82 = load i32, ptr %14, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds double, ptr %81, i64 %83
  %85 = load double, ptr %84, align 8, !tbaa !11
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = load i32, ptr %18, align 4, !tbaa !9
  %88 = sub nsw i32 %87, 1
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = mul nsw i32 %88, %89
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds double, ptr %86, i64 %91
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds double, ptr %92, i64 %94
  %96 = load double, ptr %95, align 8, !tbaa !11
  %97 = fdiv double %85, %96
  %98 = fadd double %74, %97
  %99 = fmul double 5.000000e-01, %98
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load i32, ptr %18, align 4, !tbaa !9
  %102 = load i32, ptr %11, align 4, !tbaa !9
  %103 = mul nsw i32 %101, %102
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds double, ptr %100, i64 %104
  %106 = load i32, ptr %13, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds double, ptr %105, i64 %107
  %109 = load double, ptr %108, align 8, !tbaa !11
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = load i32, ptr %18, align 4, !tbaa !9
  %112 = sub nsw i32 %111, 1
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = mul nsw i32 %112, %113
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds double, ptr %110, i64 %115
  %117 = load i32, ptr %13, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds double, ptr %116, i64 %118
  %120 = load double, ptr %119, align 8, !tbaa !11
  %121 = fsub double %109, %120
  %122 = load double, ptr %19, align 8, !tbaa !11
  %123 = call double @llvm.fmuladd.f64(double %99, double %121, double %122)
  store double %123, ptr %19, align 8, !tbaa !11
  %124 = load double, ptr %19, align 8, !tbaa !11
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = load i32, ptr %18, align 4, !tbaa !9
  %127 = load i32, ptr %11, align 4, !tbaa !9
  %128 = mul nsw i32 %126, %127
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds double, ptr %125, i64 %129
  %131 = load i32, ptr %16, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds double, ptr %130, i64 %132
  store double %124, ptr %133, align 8, !tbaa !11
  br label %134

134:                                              ; preds = %53
  %135 = load i32, ptr %18, align 4, !tbaa !9
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %18, align 4, !tbaa !9
  br label %49, !llvm.loop !13

137:                                              ; preds = %49
  store i32 0, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %138

138:                                              ; preds = %137, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %139 = load i32, ptr %9, align 4
  ret i32 %139
}

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

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@.str.29 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.array_integrate_ratio = external hidden unnamed_addr constant [22 x i8], align 1

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

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

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @array_integrate_ratio(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #2 {
  %9 = icmp eq i32 %6, %3
  %10 = icmp eq i32 %6, %4
  %or.cond = or i1 %9, %10
  %11 = icmp eq i32 %6, %5
  %or.cond54 = or i1 %11, %or.cond
  br i1 %or.cond54, label %12, label %14

12:                                               ; preds = %8
  %13 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.29, ptr noundef nonnull @__func__.array_integrate_ratio, i32 noundef 1580, i32 noundef %6, i32 noundef %3, i32 noundef %4, i32 noundef %5) #3
  br label %.loopexit

14:                                               ; preds = %8
  %15 = sext i32 %6 to i64
  %16 = getelementptr inbounds double, ptr %0, i64 %15
  store double 0.000000e+00, ptr %16, align 8, !tbaa !5
  %17 = icmp sgt i32 %2, 1
  br i1 %17, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %14
  %18 = sext i32 %4 to i64
  %19 = sext i32 %5 to i64
  %20 = sext i32 %3 to i64
  %21 = sext i32 %1 to i64
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %22 ]
  %.056 = phi double [ 0.000000e+00, %.lr.ph ], [ %49, %22 ]
  %23 = mul nsw i64 %indvars.iv, %21
  %24 = getelementptr inbounds double, ptr %0, i64 %23
  %25 = getelementptr inbounds double, ptr %24, i64 %18
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds double, ptr %24, i64 %19
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = add nsw i64 %indvars.iv, -1
  %30 = mul nsw i64 %29, %21
  %31 = getelementptr inbounds double, ptr %0, i64 %30
  %32 = getelementptr inbounds double, ptr %31, i64 %18
  %33 = load double, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds double, ptr %31, i64 %19
  %35 = load double, ptr %34, align 8, !tbaa !5
  %36 = insertelement <2 x double> poison, double %26, i64 0
  %37 = insertelement <2 x double> %36, double %33, i64 1
  %38 = insertelement <2 x double> poison, double %28, i64 0
  %39 = insertelement <2 x double> %38, double %35, i64 1
  %40 = fdiv <2 x double> %37, %39
  %shift = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %41 = fadd <2 x double> %40, %shift
  %42 = extractelement <2 x double> %41, i64 0
  %43 = fmul double %42, 5.000000e-01
  %44 = getelementptr inbounds double, ptr %24, i64 %20
  %45 = load double, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %31, i64 %20
  %47 = load double, ptr %46, align 8, !tbaa !5
  %48 = fsub double %45, %47
  %49 = tail call double @llvm.fmuladd.f64(double %43, double %48, double %.056)
  %50 = getelementptr inbounds double, ptr %24, i64 %15
  store double %49, ptr %50, align 8, !tbaa !5
  %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 %.loopexit, label %22, !llvm.loop !9

.loopexit:                                        ; preds = %22, %14, %12
  %.049 = phi i32 [ 1, %12 ], [ 0, %14 ], [ 0, %22 ]
  ret i32 %.049
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { nofree 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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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