; LLVM IR from tangjz/acm-icpc :: 51nod (1674)

; 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 }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@szA = external dso_local global i32, align 4
@szO = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@stkA = external dso_local global [100001 x %"struct.std::pair"], align 16
@stkO = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair.0", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", 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
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %30, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %33

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @a, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %28)
  br label %30

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

33:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %238, %33
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %241

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 2147483647, ptr %6, align 4, !tbaa !5
  %40 = call i64 @_ZSt9make_pairIjRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %40, ptr %5, align 4
  %41 = load i32, ptr @szA, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr @szA, align 4, !tbaa !5
  %43 = sext i32 %41 to i64
  %44 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %43
  %45 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSIjiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRiOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 4 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %62, %39
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = load i32, ptr @szA, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %57
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !11
  %61 = and i32 %60, %55
  store i32 %61, ptr %59, align 8, !tbaa !11
  br label %62

62:                                               ; preds = %51
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %7, align 4, !tbaa !5
  br label %46, !llvm.loop !13

65:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %97, %65
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = load i32, ptr @szA, align 4, !tbaa !5
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %100

71:                                               ; preds = %66
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %87

74:                                               ; preds = %71
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %77
  %79 = getelementptr inbounds %"struct.std::pair", ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !11
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %82
  %84 = getelementptr inbounds %"struct.std::pair", ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !11
  %86 = icmp ne i32 %80, %85
  br i1 %86, label %87, label %96

87:                                               ; preds = %74, %71
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %89
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %8, align 4, !tbaa !5
  %93 = sext i32 %91 to i64
  %94 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %93
  %95 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %94, ptr noundef nonnull align 4 dereferenceable(8) %90)
  br label %96

96:                                               ; preds = %87, %74
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %9, align 4, !tbaa !5
  br label %66, !llvm.loop !14

100:                                              ; preds = %70
  %101 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %101, ptr @szA, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  %102 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %102, ptr %10, align 4
  %103 = load i32, ptr @szO, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr @szO, align 4, !tbaa !5
  %105 = sext i32 %103 to i64
  %106 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %105
  %107 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %106, ptr noundef nonnull align 4 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %124, %100
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = load i32, ptr @szO, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %127

113:                                              ; preds = %108
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %12, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %119
  %121 = getelementptr inbounds %"struct.std::pair", ptr %120, i32 0, i32 0
  %122 = load i32, ptr %121, align 8, !tbaa !11
  %123 = or i32 %122, %117
  store i32 %123, ptr %121, align 8, !tbaa !11
  br label %124

124:                                              ; preds = %113
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %12, align 4, !tbaa !5
  br label %108, !llvm.loop !15

127:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %128

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

132:                                              ; preds = %128
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %162

133:                                              ; preds = %128
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %149

136:                                              ; preds = %133
  %137 = load i32, ptr %13, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %139
  %141 = getelementptr inbounds %"struct.std::pair", ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 8, !tbaa !11
  %143 = load i32, ptr %14, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %144
  %146 = getelementptr inbounds %"struct.std::pair", ptr %145, i32 0, i32 0
  %147 = load i32, ptr %146, align 8, !tbaa !11
  %148 = icmp ne i32 %142, %147
  br i1 %148, label %149, label %158

149:                                              ; preds = %136, %133
  %150 = load i32, ptr %14, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %151
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %13, align 4, !tbaa !5
  %155 = sext i32 %153 to i64
  %156 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %155
  %157 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %156, ptr noundef nonnull align 4 dereferenceable(8) %152)
  br label %158

158:                                              ; preds = %149, %136
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %14, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %14, align 4, !tbaa !5
  br label %128, !llvm.loop !16

