; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Random/Morgan and a String (A)

; 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.0" = type { i32, %"struct.std::pair" }
%"struct.std::pair" = type { i32, i32 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@p = external dso_local global [2 x [262144 x i32]], align 16
@L = external dso_local global [262144 x %"struct.std::pair.0"], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z14getSuffixArrayRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %31, %1
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %34

20:                                               ; preds = %15
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %21, i64 noundef %23)
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = sext i8 %25 to i32
  %27 = sub nsw i32 %26, 65
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [262144 x i32], ptr @p, i64 0, i64 %29
  store i32 %27, ptr %30, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %20
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %5, align 4, !tbaa !9
  br label %15, !llvm.loop !12

34:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %179, %34
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = ashr i32 %36, 1
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %35
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %184

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %88, %41
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %4, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %91

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %49
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [262144 x i32], ptr %50, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %56
  %58 = getelementptr inbounds %"struct.std::pair.0", ptr %57, i32 0, i32 0
  store i32 %54, ptr %58, align 4, !tbaa !14
  %59 = load i32, ptr %9, align 4, !tbaa !9
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = add nsw i32 %59, %60
  %62 = load i32, ptr %4, align 4, !tbaa !9
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %74

64:                                               ; preds = %47
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %66
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = add nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [262144 x i32], ptr %67, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !9
  br label %75

74:                                               ; preds = %47
  br label %75

75:                                               ; preds = %74, %64
  %76 = phi i32 [ %73, %64 ], [ -1, %74 ]
  %77 = load i32, ptr %9, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %78
  %80 = getelementptr inbounds %"struct.std::pair.0", ptr %79, i32 0, i32 1
  %81 = getelementptr inbounds %"struct.std::pair", ptr %80, i32 0, i32 0
  store i32 %76, ptr %81, align 4, !tbaa !17
  %82 = load i32, ptr %9, align 4, !tbaa !9
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %84
  %86 = getelementptr inbounds %"struct.std::pair.0", ptr %85, i32 0, i32 1
  %87 = getelementptr inbounds %"struct.std::pair", ptr %86, i32 0, i32 1
  store i32 %82, ptr %87, align 4, !tbaa !18
  br label %88

88:                                               ; preds = %75
  %89 = load i32, ptr %9, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %9, align 4, !tbaa !9
  br label %42, !llvm.loop !19

91:                                               ; preds = %46
  %92 = load i32, ptr %4, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %"struct.std::pair.0", ptr @L, i64 %93
  call void @_ZSt4sortIPSt4pairIiS0_IiiEEEvT_S4_(ptr noundef @L, ptr noundef %94)
  %95 = load i32, ptr %3, align 4, !tbaa !9
  %96 = xor i32 %95, 1
  store i32 %96, ptr %3, align 4, !tbaa !9
  %97 = load i32, ptr %3, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %98
  %100 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr getelementptr inbounds (%"struct.std::pair.0", ptr @L, i32 0, i32 1), i32 0, i32 1), align 4, !tbaa !18
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [262144 x i32], ptr %99, i64 0, i64 %101
  store i32 0, ptr %102, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %175, %91
  %104 = load i32, ptr %10, align 4, !tbaa !9
  %105 = load i32, ptr %4, align 4, !tbaa !9
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %178

108:                                              ; preds = %103
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %110
  %112 = getelementptr inbounds %"struct.std::pair.0", ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 4, !tbaa !14
  %114 = load i32, ptr %10, align 4, !tbaa !9
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %116
  %118 = getelementptr inbounds %"struct.std::pair.0", ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !14
  %120 = icmp eq i32 %113, %119
  br i1 %120, label %121, label %161

121:                                              ; preds = %108
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %123
  %125 = getelementptr inbounds %"struct.std::pair.0", ptr %124, i32 0, i32 1
  %126 = getelementptr inbounds %"struct.std::pair", ptr %125, i32 0, i32 0
  %127 = load i32, ptr %126, align 4, !tbaa !17
  %128 = load i32, ptr %10, align 4, !tbaa !9
  %129 = sub nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %130
  %132 = getelementptr inbounds %"struct.std::pair.0", ptr %131, i32 0, i32 1
  %133 = getelementptr inbounds %"struct.std::pair", ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !17
  %135 = icmp eq i32 %127, %134
  br i1 %135, label %136, label %161

136:                                              ; preds = %121
  %137 = load i32, ptr %3, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %138
  %140 = load i32, ptr %10, align 4, !tbaa !9
  %141 = sub nsw i32 %140, 1
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %142
  %144 = getelementptr inbounds %"struct.std::pair.0", ptr %143, i32 0, i32 1
  %145 = getelementptr inbounds %"struct.std::pair", ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !18
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [262144 x i32], ptr %139, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !9
  %150 = load i32, ptr %3, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %151
  %153 = load i32, ptr %10, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %154
  %156 = getelementptr inbounds %"struct.std::pair.0", ptr %155, i32 0, i32 1
  %157 = getelementptr inbounds %"struct.std::pair", ptr %156, i32 0, i32 1
  %158 = load i32, ptr %157, align 4, !tbaa !18
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [262144 x i32], ptr %152, i64 0, i64 %159
  store i32 %149, ptr %160, align 4, !tbaa !9
  br label %174

161:                                              ; preds = %121, %108
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = load i32, ptr %3, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %164
  %166 = load i32, ptr %10, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %167
  %169 = getelementptr inbounds %"struct.std::pair.0", ptr %168, i32 0, i32 1
  %170 = getelementptr inbounds %"struct.std::pair", ptr %169, i32 0, i32 1
  %171 = load i32, ptr %170, align 4, !tbaa !18
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [262144 x i32], ptr %165, i64 0, i64 %172
  store i32 %162, ptr %173, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %161, %136
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %10, align 4, !tbaa !9
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %10, align 4, !tbaa !9
  br label %103, !llvm.loop !20

178:                                              ; preds = %107
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %6, align 4, !tbaa !9
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %6, align 4, !tbaa !9
  %182 = load i32, ptr %7, align 4, !tbaa !9
  %183 = shl i32 %182, 1
  store i32 %183, ptr %7, align 4, !tbaa !9
  br label %35, !llvm.loop !21

184:                                              ; preds = %40
  %185 = load ptr, ptr %2, align 8, !tbaa !5
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %185)
  %187 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %186, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %188

188:                                              ; preds = %206, %184
  %189 = load i32, ptr %11, align 4, !tbaa !9
  %190 = load i32, ptr %4, align 4, !tbaa !9
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %209

193:                                              ; preds = %188
  %194 = load i32, ptr %11, align 4, !tbaa !9
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %194)
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %195, ptr noundef @.str)
  %197 = load i32, ptr %3, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %198
  %200 = load i32, ptr %11, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [262144 x i32], ptr %199, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !9
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %196, i32 noundef %203)
  %205 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %204, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %206

206:                                              ; preds = %193
  %207 = load i32, ptr %11, align 4, !tbaa !9
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %11, align 4, !tbaa !9
  br label %188, !llvm.loop !22

209:                                              ; preds = %192
  %210 = load i32, ptr %3, align 4, !tbaa !9
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 %210
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #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) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiS0_IiiEEEvT_S4_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 = { inlinehint 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 = { "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 #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !10, i64 0}
!15 = !{!"_ZTSSt4pairIiS_IiiEE", !10, i64 0, !16, i64 4}
!16 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!17 = !{!15, !10, i64 4}
!18 = !{!15, !10, i64 8}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


