; 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.136 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.137 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.139 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.140 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [15 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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

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

14:                                               ; preds = %3
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %16 = load ptr, ptr %6, align 8, !tbaa !9
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %16)
  br label %18

18:                                               ; preds = %14, %3
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %18
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.136)
  store i32 1, ptr %10, align 4
  br label %123

24:                                               ; preds = %18
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %25, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !11
  %30 = fcmp olt double %29, 0.000000e+00
  br i1 %30, label %31, label %32

31:                                               ; preds = %24
  store i8 45, ptr %9, align 1, !tbaa !13
  br label %33

32:                                               ; preds = %24
  store i8 32, ptr %9, align 1, !tbaa !13
  br label %33

33:                                               ; preds = %32, %31
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds double, ptr %34, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = call double @llvm.fabs.f64(double %38)
  store double %39, ptr %8, align 8, !tbaa !11
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sle i32 2, %40
  br i1 %41, label %42, label %48

42:                                               ; preds = %33
  %43 = load i8, ptr %9, align 1, !tbaa !13
  %44 = sext i8 %43 to i32
  %45 = load double, ptr %8, align 8, !tbaa !11
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.137, i32 noundef %44, double noundef %45, i32 noundef %46)
  br label %66

48:                                               ; preds = %33
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %56

51:                                               ; preds = %48
  %52 = load i8, ptr %9, align 1, !tbaa !13
  %53 = sext i8 %52 to i32
  %54 = load double, ptr %8, align 8, !tbaa !11
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.138, i32 noundef %53, double noundef %54)
  br label %65

56:                                               ; preds = %48
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %64

59:                                               ; preds = %56
  %60 = load i8, ptr %9, align 1, !tbaa !13
  %61 = sext i8 %60 to i32
  %62 = load double, ptr %8, align 8, !tbaa !11
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.139, i32 noundef %61, double noundef %62)
  br label %64

64:                                               ; preds = %59, %56
  br label %65

65:                                               ; preds = %64, %51
  br label %66

66:                                               ; preds = %65, %42
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  store i32 %68, ptr %7, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %119, %66
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = icmp sle i32 0, %70
  br i1 %71, label %72, label %122

72:                                               ; preds = %69
  %73 = load ptr, ptr %5, align 8, !tbaa !9
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %73, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !11
  %78 = fcmp olt double %77, 0.000000e+00
  br i1 %78, label %79, label %80

79:                                               ; preds = %72
  store i8 45, ptr %9, align 1, !tbaa !13
  br label %81

80:                                               ; preds = %72
  store i8 43, ptr %9, align 1, !tbaa !13
  br label %81

81:                                               ; preds = %80, %79
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds double, ptr %82, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !11
  %87 = call double @llvm.fabs.f64(double %86)
  store double %87, ptr %8, align 8, !tbaa !11
  %88 = load double, ptr %8, align 8, !tbaa !11
  %89 = fcmp une double %88, 0.000000e+00
  br i1 %89, label %90, label %118

90:                                               ; preds = %81
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = icmp sle i32 2, %91
  br i1 %92, label %93, label %99

93:                                               ; preds = %90
  %94 = load i8, ptr %9, align 1, !tbaa !13
  %95 = sext i8 %94 to i32
  %96 = load double, ptr %8, align 8, !tbaa !11
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = call i32 (ptr, ...) @printf(ptr noundef @.str.140, i32 noundef %95, double noundef %96, i32 noundef %97)
  br label %117

99:                                               ; preds = %90
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 1
  br i1 %101, label %102, label %107

102:                                              ; preds = %99
  %103 = load i8, ptr %9, align 1, !tbaa !13
  %104 = sext i8 %103 to i32
  %105 = load double, ptr %8, align 8, !tbaa !11
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.141, i32 noundef %104, double noundef %105)
  br label %116

107:                                              ; preds = %99
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %115

110:                                              ; preds = %107
  %111 = load i8, ptr %9, align 1, !tbaa !13
  %112 = sext i8 %111 to i32
  %113 = load double, ptr %8, align 8, !tbaa !11
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.142, i32 noundef %112, double noundef %113)
  br label %115

115:                                              ; preds = %110, %107
  br label %116

116:                                              ; preds = %115, %102
  br label %117

117:                                              ; preds = %116, %93
  br label %118

118:                                              ; preds = %117, %81
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = add nsw i32 %120, -1
  store i32 %121, ptr %7, align 4, !tbaa !5
  br label %69, !llvm.loop !14

122:                                              ; preds = %69
  store i32 1, ptr %10, align 4
  br label %123

123:                                              ; preds = %122, %22
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @s_len_trim(ptr noundef) #3

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


; 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.136 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.137 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.138 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.139 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.140 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

; Function Attrs: nounwind uwtable
define dso_local void @r8poly_print(i32 noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = tail call i32 @s_len_trim(ptr noundef %2)
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %6, label %9

6:                                                ; preds = %3
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %2)
  br label %9

9:                                                ; preds = %6, %3
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %11 = icmp slt i32 %0, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.136)
  br label %.loopexit

14:                                               ; preds = %9
  %15 = zext nneg i32 %0 to i64
  %16 = getelementptr inbounds double, ptr %1, i64 %15
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fcmp olt double %17, 0.000000e+00
  %. = select i1 %18, i32 45, i32 32
  %19 = tail call double @llvm.fabs.f64(double %17)
  %20 = icmp ugt i32 %0, 1
  br i1 %20, label %21, label %23

21:                                               ; preds = %14
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.137, i32 noundef %., double noundef %19, i32 noundef %0)
  br label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %25, %21
  br label %.lr.ph

23:                                               ; preds = %14
  %24 = icmp eq i32 %0, 1
  br i1 %24, label %25, label %27

25:                                               ; preds = %23
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.138, i32 noundef %., double noundef %19)
  br label %.lr.ph.preheader

27:                                               ; preds = %23
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.139, i32 noundef %., double noundef %19)
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph.preheader, %45
  %indvars.iv = phi i64 [ %indvars.iv.next, %45 ], [ %15, %.lr.ph.preheader ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %indvars = trunc i64 %indvars.iv.next to i32
  %29 = and i64 %indvars.iv.next, 4294967295
  %30 = getelementptr inbounds double, ptr %1, i64 %29
  %31 = load double, ptr %30, align 8, !tbaa !5
  %32 = fcmp olt double %31, 0.000000e+00
  %.37 = select i1 %32, i32 45, i32 43
  %33 = tail call double @llvm.fabs.f64(double %31)
  %34 = fcmp une double %31, 0.000000e+00
  br i1 %34, label %35, label %45

35:                                               ; preds = %.lr.ph
  %36 = icmp ugt i64 %indvars.iv, 2
  br i1 %36, label %37, label %39

37:                                               ; preds = %35
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.140, i32 noundef %.37, double noundef %33, i32 noundef %indvars)
  br label %45

39:                                               ; preds = %35
  %40 = icmp eq i32 %indvars, 1
  br i1 %40, label %41, label %43

41:                                               ; preds = %39
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.141, i32 noundef %.37, double noundef %33)
  br label %45

43:                                               ; preds = %39
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.142, i32 noundef %.37, double noundef %33)
  br label %45

45:                                               ; preds = %.lr.ph, %41, %43, %37
  %.not = icmp eq i32 %indvars, 0
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !9

.loopexit:                                        ; preds = %45, %27, %12
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @s_len_trim(ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass