; LLVM IR from Aryansh-S/USACO :: USACO/2019/Dec/Gold (milkvisits)

; 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::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.HLD = type <{ [100005 x %"class.std::vector.3"], %"class.std::vector.3", [100005 x i32], [100005 x i32], [100005 x i32], [100005 x i32], [100005 x i32], i32, %struct.SEG, i32, [4 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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 }
%struct.SEG = type { i32, i32, %"class.std::vector.3" }
%"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 }
%"struct.std::array" = type { [5 x i32] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@CLK = external dso_local global %"class.std::chrono::time_point", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@qr = external dso_local global %"class.std::vector", align 8
@_Z3ansB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@h = external dso_local global %struct.HLD, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = 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

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

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::chrono::time_point", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::array", 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
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::array", align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %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 ptr, align 8
  %20 = alloca %"class.std::__cxx11::basic_string", align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %23 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.7)
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %30

25:                                               ; preds = %0
  %26 = load ptr, ptr @stdin, align 8, !tbaa !5
  %27 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.7, ptr noundef %26)
  %28 = load ptr, ptr @stdout, align 8, !tbaa !5
  %29 = call ptr @freopen(ptr noundef @.str.8, ptr noundef @.str.9, ptr noundef %28)
  br label %30

30:                                               ; preds = %25, %0
  %31 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %32 = getelementptr i8, ptr %31, i64 -24
  %33 = load i64, ptr %32, align 8
  %34 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %33
  %35 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef null)
  %36 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #9
  %37 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #9
  %38 = getelementptr inbounds %"class.std::chrono::time_point", ptr %2, i32 0, i32 0
  %39 = getelementptr inbounds %"class.std::chrono::duration", ptr %38, i32 0, i32 0
  store i64 %37, ptr %39, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @CLK, ptr align 8 %2, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #9
  call void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %40 = load i32, ptr @n, align 4, !tbaa !14
  %41 = icmp sgt i32 0, %40
  %42 = zext i1 %41 to i32
  %43 = sub nsw i32 0, %42
  store i32 %43, ptr %3, align 4, !tbaa !14
  br label %44

44:                                               ; preds = %70, %30
  %45 = load i32, ptr %3, align 4, !tbaa !14
  %46 = load i32, ptr @n, align 4, !tbaa !14
  %47 = load i32, ptr @n, align 4, !tbaa !14
  %48 = icmp sgt i32 0, %47
  %49 = zext i1 %48 to i32
  %50 = sub nsw i32 %46, %49
  %51 = icmp ne i32 %45, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %72

53:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  call void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.start.p0(i64 20, ptr %5) #9
  %54 = getelementptr inbounds %"struct.std::array", ptr %5, i32 0, i32 0
  %55 = load i32, ptr %4, align 4, !tbaa !14
  store i32 %55, ptr %54, align 4, !tbaa !14
  %56 = getelementptr inbounds i32, ptr %54, i64 1
  store i32 1, ptr %56, align 4, !tbaa !14
  %57 = getelementptr inbounds i32, ptr %54, i64 2
  store i32 0, ptr %57, align 4, !tbaa !14
  %58 = getelementptr inbounds i32, ptr %54, i64 3
  store i32 0, ptr %58, align 4, !tbaa !14
  %59 = getelementptr inbounds i32, ptr %54, i64 4
  %60 = load i32, ptr %3, align 4, !tbaa !14
  store i32 %60, ptr %59, align 4, !tbaa !14
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qr, ptr noundef nonnull align 4 dereferenceable(20) %5)
  call void @llvm.lifetime.end.p0(i64 20, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  br label %61

61:                                               ; preds = %53
  %62 = load i32, ptr @n, align 4, !tbaa !14
  %63 = icmp sgt i32 0, %62
  br i1 %63, label %64, label %67

64:                                               ; preds = %61
  %65 = load i32, ptr %3, align 4, !tbaa !14
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %3, align 4, !tbaa !14
  br label %70

67:                                               ; preds = %61
  %68 = load i32, ptr %3, align 4, !tbaa !14
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %3, align 4, !tbaa !14
  br label %70

70:                                               ; preds = %67, %64
  %71 = phi ptr [ %3, %64 ], [ %3, %67 ]
  br label %44, !llvm.loop !16

72:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  %73 = load i32, ptr @n, align 4, !tbaa !14
  %74 = sub nsw i32 %73, 1
  %75 = icmp sgt i32 0, %74
  %76 = zext i1 %75 to i32
  %77 = sub nsw i32 0, %76
  store i32 %77, ptr %6, align 4, !tbaa !14
  br label %78

78:                                               ; preds = %106, %72
  %79 = load i32, ptr %6, align 4, !tbaa !14
  %80 = load i32, ptr @n, align 4, !tbaa !14
  %81 = sub nsw i32 %80, 1
  %82 = load i32, ptr @n, align 4, !tbaa !14
  %83 = sub nsw i32 %82, 1
  %84 = icmp sgt i32 0, %83
  %85 = zext i1 %84 to i32
  %86 = sub nsw i32 %81, %85
  %87 = icmp ne i32 %79, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %108

89:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  call void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %90 = load i32, ptr %7, align 4, !tbaa !14
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr %7, align 4, !tbaa !14
  %92 = load i32, ptr %8, align 4, !tbaa !14
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr %8, align 4, !tbaa !14
  %94 = load i32, ptr %7, align 4, !tbaa !14
  %95 = load i32, ptr %8, align 4, !tbaa !14
  call void @_ZN3HLDILi100005ELb0EE3addEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %94, i32 noundef %95)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %96

96:                                               ; preds = %89
  %97 = load i32, ptr @n, align 4, !tbaa !14
  %98 = sub nsw i32 %97, 1
  %99 = icmp sgt i32 0, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %96
  %101 = load i32, ptr %6, align 4, !tbaa !14
  %102 = add nsw i32 %101, -1
  store i32 %102, ptr %6, align 4, !tbaa !14
  br label %106

103:                                              ; preds = %96
  %104 = load i32, ptr %6, align 4, !tbaa !14
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %6, align 4, !tbaa !14
  br label %106

106:                                              ; preds = %103, %100
  %107 = phi ptr [ %6, %100 ], [ %6, %103 ]
  br label %78, !llvm.loop !18

