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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [37 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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @r82row_sort_quick_a(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [25 x i32], align 16
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  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 100, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 1
  br i1 %13, label %14, label %21

14:                                               ; preds = %2
  %15 = load ptr, ptr @stderr, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str) #4
  %17 = load ptr, ptr @stderr, align 8, !tbaa !9
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.74) #4
  %19 = load ptr, ptr @stderr, align 8, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.72) #4
  call void @exit(i32 noundef 1) #5
  unreachable

21:                                               ; preds = %2
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i32 1, ptr %11, align 4
  br label %114

25:                                               ; preds = %21
  store i32 1, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [25 x i32], ptr %9, i64 0, i64 %30
  store i32 %27, ptr %31, align 4, !tbaa !5
  store i32 1, ptr %5, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %32, ptr %8, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %112, %25
  %34 = load i32, ptr %8, align 4, !tbaa !5
  %35 = icmp slt i32 0, %34
  br i1 %35, label %36, label %113

36:                                               ; preds = %33
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !9
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sub nsw i32 %39, 1
  %41 = mul nsw i32 2, %40
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds double, ptr %38, i64 %42
  %44 = getelementptr inbounds double, ptr %43, i64 0
  call void @r82row_part_quick_a(i32 noundef %37, ptr noundef %44, ptr noundef %6, ptr noundef %10)
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = icmp slt i32 1, %45
  br i1 %46, label %47, label %69

47:                                               ; preds = %36
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = icmp slt i32 25, %48
  br i1 %49, label %50, label %57

50:                                               ; preds = %47
  %51 = load ptr, ptr @stderr, align 8, !tbaa !9
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str) #4
  %53 = load ptr, ptr @stderr, align 8, !tbaa !9
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.74) #4
  %55 = load ptr, ptr @stderr, align 8, !tbaa !9
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.75, i32 noundef 25) #4
  call void @exit(i32 noundef 1) #5
  unreachable

57:                                               ; preds = %47
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !5
  %60 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %60, ptr %8, align 4, !tbaa !5
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = add nsw i32 %61, %62
  %64 = sub nsw i32 %63, 1
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [25 x i32], ptr %9, i64 0, i64 %67
  store i32 %64, ptr %68, align 4, !tbaa !5
  br label %112

69:                                               ; preds = %36
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %73, label %82

73:                                               ; preds = %69
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  %76 = load i32, ptr %10, align 4, !tbaa !5
  %77 = sub nsw i32 %75, %76
  store i32 %77, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = add nsw i32 %78, %79
  %81 = sub nsw i32 %80, 1
  store i32 %81, ptr %5, align 4, !tbaa !5
  br label %111

82:                                               ; preds = %69
  br label %83

83:                                               ; preds = %109, %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = icmp sle i32 %84, 1
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %110

87:                                               ; preds = %83
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [25 x i32], ptr %9, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  store i32 %92, ptr %5, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sub nsw i32 %93, 2
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [25 x i32], ptr %9, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [25 x i32], ptr %9, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sub nsw i32 %97, %102
  store i32 %103, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  store i32 %105, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = icmp slt i32 0, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %87
  br label %110

109:                                              ; preds = %87
  br label %83

110:                                              ; preds = %108, %86
  br label %111

111:                                              ; preds = %110, %73
  br label %112

112:                                              ; preds = %111, %57
  br label %33, !llvm.loop !11

113:                                              ; preds = %33
  store i32 1, ptr %11, align 4
  br label %114

114:                                              ; preds = %113, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 100, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn 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 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 }
attributes #5 = { noreturn 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"}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @r82row_part_quick_a(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @r82row_sort_quick_a(i32 noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = alloca [25 x i32], align 16
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %6 = icmp slt i32 %0, 1
  br i1 %6, label %7, label %14

7:                                                ; preds = %2
  %8 = load ptr, ptr @stderr, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef nonnull @.str) #5
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.74) #5
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.72) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

14:                                               ; preds = %2
  %15 = icmp eq i32 %0, 1
  br i1 %15, label %.loopexit30, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %14
  %16 = add nuw nsw i32 %0, 1
  store i32 %16, ptr %4, align 16, !tbaa !9
  br label %.lr.ph41

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %.loopexit
  %.040 = phi i32 [ %.1, %.loopexit ], [ %0, %.lr.ph41.preheader ]
  %.02139 = phi i32 [ %.2, %.loopexit ], [ 1, %.lr.ph41.preheader ]
  %.02338 = phi i32 [ %.225, %.loopexit ], [ 1, %.lr.ph41.preheader ]
  %17 = shl i32 %.02338, 1
  %18 = add i32 %17, -2
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds double, ptr %1, i64 %19
  call void @r82row_part_quick_a(i32 noundef %.040, ptr noundef %20, ptr noundef nonnull %3, ptr noundef nonnull %5)
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %23, label %39

23:                                               ; preds = %.lr.ph41
  %24 = icmp sgt i32 %.02139, 25
  br i1 %24, label %25, label %32

25:                                               ; preds = %23
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str) #5
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.74) #5
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.75, i32 noundef 25) #5
  call void @exit(i32 noundef 1) #6
  unreachable

32:                                               ; preds = %23
  %33 = add nsw i32 %.02139, 1
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = add i32 %.02338, -1
  %36 = add i32 %35, %34
  %37 = sext i32 %.02139 to i64
  %38 = getelementptr inbounds [25 x i32], ptr %4, i64 0, i64 %37
  store i32 %36, ptr %38, align 4, !tbaa !9
  br label %.loopexit

39:                                               ; preds = %.lr.ph41
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = icmp slt i32 %40, %.040
  br i1 %41, label %44, label %.preheader

.preheader:                                       ; preds = %39
  %42 = icmp slt i32 %.02139, 2
  br i1 %42, label %.loopexit30, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %43 = zext nneg i32 %.02139 to i64
  br label %.lr.ph

44:                                               ; preds = %39
  %45 = add nuw nsw i32 %.040, 1
  %46 = sub i32 %45, %40
  %47 = add i32 %.02338, -1
  %48 = add i32 %47, %40
  br label %.loopexit

49:                                               ; preds = %.lr.ph
  %50 = icmp ult i64 %indvars.iv, 3
  br i1 %50, label %.loopexit30, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %49
  %indvars.iv = phi i64 [ %43, %.lr.ph.preheader ], [ %indvars.iv.next, %49 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %51 = getelementptr inbounds [25 x i32], ptr %4, i64 0, i64 %indvars.iv.next
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = add nsw i64 %indvars.iv, -2
  %54 = getelementptr inbounds [25 x i32], ptr %4, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = sub nsw i32 %55, %52
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.loopexit.loopexit, label %49

.loopexit.loopexit:                               ; preds = %.lr.ph
  %58 = trunc nuw nsw i64 %indvars.iv.next to i32
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %44, %32
  %.225 = phi i32 [ %.02338, %32 ], [ %48, %44 ], [ %52, %.loopexit.loopexit ]
  %.2 = phi i32 [ %33, %32 ], [ %.02139, %44 ], [ %58, %.loopexit.loopexit ]
  %.1 = phi i32 [ %21, %32 ], [ %46, %44 ], [ %56, %.loopexit.loopexit ]
  %59 = icmp sgt i32 %.1, 0
  br i1 %59, label %.lr.ph41, label %.loopexit30, !llvm.loop !11

.loopexit30:                                      ; preds = %.preheader, %.loopexit, %49, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { noreturn 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 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 }
attributes #5 = { cold nounwind }
attributes #6 = { noreturn 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass