; 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: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @r83row_min(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store ptr null, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = icmp sle i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %71

13:                                               ; preds = %2
  %14 = call noalias ptr @malloc(i64 noundef 24) #4
  store ptr %14, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %66, %13
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 3
  br i1 %17, label %18, label %69

18:                                               ; preds = %15
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = add nsw i32 %20, 0
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds double, ptr %19, i64 %22
  %24 = load double, ptr %23, align 8, !tbaa !11
  %25 = load ptr, ptr %6, align 8, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  store double %24, ptr %28, align 8, !tbaa !11
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %62, %18
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %33, label %65

33:                                               ; preds = %29
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = mul nsw i32 %36, 3
  %38 = add nsw i32 %35, %37
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds double, ptr %34, i64 %39
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !9
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds double, ptr %42, i64 %44
  %46 = load double, ptr %45, align 8, !tbaa !11
  %47 = fcmp olt double %41, %46
  br i1 %47, label %48, label %61

48:                                               ; preds = %33
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = mul nsw i32 %51, 3
  %53 = add nsw i32 %50, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds double, ptr %49, i64 %54
  %56 = load double, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %6, align 8, !tbaa !9
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds double, ptr %57, i64 %59
  store double %56, ptr %60, align 8, !tbaa !11
  br label %61

61:                                               ; preds = %48, %33
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %8, align 4, !tbaa !5
  br label %29, !llvm.loop !13

65:                                               ; preds = %29
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %7, align 4, !tbaa !5
  br label %15, !llvm.loop !15

69:                                               ; preds = %15
  %70 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %70, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %71

71:                                               ; preds = %69, %12
  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 8, ptr %6) #3
  %72 = load ptr, ptr %3, align 8
  ret ptr %72
}

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 = { 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 }
attributes #4 = { 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 = !{!"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}


; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local noalias noundef ptr @r83row_min(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = icmp slt i32 %0, 1
  br i1 %3, label %.loopexit, label %4

4:                                                ; preds = %2
  %5 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #3
  %.not = icmp eq i32 %0, 1
  br i1 %.not, label %.split.preheader, label %.lr.ph.us.preheader

.lr.ph.us.preheader:                              ; preds = %4
  %6 = load double, ptr %1, align 8, !tbaa !5
  %wide.trip.count = zext nneg i32 %0 to i64
  %7 = add nsw i64 %wide.trip.count, -1
  %8 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %7, 1
  %9 = icmp eq i64 %8, 0
  br i1 %9, label %._crit_edge.us.unr-lcssa, label %.lr.ph.us.preheader.new

.lr.ph.us.preheader.new:                          ; preds = %.lr.ph.us.preheader
  %unroll_iter = and i64 %7, -2
  %invariant.gep66 = getelementptr i8, ptr %1, i64 24
  br label %10

.split.preheader:                                 ; preds = %4
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa !5
  br label %.loopexit

10:                                               ; preds = %10, %.lr.ph.us.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.us.preheader.new ], [ %indvars.iv.next.148, %10 ]
  %11 = phi double [ %6, %.lr.ph.us.preheader.new ], [ %19, %10 ]
  %niter = phi i64 [ 0, %.lr.ph.us.preheader.new ], [ %niter.next.1, %10 ]
  %.idx = mul i64 %indvars.iv, 24
  %12 = getelementptr inbounds i8, ptr %1, i64 %.idx
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fcmp olt double %13, %11
  %15 = select i1 %14, double %13, double %11
  %16 = mul i64 %indvars.iv, 24
  %gep67 = getelementptr i8, ptr %invariant.gep66, i64 %16
  %17 = load double, ptr %gep67, align 8, !tbaa !5
  %18 = fcmp olt double %17, %15
  %19 = select i1 %18, double %17, double %15
  %indvars.iv.next.148 = add nuw nsw i64 %indvars.iv, 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_edge.us.unr-lcssa.loopexit, label %10, !llvm.loop !9

._crit_edge.us.unr-lcssa.loopexit:                ; preds = %10
  %20 = mul i64 %indvars.iv.next.148, 24
  br label %._crit_edge.us.unr-lcssa

