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

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

; 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 uwtable
declare dso_local double @r8mat_det_4d(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local double @r8mat_det_5d(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [16 x double], align 16
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store double 0.000000e+00, ptr %4, align 8, !tbaa !9
  store double 1.000000e+00, ptr %9, align 8, !tbaa !9
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %10

10:                                               ; preds = %68, %1
  %11 = load i32, ptr %8, align 4, !tbaa !11
  %12 = icmp slt i32 %11, 5
  br i1 %12, label %13, label %71

13:                                               ; preds = %10
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %14

14:                                               ; preds = %49, %13
  %15 = load i32, ptr %5, align 4, !tbaa !11
  %16 = icmp slt i32 %15, 4
  br i1 %16, label %17, label %52

17:                                               ; preds = %14
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %45, %17
  %19 = load i32, ptr %7, align 4, !tbaa !11
  %20 = icmp slt i32 %19, 4
  br i1 %20, label %21, label %48

21:                                               ; preds = %18
  %22 = load i32, ptr %7, align 4, !tbaa !11
  %23 = load i32, ptr %8, align 4, !tbaa !11
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %27

26:                                               ; preds = %21
  store i32 1, ptr %6, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %26, %25
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = load i32, ptr %5, align 4, !tbaa !11
  %30 = add nsw i32 %29, 1
  %31 = load i32, ptr %7, align 4, !tbaa !11
  %32 = load i32, ptr %6, align 4, !tbaa !11
  %33 = add nsw i32 %31, %32
  %34 = mul nsw i32 %33, 5
  %35 = add nsw i32 %30, %34
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds double, ptr %28, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = load i32, ptr %5, align 4, !tbaa !11
  %40 = load i32, ptr %7, align 4, !tbaa !11
  %41 = mul nsw i32 %40, 4
  %42 = add nsw i32 %39, %41
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [16 x double], ptr %3, i64 0, i64 %43
  store double %38, ptr %44, align 8, !tbaa !9
  br label %45

45:                                               ; preds = %27
  %46 = load i32, ptr %7, align 4, !tbaa !11
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %7, align 4, !tbaa !11
  br label %18, !llvm.loop !13

48:                                               ; preds = %18
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %5, align 4, !tbaa !11
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !11
  br label %14, !llvm.loop !15

52:                                               ; preds = %14
  %53 = load double, ptr %4, align 8, !tbaa !9
  %54 = load double, ptr %9, align 8, !tbaa !9
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = load i32, ptr %8, align 4, !tbaa !11
  %57 = mul nsw i32 %56, 5
  %58 = add nsw i32 0, %57
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds double, ptr %55, i64 %59
  %61 = load double, ptr %60, align 8, !tbaa !9
  %62 = fmul double %54, %61
  %63 = getelementptr inbounds [16 x double], ptr %3, i64 0, i64 0
  %64 = call double @r8mat_det_4d(ptr noundef %63)
  %65 = call double @llvm.fmuladd.f64(double %62, double %64, double %53)
  store double %65, ptr %4, align 8, !tbaa !9
  %66 = load double, ptr %9, align 8, !tbaa !9
  %67 = fneg double %66
  store double %67, ptr %9, align 8, !tbaa !9
  br label %68

68:                                               ; preds = %52
  %69 = load i32, ptr %8, align 4, !tbaa !11
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %8, align 4, !tbaa !11
  br label %10, !llvm.loop !16

71:                                               ; preds = %10
  %72 = load double, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 128, ptr %3) #3
  ret double %72
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = !{!"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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local double @r8mat_det_4d(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local double @r8mat_det_5d(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
.preheader24:
  %1 = alloca [16 x double], align 16
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #3
  %2 = getelementptr inbounds i8, ptr %1, i64 112
  %3 = getelementptr inbounds i8, ptr %1, i64 80
  %4 = getelementptr inbounds i8, ptr %1, i64 48
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %invariant.gep45 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = getelementptr inbounds i8, ptr %1, i64 96
  %7 = getelementptr inbounds i8, ptr %1, i64 64
  %8 = getelementptr inbounds i8, ptr %1, i64 32
  %invariant.gep = getelementptr inbounds i8, ptr %0, i64 8
  %gep = getelementptr inbounds i8, ptr %0, i64 48
  %gep34 = getelementptr inbounds i8, ptr %0, i64 88
  %gep36 = getelementptr inbounds i8, ptr %0, i64 128
  %gep38 = getelementptr inbounds i8, ptr %0, i64 168
  %9 = load <2 x double>, ptr %gep, align 8, !tbaa !5
  store <2 x double> %9, ptr %1, align 16, !tbaa !5
  %10 = load <2 x double>, ptr %gep34, align 8, !tbaa !5
  store <2 x double> %10, ptr %8, align 16, !tbaa !5
  %11 = load <2 x double>, ptr %gep36, align 8, !tbaa !5
  store <2 x double> %11, ptr %7, align 16, !tbaa !5
  %12 = load <2 x double>, ptr %gep38, align 8, !tbaa !5
  store <2 x double> %12, ptr %6, align 16, !tbaa !5
  %gep46 = getelementptr inbounds i8, ptr %0, i64 64
  %gep48 = getelementptr inbounds i8, ptr %0, i64 104
  %gep50 = getelementptr inbounds i8, ptr %0, i64 144
  %gep52 = getelementptr inbounds i8, ptr %0, i64 184
  %13 = load <2 x double>, ptr %gep46, align 8, !tbaa !5
  store <2 x double> %13, ptr %5, align 16, !tbaa !5
  %14 = load <2 x double>, ptr %gep48, align 8, !tbaa !5
  store <2 x double> %14, ptr %4, align 16, !tbaa !5
  %15 = load <2 x double>, ptr %gep50, align 8, !tbaa !5
  store <2 x double> %15, ptr %3, align 16, !tbaa !5
  %16 = load <2 x double>, ptr %gep52, align 8, !tbaa !5
  store <2 x double> %16, ptr %2, align 16, !tbaa !5
  %17 = load double, ptr %0, align 8, !tbaa !5
  %18 = call double @r8mat_det_4d(ptr noundef nonnull %1)
  %19 = call double @llvm.fmuladd.f64(double %17, double %18, double 0.000000e+00)
  %gep34.1 = getelementptr inbounds i8, ptr %0, i64 88
  %gep36.1 = getelementptr inbounds i8, ptr %0, i64 128
  %gep38.1 = getelementptr inbounds i8, ptr %0, i64 168
  %20 = load <2 x double>, ptr %invariant.gep, align 8, !tbaa !5
  store <2 x double> %20, ptr %1, align 16, !tbaa !5
  %21 = load <2 x double>, ptr %gep34.1, align 8, !tbaa !5
  store <2 x double> %21, ptr %8, align 16, !tbaa !5
  %22 = load <2 x double>, ptr %gep36.1, align 8, !tbaa !5
  store <2 x double> %22, ptr %7, align 16, !tbaa !5
  %23 = load <2 x double>, ptr %gep38.1, align 8, !tbaa !5
  store <2 x double> %23, ptr %6, align 16, !tbaa !5
  %gep48.1 = getelementptr inbounds i8, ptr %0, i64 104
  %gep50.1 = getelementptr inbounds i8, ptr %0, i64 144
  %gep52.1 = getelementptr inbounds i8, ptr %0, i64 184
  %24 = load <2 x double>, ptr %invariant.gep45, align 8, !tbaa !5
  store <2 x double> %24, ptr %5, align 16, !tbaa !5
  %25 = load <2 x double>, ptr %gep48.1, align 8, !tbaa !5
  store <2 x double> %25, ptr %4, align 16, !tbaa !5
  %26 = load <2 x double>, ptr %gep50.1, align 8, !tbaa !5
  store <2 x double> %26, ptr %3, align 16, !tbaa !5
  %27 = load <2 x double>, ptr %gep52.1, align 8, !tbaa !5
  store <2 x double> %27, ptr %2, align 16, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %0, i64 40
  %29 = load double, ptr %28, align 8, !tbaa !5
  %30 = fneg double %29
  %31 = call double @r8mat_det_4d(ptr noundef nonnull %1)
  %32 = call double @llvm.fmuladd.f64(double %30, double %31, double %19)
  %gep34.2 = getelementptr inbounds i8, ptr %0, i64 48
  %gep36.2 = getelementptr inbounds i8, ptr %0, i64 128
  %gep38.2 = getelementptr inbounds i8, ptr %0, i64 168
  %33 = load <2 x double>, ptr %invariant.gep, align 8, !tbaa !5
  store <2 x double> %33, ptr %1, align 16, !tbaa !5
  %34 = load <2 x double>, ptr %gep34.2, align 8, !tbaa !5
  store <2 x double> %34, ptr %8, align 16, !tbaa !5
  %35 = load <2 x double>, ptr %gep36.2, align 8, !tbaa !5
  store <2 x double> %35, ptr %7, align 16, !tbaa !5
  %36 = load <2 x double>, ptr %gep38.2, align 8, !tbaa !5
  store <2 x double> %36, ptr %6, align 16, !tbaa !5
  %gep48.2 = getelementptr inbounds i8, ptr %0, i64 64
  %gep50.2 = getelementptr inbounds i8, ptr %0, i64 144
  %gep52.2 = getelementptr inbounds i8, ptr %0, i64 184
  %37 = load <2 x double>, ptr %invariant.gep45, align 8, !tbaa !5
  store <2 x double> %37, ptr %5, align 16, !tbaa !5
  %38 = load <2 x double>, ptr %gep48.2, align 8, !tbaa !5
  store <2 x double> %38, ptr %4, align 16, !tbaa !5
  %39 = load <2 x double>, ptr %gep50.2, align 8, !tbaa !5
  store <2 x double> %39, ptr %3, align 16, !tbaa !5
  %40 = load <2 x double>, ptr %gep52.2, align 8, !tbaa !5
  store <2 x double> %40, ptr %2, align 16, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %0, i64 80
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = call double @r8mat_det_4d(ptr noundef nonnull %1)
  %44 = call double @llvm.fmuladd.f64(double %42, double %43, double %32)
  %gep34.3 = getelementptr inbounds i8, ptr %0, i64 48
  %gep36.3 = getelementptr inbounds i8, ptr %0, i64 88
  %gep38.3 = getelementptr inbounds i8, ptr %0, i64 168
  %45 = load <2 x double>, ptr %invariant.gep, align 8, !tbaa !5
  store <2 x double> %45, ptr %1, align 16, !tbaa !5
  %46 = load <2 x double>, ptr %gep34.3, align 8, !tbaa !5
  store <2 x double> %46, ptr %8, align 16, !tbaa !5
  %47 = load <2 x double>, ptr %gep36.3, align 8, !tbaa !5
  store <2 x double> %47, ptr %7, align 16, !tbaa !5
  %48 = load <2 x double>, ptr %gep38.3, align 8, !tbaa !5
  store <2 x double> %48, ptr %6, align 16, !tbaa !5
  %gep48.3 = getelementptr inbounds i8, ptr %0, i64 64
  %gep50.3 = getelementptr inbounds i8, ptr %0, i64 104
  %gep52.3 = getelementptr inbounds i8, ptr %0, i64 184
  %49 = load <2 x double>, ptr %invariant.gep45, align 8, !tbaa !5
  store <2 x double> %49, ptr %5, align 16, !tbaa !5
  %50 = load <2 x double>, ptr %gep48.3, align 8, !tbaa !5
  store <2 x double> %50, ptr %4, align 16, !tbaa !5
  %51 = load <2 x double>, ptr %gep50.3, align 8, !tbaa !5
  store <2 x double> %51, ptr %3, align 16, !tbaa !5
  %52 = load <2 x double>, ptr %gep52.3, align 8, !tbaa !5
  store <2 x double> %52, ptr %2, align 16, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %0, i64 120
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fneg double %54
  %56 = call double @r8mat_det_4d(ptr noundef nonnull %1)
  %57 = call double @llvm.fmuladd.f64(double %55, double %56, double %44)
  %gep34.4 = getelementptr inbounds i8, ptr %0, i64 48
  %gep36.4 = getelementptr inbounds i8, ptr %0, i64 88
  %gep38.4 = getelementptr inbounds i8, ptr %0, i64 128
  %58 = load <2 x double>, ptr %invariant.gep, align 8, !tbaa !5
  store <2 x double> %58, ptr %1, align 16, !tbaa !5
  %59 = load <2 x double>, ptr %gep34.4, align 8, !tbaa !5
  store <2 x double> %59, ptr %8, align 16, !tbaa !5
  %60 = load <2 x double>, ptr %gep36.4, align 8, !tbaa !5
  store <2 x double> %60, ptr %7, align 16, !tbaa !5
  %61 = load <2 x double>, ptr %gep38.4, align 8, !tbaa !5
  store <2 x double> %61, ptr %6, align 16, !tbaa !5
  %gep48.4 = getelementptr inbounds i8, ptr %0, i64 64
  %gep50.4 = getelementptr inbounds i8, ptr %0, i64 104
  %gep52.4 = getelementptr inbounds i8, ptr %0, i64 144
  %62 = load <2 x double>, ptr %invariant.gep45, align 8, !tbaa !5
  store <2 x double> %62, ptr %5, align 16, !tbaa !5
  %63 = load <2 x double>, ptr %gep48.4, align 8, !tbaa !5
  store <2 x double> %63, ptr %4, align 16, !tbaa !5
  %64 = load <2 x double>, ptr %gep50.4, align 8, !tbaa !5
  store <2 x double> %64, ptr %3, align 16, !tbaa !5
  %65 = load <2 x double>, ptr %gep52.4, align 8, !tbaa !5
  store <2 x double> %65, ptr %2, align 16, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %0, i64 160
  %67 = load double, ptr %66, align 8, !tbaa !5
  %68 = call double @r8mat_det_4d(ptr noundef nonnull %1)
  %69 = call double @llvm.fmuladd.f64(double %67, double %68, double %57)
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #3
  ret double %69
}

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass