; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2017-18/Jan 2018/Gold (18 Jan Gold 1)

; 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<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.DSU = type { [100001 x i32], [100001 x i32] }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::array" = type { [3 x i32] }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@ans = external dso_local global [100001 x i32], align 16
@ed = external dso_local global %"class.std::vector", align 8
@q = external dso_local global %"class.std::vector", align 8
@D = external dso_local global %struct.DSU, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::array", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::array", align 4
  %11 = alloca %"class.std::reverse_iterator", align 8
  %12 = alloca %"class.std::reverse_iterator", align 8
  %13 = alloca %"class.std::reverse_iterator", align 8
  %14 = alloca %"class.std::reverse_iterator", align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca %"struct.std::array", align 4
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %21 = load ptr, ptr @stdin, align 8, !tbaa !5
  %22 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.4, ptr noundef %21)
  %23 = load ptr, ptr @stdout, align 8, !tbaa !5
  %24 = call ptr @freopen(ptr noundef @.str.5, ptr noundef @.str.6, ptr noundef %23)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %43, %0
  %28 = load i32, ptr %2, align 4, !tbaa !9
  %29 = load i32, ptr @N, align 4, !tbaa !9
  %30 = sub nsw i32 %29, 1
  %31 = icmp slt i32 %28, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %46

33:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #8
  %37 = getelementptr inbounds %"struct.std::array", ptr %6, i32 0, i32 0
  %38 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %38, ptr %37, align 4, !tbaa !9
  %39 = getelementptr inbounds i32, ptr %37, i64 1
  %40 = load i32, ptr %3, align 4, !tbaa !9
  store i32 %40, ptr %39, align 4, !tbaa !9
  %41 = getelementptr inbounds i32, ptr %37, i64 2
  %42 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %42, ptr %41, align 4, !tbaa !9
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @ed, ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %43

43:                                               ; preds = %33
  %44 = load i32, ptr %2, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !9
  br label %27, !llvm.loop !11

46:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %61, %46
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = load i32, ptr @Q, align 4, !tbaa !9
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %64

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #8
  %55 = getelementptr inbounds %"struct.std::array", ptr %10, i32 0, i32 0
  %56 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %56, ptr %55, align 4, !tbaa !9
  %57 = getelementptr inbounds i32, ptr %55, i64 1
  %58 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %58, ptr %57, align 4, !tbaa !9
  %59 = getelementptr inbounds i32, ptr %55, i64 2
  %60 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %60, ptr %59, align 4, !tbaa !9
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @q, ptr noundef nonnull align 4 dereferenceable(12) %10)
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %61

61:                                               ; preds = %52
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %7, align 4, !tbaa !9
  br label %47, !llvm.loop !13

64:                                               ; preds = %51
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  call void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS4_SaIS4_EEEEEEvT_SB_(ptr noundef %11, ptr noundef %12)
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  call void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS4_SaIS4_EEEEEEvT_SB_(ptr noundef %13, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store ptr @q, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %65 = call ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  %66 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %65, ptr %66, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %67 = call ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  %68 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %67, ptr %68, align 8
  br label %69

69:                                               ; preds = %115, %64
  %70 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #8
  br i1 %70, label %72, label %71

71:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %117

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #8
  %73 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %73, i64 12, i1 false), !tbaa.struct !14
  br label %74

74:                                               ; preds = %90, %72
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm3EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  %77 = trunc i64 %76 to i32
  %78 = icmp slt i32 %75, %77
  br i1 %78, label %79, label %88

79:                                               ; preds = %74
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %81) #8
  %83 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %82, i64 noundef 0) #8
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %19, i64 noundef 0) #8
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp sge i32 %84, %86
  br label %88

88:                                               ; preds = %79, %74
  %89 = phi i1 [ false, %74 ], [ %87, %79 ]
  br i1 %89, label %90, label %104

90:                                               ; preds = %88
  %91 = load i32, ptr %15, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %92) #8
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %93, i64 noundef 1) #8
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = load i32, ptr %15, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %97) #8
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %98, i64 noundef 2) #8
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = call noundef zeroext i1 @_ZN3DSUILi100001EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(800008) @D, i32 noundef %95, i32 noundef %100)
  %102 = load i32, ptr %15, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %15, align 4, !tbaa !9
  br label %74, !llvm.loop !16