162:                                              ; preds = %132
  %163 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %163, ptr @szO, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %164 = load i32, ptr @szA, align 4, !tbaa !5
  %165 = sub nsw i32 %164, 1
  store i32 %165, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %166 = load i32, ptr @szO, align 4, !tbaa !5
  %167 = sub nsw i32 %166, 1
  store i32 %167, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %168 = load i32, ptr %3, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %18, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %235, %162
  %171 = load i32, ptr %15, align 4, !tbaa !5
  %172 = icmp sge i32 %171, 0
  br i1 %172, label %173, label %176

173:                                              ; preds = %170
  %174 = load i32, ptr %16, align 4, !tbaa !5
  %175 = icmp sge i32 %174, 0
  br label %176

176:                                              ; preds = %173, %170
  %177 = phi i1 [ false, %170 ], [ %175, %173 ]
  br i1 %177, label %179, label %178

178:                                              ; preds = %176
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %237

179:                                              ; preds = %176
  %180 = load i32, ptr %15, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %181
  %183 = getelementptr inbounds %"struct.std::pair", ptr %182, i32 0, i32 1
  %184 = load i32, ptr %16, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %185
  %187 = getelementptr inbounds %"struct.std::pair", ptr %186, i32 0, i32 1
  %188 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %183, ptr noundef nonnull align 4 dereferenceable(4) %187)
  %189 = load i32, ptr %188, align 4, !tbaa !5
  store i32 %189, ptr %17, align 4, !tbaa !5
  %190 = load i32, ptr @ans, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = load i32, ptr %15, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %193
  %195 = getelementptr inbounds %"struct.std::pair", ptr %194, i32 0, i32 0
  %196 = load i32, ptr %195, align 8, !tbaa !11
  %197 = sext i32 %196 to i64
  %198 = load i32, ptr %16, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %199
  %201 = getelementptr inbounds %"struct.std::pair", ptr %200, i32 0, i32 0
  %202 = load i32, ptr %201, align 8, !tbaa !11
  %203 = sext i32 %202 to i64
  %204 = mul nsw i64 %197, %203
  %205 = srem i64 %204, 1000000007
  %206 = load i32, ptr %18, align 4, !tbaa !5
  %207 = load i32, ptr %17, align 4, !tbaa !5
  %208 = sub nsw i32 %206, %207
  %209 = sext i32 %208 to i64
  %210 = mul nsw i64 %205, %209
  %211 = add nsw i64 %191, %210
  %212 = srem i64 %211, 1000000007
  %213 = trunc i64 %212 to i32
  store i32 %213, ptr @ans, align 4, !tbaa !5
  %214 = load i32, ptr %17, align 4, !tbaa !5
  %215 = load i32, ptr %15, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %216
  %218 = getelementptr inbounds %"struct.std::pair", ptr %217, i32 0, i32 1
  %219 = load i32, ptr %218, align 4, !tbaa !17
  %220 = icmp eq i32 %214, %219
  br i1 %220, label %221, label %224

221:                                              ; preds = %179
  %222 = load i32, ptr %15, align 4, !tbaa !5
  %223 = add nsw i32 %222, -1
  store i32 %223, ptr %15, align 4, !tbaa !5
  br label %224

224:                                              ; preds = %221, %179
  %225 = load i32, ptr %17, align 4, !tbaa !5
  %226 = load i32, ptr %16, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %227
  %229 = getelementptr inbounds %"struct.std::pair", ptr %228, i32 0, i32 1
  %230 = load i32, ptr %229, align 4, !tbaa !17
  %231 = icmp eq i32 %225, %230
  br i1 %231, label %232, label %235

232:                                              ; preds = %224
  %233 = load i32, ptr %16, align 4, !tbaa !5
  %234 = add nsw i32 %233, -1
  store i32 %234, ptr %16, align 4, !tbaa !5
  br label %235

235:                                              ; preds = %232, %224
  %236 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %236, ptr %18, align 4, !tbaa !5
  br label %170, !llvm.loop !18

237:                                              ; preds = %178
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %3, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !19

241:                                              ; preds = %38
  %242 = load i32, ptr @ans, align 4, !tbaa !5
  %243 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %242)
  ret i32 0
}

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 i64 @_ZSt9make_pairIjRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@szA = external dso_local local_unnamed_addr global i32, align 4
@szO = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@stkA = external dso_local global [100001 x %"struct.std::pair"], align 16
@stkO = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %.not58 = icmp slt i32 %7, 1
  br i1 %.not58, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  br label %._crit_edge84

._crit_edge:                                      ; preds = %.lr.ph
  %8 = icmp slt i32 %11, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  br i1 %8, label %._crit_edge84, label %.lr.ph83

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

._crit_edge84:                                    ; preds = %._crit_edge80, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %13 = load i32, ptr @ans, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %13)
  ret i32 0

.lr.ph83:                                         ; preds = %._crit_edge, %._crit_edge80
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 2147483647, ptr %3, align 4, !tbaa !5
  %15 = call i64 @_ZSt9make_pairIjRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %15, ptr %2, align 8
  %16 = load i32, ptr @szA, align 4, !tbaa !5
  %17 = add nsw i32 %16, 1
  store i32 %17, ptr @szA, align 4, !tbaa !5
  %18 = sext i32 %16 to i64
  %19 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %18
  %20 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSIjiEENSt9enable_ifIXsr6__and_ISt13is_assignableIRiOT_ES3_IS4_OT0_EEE5valueERS0_E4typeEOS_IS5_S8_E(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %21 = load i32, ptr @szA, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph62, label %._crit_edge66

.lr.ph62:                                         ; preds = %.lr.ph83
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %wide.trip.count = zext nneg i32 %21 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %27 = icmp ult i32 %21, 4
  br i1 %27, label %.preheader57.unr-lcssa, label %.lr.ph62.new

.lr.ph62.new:                                     ; preds = %.lr.ph62
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %31

.preheader57.unr-lcssa:                           ; preds = %31, %.lr.ph62
  %indvars.iv86.unr = phi i64 [ 0, %.lr.ph62 ], [ %indvars.iv.next87.3, %31 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader57, label %.epil.preheader

.epil.preheader:                                  ; preds = %.preheader57.unr-lcssa, %.epil.preheader
  %indvars.iv86.epil = phi i64 [ %indvars.iv.next87.epil, %.epil.preheader ], [ %indvars.iv86.unr, %.preheader57.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.preheader57.unr-lcssa ]
  %28 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv86.epil
  %29 = load i32, ptr %28, align 8, !tbaa !11
  %30 = and i32 %29, %26
  store i32 %30, ptr %28, align 8, !tbaa !11
  %indvars.iv.next87.epil = add nuw nsw i64 %indvars.iv86.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader57, label %.epil.preheader, !llvm.loop !13

.preheader57:                                     ; preds = %.epil.preheader, %.preheader57.unr-lcssa
  br i1 %22, label %.lr.ph65, label %._crit_edge66

31:                                               ; preds = %31, %.lr.ph62.new
  %indvars.iv86 = phi i64 [ 0, %.lr.ph62.new ], [ %indvars.iv.next87.3, %31 ]
  %niter = phi i64 [ 0, %.lr.ph62.new ], [ %niter.next.3, %31 ]
  %32 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv86
  %33 = load i32, ptr %32, align 16, !tbaa !11
  %34 = and i32 %33, %26
  store i32 %34, ptr %32, align 16, !tbaa !11
  %indvars.iv.next87 = or disjoint i64 %indvars.iv86, 1
  %35 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv.next87
  %36 = load i32, ptr %35, align 8, !tbaa !11
  %37 = and i32 %36, %26
  store i32 %37, ptr %35, align 8, !tbaa !11
  %indvars.iv.next87.1 = or disjoint i64 %indvars.iv86, 2
  %38 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv.next87.1
  %39 = load i32, ptr %38, align 16, !tbaa !11
  %40 = and i32 %39, %26
  store i32 %40, ptr %38, align 16, !tbaa !11
  %indvars.iv.next87.2 = or disjoint i64 %indvars.iv86, 3
  %41 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv.next87.2
  %42 = load i32, ptr %41, align 8, !tbaa !11
  %43 = and i32 %42, %26
  store i32 %43, ptr %41, align 8, !tbaa !11
  %indvars.iv.next87.3 = add nuw nsw i64 %indvars.iv86, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader57.unr-lcssa, label %31, !llvm.loop !15

._crit_edge66:                                    ; preds = %71, %.lr.ph83, %.preheader57
  %.049.lcssa = phi i32 [ 0, %.preheader57 ], [ 0, %.lr.ph83 ], [ %.150, %71 ]
  store i32 %.049.lcssa, ptr @szA, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  %44 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %44, ptr %4, align 8
  %45 = load i32, ptr @szO, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @szO, align 4, !tbaa !5
  %47 = sext i32 %45 to i64
  %48 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %47
  %49 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %48, ptr noundef nonnull align 4 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %50 = load i32, ptr @szO, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph69, label %._crit_edge73

.lr.ph69:                                         ; preds = %._crit_edge66
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %wide.trip.count95 = zext nneg i32 %50 to i64
  %xtraiter105 = and i64 %wide.trip.count95, 3
  %56 = icmp ult i32 %50, 4
  br i1 %56, label %.preheader.unr-lcssa, label %.lr.ph69.new

.lr.ph69.new:                                     ; preds = %.lr.ph69
  %unroll_iter108 = and i64 %wide.trip.count95, 2147483644
  br label %78

.lr.ph65:                                         ; preds = %.preheader57, %71
  %57 = phi i32 [ %72, %71 ], [ %21, %.preheader57 ]
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %71 ], [ 0, %.preheader57 ]
  %.04963 = phi i32 [ %.150, %71 ], [ 0, %.preheader57 ]
  %.not55 = icmp eq i32 %.04963, 0
  br i1 %.not55, label %65, label %58

58:                                               ; preds = %.lr.ph65
  %59 = add nsw i32 %.04963, -1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %60
  %62 = load i32, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv89
  %64 = load i32, ptr %63, align 8, !tbaa !11
  %.not56 = icmp eq i32 %62, %64
  br i1 %.not56, label %71, label %65

65:                                               ; preds = %58, %.lr.ph65
  %66 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %indvars.iv89
  %67 = add nsw i32 %.04963, 1
  %68 = sext i32 %.04963 to i64
  %69 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %68
  %70 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %69, ptr noundef nonnull align 4 dereferenceable(8) %66)
  %.pre = load i32, ptr @szA, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %58, %65
  %72 = phi i32 [ %.pre, %65 ], [ %57, %58 ]
  %.150 = phi i32 [ %67, %65 ], [ %.04963, %58 ]
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %73 = sext i32 %72 to i64
  %74 = icmp slt i64 %indvars.iv.next90, %73
  br i1 %74, label %.lr.ph65, label %._crit_edge66, !llvm.loop !16

.preheader.unr-lcssa:                             ; preds = %78, %.lr.ph69
  %indvars.iv92.unr = phi i64 [ 0, %.lr.ph69 ], [ %indvars.iv.next93.3, %78 ]
  %lcmp.mod107.not = icmp eq i64 %xtraiter105, 0
  br i1 %lcmp.mod107.not, label %.preheader, label %.epil.preheader104

.epil.preheader104:                               ; preds = %.preheader.unr-lcssa, %.epil.preheader104
  %indvars.iv92.epil = phi i64 [ %indvars.iv.next93.epil, %.epil.preheader104 ], [ %indvars.iv92.unr, %.preheader.unr-lcssa ]
  %epil.iter106 = phi i64 [ %epil.iter106.next, %.epil.preheader104 ], [ 0, %.preheader.unr-lcssa ]
  %75 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv92.epil
  %76 = load i32, ptr %75, align 8, !tbaa !11
  %77 = or i32 %76, %55
  store i32 %77, ptr %75, align 8, !tbaa !11
  %indvars.iv.next93.epil = add nuw nsw i64 %indvars.iv92.epil, 1
  %epil.iter106.next = add i64 %epil.iter106, 1
  %epil.iter106.cmp.not = icmp eq i64 %epil.iter106.next, %xtraiter105
  br i1 %epil.iter106.cmp.not, label %.preheader, label %.epil.preheader104, !llvm.loop !17

.preheader:                                       ; preds = %.epil.preheader104, %.preheader.unr-lcssa
  br i1 %51, label %.lr.ph72, label %._crit_edge73

78:                                               ; preds = %78, %.lr.ph69.new
  %indvars.iv92 = phi i64 [ 0, %.lr.ph69.new ], [ %indvars.iv.next93.3, %78 ]
  %niter109 = phi i64 [ 0, %.lr.ph69.new ], [ %niter109.next.3, %78 ]
  %79 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv92
  %80 = load i32, ptr %79, align 16, !tbaa !11
  %81 = or i32 %80, %55
  store i32 %81, ptr %79, align 16, !tbaa !11
  %indvars.iv.next93 = or disjoint i64 %indvars.iv92, 1
  %82 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv.next93
  %83 = load i32, ptr %82, align 8, !tbaa !11
  %84 = or i32 %83, %55
  store i32 %84, ptr %82, align 8, !tbaa !11
  %indvars.iv.next93.1 = or disjoint i64 %indvars.iv92, 2
  %85 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv.next93.1
  %86 = load i32, ptr %85, align 16, !tbaa !11
  %87 = or i32 %86, %55
  store i32 %87, ptr %85, align 16, !tbaa !11
  %indvars.iv.next93.2 = or disjoint i64 %indvars.iv92, 3
  %88 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv.next93.2
  %89 = load i32, ptr %88, align 8, !tbaa !11
  %90 = or i32 %89, %55
  store i32 %90, ptr %88, align 8, !tbaa !11
  %indvars.iv.next93.3 = add nuw nsw i64 %indvars.iv92, 4
  %niter109.next.3 = add i64 %niter109, 4
  %niter109.ncmp.3 = icmp eq i64 %niter109.next.3, %unroll_iter108
  br i1 %niter109.ncmp.3, label %.preheader.unr-lcssa, label %78, !llvm.loop !18

._crit_edge73:                                    ; preds = %113, %._crit_edge66, %.preheader
  %.045.lcssa = phi i32 [ 0, %.preheader ], [ 0, %._crit_edge66 ], [ %.146, %113 ]
  store i32 %.045.lcssa, ptr @szO, align 4, !tbaa !5
  %91 = load i32, ptr @szA, align 4, !tbaa !5
  %92 = load i32, ptr %1, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  %94 = icmp sgt i32 %91, 0
  %95 = icmp sgt i32 %.045.lcssa, 0
  %96 = select i1 %94, i1 %95, i1 false
  br i1 %96, label %.lr.ph79.preheader, label %._crit_edge80

.lr.ph79.preheader:                               ; preds = %._crit_edge73
  %97 = add nsw i32 %.045.lcssa, -1
  %98 = add nsw i32 %91, -1
  br label %.lr.ph79

.lr.ph72:                                         ; preds = %.preheader, %113
  %99 = phi i32 [ %114, %113 ], [ %50, %.preheader ]
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %113 ], [ 0, %.preheader ]
  %.04570 = phi i32 [ %.146, %113 ], [ 0, %.preheader ]
  %.not53 = icmp eq i32 %.04570, 0
  br i1 %.not53, label %107, label %100

100:                                              ; preds = %.lr.ph72
  %101 = add nsw i32 %.04570, -1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %102
  %104 = load i32, ptr %103, align 8, !tbaa !11
  %105 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv97
  %106 = load i32, ptr %105, align 8, !tbaa !11
  %.not54 = icmp eq i32 %104, %106
  br i1 %.not54, label %113, label %107

107:                                              ; preds = %100, %.lr.ph72
  %108 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %indvars.iv97
  %109 = add nsw i32 %.04570, 1
  %110 = sext i32 %.04570 to i64
  %111 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %110
  %112 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %111, ptr noundef nonnull align 4 dereferenceable(8) %108)
  %.pre100 = load i32, ptr @szO, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %100, %107
  %114 = phi i32 [ %.pre100, %107 ], [ %99, %100 ]
  %.146 = phi i32 [ %109, %107 ], [ %.04570, %100 ]
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %115 = sext i32 %114 to i64
  %116 = icmp slt i64 %indvars.iv.next98, %115
  br i1 %116, label %.lr.ph72, label %._crit_edge73, !llvm.loop !19

._crit_edge80.loopexit:                           ; preds = %.lr.ph79
  %.pre101 = load i32, ptr %1, align 4, !tbaa !5
  %.pre102 = add nsw i32 %.pre101, 1
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %._crit_edge80.loopexit, %._crit_edge73
  %.pre-phi = phi i32 [ %.pre102, %._crit_edge80.loopexit ], [ %93, %._crit_edge73 ]
  %117 = phi i32 [ %.pre101, %._crit_edge80.loopexit ], [ %92, %._crit_edge73 ]
  store i32 %.pre-phi, ptr %1, align 4, !tbaa !5
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %.not52.not = icmp slt i32 %117, %118
  br i1 %.not52.not, label %.lr.ph83, label %._crit_edge84, !llvm.loop !20

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %.lr.ph79
  %.077 = phi i32 [ %126, %.lr.ph79 ], [ %93, %.lr.ph79.preheader ]
  %.04176 = phi i32 [ %.1, %.lr.ph79 ], [ %97, %.lr.ph79.preheader ]
  %.04275 = phi i32 [ %spec.select, %.lr.ph79 ], [ %98, %.lr.ph79.preheader ]
  %119 = zext nneg i32 %.04275 to i64
  %120 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkA, i64 0, i64 %119
  %121 = getelementptr inbounds i8, ptr %120, i64 4
  %122 = zext nneg i32 %.04176 to i64
  %123 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @stkO, i64 0, i64 %122
  %124 = getelementptr inbounds i8, ptr %123, i64 4
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %121, ptr noundef nonnull align 4 dereferenceable(4) %124)
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr @ans, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = load i32, ptr %120, align 8, !tbaa !11
  %130 = sext i32 %129 to i64
  %131 = load i32, ptr %123, align 8, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = mul nsw i64 %132, %130
  %134 = srem i64 %133, 1000000007
  %135 = sub nsw i32 %.077, %126
  %136 = sext i32 %135 to i64
  %137 = mul nsw i64 %134, %136
  %138 = add nsw i64 %137, %128
  %139 = srem i64 %138, 1000000007
  %140 = trunc nsw i64 %139 to i32
  store i32 %140, ptr @ans, align 4, !tbaa !5
  %141 = load i32, ptr %121, align 4, !tbaa !21
  %142 = icmp eq i32 %126, %141
  %143 = sext i1 %142 to i32
  %spec.select = add nsw i32 %.04275, %143
  %144 = load i32, ptr %124, align 4, !tbaa !21
  %145 = icmp eq i32 %126, %144
  %146 = sext i1 %145 to i32
  %.1 = add nsw i32 %.04176, %146
  %147 = icmp sgt i32 %spec.select, -1
  %148 = icmp sgt i32 %.1, -1
  %149 = select i1 %147, i1 %148, i1 false
  br i1 %149, label %.lr.ph79, label %._crit_edge80.loopexit, !llvm.loop !22
}

; 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 i64 @_ZSt9make_pairIjRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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