; 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.0" = type { i32, %"struct.std::pair" }
%"struct.std::pair" = type { i32, i32 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@p = external dso_local local_unnamed_addr global [2 x [262144 x i32]], align 16
@L = external dso_local global [262144 x %"struct.std::pair.0"], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z14getSuffixArrayRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #0 {
  %2 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #4
  %3 = trunc i64 %2 to i32
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge68

.lr.ph.preheader:                                 ; preds = %1
  %wide.trip.count = and i64 %2, 2147483647
  br label %.lr.ph

.preheader58:                                     ; preds = %.lr.ph
  br i1 %4, label %.preheader.lr.ph, label %._crit_edge68

.preheader.lr.ph:                                 ; preds = %.preheader58
  %sext = and i64 %2, 2147483647
  %5 = getelementptr inbounds %"struct.std::pair.0", ptr @L, i64 %sext
  %.not = icmp eq i32 %3, 1
  br i1 %.not, label %._crit_edge68.loopexit, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %6 = and i64 %2, 2147483647
  %wide.trip.count86 = and i64 %2, 2147483647
  br label %.lr.ph61.us

.lr.ph64.us:                                      ; preds = %51
  tail call void @_ZSt4sortIPSt4pairIiS0_IiiEEEvT_S4_(ptr noundef nonnull @L, ptr noundef nonnull %5)
  %7 = xor i32 %.05566.us, 1
  %8 = zext nneg i32 %7 to i64
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @L, i64 8), align 8, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %8, i64 %10
  store i32 0, ptr %11, align 4, !tbaa !11
  %.pre = load i32, ptr @L, align 16, !tbaa !12
  br label %12

12:                                               ; preds = %.lr.ph64.us, %41
  %13 = phi i32 [ %.pre, %.lr.ph64.us ], [ %15, %41 ]
  %indvars.iv88 = phi i64 [ 1, %.lr.ph64.us ], [ %indvars.iv.next89, %41 ]
  %14 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %indvars.iv88
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = add nsw i64 %indvars.iv88, -1
  %17 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %16
  %18 = icmp eq i32 %15, %13
  br i1 %18, label %19, label %25

19:                                               ; preds = %12
  %20 = getelementptr inbounds i8, ptr %14, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %22 = getelementptr inbounds i8, ptr %17, i64 4
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = icmp eq i32 %21, %23
  br i1 %24, label %31, label %25

25:                                               ; preds = %19, %12
  %26 = getelementptr inbounds i8, ptr %14, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %8, i64 %28
  %30 = trunc nuw nsw i64 %indvars.iv88 to i32
  store i32 %30, ptr %29, align 4, !tbaa !11
  br label %41

31:                                               ; preds = %19
  %32 = getelementptr inbounds i8, ptr %17, i64 8
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %8, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = getelementptr inbounds i8, ptr %14, i64 8
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %8, i64 %39
  store i32 %36, ptr %40, align 4, !tbaa !11
  br label %41

41:                                               ; preds = %31, %25
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count86
  br i1 %exitcond92.not, label %._crit_edge65.us, label %12, !llvm.loop !14

42:                                               ; preds = %.lr.ph61.us, %51
  %indvars.iv83 = phi i64 [ 0, %.lr.ph61.us ], [ %indvars.iv.next84, %51 ]
  %43 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %56, i64 %indvars.iv83
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %45 = getelementptr inbounds [262144 x %"struct.std::pair.0"], ptr @L, i64 0, i64 %indvars.iv83
  store i32 %44, ptr %45, align 4, !tbaa !12
  %46 = add nsw i64 %indvars.iv83, %57
  %47 = icmp slt i64 %46, %6
  br i1 %47, label %48, label %51

48:                                               ; preds = %42
  %49 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %56, i64 %46
  %50 = load i32, ptr %49, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %48, %42
  %52 = phi i32 [ %50, %48 ], [ -1, %42 ]
  %53 = getelementptr inbounds i8, ptr %45, i64 4
  store i32 %52, ptr %53, align 4, !tbaa !13
  %54 = getelementptr inbounds i8, ptr %45, i64 8
  %55 = trunc nuw nsw i64 %indvars.iv83 to i32
  store i32 %55, ptr %54, align 4, !tbaa !5
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count86
  br i1 %exitcond87.not, label %.lr.ph64.us, label %42, !llvm.loop !16

.lr.ph61.us:                                      ; preds = %._crit_edge65.us, %.preheader.us.preheader
  %.05267.us = phi i32 [ %58, %._crit_edge65.us ], [ 1, %.preheader.us.preheader ]
  %.05566.us = phi i32 [ %7, %._crit_edge65.us ], [ 0, %.preheader.us.preheader ]
  %56 = zext nneg i32 %.05566.us to i64
  %57 = sext i32 %.05267.us to i64
  br label %42

._crit_edge65.us:                                 ; preds = %41
  %58 = shl i32 %.05267.us, 1
  %59 = ashr exact i32 %58, 1
  %60 = icmp slt i32 %59, %3
  br i1 %60, label %.lr.ph61.us, label %._crit_edge68, !llvm.loop !17

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %61 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %62 = load i8, ptr %61, align 1, !tbaa !18
  %63 = sext i8 %62 to i32
  %64 = add nsw i32 %63, -65
  %65 = getelementptr inbounds [262144 x i32], ptr @p, i64 0, i64 %indvars.iv
  store i32 %64, ptr %65, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader58, label %.lr.ph, !llvm.loop !19

._crit_edge68.loopexit:                           ; preds = %.preheader.lr.ph
  %66 = load i32, ptr @p, align 16, !tbaa !11
  store i32 %66, ptr @L, align 16, !tbaa !12
  store i32 -1, ptr getelementptr inbounds (i8, ptr @L, i64 4), align 4, !tbaa !13
  store i32 0, ptr getelementptr inbounds (i8, ptr @L, i64 8), align 8, !tbaa !5
  tail call void @_ZSt4sortIPSt4pairIiS0_IiiEEEvT_S4_(ptr noundef nonnull @L, ptr noundef nonnull %5)
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @L, i64 8), align 8, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 1, i64 %68
  store i32 0, ptr %69, align 4, !tbaa !11
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge65.us, %1, %._crit_edge68.loopexit, %.preheader58
  %.055.lcssa = phi i32 [ 0, %.preheader58 ], [ 1, %._crit_edge68.loopexit ], [ 0, %1 ], [ %7, %._crit_edge65.us ]
  %70 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %0)
  %71 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br i1 %4, label %.lr.ph78, label %._crit_edge

.lr.ph78:                                         ; preds = %._crit_edge68
  %72 = zext nneg i32 %.055.lcssa to i64
  %wide.trip.count101 = and i64 %2, 2147483647
  br label %73

._crit_edge:                                      ; preds = %73, %._crit_edge68
  ret i32 %.055.lcssa

73:                                               ; preds = %.lr.ph78, %73
  %indvars.iv98 = phi i64 [ 0, %.lr.ph78 ], [ %indvars.iv.next99, %73 ]
  %74 = trunc nuw nsw i64 %indvars.iv98 to i32
  %75 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %74)
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef nonnull @.str)
  %77 = getelementptr inbounds [2 x [262144 x i32]], ptr @p, i64 0, i64 %72, i64 %indvars.iv98
  %78 = load i32, ptr %77, align 4, !tbaa !11
  %79 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %76, i32 noundef %78)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count101
  br i1 %exitcond102.not, label %._crit_edge, label %73, !llvm.loop !20
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiS0_IiiEEEvT_S4_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

attributes #0 = { 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 #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 = { inlinehint 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 = { "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, !7, i64 8}
!6 = !{!"_ZTSSt4pairIiS_IiiEE", !7, i64 0, !10, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!8, !8, i64 0}
!19 = distinct !{!19, !15}
!20 = distinct !{!20, !15}


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