._crit_edge.us.unr-lcssa:                         ; preds = %._crit_edge.us.unr-lcssa.loopexit, %.lr.ph.us.preheader
  %.lcssa45.ph = phi double [ poison, %.lr.ph.us.preheader ], [ %19, %._crit_edge.us.unr-lcssa.loopexit ]
  %indvars.iv.unr = phi i64 [ 24, %.lr.ph.us.preheader ], [ %20, %._crit_edge.us.unr-lcssa.loopexit ]
  %.unr = phi double [ %6, %.lr.ph.us.preheader ], [ %19, %._crit_edge.us.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %._crit_edge.us.epilog-lcssa

._crit_edge.us.epilog-lcssa:                      ; preds = %._crit_edge.us.unr-lcssa
  %21 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv.unr
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fcmp olt double %22, %.unr
  %24 = select i1 %23, double %22, double %.unr
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %._crit_edge.us.unr-lcssa, %._crit_edge.us.epilog-lcssa
  %.lcssa45 = phi double [ %.lcssa45.ph, %._crit_edge.us.unr-lcssa ], [ %24, %._crit_edge.us.epilog-lcssa ]
  store double %.lcssa45, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %5, i64 8
  %invariant.gep = getelementptr i8, ptr %1, i64 8
  %xtraiter50 = and i64 %7, 1
  %28 = icmp eq i64 %8, 0
  br i1 %28, label %._crit_edge.us.1.unr-lcssa, label %._crit_edge.us.new

._crit_edge.us.new:                               ; preds = %._crit_edge.us
  %unroll_iter54 = and i64 %7, -2
  %invariant.gep68 = getelementptr i8, ptr %invariant.gep, i64 24
  br label %29

29:                                               ; preds = %29, %._crit_edge.us.new
  %indvars.iv.1 = phi i64 [ 1, %._crit_edge.us.new ], [ %indvars.iv.next.1.1, %29 ]
  %30 = phi double [ %26, %._crit_edge.us.new ], [ %37, %29 ]
  %niter55 = phi i64 [ 0, %._crit_edge.us.new ], [ %niter55.next.1, %29 ]
  %.idx36 = mul i64 %indvars.iv.1, 24
  %gep = getelementptr i8, ptr %invariant.gep, i64 %.idx36
  %31 = load double, ptr %gep, align 8, !tbaa !5
  %32 = fcmp olt double %31, %30
  %33 = select i1 %32, double %31, double %30
  %34 = mul i64 %indvars.iv.1, 24
  %gep69 = getelementptr i8, ptr %invariant.gep68, i64 %34
  %35 = load double, ptr %gep69, align 8, !tbaa !5
  %36 = fcmp olt double %35, %33
  %37 = select i1 %36, double %35, double %33
  %indvars.iv.next.1.1 = add nuw nsw i64 %indvars.iv.1, 2
  %niter55.next.1 = add i64 %niter55, 2
  %niter55.ncmp.1 = icmp eq i64 %niter55.next.1, %unroll_iter54
  br i1 %niter55.ncmp.1, label %._crit_edge.us.1.unr-lcssa.loopexit, label %29, !llvm.loop !9

._crit_edge.us.1.unr-lcssa.loopexit:              ; preds = %29
  %38 = mul i64 %indvars.iv.next.1.1, 24
  br label %._crit_edge.us.1.unr-lcssa

._crit_edge.us.1.unr-lcssa:                       ; preds = %._crit_edge.us.1.unr-lcssa.loopexit, %._crit_edge.us
  %.lcssa44.ph = phi double [ poison, %._crit_edge.us ], [ %37, %._crit_edge.us.1.unr-lcssa.loopexit ]
  %indvars.iv.1.unr = phi i64 [ 24, %._crit_edge.us ], [ %38, %._crit_edge.us.1.unr-lcssa.loopexit ]
  %.unr51 = phi double [ %26, %._crit_edge.us ], [ %37, %._crit_edge.us.1.unr-lcssa.loopexit ]
  %lcmp.mod52.not = icmp eq i64 %xtraiter50, 0
  br i1 %lcmp.mod52.not, label %._crit_edge.us.1, label %._crit_edge.us.1.epilog-lcssa

._crit_edge.us.1.epilog-lcssa:                    ; preds = %._crit_edge.us.1.unr-lcssa
  %gep.epil = getelementptr i8, ptr %invariant.gep, i64 %indvars.iv.1.unr
  %39 = load double, ptr %gep.epil, align 8, !tbaa !5
  %40 = fcmp olt double %39, %.unr51
  %41 = select i1 %40, double %39, double %.unr51
  br label %._crit_edge.us.1

._crit_edge.us.1:                                 ; preds = %._crit_edge.us.1.unr-lcssa, %._crit_edge.us.1.epilog-lcssa
  %.lcssa44 = phi double [ %.lcssa44.ph, %._crit_edge.us.1.unr-lcssa ], [ %41, %._crit_edge.us.1.epilog-lcssa ]
  store double %.lcssa44, ptr %27, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %1, i64 16
  %43 = load double, ptr %42, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %5, i64 16
  %invariant.gep40 = getelementptr i8, ptr %1, i64 16
  %xtraiter57 = and i64 %7, 1
  %45 = icmp eq i64 %8, 0
  br i1 %45, label %._crit_edge.us.2.unr-lcssa, label %._crit_edge.us.1.new

._crit_edge.us.1.new:                             ; preds = %._crit_edge.us.1
  %unroll_iter61 = and i64 %7, -2
  %invariant.gep70 = getelementptr i8, ptr %invariant.gep40, i64 24
  br label %46

46:                                               ; preds = %46, %._crit_edge.us.1.new
  %indvars.iv.2 = phi i64 [ 1, %._crit_edge.us.1.new ], [ %indvars.iv.next.2.1, %46 ]
  %47 = phi double [ %43, %._crit_edge.us.1.new ], [ %54, %46 ]
  %niter62 = phi i64 [ 0, %._crit_edge.us.1.new ], [ %niter62.next.1, %46 ]
  %.idx37 = mul i64 %indvars.iv.2, 24
  %gep41 = getelementptr i8, ptr %invariant.gep40, i64 %.idx37
  %48 = load double, ptr %gep41, align 8, !tbaa !5
  %49 = fcmp olt double %48, %47
  %50 = select i1 %49, double %48, double %47
  %51 = mul i64 %indvars.iv.2, 24
  %gep71 = getelementptr i8, ptr %invariant.gep70, i64 %51
  %52 = load double, ptr %gep71, align 8, !tbaa !5
  %53 = fcmp olt double %52, %50
  %54 = select i1 %53, double %52, double %50
  %indvars.iv.next.2.1 = add nuw nsw i64 %indvars.iv.2, 2
  %niter62.next.1 = add i64 %niter62, 2
  %niter62.ncmp.1 = icmp eq i64 %niter62.next.1, %unroll_iter61
  br i1 %niter62.ncmp.1, label %._crit_edge.us.2.unr-lcssa.loopexit, label %46, !llvm.loop !9

._crit_edge.us.2.unr-lcssa.loopexit:              ; preds = %46
  %55 = mul i64 %indvars.iv.next.2.1, 24
  br label %._crit_edge.us.2.unr-lcssa

._crit_edge.us.2.unr-lcssa:                       ; preds = %._crit_edge.us.2.unr-lcssa.loopexit, %._crit_edge.us.1
  %.lcssa.ph = phi double [ poison, %._crit_edge.us.1 ], [ %54, %._crit_edge.us.2.unr-lcssa.loopexit ]
  %indvars.iv.2.unr = phi i64 [ 24, %._crit_edge.us.1 ], [ %55, %._crit_edge.us.2.unr-lcssa.loopexit ]
  %.unr58 = phi double [ %43, %._crit_edge.us.1 ], [ %54, %._crit_edge.us.2.unr-lcssa.loopexit ]
  %lcmp.mod59.not = icmp eq i64 %xtraiter57, 0
  br i1 %lcmp.mod59.not, label %._crit_edge.us.2, label %._crit_edge.us.2.epilog-lcssa

._crit_edge.us.2.epilog-lcssa:                    ; preds = %._crit_edge.us.2.unr-lcssa
  %gep41.epil = getelementptr i8, ptr %invariant.gep40, i64 %indvars.iv.2.unr
  %56 = load double, ptr %gep41.epil, align 8, !tbaa !5
  %57 = fcmp olt double %56, %.unr58
  %58 = select i1 %57, double %56, double %.unr58
  br label %._crit_edge.us.2

._crit_edge.us.2:                                 ; preds = %._crit_edge.us.2.unr-lcssa, %._crit_edge.us.2.epilog-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %._crit_edge.us.2.unr-lcssa ], [ %58, %._crit_edge.us.2.epilog-lcssa ]
  store double %.lcssa, ptr %44, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge.us.2, %.split.preheader, %2
  %.022 = phi ptr [ null, %2 ], [ %5, %.split.preheader ], [ %5, %._crit_edge.us.2 ]
  ret ptr %.022
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass