; 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.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [3 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
declare dso_local i32 @s_len_trim(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @r8vec_transpose_print(i32 noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %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
  %10 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %11 = load ptr, ptr %6, align 8, !tbaa !9
  %12 = call i32 @s_len_trim(ptr noundef %11)
  store i32 %12, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %57, %3
  %14 = load i32, ptr %9, align 4, !tbaa !5
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %17, label %60

17:                                               ; preds = %13
  %18 = load i32, ptr %9, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %23

20:                                               ; preds = %17
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef %21)
  br label %34

23:                                               ; preds = %17
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %30, %23
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr %10, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %28, label %33

28:                                               ; preds = %24
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  br label %30

30:                                               ; preds = %28
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %7, align 4, !tbaa !5
  br label %24, !llvm.loop !11

33:                                               ; preds = %24
  br label %34

34:                                               ; preds = %33, %20
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.211)
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = add nsw i32 %36, 5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = call i32 @i4_min(i32 noundef %37, i32 noundef %38)
  store i32 %39, ptr %8, align 4, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %40, ptr %7, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %52, %34
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = load i32, ptr %8, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %55

45:                                               ; preds = %41
  %46 = load ptr, ptr %5, align 8, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds double, ptr %46, i64 %48
  %50 = load double, ptr %49, align 8, !tbaa !13
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str.88, double noundef %50)
  br label %52

52:                                               ; preds = %45
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %7, align 4, !tbaa !5
  br label %41, !llvm.loop !15

55:                                               ; preds = %41
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %57

57:                                               ; preds = %55
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = add nsw i32 %58, 5
  store i32 %59, ptr %9, align 4, !tbaa !5
  br label %13, !llvm.loop !16

60:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  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}


; 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.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.211 = external hidden unnamed_addr constant [3 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
declare dso_local i32 @s_len_trim(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @r8vec_transpose_print(i32 noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call i32 @s_len_trim(ptr noundef %2)
  %.fr25 = freeze i32 %4
  %5 = icmp sgt i32 %0, 0
  br i1 %5, label %.lr.ph23, label %._crit_edge24

.lr.ph23:                                         ; preds = %3
  %6 = icmp sgt i32 %.fr25, 0
  br i1 %6, label %.lr.ph23.split.us, label %.lr.ph23.split

.lr.ph23.split.us:                                ; preds = %.lr.ph23, %._crit_edge.us
  %indvars.iv32 = phi i64 [ %indvars.iv.next33, %._crit_edge.us ], [ 0, %.lr.ph23 ]
  %indvars41 = trunc i64 %indvars.iv32 to i32
  %7 = icmp eq i32 %indvars41, 0
  br i1 %7, label %10, label %.preheader.us

.preheader.us:                                    ; preds = %.lr.ph23.split.us, %.preheader.us
  %.018.us = phi i32 [ %9, %.preheader.us ], [ 0, %.lr.ph23.split.us ]
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %9 = add nuw nsw i32 %.018.us, 1
  %exitcond31.not = icmp eq i32 %9, %.fr25
  br i1 %exitcond31.not, label %..loopexit_crit_edge.us, label %.preheader.us, !llvm.loop !5

10:                                               ; preds = %.lr.ph23.split.us
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef %2)
  br label %..loopexit_crit_edge.us

..loopexit_crit_edge.us:                          ; preds = %.preheader.us, %10
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.211)
  %indvars.iv.next33 = add nuw i64 %indvars.iv32, 5
  %indvars40 = trunc i64 %indvars.iv.next33 to i32
  %13 = tail call i32 @i4_min(i32 noundef %indvars40, i32 noundef %0)
  %14 = icmp sgt i32 %13, %indvars41
  br i1 %14, label %.lr.ph20.us.preheader, label %._crit_edge.us

.lr.ph20.us.preheader:                            ; preds = %..loopexit_crit_edge.us
  %wide.trip.count38 = zext i32 %13 to i64
  br label %.lr.ph20.us

._crit_edge.us:                                   ; preds = %.lr.ph20.us, %..loopexit_crit_edge.us
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %16 = icmp slt i32 %indvars40, %0
  br i1 %16, label %.lr.ph23.split.us, label %._crit_edge24, !llvm.loop !7

.lr.ph20.us:                                      ; preds = %.lr.ph20.us.preheader, %.lr.ph20.us
  %indvars.iv34 = phi i64 [ %indvars.iv32, %.lr.ph20.us.preheader ], [ %indvars.iv.next35, %.lr.ph20.us ]
  %17 = getelementptr inbounds double, ptr %1, i64 %indvars.iv34
  %18 = load double, ptr %17, align 8, !tbaa !8
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.88, double noundef %18)
  %indvars.iv.next35 = add nuw i64 %indvars.iv34, 1
  %exitcond39.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count38
  br i1 %exitcond39.not, label %._crit_edge.us, label %.lr.ph20.us, !llvm.loop !12

.lr.ph23.split:                                   ; preds = %.lr.ph23, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %.lr.ph23 ]
  %indvars30 = trunc i64 %indvars.iv to i32
  %20 = icmp eq i32 %indvars30, 0
  br i1 %20, label %21, label %.preheader

21:                                               ; preds = %.lr.ph23.split
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, ptr noundef %2)
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph23.split, %21
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.211)
  %indvars.iv.next = add nuw i64 %indvars.iv, 5
  %indvars = trunc i64 %indvars.iv.next to i32
  %24 = tail call i32 @i4_min(i32 noundef %indvars, i32 noundef %0)
  %25 = icmp sgt i32 %24, %indvars30
  br i1 %25, label %.lr.ph20.preheader, label %._crit_edge

.lr.ph20.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext i32 %24 to i64
  br label %.lr.ph20

.lr.ph20:                                         ; preds = %.lr.ph20.preheader, %.lr.ph20
  %indvars.iv27 = phi i64 [ %indvars.iv, %.lr.ph20.preheader ], [ %indvars.iv.next28, %.lr.ph20 ]
  %26 = getelementptr inbounds double, ptr %1, i64 %indvars.iv27
  %27 = load double, ptr %26, align 8, !tbaa !8
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.88, double noundef %27)
  %indvars.iv.next28 = add nuw i64 %indvars.iv27, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next28, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph20, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph20, %.preheader
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %30 = icmp slt i32 %indvars, %0
  br i1 %30, label %.lr.ph23.split, label %._crit_edge24, !llvm.loop !7

._crit_edge24:                                    ; preds = %._crit_edge, %._crit_edge.us, %3
  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}


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