; LLVM IR from sunkafei/xcpc-algorithm-templates :: 算法/字符串算法/模糊匹配.ll/Z5queryNSt7 (cxx1112basic_stringIcSt11char_traitsIcESaIcEEE)

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

%"struct.std::pair" = type { i32, i32 }
%struct.SuffixArray = type { [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i8] }

@n = external dso_local global i32, align 4
@range = external dso_local global [410000 x %"struct.std::pair"], align 16
@pre = external dso_local global %struct.SuffixArray, align 4
@suf = external dso_local global %struct.SuffixArray, align 4

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3askiii(i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5queryNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca %"struct.std::pair", align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca %"struct.std::pair", align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %14 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %15 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %14
  %16 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %15, ptr noundef nonnull align 4 dereferenceable(8) %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %17 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %18 = sub i64 %17, 1
  %19 = trunc i64 %18 to i32
  store i32 %19, ptr %6, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %63, %1
  %21 = load i32, ptr %6, align 4, !tbaa !11
  %22 = icmp sge i32 %21, 0
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %66

24:                                               ; preds = %20
  %25 = load i32, ptr %6, align 4, !tbaa !11
  %26 = add nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %27
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !13
  %31 = load i32, ptr %6, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %33
  %35 = getelementptr inbounds %"struct.std::pair", ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = icmp sgt i32 %30, %36
  br i1 %37, label %38, label %47

38:                                               ; preds = %24
  %39 = load i32, ptr %6, align 4, !tbaa !11
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %41
  %43 = load i32, ptr %6, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %44
  %46 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %45, ptr noundef nonnull align 4 dereferenceable(8) %42)
  br label %62

47:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %48 = load i32, ptr %6, align 4, !tbaa !11
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %50
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %51, i64 8, i1 false)
  %52 = load i32, ptr %6, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %53)
  %55 = load i8, ptr %54, align 1, !tbaa !16
  %56 = load i64, ptr %8, align 4
  %57 = call i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000) @pre, i64 %56, i8 noundef signext %55)
  store i64 %57, ptr %7, align 4
  %58 = load i32, ptr %6, align 4, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %59
  %61 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %60, ptr noundef nonnull align 4 dereferenceable(8) %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %62

62:                                               ; preds = %47, %38
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %6, align 4, !tbaa !11
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %6, align 4, !tbaa !11
  br label %20, !llvm.loop !17

66:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !11
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %67

67:                                               ; preds = %137, %66
  %68 = load i32, ptr %11, align 4, !tbaa !11
  %69 = sext i32 %68 to i64
  %70 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %71 = icmp ult i64 %69, %70
  br i1 %71, label %72, label %78

72:                                               ; preds = %67
  %73 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !13
  %75 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %76 = load i32, ptr %75, align 4, !tbaa !15
  %77 = icmp sle i32 %74, %76
  br label %78

78:                                               ; preds = %72, %67
  %79 = phi i1 [ false, %67 ], [ %77, %72 ]
  br i1 %79, label %81, label %80

80:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %140

81:                                               ; preds = %78
  %82 = load i32, ptr %11, align 4, !tbaa !11
  %83 = add nsw i32 %82, 1
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %84
  %86 = getelementptr inbounds %"struct.std::pair", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 8, !tbaa !13
  %88 = load i32, ptr %11, align 4, !tbaa !11
  %89 = add nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %90
  %92 = getelementptr inbounds %"struct.std::pair", ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !15
  %94 = icmp sle i32 %87, %93
  br i1 %94, label %95, label %129

95:                                               ; preds = %81
  %96 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %97 = load i32, ptr %96, align 4, !tbaa !13
  %98 = add nsw i32 %97, 1
  %99 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %100 = load i32, ptr %99, align 4, !tbaa !15
  %101 = add nsw i32 %100, 1
  %102 = load i32, ptr %11, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %104
  %106 = getelementptr inbounds %"struct.std::pair", ptr %105, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !15
  %108 = add nsw i32 %107, 1
  %109 = call noundef i32 @_Z3askiii(i32 noundef %98, i32 noundef %101, i32 noundef %108)
  %110 = sext i32 %109 to i64
  %111 = load i64, ptr %3, align 8, !tbaa !9
  %112 = add nsw i64 %111, %110
  store i64 %112, ptr %3, align 8, !tbaa !9
  %113 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %114 = load i32, ptr %113, align 4, !tbaa !13
  %115 = add nsw i32 %114, 1
  %116 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !15
  %118 = add nsw i32 %117, 1
  %119 = load i32, ptr %11, align 4, !tbaa !11
  %120 = add nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %121
  %123 = getelementptr inbounds %"struct.std::pair", ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !13
  %125 = call noundef i32 @_Z3askiii(i32 noundef %115, i32 noundef %118, i32 noundef %124)
  %126 = sext i32 %125 to i64
  %127 = load i64, ptr %3, align 8, !tbaa !9
  %128 = sub nsw i64 %127, %126
  store i64 %128, ptr %3, align 8, !tbaa !9
  br label %129

129:                                              ; preds = %95, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %9, i64 8, i1 false)
  %130 = load i32, ptr %11, align 4, !tbaa !11
  %131 = sext i32 %130 to i64
  %132 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %131)
  %133 = load i8, ptr %132, align 1, !tbaa !16
  %134 = load i64, ptr %13, align 4
  %135 = call i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000) @suf, i64 %134, i8 noundef signext %133)
  store i64 %135, ptr %12, align 4
  %136 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(8) %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %137

137:                                              ; preds = %129
  %138 = load i32, ptr %11, align 4, !tbaa !11
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %11, align 4, !tbaa !11
  br label %67, !llvm.loop !19

140:                                              ; preds = %80
  %141 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %142 = load i32, ptr %141, align 4, !tbaa !13
  %143 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !15
  %145 = icmp sle i32 %142, %144
  br i1 %145, label %146, label %159

146:                                              ; preds = %140
  %147 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %148 = load i32, ptr %147, align 4, !tbaa !15
  %149 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %150 = load i32, ptr %149, align 4, !tbaa !13
  %151 = sub nsw i32 %148, %150
  %152 = add nsw i32 %151, 1
  %153 = sext i32 %152 to i64
  %154 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %155 = sub i64 %154, 1
  %156 = mul i64 %153, %155
  %157 = load i64, ptr %3, align 8, !tbaa !9
  %158 = sub i64 %157, %156
  store i64 %158, ptr %3, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %146, %140
  %160 = load i64, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret i64 %160
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000), i64, i8 noundef signext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !12, i64 0, !12, i64 4}
!15 = !{!14, !12, i64 4}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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

%"struct.std::pair" = type { i32, i32 }
%struct.SuffixArray = type { [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i32], [410000 x i8] }

@n = external dso_local global i32, align 4
@range = external dso_local global [410000 x %"struct.std::pair"], align 16
@pre = external dso_local global %struct.SuffixArray, align 4
@suf = external dso_local global %struct.SuffixArray, align 4

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3askiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5queryNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %"struct.std::pair", align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %8 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %9 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %8
  %10 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(8) %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %11 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %12 = trunc i64 %11 to i32
  %.02232 = add i32 %12, -1
  %13 = icmp sgt i32 %.02232, -1
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %1
  %14 = zext nneg i32 %.02232 to i64
  %15 = and i64 %11, 4294967295
  br label %.lr.ph

._crit_edge:                                      ; preds = %37, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #3
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  %16 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %17 = icmp ne i64 %16, 0
  %18 = load i32, ptr %5, align 8
  %19 = getelementptr inbounds i8, ptr %5, i64 4
  %20 = load i32, ptr %19, align 4
  %21 = icmp sle i32 %18, %20
  %22 = select i1 %17, i1 %21, i1 false
  br i1 %22, label %.lr.ph38, label %._crit_edge39

.lr.ph:                                           ; preds = %.lr.ph.preheader, %37
  %indvars.iv46 = phi i64 [ %15, %.lr.ph.preheader ], [ %indvars.iv.next47, %37 ]
  %indvars.iv = phi i64 [ %14, %.lr.ph.preheader ], [ %indvars.iv.next, %37 ]
  %23 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %indvars.iv46
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %23, i64 4
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %27 = icmp sgt i32 %24, %26
  br i1 %27, label %28, label %31

28:                                               ; preds = %.lr.ph
  %29 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %indvars.iv
  %30 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(8) %23)
  br label %37

31:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %.sroa.07.0.copyload = load i64, ptr %23, align 8
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %33 = load i8, ptr %32, align 1, !tbaa !12
  %34 = call i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000) @pre, i64 %.sroa.07.0.copyload, i8 noundef signext %33)
  store i64 %34, ptr %4, align 8
  %35 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %indvars.iv
  %36 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %35, ptr noundef nonnull align 4 dereferenceable(8) %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %37

37:                                               ; preds = %28, %31
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %38 = icmp sgt i64 %indvars.iv, 0
  %indvars.iv.next47 = add nsw i64 %indvars.iv46, -1
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge39:                                    ; preds = %60, %._crit_edge
  %.0.lcssa = phi i64 [ 0, %._crit_edge ], [ %.1, %60 ]
  %.lcssa31 = phi i32 [ %18, %._crit_edge ], [ %67, %60 ]
  %.lcssa30 = phi i32 [ %20, %._crit_edge ], [ %68, %60 ]
  %.lcssa = phi i1 [ %21, %._crit_edge ], [ %69, %60 ]
  br i1 %.lcssa, label %71, label %78

.lr.ph38:                                         ; preds = %._crit_edge, %60
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %60 ], [ 0, %._crit_edge ]
  %39 = phi i32 [ %68, %60 ], [ %20, %._crit_edge ]
  %40 = phi i32 [ %67, %60 ], [ %18, %._crit_edge ]
  %.036 = phi i64 [ %.1, %60 ], [ 0, %._crit_edge ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %41 = getelementptr inbounds [410000 x %"struct.std::pair"], ptr @range, i64 0, i64 %indvars.iv.next52
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds i8, ptr %41, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %.not = icmp sgt i32 %42, %44
  br i1 %.not, label %60, label %45

45:                                               ; preds = %.lr.ph38
  %46 = add nsw i32 %40, 1
  %47 = add nsw i32 %39, 1
  %48 = add nsw i32 %44, 1
  %49 = call noundef i32 @_Z3askiii(i32 noundef %46, i32 noundef %47, i32 noundef %48)
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %.036, %50
  %52 = load i32, ptr %5, align 8, !tbaa !9
  %53 = add nsw i32 %52, 1
  %54 = load i32, ptr %19, align 4, !tbaa !11
  %55 = add nsw i32 %54, 1
  %56 = load i32, ptr %41, align 8, !tbaa !9
  %57 = call noundef i32 @_Z3askiii(i32 noundef %53, i32 noundef %55, i32 noundef %56)
  %58 = sext i32 %57 to i64
  %59 = sub i64 %51, %58
  br label %60

60:                                               ; preds = %45, %.lr.ph38
  %.1 = phi i64 [ %59, %45 ], [ %.036, %.lr.ph38 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  %.sroa.0.0.copyload = load i64, ptr %5, align 8
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv51)
  %62 = load i8, ptr %61, align 1, !tbaa !12
  %63 = call i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000) @suf, i64 %.sroa.0.0.copyload, i8 noundef signext %62)
  store i64 %63, ptr %7, align 8
  %64 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  %65 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %66 = icmp ugt i64 %65, %indvars.iv.next52
  %67 = load i32, ptr %5, align 8
  %68 = load i32, ptr %19, align 4
  %69 = icmp sle i32 %67, %68
  %70 = select i1 %66, i1 %69, i1 false
  br i1 %70, label %.lr.ph38, label %._crit_edge39, !llvm.loop !15

71:                                               ; preds = %._crit_edge39
  %reass.sub = sub i32 %.lcssa30, %.lcssa31
  %72 = add i32 %reass.sub, 1
  %73 = sext i32 %72 to i64
  %74 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #3
  %75 = add i64 %74, -1
  %76 = mul i64 %75, %73
  %77 = sub i64 %.0.lcssa, %76
  br label %78

78:                                               ; preds = %71, %._crit_edge39
  %.2 = phi i64 [ %77, %71 ], [ %.0.lcssa, %._crit_edge39 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.2
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIiiEC2IiRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZN11SuffixArray7advanceESt4pairIiiEc(ptr noundef nonnull align 4 dereferenceable(8610000), i64, i8 noundef signext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { mustprogress 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 #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++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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