; LLVM IR from tangjz/acm-icpc :: codeforces/complete/936E.ll (Z7getRooti)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@tot = external dso_local global i32, align 4
@ord = external dso_local global [300001 x i32], align 16
@g = external dso_local global [300001 x %"class.std::vector"], align 16
@banG = external dso_local global [300001 x i8], align 16
@_ZZ7getRootiE2fa = external hidden global [300001 x i32], align 16
@_ZZ7getRootiE2sz = external hidden global [300001 x i32], align 16
@_ZZ7getRootiE2mx = external hidden global [300001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z7getRooti(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %15
  store i32 -1, ptr %16, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @tot, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr @tot, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %20
  store i32 %17, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %85, %1
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr @tot, align 4, !tbaa !5
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %88

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  store i32 %31, ptr %5, align 4, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %33
  store i32 0, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %36
  store i32 0, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [300001 x %"class.std::vector"], ptr @g, i64 0, i64 %39
  store ptr %40, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %41 = load ptr, ptr %6, align 8, !tbaa !9
  %42 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #4
  %43 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %44 = load ptr, ptr %6, align 8, !tbaa !9
  %45 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #4
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  br label %47

47:                                               ; preds = %82, %27
  %48 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  store ptr %51, ptr %9, align 8, !tbaa !9
  %52 = load ptr, ptr %9, align 8, !tbaa !9
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp eq i32 %53, %57
  br i1 %58, label %66, label %59

59:                                               ; preds = %50
  %60 = load ptr, ptr %9, align 8, !tbaa !9
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [300001 x i8], ptr @banG, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !11, !range !13, !noundef !14
  %65 = trunc i8 %64 to i1
  br i1 %65, label %66, label %67

66:                                               ; preds = %59, %50
  store i32 6, ptr %4, align 4
  br label %79

67:                                               ; preds = %59
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %71
  store i32 %68, ptr %72, align 4, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !9
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr @tot, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr @tot, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %77
  store i32 %74, ptr %78, align 4, !tbaa !5
  store i32 0, ptr %4, align 4
  br label %79

79:                                               ; preds = %67, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %80 = load i32, ptr %4, align 4
  switch i32 %80, label %169 [
    i32 0, label %81
    i32 6, label %82
  ]

81:                                               ; preds = %79
  br label %82

82:                                               ; preds = %81, %79
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %47

84:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %3, align 4, !tbaa !5
  br label %22, !llvm.loop !15

88:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %89 = load i32, ptr @tot, align 4, !tbaa !5
  store i32 %89, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %90 = load i32, ptr @tot, align 4, !tbaa !5
  store i32 %90, ptr %11, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %164, %88
  %92 = load i32, ptr %11, align 4, !tbaa !5
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %167

95:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %96 = load i32, ptr %11, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %12, align 4, !tbaa !5
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %103 = load i32, ptr @tot, align 4, !tbaa !5
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %106, align 4, !tbaa !5
  %109 = sub nsw i32 %103, %108
  store i32 %109, ptr %13, align 4, !tbaa !5
  %110 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %102, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %115 = load i32, ptr %12, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = icmp slt i32 %118, %119
  br i1 %120, label %121, label %127

121:                                              ; preds = %95
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  store i32 %125, ptr %10, align 4, !tbaa !5
  %126 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %126, ptr %2, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %121, %95
  %128 = load i32, ptr %12, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = icmp ne i32 %131, -1
  br i1 %132, label %133, label %163

133:                                              ; preds = %127
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = add nsw i32 %144, %137
  store i32 %145, ptr %143, align 4, !tbaa !5
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %150
  %152 = load i32, ptr %12, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %153
  %155 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %151, ptr noundef nonnull align 4 dereferenceable(4) %154)
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %161
  store i32 %156, ptr %162, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %133, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %164

164:                                              ; preds = %163
  %165 = load i32, ptr %11, align 4, !tbaa !5
  %166 = add nsw i32 %165, -1
  store i32 %166, ptr %11, align 4, !tbaa !5
  br label %91, !llvm.loop !17

167:                                              ; preds = %94
  %168 = load i32, ptr %2, align 4, !tbaa !5
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  ret i32 %168

169:                                              ; preds = %79
  unreachable
}

