; 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.21 = external hidden unnamed_addr constant [5 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

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

14:                                               ; preds = %59, %3
  %15 = load i32, ptr %9, align 4, !tbaa !5
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %18, label %62

18:                                               ; preds = %14
  %19 = load i32, ptr %9, align 4, !tbaa !5
  %20 = add nsw i32 %19, 5
  %21 = sub nsw i32 %20, 1
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = call i32 @i4_min(i32 noundef %21, i32 noundef %22)
  store i32 %23, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %29

26:                                               ; preds = %18
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, ptr noundef %27)
  br label %40

29:                                               ; preds = %18
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %36, %29
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = load i32, ptr %10, align 4, !tbaa !5
  %33 = icmp sle i32 %31, %32
  br i1 %33, label %34, label %39

34:                                               ; preds = %30
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  br label %36

36:                                               ; preds = %34
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !5
  br label %30, !llvm.loop !11

39:                                               ; preds = %30
  br label %40

40:                                               ; preds = %39, %26
  %41 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %41, ptr %7, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %54, %40
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %46, label %57

46:                                               ; preds = %42
  %47 = load ptr, ptr %5, align 8, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %47, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %52)
  br label %54

54:                                               ; preds = %46
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %7, align 4, !tbaa !5
  br label %42, !llvm.loop !13

57:                                               ; preds = %42
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %59

59:                                               ; preds = %57
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = add nsw i32 %60, 5
  store i32 %61, ptr %9, align 4, !tbaa !5
  br label %14, !llvm.loop !14

62:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

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 = { nounwind willreturn memory(read) "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 = { "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 }
attributes #5 = { nounwind willreturn memory(read) }

!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 = distinct !{!13, !12}
!14 = distinct !{!14, !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.21 = external hidden unnamed_addr constant [5 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @i4vec_transpose_print(i32 noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #3
  %.fr30 = freeze i64 %4
  %5 = trunc i64 %.fr30 to i32
  %.not25 = icmp slt i32 %0, 1
  br i1 %.not25, label %._crit_edge29, label %.lr.ph28

.lr.ph28:                                         ; preds = %3
  %.not1820 = icmp slt i32 %5, 1
  %invariant.gep = getelementptr i8, ptr %1, i64 -4
  br i1 %.not1820, label %.lr.ph28.split.us, label %.lr.ph28.split

.lr.ph28.split.us:                                ; preds = %.lr.ph28, %._crit_edge.us
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %._crit_edge.us ], [ 1, %.lr.ph28 ]
  %indvars46 = trunc i64 %indvars.iv37 to i32
  %indvars.iv.next38 = add nuw i64 %indvars.iv37, 5
  %indvars45 = trunc i64 %indvars.iv.next38 to i32
  %6 = add nuw nsw i32 %indvars46, 4
  %7 = tail call i32 @i4_min(i32 noundef %6, i32 noundef %0)
  %8 = icmp eq i32 %indvars46, 1
  br i1 %8, label %9, label %.preheader.us

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

.preheader.us:                                    ; preds = %.lr.ph28.split.us, %9
  %.not1922.us = icmp slt i32 %7, %indvars46
  br i1 %.not1922.us, label %._crit_edge.us, label %.lr.ph24.us.preheader

.lr.ph24.us.preheader:                            ; preds = %.preheader.us
  %11 = add i32 %7, 1
  %wide.trip.count43 = zext i32 %11 to i64
  br label %.lr.ph24.us

.lr.ph24.us:                                      ; preds = %.lr.ph24.us.preheader, %.lr.ph24.us
  %indvars.iv39 = phi i64 [ %indvars.iv37, %.lr.ph24.us.preheader ], [ %indvars.iv.next40, %.lr.ph24.us ]
  %gep.us = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv39
  %12 = load i32, ptr %gep.us, align 4, !tbaa !5
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %12)
  %indvars.iv.next40 = add nuw i64 %indvars.iv39, 1
  %exitcond44.not = icmp eq i64 %indvars.iv.next40, %wide.trip.count43
  br i1 %exitcond44.not, label %._crit_edge.us, label %.lr.ph24.us, !llvm.loop !9

._crit_edge.us:                                   ; preds = %.lr.ph24.us, %.preheader.us
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %.not.us = icmp sgt i32 %indvars45, %0
  br i1 %.not.us, label %._crit_edge29, label %.lr.ph28.split.us, !llvm.loop !11

.lr.ph28.split:                                   ; preds = %.lr.ph28, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 1, %.lr.ph28 ]
  %indvars36 = trunc i64 %indvars.iv to i32
  %indvars.iv.next = add nuw i64 %indvars.iv, 5
  %indvars = trunc i64 %indvars.iv.next to i32
  %15 = add nuw nsw i32 %indvars36, 4
  %16 = tail call i32 @i4_min(i32 noundef %15, i32 noundef %0)
  %17 = icmp eq i32 %indvars36, 1
  br i1 %17, label %18, label %.preheader

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

.preheader:                                       ; preds = %.lr.ph28.split, %.preheader
  %.021 = phi i32 [ %21, %.preheader ], [ 1, %.lr.ph28.split ]
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %21 = add nuw i32 %.021, 1
  %exitcond.not = icmp eq i32 %.021, %5
  br i1 %exitcond.not, label %..loopexit_crit_edge, label %.preheader, !llvm.loop !12

..loopexit_crit_edge:                             ; preds = %.preheader, %18
  %.not1922 = icmp slt i32 %16, %indvars36
  br i1 %.not1922, label %._crit_edge, label %.lr.ph24.preheader

.lr.ph24.preheader:                               ; preds = %..loopexit_crit_edge
  %22 = add i32 %16, 1
  %wide.trip.count = zext i32 %22 to i64
  br label %.lr.ph24

.lr.ph24:                                         ; preds = %.lr.ph24.preheader, %.lr.ph24
  %indvars.iv32 = phi i64 [ %indvars.iv, %.lr.ph24.preheader ], [ %indvars.iv.next33, %.lr.ph24 ]
  %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv32
  %23 = load i32, ptr %gep, align 4, !tbaa !5
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef %23)
  %indvars.iv.next33 = add nuw i64 %indvars.iv32, 1
  %exitcond35.not = icmp eq i64 %indvars.iv.next33, %wide.trip.count
  br i1 %exitcond35.not, label %._crit_edge, label %.lr.ph24, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph24, %..loopexit_crit_edge
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %.not = icmp sgt i32 %indvars, %0
  br i1 %.not, label %._crit_edge29, label %.lr.ph28.split, !llvm.loop !11

._crit_edge29:                                    ; preds = %._crit_edge, %._crit_edge.us, %3
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

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

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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 "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 willreturn memory(read) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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