104:                                              ; preds = %88
  %105 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %19, i64 noundef 1) #8
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = call noundef i32 @_ZN3DSUILi100001EE3getEi(ptr noundef nonnull align 4 dereferenceable(800008) @D, i32 noundef %106)
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (%struct.DSU, ptr @D, i32 0, i32 1), i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %19, i64 noundef 2) #8
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %113
  store i32 %110, ptr %114, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  br label %115

115:                                              ; preds = %104
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #8
  br label %69

117:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %131, %117
  %119 = load i32, ptr %20, align 4, !tbaa !9
  %120 = load i32, ptr @Q, align 4, !tbaa !9
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %134

123:                                              ; preds = %118
  %124 = load i32, ptr %20, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = sub nsw i32 %127, 1
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %128)
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %129, ptr noundef @.str.7)
  br label %131

131:                                              ; preds = %123
  %132 = load i32, ptr %20, align 4, !tbaa !9
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %20, align 4, !tbaa !9
  br label %118, !llvm.loop !17

134:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %135 = load i32, ptr %1, align 4
  ret i32 %135
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

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

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

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

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

; 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) #7

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSUILi100001EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(800008), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3DSUILi100001EE3getEi(ptr noundef nonnull align 4 dereferenceable(800008), i32 noundef) #3 align 2

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

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

attributes #0 = { mustprogress norecurse 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i64 0, i64 12, !15}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; 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<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 3>, std::allocator<std::array<int, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.DSU = type { [100001 x i32], [100001 x i32] }
%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::array" = type { [3 x i32] }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [100001 x i32], align 16
@ed = external dso_local global %"class.std::vector", align 8
@q = external dso_local global %"class.std::vector", align 8
@D = external dso_local global %struct.DSU, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::array", align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::array", align 4
  %8 = alloca %"class.std::reverse_iterator", align 8
  %9 = alloca %"class.std::reverse_iterator", align 8
  %10 = alloca %"class.std::reverse_iterator", align 8
  %11 = alloca %"class.std::reverse_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"struct.std::array", align 4
  %15 = load ptr, ptr @stdin, align 8, !tbaa !5
  %16 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, ptr noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = tail call ptr @freopen(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, ptr noundef %17)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  %21 = load i32, ptr @N, align 4, !tbaa !9
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %0
  %23 = getelementptr inbounds i8, ptr %4, i64 4
  %24 = getelementptr inbounds i8, ptr %4, i64 8
  br label %29

.preheader:                                       ; preds = %29, %0
  %25 = load i32, ptr @Q, align 4, !tbaa !9
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph19, label %._crit_edge

.lr.ph19:                                         ; preds = %.preheader
  %27 = getelementptr inbounds i8, ptr %7, i64 4
  %28 = getelementptr inbounds i8, ptr %7, i64 8
  br label %43

29:                                               ; preds = %.lr.ph, %29
  %.01417 = phi i32 [ 0, %.lr.ph ], [ %36, %29 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #8
  %33 = load i32, ptr %3, align 4, !tbaa !9
  store i32 %33, ptr %4, align 4, !tbaa !9
  %34 = load i32, ptr %1, align 4, !tbaa !9
  store i32 %34, ptr %23, align 4, !tbaa !9
  %35 = load i32, ptr %2, align 4, !tbaa !9
  store i32 %35, ptr %24, align 4, !tbaa !9
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @ed, ptr noundef nonnull align 4 dereferenceable(12) %4)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %36 = add nuw nsw i32 %.01417, 1
  %37 = load i32, ptr @N, align 4, !tbaa !9
  %38 = add nsw i32 %37, -1
  %39 = icmp slt i32 %36, %38
  br i1 %39, label %29, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %43, %.preheader
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  call void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS4_SaIS4_EEEEEEvT_SB_(ptr noundef nonnull %8, ptr noundef nonnull %9)
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %10, ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  call void @_ZSt4sortISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS4_SaIS4_EEEEEEvT_SB_(ptr noundef nonnull %10, ptr noundef nonnull %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  %40 = call ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  store ptr %40, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #8
  %41 = call ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @q) #8
  store ptr %41, ptr %13, align 8
  %42 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br i1 %42, label %.lr.ph27, label %._crit_edge28

