; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/344 Division 2/Problem C (C)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [200100 x i32], align 16
@ans = external dso_local global [200100 x i32], align 16
@b = external dso_local global [200100 x %"struct.std::pair"], align 16
@r = external dso_local global [200100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::stack", align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %40, %0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %31)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %38
  store i32 %36, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %28
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

43:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %59, %43
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %51
  %53 = getelementptr inbounds %"struct.std::pair", ptr %52, i32 0, i32 0
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %55
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i32 0, i32 1
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %53, ptr noundef %57)
  br label %59

59:                                               ; preds = %49
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !11

62:                                               ; preds = %48
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = load i32, ptr @m, align 4, !tbaa !5
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %66
  store i32 %63, ptr %67, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %4) #7
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %68 = load i32, ptr @m, align 4, !tbaa !5
  %69 = sub nsw i32 %68, 1
  store i32 %69, ptr %5, align 4, !tbaa !5
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %70 unwind label %77

70:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %71 = load i32, ptr @m, align 4, !tbaa !5
  %72 = sub nsw i32 %71, 2
  store i32 %72, ptr %8, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %124, %70
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = icmp sge i32 %74, 0
  br i1 %75, label %81, label %76

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

77:                                               ; preds = %62
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %6, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %305

81:                                               ; preds = %73
  br label %82

82:                                               ; preds = %102, %81
  %83 = invoke noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %84 unwind label %103

84:                                               ; preds = %82
  br i1 %83, label %99, label %85

85:                                               ; preds = %84
  %86 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %87 unwind label %103

87:                                               ; preds = %85
  %88 = load i32, ptr %86, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %89
  %91 = getelementptr inbounds %"struct.std::pair", ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !12
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %94
  %96 = getelementptr inbounds %"struct.std::pair", ptr %95, i32 0, i32 1
  %97 = load i32, ptr %96, align 4, !tbaa !12
  %98 = icmp slt i32 %92, %97
  br label %99

99:                                               ; preds = %87, %84
  %100 = phi i1 [ false, %84 ], [ %98, %87 ]
  br i1 %100, label %101, label %107

101:                                              ; preds = %99
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %102 unwind label %103

102:                                              ; preds = %101
  br label %82, !llvm.loop !14

103:                                              ; preds = %122, %115, %107, %101, %85, %82
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %6, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %305

107:                                              ; preds = %99
  %108 = invoke noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %109 unwind label %103

109:                                              ; preds = %107
  br i1 %108, label %110, label %115

110:                                              ; preds = %109
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %113
  store i32 %111, ptr %114, align 4, !tbaa !5
  br label %122

115:                                              ; preds = %109
  %116 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %4)
          to label %117 unwind label %103

117:                                              ; preds = %115
  %118 = load i32, ptr %116, align 4, !tbaa !5
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %120
  store i32 %118, ptr %121, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %117, %110
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %4, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %123 unwind label %103

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %8, align 4, !tbaa !5
  br label %73, !llvm.loop !15

127:                                              ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 -1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %143, %127
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = load i32, ptr @m, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 13, ptr %11, align 4
  br label %146

133:                                              ; preds = %128
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = load i32, ptr @m, align 4, !tbaa !5
  %139 = icmp eq i32 %137, %138
  br i1 %139, label %140, label %142

140:                                              ; preds = %133
  %141 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %141, ptr %9, align 4, !tbaa !5
  store i32 13, ptr %11, align 4
  br label %146

142:                                              ; preds = %133
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %10, align 4, !tbaa !5
  br label %128, !llvm.loop !16

146:                                              ; preds = %140, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %147

147:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %149
  %151 = getelementptr inbounds %"struct.std::pair", ptr %150, i32 0, i32 0
  %152 = load i32, ptr %151, align 8, !tbaa !17
  store i32 %152, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %154
  %156 = getelementptr inbounds %"struct.std::pair", ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 4, !tbaa !12
  store i32 %157, ptr %13, align 4, !tbaa !5
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr @a, i64 %159
  invoke void @_ZSt4sortIPiEvT_S1_(ptr noundef @a, ptr noundef %160)
          to label %161 unwind label %173

161:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %162 = load i32, ptr %13, align 4, !tbaa !5
  %163 = sub nsw i32 %162, 1
  store i32 %163, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %164 = load i32, ptr %13, align 4, !tbaa !5
  %165 = sub nsw i32 %164, 1
  store i32 %165, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %17, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %239, %161
  %169 = load i32, ptr %17, align 4, !tbaa !5
  %170 = load i32, ptr @m, align 4, !tbaa !5
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %177, label %172

172:                                              ; preds = %168
  store i32 16, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %242

173:                                              ; preds = %147
  %174 = landingpad { ptr, i32 }
          cleanup
  %175 = extractvalue { ptr, i32 } %174, 0
  store ptr %175, ptr %6, align 8
  %176 = extractvalue { ptr, i32 } %174, 1
  store i32 %176, ptr %7, align 4
  br label %304

177:                                              ; preds = %168
  %178 = load i32, ptr %17, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr @m, align 4, !tbaa !5
  %183 = icmp eq i32 %181, %182
  br i1 %183, label %184, label %238

184:                                              ; preds = %177
  %185 = load i32, ptr %17, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %186
  %188 = getelementptr inbounds %"struct.std::pair", ptr %187, i32 0, i32 0
  %189 = load i32, ptr %188, align 8, !tbaa !17
  %190 = load i32, ptr %12, align 4, !tbaa !5
  %191 = icmp eq i32 %189, %190
  br i1 %191, label %192, label %193

192:                                              ; preds = %184
  br label %239

193:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %194 = load i32, ptr %17, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %195
  %197 = getelementptr inbounds %"struct.std::pair", ptr %196, i32 0, i32 1
  %198 = load i32, ptr %197, align 4, !tbaa !12
  store i32 %198, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %199 = load i32, ptr %17, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %200
  %202 = getelementptr inbounds %"struct.std::pair", ptr %201, i32 0, i32 0
  %203 = load i32, ptr %202, align 8, !tbaa !17
  store i32 %203, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %204 = load i32, ptr %13, align 4, !tbaa !5
  %205 = load i32, ptr %18, align 4, !tbaa !5
  %206 = sub nsw i32 %204, %205
  store i32 %206, ptr %20, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %234, %193
  %208 = load i32, ptr %20, align 4, !tbaa !5
  %209 = add nsw i32 %208, -1
  store i32 %209, ptr %20, align 4, !tbaa !5
  %210 = icmp ne i32 %208, 0
  br i1 %210, label %211, label %235

211:                                              ; preds = %207
  %212 = load i32, ptr %19, align 4, !tbaa !5
  %213 = icmp eq i32 %212, 1
  br i1 %213, label %214, label %224

214:                                              ; preds = %211
  %215 = load i32, ptr %14, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %14, align 4, !tbaa !5
  %217 = sext i32 %215 to i64
  %218 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !5
  %220 = load i32, ptr %16, align 4, !tbaa !5
  %221 = add nsw i32 %220, -1
  store i32 %221, ptr %16, align 4, !tbaa !5
  %222 = sext i32 %220 to i64
  %223 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %222
  store i32 %219, ptr %223, align 4, !tbaa !5
  br label %234

224:                                              ; preds = %211
  %225 = load i32, ptr %15, align 4, !tbaa !5
  %226 = add nsw i32 %225, -1
  store i32 %226, ptr %15, align 4, !tbaa !5
  %227 = sext i32 %225 to i64
  %228 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  %230 = load i32, ptr %16, align 4, !tbaa !5
  %231 = add nsw i32 %230, -1
  store i32 %231, ptr %16, align 4, !tbaa !5
  %232 = sext i32 %230 to i64
  %233 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %232
  store i32 %229, ptr %233, align 4, !tbaa !5
  br label %234

234:                                              ; preds = %224, %214
  br label %207, !llvm.loop !18

235:                                              ; preds = %207
  %236 = load i32, ptr %19, align 4, !tbaa !5
  store i32 %236, ptr %12, align 4, !tbaa !5
  %237 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %237, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %238

238:                                              ; preds = %235, %177
  br label %239

239:                                              ; preds = %238, %192
  %240 = load i32, ptr %17, align 4, !tbaa !5
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %17, align 4, !tbaa !5
  br label %168, !llvm.loop !19

242:                                              ; preds = %172
  %243 = load i32, ptr %12, align 4, !tbaa !5
  %244 = icmp eq i32 %243, 1
  br i1 %244, label %245, label %260

245:                                              ; preds = %242
  br label %246

246:                                              ; preds = %249, %245
  %247 = load i32, ptr %16, align 4, !tbaa !5
  %248 = icmp sge i32 %247, 0
  br i1 %248, label %249, label %259

249:                                              ; preds = %246
  %250 = load i32, ptr %15, align 4, !tbaa !5
  %251 = add nsw i32 %250, -1
  store i32 %251, ptr %15, align 4, !tbaa !5
  %252 = sext i32 %250 to i64
  %253 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %252
  %254 = load i32, ptr %253, align 4, !tbaa !5
  %255 = load i32, ptr %16, align 4, !tbaa !5
  %256 = add nsw i32 %255, -1
  store i32 %256, ptr %16, align 4, !tbaa !5
  %257 = sext i32 %255 to i64
  %258 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %257
  store i32 %254, ptr %258, align 4, !tbaa !5
  br label %246, !llvm.loop !20

259:                                              ; preds = %246
  br label %275

260:                                              ; preds = %242
  br label %261

261:                                              ; preds = %264, %260
  %262 = load i32, ptr %16, align 4, !tbaa !5
  %263 = icmp sge i32 %262, 0
  br i1 %263, label %264, label %274

264:                                              ; preds = %261
  %265 = load i32, ptr %14, align 4, !tbaa !5
  %266 = add nsw i32 %265, 1
  store i32 %266, ptr %14, align 4, !tbaa !5
  %267 = sext i32 %265 to i64
  %268 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %267
  %269 = load i32, ptr %268, align 4, !tbaa !5
  %270 = load i32, ptr %16, align 4, !tbaa !5
  %271 = add nsw i32 %270, -1
  store i32 %271, ptr %16, align 4, !tbaa !5
  %272 = sext i32 %270 to i64
  %273 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %272
  store i32 %269, ptr %273, align 4, !tbaa !5
  br label %261, !llvm.loop !21

274:                                              ; preds = %261
  br label %275

275:                                              ; preds = %274, %259
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %276

276:                                              ; preds = %288, %275
  %277 = load i32, ptr %21, align 4, !tbaa !5
  %278 = load i32, ptr @n, align 4, !tbaa !5
  %279 = icmp slt i32 %277, %278
  br i1 %279, label %281, label %280

280:                                              ; preds = %276
  store i32 25, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %295

281:                                              ; preds = %276
  %282 = load i32, ptr %21, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %285)
          to label %287 unwind label %291

287:                                              ; preds = %281
  br label %288

288:                                              ; preds = %287
  %289 = load i32, ptr %21, align 4, !tbaa !5
  %290 = add nsw i32 %289, 1
  store i32 %290, ptr %21, align 4, !tbaa !5
  br label %276, !llvm.loop !22

291:                                              ; preds = %281
  %292 = landingpad { ptr, i32 }
          cleanup
  %293 = extractvalue { ptr, i32 } %292, 0
  store ptr %293, ptr %6, align 8
  %294 = extractvalue { ptr, i32 } %292, 1
  store i32 %294, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %303

295:                                              ; preds = %280
  %296 = invoke i32 @puts(ptr noundef @.str.3)
          to label %297 unwind label %299

297:                                              ; preds = %295
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %4) #7
  %298 = load i32, ptr %1, align 4
  ret i32 %298

299:                                              ; preds = %295
  %300 = landingpad { ptr, i32 }
          cleanup
  %301 = extractvalue { ptr, i32 } %300, 0
  store ptr %301, ptr %6, align 8
  %302 = extractvalue { ptr, i32 } %300, 1
  store i32 %302, ptr %7, align 4
  br label %303

303:                                              ; preds = %299, %291
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %304

304:                                              ; preds = %303, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %305

305:                                              ; preds = %304, %103, %77
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %4) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %4) #7
  br label %306

306:                                              ; preds = %305
  %307 = load ptr, ptr %6, align 8
  %308 = load i32, ptr %7, align 4
  %309 = insertvalue { ptr, i32 } poison, ptr %307, 0
  %310 = insertvalue { ptr, i32 } %309, i32 %308, 1
  resume { ptr, i32 } %310
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #4 align 2

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

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

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

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

declare i32 @printf(ptr noundef, ...) #1

declare i32 @puts(ptr noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #6 align 2

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 = { 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 #5 = { 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 #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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!13, !6, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.std::pair" = type { i32, i32 }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [200100 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200100 x i32], align 16
@b = external dso_local global [200100 x %"struct.std::pair"], align 16
@r = external dso_local local_unnamed_addr global [200100 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::stack", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader80

.preheader80:                                     ; preds = %.lr.ph, %0
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph83, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %11 = load i32, ptr %9, align 4, !tbaa !5
  %12 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %indvars.iv
  store i32 %11, ptr %12, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %.preheader80, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph83, %.preheader80
  %.lcssa = phi i32 [ %7, %.preheader80 ], [ %24, %.lr.ph83 ]
  %16 = add nsw i32 %.lcssa, -1
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %17
  store i32 %.lcssa, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #8
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = add nsw i32 %19, -1
  store i32 %20, ptr %2, align 4, !tbaa !5
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushEOi(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %27 unwind label %34

.lr.ph83:                                         ; preds = %.preheader80, %.lr.ph83
  %indvars.iv135 = phi i64 [ %indvars.iv.next136, %.lr.ph83 ], [ 0, %.preheader80 ]
  %21 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %indvars.iv135
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  %23 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %21, ptr noundef nonnull %22)
  %indvars.iv.next136 = add nuw nsw i64 %indvars.iv135, 1
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next136, %25
  br i1 %26, label %.lr.ph83, label %._crit_edge, !llvm.loop !11

27:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = add nsw i32 %28, -2
  store i32 %29, ptr %3, align 4, !tbaa !5
  %30 = icmp sgt i32 %28, 1
  br i1 %30, label %.preheader79, label %._crit_edge86

.preheader79:                                     ; preds = %27, %56
  %31 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %31, label %.critedge, label %.lr.ph84

._crit_edge86.loopexit:                           ; preds = %56
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge86

._crit_edge86:                                    ; preds = %._crit_edge86.loopexit, %27
  %32 = phi i32 [ %.pre, %._crit_edge86.loopexit ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.lr.ph89.preheader, label %._crit_edge90

.lr.ph89.preheader:                               ; preds = %._crit_edge86
  %wide.trip.count = zext nneg i32 %32 to i64
  br label %.lr.ph89

34:                                               ; preds = %._crit_edge
  %35 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  br label %151

.lr.ph84:                                         ; preds = %.preheader79, %46
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %38, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !12
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %42, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !12
  %45 = icmp slt i32 %40, %44
  br i1 %45, label %46, label %.critedge

46:                                               ; preds = %.lr.ph84
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %47 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %47, label %.critedge, label %.lr.ph84, !llvm.loop !14

48:                                               ; preds = %53
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  br label %151

.critedge:                                        ; preds = %.lr.ph84, %46, %.preheader79
  %50 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br i1 %50, label %53, label %51

51:                                               ; preds = %.critedge
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  br label %53

53:                                               ; preds = %.critedge, %51
  %.sink.in = phi ptr [ %52, %51 ], [ @m, %.critedge ]
  %.sink = load i32, ptr %.sink.in, align 4, !tbaa !5
  %.sink183 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %.sink183 to i64
  %55 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %54
  store i32 %.sink, ptr %55, align 4, !tbaa !5
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %56 unwind label %48

56:                                               ; preds = %53
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr %3, align 4, !tbaa !5
  %59 = icmp sgt i32 %57, 0
  br i1 %59, label %.preheader79, label %._crit_edge86.loopexit, !llvm.loop !15

.lr.ph89:                                         ; preds = %.lr.ph89.preheader, %63
  %indvars.iv138 = phi i64 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next139, %63 ]
  %60 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %indvars.iv138
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp eq i32 %61, %32
  br i1 %62, label %._crit_edge90.loopexit.split.loop.exit, label %63

63:                                               ; preds = %.lr.ph89
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next139, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge90, label %.lr.ph89, !llvm.loop !16

._crit_edge90.loopexit.split.loop.exit:           ; preds = %.lr.ph89
  %64 = trunc nuw nsw i64 %indvars.iv138 to i32
  br label %._crit_edge90

._crit_edge90:                                    ; preds = %63, %._crit_edge90.loopexit.split.loop.exit, %._crit_edge86
  %.067 = phi i32 [ -1, %._crit_edge86 ], [ %64, %._crit_edge90.loopexit.split.loop.exit ], [ -1, %63 ]
  %65 = sext i32 %.067 to i64
  %66 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %65
  %67 = load i32, ptr %66, align 8, !tbaa !17
  %68 = getelementptr inbounds i8, ptr %66, i64 4
  %69 = load i32, ptr %68, align 4, !tbaa !12
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr @a, i64 %70
  invoke void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %71)
          to label %72 unwind label %95

72:                                               ; preds = %._crit_edge90
  %73 = add nsw i32 %69, -1
  %74 = load i32, ptr @m, align 4, !tbaa !5
  %.050105 = add nsw i32 %.067, 1
  %75 = icmp slt i32 %.050105, %74
  br i1 %75, label %.lr.ph113.preheader, label %._crit_edge114

.lr.ph113.preheader:                              ; preds = %72
  %76 = add nsw i64 %65, 1
  br label %.lr.ph113

._crit_edge114.loopexit:                          ; preds = %.loopexit78
  %77 = sext i32 %.360 to i64
  br label %._crit_edge114

._crit_edge114:                                   ; preds = %._crit_edge114.loopexit, %72
  %.064.lcssa = phi i32 [ %67, %72 ], [ %.165, %._crit_edge114.loopexit ]
  %.057.lcssa = phi i64 [ 0, %72 ], [ %77, %._crit_edge114.loopexit ]
  %.052.lcssa = phi i32 [ %73, %72 ], [ %.355, %._crit_edge114.loopexit ]
  %.051.lcssa = phi i32 [ %73, %72 ], [ %.3, %._crit_edge114.loopexit ]
  %78 = icmp eq i32 %.064.lcssa, 1
  %79 = icmp sgt i32 %.051.lcssa, -1
  br i1 %78, label %.preheader, label %.preheader76

.preheader76:                                     ; preds = %._crit_edge114
  br i1 %79, label %.lr.ph121.preheader, label %.loopexit

.lr.ph121.preheader:                              ; preds = %.preheader76
  %80 = zext nneg i32 %.051.lcssa to i64
  %81 = add nuw nsw i64 %80, 1
  %min.iters.check195 = icmp ult i32 %.051.lcssa, 7
  br i1 %min.iters.check195, label %.lr.ph121.preheader213, label %vector.ph196

.lr.ph121.preheader213:                           ; preds = %middle.block193, %.lr.ph121.preheader
  %indvars.iv162.ph = phi i64 [ %.057.lcssa, %.lr.ph121.preheader ], [ %ind.end199, %middle.block193 ]
  %indvars.iv160.ph = phi i64 [ %80, %.lr.ph121.preheader ], [ %ind.end201, %middle.block193 ]
  br label %.lr.ph121

vector.ph196:                                     ; preds = %.lr.ph121.preheader
  %n.vec198 = and i64 %81, 4294967288
  %ind.end199 = add nsw i64 %.057.lcssa, %n.vec198
  %ind.end201 = sub nsw i64 %80, %n.vec198
  br label %vector.body203

vector.body203:                                   ; preds = %vector.body203, %vector.ph196
  %index204 = phi i64 [ 0, %vector.ph196 ], [ %index.next211, %vector.body203 ]
  %offset.idx205 = add i64 %.057.lcssa, %index204
  %offset.idx206 = sub i64 %80, %index204
  %82 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %offset.idx205
  %83 = getelementptr inbounds i8, ptr %82, i64 16
  %wide.load207 = load <4 x i32>, ptr %82, align 4, !tbaa !5
  %wide.load208 = load <4 x i32>, ptr %83, align 4, !tbaa !5
  %84 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %offset.idx206
  %85 = getelementptr inbounds i8, ptr %84, i64 -12
  %86 = getelementptr inbounds i8, ptr %84, i64 -28
  %reverse209 = shufflevector <4 x i32> %wide.load207, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse209, ptr %85, align 4, !tbaa !5
  %reverse210 = shufflevector <4 x i32> %wide.load208, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse210, ptr %86, align 4, !tbaa !5
  %index.next211 = add nuw i64 %index204, 8
  %87 = icmp eq i64 %index.next211, %n.vec198
  br i1 %87, label %middle.block193, label %vector.body203, !llvm.loop !18

middle.block193:                                  ; preds = %vector.body203
  %cmp.n212 = icmp eq i64 %81, %n.vec198
  br i1 %cmp.n212, label %.loopexit, label %.lr.ph121.preheader213

.preheader:                                       ; preds = %._crit_edge114
  br i1 %79, label %.lr.ph124.preheader, label %.loopexit

.lr.ph124.preheader:                              ; preds = %.preheader
  %88 = sext i32 %.052.lcssa to i64
  %89 = zext nneg i32 %.051.lcssa to i64
  %90 = sub nsw i64 %88, %89
  %91 = shl nsw i64 %90, 2
  %scevgep167 = getelementptr i8, ptr @a, i64 %91
  %92 = add nuw i32 %.051.lcssa, 1
  %93 = zext i32 %92 to i64
  %94 = shl nuw nsw i64 %93, 2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @ans, ptr noundef nonnull align 4 dereferenceable(1) %scevgep167, i64 %94, i1 false), !tbaa !5
  br label %.loopexit

95:                                               ; preds = %._crit_edge90
  %96 = landingpad { ptr, i32 }
          cleanup
  br label %151

.lr.ph113:                                        ; preds = %.lr.ph113.preheader, %.loopexit78
  %indvars.iv156 = phi i64 [ %76, %.lr.ph113.preheader ], [ %indvars.iv.next157, %.loopexit78 ]
  %.051110 = phi i32 [ %73, %.lr.ph113.preheader ], [ %.3, %.loopexit78 ]
  %.052109 = phi i32 [ %73, %.lr.ph113.preheader ], [ %.355, %.loopexit78 ]
  %.057108 = phi i32 [ 0, %.lr.ph113.preheader ], [ %.360, %.loopexit78 ]
  %.062107 = phi i32 [ %69, %.lr.ph113.preheader ], [ %.163, %.loopexit78 ]
  %.064106 = phi i32 [ %67, %.lr.ph113.preheader ], [ %.165, %.loopexit78 ]
  %97 = getelementptr inbounds [200100 x i32], ptr @r, i64 0, i64 %indvars.iv156
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp eq i32 %98, %74
  br i1 %99, label %100, label %.loopexit78

100:                                              ; preds = %.lr.ph113
  %101 = getelementptr inbounds [200100 x %"struct.std::pair"], ptr @b, i64 0, i64 %indvars.iv156
  %102 = load i32, ptr %101, align 8, !tbaa !17
  %103 = icmp eq i32 %102, %.064106
  br i1 %103, label %.loopexit78, label %104

104:                                              ; preds = %100
  %105 = getelementptr inbounds i8, ptr %101, i64 4
  %106 = load i32, ptr %105, align 4, !tbaa !12
  %.not94 = icmp eq i32 %.062107, %106
  br i1 %.not94, label %.loopexit78, label %.lr.ph99

.lr.ph99:                                         ; preds = %104
  %107 = xor i32 %106, -1
  %108 = add i32 %.062107, %107
  %109 = icmp eq i32 %102, 1
  %110 = sext i32 %.051110 to i64
  br i1 %109, label %.lr.ph99.split.us.preheader, label %.lr.ph99.split.preheader

.lr.ph99.split.preheader:                         ; preds = %.lr.ph99
  %111 = zext i32 %108 to i64
  %112 = shl nuw nsw i64 %111, 2
  %113 = sub nsw i64 %110, %111
  %114 = shl nsw i64 %113, 2
  %scevgep = getelementptr i8, ptr @ans, i64 %114
  %115 = sext i32 %.052109 to i64
  %116 = sub nsw i64 %115, %111
  %117 = shl nsw i64 %116, 2
  %scevgep141 = getelementptr i8, ptr @a, i64 %117
  %118 = add nuw nsw i64 %112, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep141, i64 %118, i1 false), !tbaa !5
  %119 = sub i32 %106, %.062107
  %120 = add i32 %119, %.052109
  %121 = sub i32 %106, %.062107
  %122 = add i32 %121, %.051110
  br label %.loopexit78

.lr.ph99.split.us.preheader:                      ; preds = %.lr.ph99
  %123 = sext i32 %.057108 to i64
  %124 = zext i32 %108 to i64
  %125 = add nuw nsw i64 %124, 1
  %min.iters.check = icmp ult i32 %108, 7
  br i1 %min.iters.check, label %.lr.ph99.split.us.preheader214, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph99.split.us.preheader
  %n.vec = and i64 %125, 8589934584
  %ind.end = add nsw i64 %n.vec, %123
  %ind.end186 = sub nsw i64 %110, %n.vec
  %.cast = trunc i64 %n.vec to i32
  %ind.end188 = sub i32 %108, %.cast
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %123
  %offset.idx190 = sub i64 %110, %index
  %126 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %offset.idx
  %127 = getelementptr inbounds i8, ptr %126, i64 16
  %wide.load = load <4 x i32>, ptr %126, align 4, !tbaa !5
  %wide.load191 = load <4 x i32>, ptr %127, align 4, !tbaa !5
  %128 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %offset.idx190
  %129 = getelementptr inbounds i8, ptr %128, i64 -12
  %130 = getelementptr inbounds i8, ptr %128, i64 -28
  %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse, ptr %129, align 4, !tbaa !5
  %reverse192 = shufflevector <4 x i32> %wide.load191, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse192, ptr %130, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %131 = icmp eq i64 %index.next, %n.vec
  br i1 %131, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %125, %n.vec
  br i1 %cmp.n, label %.loopexit78.loopexit, label %.lr.ph99.split.us.preheader214

.lr.ph99.split.us.preheader214:                   ; preds = %middle.block, %.lr.ph99.split.us.preheader
  %indvars.iv151.ph = phi i64 [ %123, %.lr.ph99.split.us.preheader ], [ %ind.end, %middle.block ]
  %indvars.iv149.ph = phi i64 [ %110, %.lr.ph99.split.us.preheader ], [ %ind.end186, %middle.block ]
  %.ph = phi i32 [ %108, %.lr.ph99.split.us.preheader ], [ %ind.end188, %middle.block ]
  br label %.lr.ph99.split.us

.lr.ph99.split.us:                                ; preds = %.lr.ph99.split.us.preheader214, %.lr.ph99.split.us
  %indvars.iv151 = phi i64 [ %indvars.iv.next152, %.lr.ph99.split.us ], [ %indvars.iv151.ph, %.lr.ph99.split.us.preheader214 ]
  %indvars.iv149 = phi i64 [ %indvars.iv.next150, %.lr.ph99.split.us ], [ %indvars.iv149.ph, %.lr.ph99.split.us.preheader214 ]
  %132 = phi i32 [ %136, %.lr.ph99.split.us ], [ %.ph, %.lr.ph99.split.us.preheader214 ]
  %indvars.iv.next152 = add nsw i64 %indvars.iv151, 1
  %133 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %indvars.iv151
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %indvars.iv149
  store i32 %134, ptr %135, align 4, !tbaa !5
  %indvars.iv.next150 = add nsw i64 %indvars.iv149, -1
  %136 = add nsw i32 %132, -1
  %.not.us = icmp eq i32 %132, 0
  br i1 %.not.us, label %.loopexit78.loopexit, label %.lr.ph99.split.us, !llvm.loop !22

.loopexit78.loopexit:                             ; preds = %.lr.ph99.split.us, %middle.block
  %indvars.iv.next152.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next152, %.lr.ph99.split.us ]
  %indvars.iv.next150.lcssa = phi i64 [ %ind.end186, %middle.block ], [ %indvars.iv.next150, %.lr.ph99.split.us ]
  %137 = trunc nsw i64 %indvars.iv.next152.lcssa to i32
  %138 = trunc nsw i64 %indvars.iv.next150.lcssa to i32
  br label %.loopexit78

.loopexit78:                                      ; preds = %.lr.ph99.split.preheader, %.loopexit78.loopexit, %104, %.lr.ph113, %100
  %.165 = phi i32 [ %.064106, %100 ], [ %.064106, %.lr.ph113 ], [ %102, %104 ], [ 1, %.loopexit78.loopexit ], [ %102, %.lr.ph99.split.preheader ]
  %.163 = phi i32 [ %.062107, %100 ], [ %.062107, %.lr.ph113 ], [ %.062107, %104 ], [ %106, %.loopexit78.loopexit ], [ %106, %.lr.ph99.split.preheader ]
  %.360 = phi i32 [ %.057108, %100 ], [ %.057108, %.lr.ph113 ], [ %.057108, %104 ], [ %137, %.loopexit78.loopexit ], [ %.057108, %.lr.ph99.split.preheader ]
  %.355 = phi i32 [ %.052109, %100 ], [ %.052109, %.lr.ph113 ], [ %.052109, %104 ], [ %.052109, %.loopexit78.loopexit ], [ %120, %.lr.ph99.split.preheader ]
  %.3 = phi i32 [ %.051110, %100 ], [ %.051110, %.lr.ph113 ], [ %.051110, %104 ], [ %138, %.loopexit78.loopexit ], [ %122, %.lr.ph99.split.preheader ]
  %indvars.iv.next157 = add nuw nsw i64 %indvars.iv156, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next157 to i32
  %exitcond159.not = icmp eq i32 %74, %lftr.wideiv
  br i1 %exitcond159.not, label %._crit_edge114.loopexit, label %.lr.ph113, !llvm.loop !23

.lr.ph121:                                        ; preds = %.lr.ph121.preheader213, %.lr.ph121
  %indvars.iv162 = phi i64 [ %indvars.iv.next163, %.lr.ph121 ], [ %indvars.iv162.ph, %.lr.ph121.preheader213 ]
  %indvars.iv160 = phi i64 [ %indvars.iv.next161, %.lr.ph121 ], [ %indvars.iv160.ph, %.lr.ph121.preheader213 ]
  %indvars.iv.next163 = add nsw i64 %indvars.iv162, 1
  %139 = getelementptr inbounds [200100 x i32], ptr @a, i64 0, i64 %indvars.iv162
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %indvars.iv.next161 = add nsw i64 %indvars.iv160, -1
  %141 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %indvars.iv160
  store i32 %140, ptr %141, align 4, !tbaa !5
  %.not = icmp eq i64 %indvars.iv160, 0
  br i1 %.not, label %.loopexit, label %.lr.ph121, !llvm.loop !24

.loopexit:                                        ; preds = %.lr.ph121, %middle.block193, %.lr.ph124.preheader, %.preheader76, %.preheader
  %142 = load i32, ptr @n, align 4, !tbaa !5
  %143 = icmp sgt i32 %142, 0
  br i1 %143, label %.lr.ph127, label %._crit_edge128

._crit_edge128:                                   ; preds = %.lr.ph127, %.loopexit
  %144 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #8
  ret i32 0

.lr.ph127:                                        ; preds = %.loopexit, %.lr.ph127
  %indvars.iv175 = phi i64 [ %indvars.iv.next176, %.lr.ph127 ], [ 0, %.loopexit ]
  %145 = getelementptr inbounds [200100 x i32], ptr @ans, i64 0, i64 %indvars.iv175
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %146)
  %indvars.iv.next176 = add nuw nsw i64 %indvars.iv175, 1
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = icmp slt i64 %indvars.iv.next176, %149
  br i1 %150, label %.lr.ph127, label %._crit_edge128, !llvm.loop !25

151:                                              ; preds = %95, %48, %34
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %96, %95 ], [ %35, %34 ]
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #8
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #4 align 2

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #6 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

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 = { 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 #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 = { 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 #5 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!13, !6, i64 0}
!18 = distinct !{!18, !10, !19, !20}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !10, !19, !20}
!22 = distinct !{!22, !10, !20, !19}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10, !20, !19}
!25 = distinct !{!25, !10}


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