108:                                              ; preds = %88
  call void @_ZN3HLDILi100005ELb0EE4initEi(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  %109 = load i32, ptr @m, align 4, !tbaa !14
  %110 = icmp sgt i32 0, %109
  %111 = zext i1 %110 to i32
  %112 = sub nsw i32 0, %111
  store i32 %112, ptr %9, align 4, !tbaa !14
  br label %113

113:                                              ; preds = %145, %108
  %114 = load i32, ptr %9, align 4, !tbaa !14
  %115 = load i32, ptr @m, align 4, !tbaa !14
  %116 = load i32, ptr @m, align 4, !tbaa !14
  %117 = icmp sgt i32 0, %116
  %118 = zext i1 %117 to i32
  %119 = sub nsw i32 %115, %118
  %120 = icmp ne i32 %114, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %147

122:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  call void @_ZN7aryansh9io_macros2inIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %123 = load i32, ptr %10, align 4, !tbaa !14
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %10, align 4, !tbaa !14
  %125 = load i32, ptr %11, align 4, !tbaa !14
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %11, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 20, ptr %13) #9
  %127 = getelementptr inbounds %"struct.std::array", ptr %13, i32 0, i32 0
  %128 = load i32, ptr %12, align 4, !tbaa !14
  store i32 %128, ptr %127, align 4, !tbaa !14
  %129 = getelementptr inbounds i32, ptr %127, i64 1
  store i32 2, ptr %129, align 4, !tbaa !14
  %130 = getelementptr inbounds i32, ptr %127, i64 2
  %131 = load i32, ptr %10, align 4, !tbaa !14
  store i32 %131, ptr %130, align 4, !tbaa !14
  %132 = getelementptr inbounds i32, ptr %127, i64 3
  %133 = load i32, ptr %11, align 4, !tbaa !14
  store i32 %133, ptr %132, align 4, !tbaa !14
  %134 = getelementptr inbounds i32, ptr %127, i64 4
  %135 = load i32, ptr %9, align 4, !tbaa !14
  store i32 %135, ptr %134, align 4, !tbaa !14
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qr, ptr noundef nonnull align 4 dereferenceable(20) %13)
  call void @llvm.lifetime.end.p0(i64 20, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %136

136:                                              ; preds = %122
  %137 = load i32, ptr @m, align 4, !tbaa !14
  %138 = icmp sgt i32 0, %137
  br i1 %138, label %139, label %142

139:                                              ; preds = %136
  %140 = load i32, ptr %9, align 4, !tbaa !14
  %141 = add nsw i32 %140, -1
  store i32 %141, ptr %9, align 4, !tbaa !14
  br label %145

142:                                              ; preds = %136
  %143 = load i32, ptr %9, align 4, !tbaa !14
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %9, align 4, !tbaa !14
  br label %145

145:                                              ; preds = %142, %139
  %146 = phi ptr [ %9, %139 ], [ %9, %142 ]
  br label %113, !llvm.loop !19

147:                                              ; preds = %121
  %148 = call ptr @_ZSt5beginISt6vectorISt5arrayIiLm5EESaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @qr)
  %149 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %148, ptr %149, align 8
  %150 = call ptr @_ZSt3endISt6vectorISt5arrayIiLm5EESaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @qr)
  %151 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %150, ptr %151, align 8
  %152 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8
  %154 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %153, ptr %155)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  store ptr @qr, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %156 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @qr) #9
  %157 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %156, ptr %157, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %158 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @qr) #9
  %159 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %158, ptr %159, align 8
  br label %160

160:                                              ; preds = %196, %147
  %161 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #9
  br i1 %161, label %163, label %162

162:                                              ; preds = %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %198

163:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %164 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  store ptr %164, ptr %19, align 8, !tbaa !5
  %165 = load ptr, ptr %19, align 8, !tbaa !5
  %166 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %165, i64 noundef 1) #9
  %167 = load i32, ptr %166, align 4, !tbaa !14
  %168 = icmp eq i32 %167, 1
  br i1 %168, label %169, label %176

169:                                              ; preds = %163
  %170 = load ptr, ptr %19, align 8, !tbaa !5
  %171 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %170, i64 noundef 4) #9
  %172 = load i32, ptr %171, align 4, !tbaa !14
  %173 = load ptr, ptr %19, align 8, !tbaa !5
  %174 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %173, i64 noundef 0) #9
  %175 = load i32, ptr %174, align 4, !tbaa !14
  call void @_ZN3HLDILi100005ELb0EE3updEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %172, i32 noundef %175)
  br label %195

176:                                              ; preds = %163
  %177 = load ptr, ptr %19, align 8, !tbaa !5
  %178 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %177, i64 noundef 2) #9
  %179 = load i32, ptr %178, align 4, !tbaa !14
  %180 = load ptr, ptr %19, align 8, !tbaa !5
  %181 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %180, i64 noundef 3) #9
  %182 = load i32, ptr %181, align 4, !tbaa !14
  %183 = call noundef i32 @_ZN3HLDILi100005ELb0EE7qrypathEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %179, i32 noundef %182)
  %184 = load ptr, ptr %19, align 8, !tbaa !5
  %185 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %184, i64 noundef 0) #9
  %186 = load i32, ptr %185, align 4, !tbaa !14
  %187 = icmp eq i32 %183, %186
  %188 = zext i1 %187 to i64
  %189 = select i1 %187, i8 49, i8 48
  %190 = load ptr, ptr %19, align 8, !tbaa !5
  %191 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %190, i64 noundef 4) #9
  %192 = load i32, ptr %191, align 4, !tbaa !14
  %193 = sext i32 %192 to i64
  %194 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3ansB5cxx11, i64 noundef %193)
  store i8 %189, ptr %194, align 1, !tbaa !20
  br label %195

195:                                              ; preds = %176, %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  br label %196

196:                                              ; preds = %195
  %197 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #9
  br label %160

198:                                              ; preds = %162
  %199 = load i32, ptr @m, align 4, !tbaa !14
  %200 = sext i32 %199 to i64
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %20, ptr noundef nonnull align 8 dereferenceable(32) @_Z3ansB5cxx11, i64 noundef 0, i64 noundef %200)
  invoke void @_ZN7aryansh9io_macros3outINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvEEvT_(ptr noundef %20)
          to label %201 unwind label %203

201:                                              ; preds = %198
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #9
  %202 = load i32, ptr %1, align 4
  ret i32 %202

203:                                              ; preds = %198
  %204 = landingpad { ptr, i32 }
          cleanup
  %205 = extractvalue { ptr, i32 } %204, 0
  store ptr %205, ptr %21, align 8
  %206 = extractvalue { ptr, i32 } %204, 1
  store i32 %206, ptr %22, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %20) #9
  br label %207

207:                                              ; preds = %203
  %208 = load ptr, ptr %21, align 8
  %209 = load i32, ptr %22, align 4
  %210 = insertvalue { ptr, i32 } poison, ptr %208, 0
  %211 = insertvalue { ptr, i32 } %210, i32 %209, 1
  resume { ptr, i32 } %211
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

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

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(20)) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE3addEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE4initEi(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) #6

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE3updEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3HLDILi100005ELb0EE7qrypathEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) #7 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvEEvT_(ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #7 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 #8 = { 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 #9 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{i64 0, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = !{!7, !7, i64 0}


; 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::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<int, 5>, std::allocator<std::array<int, 5>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%struct.HLD = type <{ [100005 x %"class.std::vector.3"], %"class.std::vector.3", [100005 x i32], [100005 x i32], [100005 x i32], [100005 x i32], [100005 x i32], i32, %struct.SEG, i32, [4 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = 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 }
%struct.SEG = type { i32, i32, %"class.std::vector.3" }
%"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 }
%"struct.std::array" = type { [5 x i32] }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@CLK = external dso_local local_unnamed_addr global %"class.std::chrono::time_point", align 8
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@qr = external dso_local global %"class.std::vector", align 8
@_Z3ansB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@h = external dso_local global %struct.HLD, align 8
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = 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

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

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::array", align 4
  %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 %"struct.std::array", align 4
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = tail call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.7)
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %18, label %13

13:                                               ; preds = %0
  %14 = load ptr, ptr @stdin, align 8, !tbaa !5
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.7, ptr noundef %14)
  %16 = load ptr, ptr @stdout, align 8, !tbaa !5
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, ptr noundef %16)
  br label %18

18:                                               ; preds = %13, %0
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %25 = tail call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #9
  store i64 %25, ptr @CLK, align 8, !tbaa !11
  tail call void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %26 = load i32, ptr @n, align 4, !tbaa !13
  %.not2735 = icmp eq i32 %26, 0
  br i1 %.not2735, label %.lr.ph41.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %18
  %.lobit.neg = ashr i32 %26, 31
  %27 = getelementptr inbounds i8, ptr %2, i64 4
  %28 = getelementptr inbounds i8, ptr %2, i64 8
  %29 = getelementptr inbounds i8, ptr %2, i64 12
  %30 = getelementptr inbounds i8, ptr %2, i64 16
  br label %33

._crit_edge:                                      ; preds = %33
  %.not2938 = icmp eq i32 %35, 1
  br i1 %.not2938, label %._crit_edge42, label %.lr.ph41.preheader

.lr.ph41.preheader:                               ; preds = %18, %._crit_edge
  %31 = phi i32 [ %35, %._crit_edge ], [ 0, %18 ]
  %32 = icmp slt i32 %31, 1
  %.neg = sext i1 %32 to i32
  br label %.lr.ph41