43:                                               ; preds = %.lr.ph19, %43
  %.01618 = phi i32 [ 0, %.lr.ph19 ], [ %48, %43 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #8
  %46 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %46, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %47, ptr %27, align 4, !tbaa !9
  store i32 %.01618, ptr %28, align 4, !tbaa !9
  call void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @q, ptr noundef nonnull align 4 dereferenceable(12) %7)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %48 = add nuw nsw i32 %.01618, 1
  %49 = load i32, ptr @Q, align 4, !tbaa !9
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %43, label %._crit_edge, !llvm.loop !13

._crit_edge28:                                    ; preds = %.critedge, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  %51 = load i32, ptr @Q, align 4, !tbaa !9
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph31, label %._crit_edge32

.lr.ph27:                                         ; preds = %._crit_edge, %.critedge
  %.01525 = phi i32 [ %.1.lcssa, %.critedge ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %14) #8
  %53 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %14, ptr noundef nonnull align 4 dereferenceable(12) %53, i64 12, i1 false), !tbaa.struct !14
  %54 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm3EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  %55 = trunc i64 %54 to i32
  %56 = icmp slt i32 %.01525, %55
  br i1 %56, label %.lr.ph22.preheader, label %.critedge

.lr.ph22.preheader:                               ; preds = %.lr.ph27
  %57 = sext i32 %.01525 to i64
  br label %.lr.ph22

.lr.ph22:                                         ; preds = %.lr.ph22.preheader, %63
  %indvars.iv = phi i64 [ %57, %.lr.ph22.preheader ], [ %indvars.iv.next, %63 ]
  %58 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #8
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %58, i64 noundef 0) #8
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %14, i64 noundef 0) #8
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %.not = icmp slt i32 %60, %62
  br i1 %.not, label %.critedge.loopexit, label %63

63:                                               ; preds = %.lr.ph22
  %64 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #8
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %64, i64 noundef 1) #8
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ed, i64 noundef %indvars.iv) #8
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %67, i64 noundef 2) #8
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = call noundef zeroext i1 @_ZN3DSUILi100001EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(800008) @D, i32 noundef %66, i32 noundef %69)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %71 = call noundef i64 @_ZNKSt6vectorISt5arrayIiLm3EESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @ed) #8
  %sext = shl i64 %71, 32
  %72 = ashr exact i64 %sext, 32
  %73 = icmp slt i64 %indvars.iv.next, %72
  br i1 %73, label %.lr.ph22, label %.critedge.loopexit, !llvm.loop !16

.critedge.loopexit:                               ; preds = %63, %.lr.ph22
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv, %.lr.ph22 ], [ %indvars.iv.next, %63 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.lr.ph27
  %.1.lcssa = phi i32 [ %.01525, %.lr.ph27 ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %14, i64 noundef 1) #8
  %75 = load i32, ptr %74, align 4, !tbaa !9
  %76 = call noundef i32 @_ZN3DSUILi100001EE3getEi(ptr noundef nonnull align 4 dereferenceable(800008) @D, i32 noundef %75)
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @D, i64 400004), i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12) %14, i64 noundef 2) #8
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %82
  store i32 %79, ptr %83, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #8
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  %85 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm3EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #8
  br i1 %85, label %.lr.ph27, label %._crit_edge28

._crit_edge32:                                    ; preds = %.lr.ph31, %._crit_edge28
  ret i32 0

.lr.ph31:                                         ; preds = %._crit_edge28, %.lr.ph31
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %.lr.ph31 ], [ 0, %._crit_edge28 ]
  %86 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv34
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = add nsw i32 %87, -1
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull @.str.7)
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %91 = load i32, ptr @Q, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = icmp slt i64 %indvars.iv.next35, %92
  br i1 %93, label %.lr.ph31, label %._crit_edge32, !llvm.loop !17
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress 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) #7

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt5arrayIiLm3EESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm3EEixEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3DSUILi100001EE5uniteEii(ptr noundef nonnull align 4 dereferenceable(800008), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3DSUILi100001EE3getEi(ptr noundef nonnull align 4 dereferenceable(800008), i32 noundef) local_unnamed_addr #3 align 2

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

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

attributes #0 = { mustprogress norecurse 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 = { "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i64 0, i64 12, !15}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass