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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.158 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.159 = external hidden unnamed_addr constant [7 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: nounwind uwtable
declare dso_local i32 @i4_min(i32 noundef, i32 noundef) #1

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local void @r8slmat_print(i32 noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %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
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %17 = load ptr, ptr %8, align 8, !tbaa !9
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %17)
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = call i32 @i4_min(i32 noundef %19, i32 noundef %21)
  store i32 %22, ptr %14, align 4, !tbaa !5
  store i32 5, ptr %15, align 4, !tbaa !5
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %105, %4
  %24 = load i32, ptr %13, align 4, !tbaa !5
  %25 = load i32, ptr %14, align 4, !tbaa !5
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %27, label %109

27:                                               ; preds = %23
  %28 = load i32, ptr %13, align 4, !tbaa !5
  %29 = load i32, ptr %15, align 4, !tbaa !5
  %30 = add nsw i32 %28, %29
  %31 = sub nsw i32 %30, 1
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sub nsw i32 %32, 1
  %34 = load i32, ptr %14, align 4, !tbaa !5
  %35 = call i32 @i4_min(i32 noundef %33, i32 noundef %34)
  %36 = call i32 @i4_min(i32 noundef %31, i32 noundef %35)
  store i32 %36, ptr %12, align 4, !tbaa !5
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.103)
  %39 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %39, ptr %11, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %47, %27
  %41 = load i32, ptr %11, align 4, !tbaa !5
  %42 = load i32, ptr %12, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %44, label %50

44:                                               ; preds = %40
  %45 = load i32, ptr %11, align 4, !tbaa !5
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.158, i32 noundef %45)
  br label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %11, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %11, align 4, !tbaa !5
  br label %40, !llvm.loop !11

50:                                               ; preds = %40
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %53 = load i32, ptr %13, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %9, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %101, %50
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %59, label %104

59:                                               ; preds = %55
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %60)
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = load i32, ptr %15, align 4, !tbaa !5
  %64 = add nsw i32 %62, %63
  %65 = sub nsw i32 %64, 1
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = load i32, ptr %14, align 4, !tbaa !5
  %69 = call i32 @i4_min(i32 noundef %67, i32 noundef %68)
  %70 = call i32 @i4_min(i32 noundef %65, i32 noundef %69)
  store i32 %70, ptr %12, align 4, !tbaa !5
  %71 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %71, ptr %11, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %96, %59
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = load i32, ptr %12, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %76, label %99

76:                                               ; preds = %72
  %77 = load i32, ptr %11, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = mul nsw i32 %78, %79
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = add nsw i32 %80, %81
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = mul nsw i32 %83, %85
  %87 = sdiv i32 %86, 2
  %88 = sub nsw i32 %82, %87
  store i32 %88, ptr %10, align 4, !tbaa !5
  %89 = load ptr, ptr %7, align 8, !tbaa !9
  %90 = load i32, ptr %10, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds double, ptr %89, i64 %92
  %94 = load double, ptr %93, align 8, !tbaa !13
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.159, double noundef %94)
  br label %96

96:                                               ; preds = %76
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %11, align 4, !tbaa !5
  br label %72, !llvm.loop !15

99:                                               ; preds = %72
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %101

101:                                              ; preds = %99
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %9, align 4, !tbaa !5
  br label %55, !llvm.loop !16

104:                                              ; preds = %55
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = load i32, ptr %15, align 4, !tbaa !5
  %108 = add nsw i32 %106, %107
  store i32 %108, ptr %13, align 4, !tbaa !5
  br label %23, !llvm.loop !17

109:                                              ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

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


; 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 [2 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.158 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.159 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @i4_min(i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @r8slmat_print(i32 noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %3)
  %7 = add nsw i32 %0, -1
  %8 = tail call i32 @i4_min(i32 noundef %1, i32 noundef %7)
  %.not55 = icmp slt i32 %8, 1
  br i1 %.not55, label %._crit_edge59, label %.lr.ph58

.loopexit:                                        ; preds = %._crit_edge48, %._crit_edge
  %.not = icmp sgt i32 %9, %8
  br i1 %.not, label %._crit_edge59, label %.lr.ph58, !llvm.loop !5

.lr.ph58:                                         ; preds = %4, %.loopexit
  %.03656 = phi i32 [ %9, %.loopexit ], [ 1, %4 ]
  %9 = add nuw nsw i32 %.03656, 5
  %10 = add nuw nsw i32 %.03656, 4
  %11 = tail call i32 @i4_min(i32 noundef %7, i32 noundef %8)
  %12 = tail call i32 @i4_min(i32 noundef %10, i32 noundef %11)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.103)
  %.not3942 = icmp sgt i32 %.03656, %12
  br i1 %.not3942, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph58, %.lr.ph
  %.03543 = phi i32 [ %16, %.lr.ph ], [ %.03656, %.lr.ph58 ]
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.158, i32 noundef %.03543)
  %16 = add nuw i32 %.03543, 1
  %exitcond.not = icmp eq i32 %.03543, %12
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !7

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph58
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %.not40.not50 = icmp slt i32 %.03656, %0
  br i1 %.not40.not50, label %.lr.ph54, label %.loopexit

.lr.ph54:                                         ; preds = %._crit_edge, %._crit_edge48
  %.0.in51 = phi i32 [ %.052, %._crit_edge48 ], [ %.03656, %._crit_edge ]
  %.052 = add nuw nsw i32 %.0.in51, 1
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %.052)
  %20 = tail call i32 @i4_min(i32 noundef %.0.in51, i32 noundef %8)
  %21 = tail call i32 @i4_min(i32 noundef %10, i32 noundef %20)
  %.not4144 = icmp sgt i32 %.03656, %21
  br i1 %.not4144, label %._crit_edge48, label %.lr.ph47

.lr.ph47:                                         ; preds = %.lr.ph54, %.lr.ph47
  %.145 = phi i32 [ %25, %.lr.ph47 ], [ %.03656, %.lr.ph54 ]
  %22 = add nsw i32 %.145, -1
  %23 = mul nsw i32 %22, %0
  %24 = add nsw i32 %23, %.052
  %25 = add nuw nsw i32 %.145, 1
  %26 = mul nuw nsw i32 %25, %.145
  %27 = lshr i32 %26, 1
  %28 = xor i32 %27, -1
  %29 = add i32 %24, %28
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds double, ptr %2, i64 %30
  %32 = load double, ptr %31, align 8, !tbaa !8
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.159, double noundef %32)
  %exitcond60.not = icmp eq i32 %.145, %21
  br i1 %exitcond60.not, label %._crit_edge48, label %.lr.ph47, !llvm.loop !12

._crit_edge48:                                    ; preds = %.lr.ph47, %.lr.ph54
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %exitcond61.not = icmp eq i32 %.052, %0
  br i1 %exitcond61.not, label %.loopexit, label %.lr.ph54, !llvm.loop !13

._crit_edge59:                                    ; preds = %.loopexit, %4
  ret void
}

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

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}


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