33:                                               ; preds = %.lr.ph, %33
  %.036 = phi i32 [ %.lobit.neg, %.lr.ph ], [ %.1, %33 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  call void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #9
  %34 = load i32, ptr %1, align 4, !tbaa !13
  store i32 %34, ptr %2, align 4, !tbaa !13
  store i32 1, ptr %27, align 4, !tbaa !13
  store i32 0, ptr %28, align 4, !tbaa !13
  store i32 0, ptr %29, align 4, !tbaa !13
  store i32 %.036, ptr %30, align 4, !tbaa !13
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qr, ptr noundef nonnull align 4 dereferenceable(20) %2)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  %35 = load i32, ptr @n, align 4, !tbaa !13
  %.inv = icmp sgt i32 %35, -1
  %.1.v = select i1 %.inv, i32 1, i32 -1
  %.1 = add nsw i32 %.1.v, %.036
  %.lobit.neg26 = ashr i32 %35, 31
  %36 = add i32 %.lobit.neg26, %35
  %.not27 = icmp eq i32 %.1, %36
  br i1 %.not27, label %._crit_edge, label %33, !llvm.loop !15

._crit_edge42:                                    ; preds = %.lr.ph41, %._crit_edge
  call void @_ZN3HLDILi100005ELb0EE4initEi(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef 0)
  %37 = load i32, ptr @m, align 4, !tbaa !13
  %.not3244 = icmp eq i32 %37, 0
  br i1 %.not3244, label %._crit_edge48, label %.lr.ph47

.lr.ph47:                                         ; preds = %._crit_edge42
  %.lobit.neg30 = ashr i32 %37, 31
  %38 = getelementptr inbounds i8, ptr %8, i64 4
  %39 = getelementptr inbounds i8, ptr %8, i64 8
  %40 = getelementptr inbounds i8, ptr %8, i64 12
  %41 = getelementptr inbounds i8, ptr %8, i64 16
  br label %55

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %.lr.ph41
  %.02239 = phi i32 [ %.123, %.lr.ph41 ], [ %.neg, %.lr.ph41.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  call void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %42 = load i32, ptr %3, align 4, !tbaa !13
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr %3, align 4, !tbaa !13
  %44 = load i32, ptr %4, align 4, !tbaa !13
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr %4, align 4, !tbaa !13
  call void @_ZN3HLDILi100005ELb0EE3addEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %43, i32 noundef %45)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  %46 = load i32, ptr @n, align 4, !tbaa !13
  %47 = icmp slt i32 %46, 1
  %.123.v = select i1 %47, i32 -1, i32 1
  %.123 = add nsw i32 %.123.v, %.02239
  %48 = add nsw i32 %46, -1
  %.neg28 = sext i1 %47 to i32
  %49 = add i32 %48, %.neg28
  %.not29 = icmp eq i32 %.123, %49
  br i1 %.not29, label %._crit_edge42, label %.lr.ph41, !llvm.loop !17

._crit_edge48:                                    ; preds = %55, %._crit_edge42
  %50 = call ptr @_ZSt5beginISt6vectorISt5arrayIiLm5EESaIS2_EEEDTcldtfp_5beginEERT_(ptr noundef nonnull align 8 dereferenceable(24) @qr)
  %51 = call ptr @_ZSt3endISt6vectorISt5arrayIiLm5EESaIS2_EEEDTcldtfp_3endEERT_(ptr noundef nonnull align 8 dereferenceable(24) @qr)
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %50, ptr %51)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #9
  %52 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @qr) #9
  store ptr %52, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #9
  %53 = call ptr @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @qr) #9
  store ptr %53, ptr %10, align 8
  %54 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  br i1 %54, label %.lr.ph50, label %._crit_edge51