; 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 dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 = { 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 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@tot = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local local_unnamed_addr global [300001 x i32], align 16
@g = external dso_local global [300001 x %"class.std::vector"], align 16
@banG = external dso_local local_unnamed_addr global [300001 x i8], align 16
@_ZZ7getRootiE2fa = external hidden local_unnamed_addr global [300001 x i32], align 16
@_ZZ7getRootiE2sz = external hidden global [300001 x i32], align 16
@_ZZ7getRootiE2mx = external hidden global [300001 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z7getRooti(i32 noundef %0) local_unnamed_addr #0 {
.lr.ph46.preheader:
  %1 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %2 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %3 = alloca i32, align 4
  %4 = sext i32 %0 to i64
  %5 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %4
  store i32 -1, ptr %5, align 4, !tbaa !5
  store i32 1, ptr @tot, align 4, !tbaa !5
  store i32 %0, ptr getelementptr inbounds (i8, ptr @ord, i64 4), align 4, !tbaa !5
  br label %.lr.ph46

.preheader:                                       ; preds = %._crit_edge
  %.not4047 = icmp eq i32 %17, 0
  br i1 %.not4047, label %._crit_edge52, label %.lr.ph51.preheader

.lr.ph51.preheader:                               ; preds = %.preheader
  %6 = sext i32 %17 to i64
  br label %.lr.ph51

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %._crit_edge
  %indvars.iv = phi i64 [ 1, %.lr.ph46.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %7 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %9
  store i32 0, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %9
  store i32 0, ptr %11, align 4, !tbaa !5
  %12 = getelementptr inbounds [300001 x %"class.std::vector"], ptr @g, i64 0, i64 %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %13 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  store ptr %13, ptr %1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %14 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  store ptr %14, ptr %2, align 8
  %15 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  br i1 %15, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph46
  %16 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %9
  br label %19

._crit_edge:                                      ; preds = %36, %.lr.ph46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @tot, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %.not.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not.not, label %.lr.ph46, label %.preheader, !llvm.loop !9

19:                                               ; preds = %.lr.ph, %36
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = load i32, ptr %16, align 4, !tbaa !5
  %23 = icmp eq i32 %21, %22
  br i1 %23, label %36, label %24

24:                                               ; preds = %19
  %25 = sext i32 %21 to i64
  %26 = getelementptr inbounds [300001 x i8], ptr @banG, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !11, !range !13, !noundef !14
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %36, label %29

29:                                               ; preds = %24
  %30 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %25
  store i32 %8, ptr %30, align 4, !tbaa !5
  %31 = load i32, ptr %20, align 4, !tbaa !5
  %32 = load i32, ptr @tot, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @tot, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %34
  store i32 %31, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %19, %24, %29
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #4
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  br i1 %38, label %19, label %._crit_edge

._crit_edge52:                                    ; preds = %65, %.preheader
  %.0.lcssa = phi i32 [ %0, %.preheader ], [ %spec.select42, %65 ]
  ret i32 %.0.lcssa

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %65
  %indvars.iv56 = phi i64 [ %6, %.lr.ph51.preheader ], [ %indvars.iv.next57, %65 ]
  %.050 = phi i32 [ %0, %.lr.ph51.preheader ], [ %spec.select42, %65 ]
  %.03348 = phi i32 [ %17, %.lr.ph51.preheader ], [ %spec.select, %65 ]
  %39 = getelementptr inbounds [300001 x i32], ptr @ord, i64 0, i64 %indvars.iv56
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %41
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %44, align 4, !tbaa !5
  %47 = sub nsw i32 %43, %46
  store i32 %47, ptr %3, align 4, !tbaa !5
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %42, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %49 = load i32, ptr %48, align 4, !tbaa !5
  store i32 %49, ptr %42, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %50 = icmp slt i32 %49, %.03348
  %spec.select = call i32 @llvm.smin.i32(i32 %49, i32 %.03348)
  %spec.select42 = select i1 %50, i32 %40, i32 %.050
  %51 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2fa, i64 0, i64 %41
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not41 = icmp eq i32 %52, -1
  br i1 %.not41, label %65, label %53

53:                                               ; preds = %.lr.ph51
  %54 = load i32, ptr %44, align 4, !tbaa !5
  %55 = sext i32 %52 to i64
  %56 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2sz, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, %54
  store i32 %58, ptr %56, align 4, !tbaa !5
  %59 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %55
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %59, ptr noundef nonnull align 4 dereferenceable(4) %44)
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %51, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [300001 x i32], ptr @_ZZ7getRootiE2mx, i64 0, i64 %63
  store i32 %61, ptr %64, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %53, %.lr.ph51
  %indvars.iv.next57 = add nsw i64 %indvars.iv56, -1
  %.not40 = icmp eq i64 %indvars.iv.next57, 0
  br i1 %.not40, label %._crit_edge52, label %.lr.ph51, !llvm.loop !15
}

; Function Attrs: mustprogress 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 dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3

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


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