; 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.110 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.113 = 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
define dso_local void @r8mat_plot(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
  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
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %14 = load ptr, ptr %8, align 8, !tbaa !9
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %14)
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %79, %4
  %17 = load i32, ptr %12, align 4, !tbaa !5
  %18 = load i32, ptr %6, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %20, label %82

20:                                               ; preds = %16
  %21 = load i32, ptr %12, align 4, !tbaa !5
  %22 = add nsw i32 %21, 70
  %23 = sub nsw i32 %22, 1
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = call i32 @i4_min(i32 noundef %23, i32 noundef %24)
  store i32 %25, ptr %11, align 4, !tbaa !5
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.110)
  %28 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %28, ptr %10, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %37, %20
  %30 = load i32, ptr %10, align 4, !tbaa !5
  %31 = load i32, ptr %11, align 4, !tbaa !5
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %33, label %40

33:                                               ; preds = %29
  %34 = load i32, ptr %10, align 4, !tbaa !5
  %35 = srem i32 %34, 10
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.111, i32 noundef %35)
  br label %37

37:                                               ; preds = %33
  %38 = load i32, ptr %10, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %10, align 4, !tbaa !5
  br label %29, !llvm.loop !11

40:                                               ; preds = %29
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %75, %40
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %47, label %78

47:                                               ; preds = %43
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.112, i32 noundef %48)
  %50 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %50, ptr %10, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %70, %47
  %52 = load i32, ptr %10, align 4, !tbaa !5
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %55, label %73

55:                                               ; preds = %51
  %56 = load ptr, ptr %7, align 8, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = mul nsw i32 %60, %61
  %63 = add nsw i32 %58, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds double, ptr %56, i64 %64
  %66 = load double, ptr %65, align 8, !tbaa !13
  %67 = call signext i8 @r8mat_plot_symbol(double noundef %66)
  %68 = sext i8 %67 to i32
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.113, i32 noundef %68)
  br label %70

70:                                               ; preds = %55
  %71 = load i32, ptr %10, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %10, align 4, !tbaa !5
  br label %51, !llvm.loop !15

73:                                               ; preds = %51
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  br label %75

75:                                               ; preds = %73
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %9, align 4, !tbaa !5
  br label %43, !llvm.loop !16

78:                                               ; preds = %43
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = add nsw i32 %80, 70
  store i32 %81, ptr %12, align 4, !tbaa !5
  br label %16, !llvm.loop !17

82:                                               ; preds = %16
  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
}

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @r8mat_plot_symbol(double noundef) #1

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.110 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.113 = 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
define dso_local void @r8mat_plot(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)
  %.not41 = icmp slt i32 %1, 1
  br i1 %.not41, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %4
  %.not2837 = icmp slt i32 %0, 1
  br i1 %.not2837, label %.lr.ph44.split.us, label %.lr.ph44.split.preheader

.lr.ph44.split.preheader:                         ; preds = %.lr.ph44
  %7 = zext nneg i32 %0 to i64
  %8 = add nuw i32 %0, 1
  %wide.trip.count = zext i32 %8 to i64
  %invariant.gep = getelementptr i8, ptr %2, i64 -8
  br label %.lr.ph44.split

.lr.ph44.split.us:                                ; preds = %.lr.ph44, %.loopexit.us
  %.042.us = phi i32 [ %9, %.loopexit.us ], [ 1, %.lr.ph44 ]
  %9 = add nuw nsw i32 %.042.us, 70
  %10 = add nuw nsw i32 %.042.us, 69
  %11 = tail call i32 @i4_min(i32 noundef %10, i32 noundef %1)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.110)
  %.not2730.us = icmp sgt i32 %.042.us, %11
  br i1 %.not2730.us, label %.loopexit.us, label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph44.split.us, %.lr.ph.us
  %.02331.us = phi i32 [ %16, %.lr.ph.us ], [ %.042.us, %.lr.ph44.split.us ]
  %14 = urem i32 %.02331.us, 10
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.111, i32 noundef %14)
  %16 = add nuw i32 %.02331.us, 1
  %exitcond57.not = icmp eq i32 %.02331.us, %11
  br i1 %exitcond57.not, label %.loopexit.us, label %.lr.ph.us, !llvm.loop !5

.loopexit.us:                                     ; preds = %.lr.ph.us, %.lr.ph44.split.us
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %.not.us = icmp sgt i32 %9, %1
  br i1 %.not.us, label %._crit_edge45, label %.lr.ph44.split.us, !llvm.loop !7

..loopexit_crit_edge:                             ; preds = %._crit_edge36, %.lr.ph40.split.us
  %.not = icmp sgt i32 %indvars, %1
  br i1 %.not, label %._crit_edge45, label %.lr.ph44.split, !llvm.loop !7

.lr.ph44.split:                                   ; preds = %.lr.ph44.split.preheader, %..loopexit_crit_edge
  %indvars.iv = phi i64 [ 1, %.lr.ph44.split.preheader ], [ %indvars.iv.next, %..loopexit_crit_edge ]
  %indvars56 = trunc i64 %indvars.iv to i32
  %indvars.iv.next = add nuw i64 %indvars.iv, 70
  %indvars = trunc i64 %indvars.iv.next to i32
  %19 = add nuw nsw i32 %indvars56, 69
  %20 = tail call i32 @i4_min(i32 noundef %19, i32 noundef %1)
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.110)
  %.not2730 = icmp slt i32 %20, %indvars56
  br i1 %.not2730, label %.lr.ph40.split.us.preheader.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph44.split, %.lr.ph
  %.02331 = phi i32 [ %25, %.lr.ph ], [ %indvars56, %.lr.ph44.split ]
  %23 = urem i32 %.02331, 10
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.111, i32 noundef %23)
  %25 = add nuw i32 %.02331, 1
  %exitcond.not = icmp eq i32 %.02331, %20
  br i1 %exitcond.not, label %.lr.ph40, label %.lr.ph, !llvm.loop !5

.lr.ph40:                                         ; preds = %.lr.ph
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br i1 %.not2730, label %.lr.ph40.split.us.preheader, label %.lr.ph35.preheader

.lr.ph35.preheader:                               ; preds = %.lr.ph40
  %28 = sext i32 %20 to i64
  br label %.lr.ph35

.lr.ph40.split.us.preheader.critedge:             ; preds = %.lr.ph44.split
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %.lr.ph40.split.us.preheader

.lr.ph40.split.us.preheader:                      ; preds = %.lr.ph40.split.us.preheader.critedge, %.lr.ph40
  br label %.lr.ph40.split.us

.lr.ph40.split.us:                                ; preds = %.lr.ph40.split.us.preheader, %.lr.ph40.split.us
  %.02238.us = phi i32 [ %33, %.lr.ph40.split.us ], [ 1, %.lr.ph40.split.us.preheader ]
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.112, i32 noundef %.02238.us)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %33 = add nuw i32 %.02238.us, 1
  %exitcond55.not = icmp eq i32 %.02238.us, %0
  br i1 %exitcond55.not, label %..loopexit_crit_edge, label %.lr.ph40.split.us, !llvm.loop !8

.lr.ph35:                                         ; preds = %.lr.ph35.preheader, %._crit_edge36
  %indvars.iv51 = phi i64 [ 1, %.lr.ph35.preheader ], [ %indvars.iv.next52, %._crit_edge36 ]
  %34 = trunc nuw nsw i64 %indvars.iv51 to i32
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.112, i32 noundef %34)
  %gep = getelementptr double, ptr %invariant.gep, i64 %indvars.iv51
  br label %36

36:                                               ; preds = %.lr.ph35, %36
  %indvars.iv48 = phi i64 [ %indvars.iv, %.lr.ph35 ], [ %indvars.iv.next49, %36 ]
  %37 = add nsw i64 %indvars.iv48, -1
  %38 = mul nsw i64 %37, %7
  %39 = getelementptr double, ptr %gep, i64 %38
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = tail call signext i8 @r8mat_plot_symbol(double noundef %40)
  %42 = sext i8 %41 to i32
  %43 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.113, i32 noundef %42)
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %.not29.not = icmp slt i64 %indvars.iv48, %28
  br i1 %.not29.not, label %36, label %._crit_edge36, !llvm.loop !13

._crit_edge36:                                    ; preds = %36
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
  br i1 %exitcond54.not, label %..loopexit_crit_edge, label %.lr.ph35, !llvm.loop !8

._crit_edge45:                                    ; preds = %..loopexit_crit_edge, %.loopexit.us, %4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @r8mat_plot_symbol(double noundef) local_unnamed_addr #0

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


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