55:                                               ; preds = %.lr.ph47, %55
  %.02445 = phi i32 [ %.lobit.neg30, %.lr.ph47 ], [ %.125, %55 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  call void @_ZN7aryansh9io_macros2inIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %56 = load i32, ptr %5, align 4, !tbaa !13
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %5, align 4, !tbaa !13
  %58 = load i32, ptr %6, align 4, !tbaa !13
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %8) #9
  %60 = load i32, ptr %7, align 4, !tbaa !13
  store i32 %60, ptr %8, align 4, !tbaa !13
  store i32 2, ptr %38, align 4, !tbaa !13
  store i32 %57, ptr %39, align 4, !tbaa !13
  store i32 %59, ptr %40, align 4, !tbaa !13
  store i32 %.02445, ptr %41, align 4, !tbaa !13
  call void @_ZNSt6vectorISt5arrayIiLm5EESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @qr, ptr noundef nonnull align 4 dereferenceable(20) %8)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  %61 = load i32, ptr @m, align 4, !tbaa !13
  %.inv33 = icmp sgt i32 %61, -1
  %.125.v = select i1 %.inv33, i32 1, i32 -1
  %.125 = add nsw i32 %.125.v, %.02445
  %.lobit.neg31 = ashr i32 %61, 31
  %62 = add i32 %.lobit.neg31, %61
  %.not32 = icmp eq i32 %.125, %62
  br i1 %.not32, label %._crit_edge48, label %55, !llvm.loop !18

._crit_edge51:                                    ; preds = %88, %._crit_edge48
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #9
  %63 = load i32, ptr @m, align 4, !tbaa !13
  %64 = sext i32 %63 to i64
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) @_Z3ansB5cxx11, i64 noundef 0, i64 noundef %64)
  invoke void @_ZN7aryansh9io_macros3outINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvEEvT_(ptr noundef nonnull %11)
          to label %91 unwind label %92

.lr.ph50:                                         ; preds = %._crit_edge48, %88
  %65 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 1) #9
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %74

69:                                               ; preds = %.lr.ph50
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 4) #9
  %71 = load i32, ptr %70, align 4, !tbaa !13
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 0) #9
  %73 = load i32, ptr %72, align 4, !tbaa !13
  call void @_ZN3HLDILi100005ELb0EE3updEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %71, i32 noundef %73)
  br label %88

74:                                               ; preds = %.lr.ph50
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 2) #9
  %76 = load i32, ptr %75, align 4, !tbaa !13
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 3) #9
  %78 = load i32, ptr %77, align 4, !tbaa !13
  %79 = call noundef i32 @_ZN3HLDILi100005ELb0EE7qrypathEii(ptr noundef nonnull align 8 dereferenceable(4400284) @h, i32 noundef %76, i32 noundef %78)
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 0) #9
  %81 = load i32, ptr %80, align 4, !tbaa !13
  %82 = icmp eq i32 %79, %81
  %83 = select i1 %82, i8 49, i8 48
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5arrayIiLm5EEixEm(ptr noundef nonnull align 4 dereferenceable(20) %65, i64 noundef 4) #9
  %85 = load i32, ptr %84, align 4, !tbaa !13
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3ansB5cxx11, i64 noundef %86)
  store i8 %83, ptr %87, align 1, !tbaa !19
  br label %88

88:                                               ; preds = %74, %69
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #9
  %90 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPSt5arrayIiLm5EESt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  br i1 %90, label %.lr.ph50, label %._crit_edge51

91:                                               ; preds = %._crit_edge51
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #9
  ret i32 0

92:                                               ; preds = %._crit_edge51
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #9
  resume { ptr, i32 } %93
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

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

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE3addEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE4initEi(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIiJiiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt5arrayIiLm5EESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) local_unnamed_addr #6

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HLDILi100005ELb0EE3updEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3HLDILi100005ELb0EE7qrypathEii(ptr noundef nonnull align 8 dereferenceable(4400284), i32 noundef, i32 noundef) local_unnamed_addr #7 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 #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEvEEvT_(ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #7 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "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 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 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 #8 = { 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 #9 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = !{!7, !7, i64 0}


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