; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/World Cup 2016/World Cup Round 2/Problem B (B)

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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@a = external dso_local global [40 x i32], align 16
@b = external dso_local global [40 x i32], align 16
@ans = external dso_local global i64, align 8
@dp = external dso_local global [40 x %"class.std::map"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %19 = alloca i32, align 4
  %20 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store i32 0, ptr %1, align 4
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %32

30:                                               ; preds = %0
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  br label %291

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

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

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

38:                                               ; preds = %33
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %40
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %41)
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %47, %51
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %38
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %2, align 4, !tbaa !5
  br label %33, !llvm.loop !9

59:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  %62 = sdiv i32 %61, 2
  store i32 %62, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %63, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %66 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds ([40 x %"class.std::map"], ptr @dp, i64 0, i64 1), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([40 x i32], ptr @a, i64 0, i64 1))
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %132, %59
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = icmp sle i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %135

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %128, %74
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = sub nsw i32 %76, %77
  %79 = icmp sge i32 %78, 1
  br i1 %79, label %81, label %80

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

81:                                               ; preds = %75
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sub nsw i32 %82, %83
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = add nsw i32 %88, %87
  store i32 %89, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = sub nsw i32 %90, %91
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %94
  %96 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %95) #5
  %97 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %9, i32 0, i32 0
  store ptr %96, ptr %97, align 8
  br label %98

98:                                               ; preds = %124, %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = sub nsw i32 %99, %100
  %102 = sub nsw i32 %101, 1
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %103
  %105 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %104) #5
  %106 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  %107 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br i1 %107, label %109, label %108

108:                                              ; preds = %98
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %127

109:                                              ; preds = %98
  %110 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %111 = getelementptr inbounds %"struct.std::pair", ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 4, !tbaa !11
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %118 = getelementptr inbounds %"struct.std::pair", ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !13
  %120 = xor i32 %116, %119
  store i32 %120, ptr %11, align 4, !tbaa !5
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %115, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = add nsw i32 %122, %112
  store i32 %123, ptr %121, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %124

124:                                              ; preds = %109
  %125 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %9, i32 noundef 0) #5
  %126 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %12, i32 0, i32 0
  store ptr %125, ptr %126, align 8
  br label %98, !llvm.loop !14

127:                                              ; preds = %108
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %8, align 4, !tbaa !5
  br label %75, !llvm.loop !15

131:                                              ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %5, align 4, !tbaa !5
  br label %69, !llvm.loop !16

135:                                              ; preds = %73
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  %140 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %139, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %140, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %143 = load i32, ptr @n, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %144
  %146 = load i32, ptr @n, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %147
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %145, ptr noundef nonnull align 4 dereferenceable(4) %148)
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %152 = load i32, ptr @n, align 4, !tbaa !5
  %153 = sub nsw i32 %152, 1
  store i32 %153, ptr %14, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %218, %135
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = load i32, ptr %3, align 4, !tbaa !5
  %157 = icmp sgt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %221

159:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %214, %159
  %161 = load i32, ptr %14, align 4, !tbaa !5
  %162 = load i32, ptr %16, align 4, !tbaa !5
  %163 = add nsw i32 %161, %162
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = icmp sle i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %160
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %217

167:                                              ; preds = %160
  %168 = load i32, ptr %14, align 4, !tbaa !5
  %169 = load i32, ptr %16, align 4, !tbaa !5
  %170 = add nsw i32 %168, %169
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr %15, align 4, !tbaa !5
  %175 = add nsw i32 %174, %173
  store i32 %175, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %176 = load i32, ptr %14, align 4, !tbaa !5
  %177 = load i32, ptr %16, align 4, !tbaa !5
  %178 = add nsw i32 %176, %177
  %179 = add nsw i32 %178, 1
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %180
  %182 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %181) #5
  %183 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %17, i32 0, i32 0
  store ptr %182, ptr %183, align 8
  br label %184

184:                                              ; preds = %210, %167
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %185 = load i32, ptr %14, align 4, !tbaa !5
  %186 = load i32, ptr %16, align 4, !tbaa !5
  %187 = add nsw i32 %185, %186
  %188 = add nsw i32 %187, 1
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %189
  %191 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %190) #5
  %192 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %18, i32 0, i32 0
  store ptr %191, ptr %192, align 8
  %193 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br i1 %193, label %195, label %194

194:                                              ; preds = %184
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %213

195:                                              ; preds = %184
  %196 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #5
  %197 = getelementptr inbounds %"struct.std::pair", ptr %196, i32 0, i32 1
  %198 = load i32, ptr %197, align 4, !tbaa !11
  %199 = load i32, ptr %14, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %200
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %202 = load i32, ptr %15, align 4, !tbaa !5
  %203 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #5
  %204 = getelementptr inbounds %"struct.std::pair", ptr %203, i32 0, i32 0
  %205 = load i32, ptr %204, align 4, !tbaa !13
  %206 = xor i32 %202, %205
  store i32 %206, ptr %19, align 4, !tbaa !5
  %207 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %201, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = add nsw i32 %208, %198
  store i32 %209, ptr %207, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %210

210:                                              ; preds = %195
  %211 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 0) #5
  %212 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  store ptr %211, ptr %212, align 8
  br label %184, !llvm.loop !17

213:                                              ; preds = %194
  br label %214

214:                                              ; preds = %213
  %215 = load i32, ptr %16, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %16, align 4, !tbaa !5
  br label %160, !llvm.loop !18

217:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr %14, align 4, !tbaa !5
  %220 = add nsw i32 %219, -1
  store i32 %220, ptr %14, align 4, !tbaa !5
  br label %154, !llvm.loop !19

221:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %222

222:                                              ; preds = %285, %221
  %223 = load i32, ptr %21, align 4, !tbaa !5
  %224 = load i32, ptr %3, align 4, !tbaa !5
  %225 = icmp sle i32 %223, %224
  br i1 %225, label %227, label %226

226:                                              ; preds = %222
  store i32 23, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %288

227:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %228 = load i32, ptr %21, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %229
  %231 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %230) #5
  %232 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %22, i32 0, i32 0
  store ptr %231, ptr %232, align 8
  br label %233

233:                                              ; preds = %281, %227
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %234 = load i32, ptr %21, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %235
  %237 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %236) #5
  %238 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %23, i32 0, i32 0
  store ptr %237, ptr %238, align 8
  %239 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  br i1 %239, label %241, label %240

240:                                              ; preds = %233
  store i32 26, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  br label %284

241:                                              ; preds = %233
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %242 = load i32, ptr %3, align 4, !tbaa !5
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %24, align 4, !tbaa !5
  br label %244

244:                                              ; preds = %277, %241
  %245 = load i32, ptr %24, align 4, !tbaa !5
  %246 = load i32, ptr @n, align 4, !tbaa !5
  %247 = icmp sle i32 %245, %246
  br i1 %247, label %249, label %248

248:                                              ; preds = %244
  store i32 29, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %280

249:                                              ; preds = %244
  %250 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #5
  %251 = getelementptr inbounds %"struct.std::pair", ptr %250, i32 0, i32 1
  %252 = load i32, ptr %251, align 4, !tbaa !11
  %253 = sext i32 %252 to i64
  %254 = load i32, ptr %24, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %256
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %258 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %22) #5
  %259 = getelementptr inbounds %"struct.std::pair", ptr %258, i32 0, i32 0
  %260 = load i32, ptr %259, align 4, !tbaa !13
  %261 = load i32, ptr %24, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = load i32, ptr %21, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !5
  %269 = sub nsw i32 %264, %268
  %270 = xor i32 %260, %269
  store i32 %270, ptr %25, align 4, !tbaa !5
  %271 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %257, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %272 = load i32, ptr %271, align 4, !tbaa !5
  %273 = sext i32 %272 to i64
  %274 = mul nsw i64 %253, %273
  %275 = load i64, ptr @ans, align 8, !tbaa !20
  %276 = add nsw i64 %275, %274
  store i64 %276, ptr @ans, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %277

277:                                              ; preds = %249
  %278 = load i32, ptr %24, align 4, !tbaa !5
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %24, align 4, !tbaa !5
  br label %244, !llvm.loop !22

280:                                              ; preds = %248
  br label %281

281:                                              ; preds = %280
  %282 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef 0) #5
  %283 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %26, i32 0, i32 0
  store ptr %282, ptr %283, align 8
  br label %233, !llvm.loop !23

284:                                              ; preds = %240
  br label %285

285:                                              ; preds = %284
  %286 = load i32, ptr %21, align 4, !tbaa !5
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %21, align 4, !tbaa !5
  br label %222, !llvm.loop !24

288:                                              ; preds = %226
  %289 = load i64, ptr @ans, align 8, !tbaa !20
  %290 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %289)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %291

291:                                              ; preds = %288, %30
  %292 = load i32, ptr %1, align 4
  ret i32 %292
}

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

declare i32 @printf(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 noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 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 = { 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 4}
!12 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !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"

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global [40 x i32], align 16
@b = external dso_local local_unnamed_addr global [40 x i32], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@dp = external dso_local global [40 x %"class.std::map"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 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::_Rb_tree_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca i32, align 4
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %15, label %.preheader68

.preheader68:                                     ; preds = %0
  %.not69 = icmp slt i32 %13, 1
  br i1 %.not69, label %._crit_edge, label %.lr.ph

15:                                               ; preds = %0
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %145

._crit_edge:                                      ; preds = %.lr.ph, %.preheader68
  %.lcssa = phi i32 [ %13, %.preheader68 ], [ %34, %.lr.ph ]
  %17 = add nsw i32 %.lcssa, 1
  %18 = sdiv i32 %17, 2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) getelementptr inbounds (i8, ptr @dp, i64 48), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @a, i64 4))
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %22, align 4, !tbaa !5
  %.not6276 = icmp slt i32 %.lcssa, 3
  br i1 %.not6276, label %._crit_edge78, label %.preheader67.preheader

.preheader67.preheader:                           ; preds = %._crit_edge
  %smax = call i32 @llvm.smax.i32(i32 %18, i32 2)
  %25 = add nuw nsw i32 %smax, 1
  %wide.trip.count113 = zext nneg i32 %25 to i64
  br label %.preheader67

.lr.ph:                                           ; preds = %.preheader68, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader68 ]
  %26 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %indvars.iv
  %27 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %26)
  %28 = add nsw i64 %indvars.iv, -1
  %29 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %26, align 4, !tbaa !5
  %32 = add nsw i32 %31, %30
  %33 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %indvars.iv
  store i32 %32, ptr %33, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %.not.not = icmp slt i64 %indvars.iv, %35
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader67:                                     ; preds = %.preheader67.preheader, %56
  %indvars.iv103 = phi i64 [ 2, %.preheader67.preheader ], [ %indvars.iv.next104, %56 ]
  %36 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %indvars.iv103
  br label %57

._crit_edge78:                                    ; preds = %56, %._crit_edge
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %39
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %40, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %45
  %47 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %45
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %46, ptr noundef nonnull align 4 dereferenceable(4) %47)
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 4, !tbaa !5
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %.05586 = add nsw i32 %51, -1
  %52 = icmp sgt i32 %.05586, %18
  br i1 %52, label %.preheader66.preheader, label %.preheader

.preheader66.preheader:                           ; preds = %._crit_edge78
  %53 = sext i32 %51 to i64
  %54 = add nsw i64 %53, -1
  %55 = sext i32 %18 to i64
  br label %.preheader66

56:                                               ; preds = %._crit_edge73
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count113
  br i1 %exitcond114.not, label %._crit_edge78, label %.preheader67, !llvm.loop !11

57:                                               ; preds = %.preheader67, %._crit_edge73
  %indvars.iv107 = phi i64 [ 0, %.preheader67 ], [ %indvars.iv.next108, %._crit_edge73 ]
  %indvars.iv105 = phi i64 [ %indvars.iv103, %.preheader67 ], [ %indvars.iv.next106, %._crit_edge73 ]
  %.05874 = phi i32 [ 0, %.preheader67 ], [ %60, %._crit_edge73 ]
  %58 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %indvars.iv105
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, %.05874
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %indvars.iv.next106 = add nsw i64 %indvars.iv105, -1
  %61 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %indvars.iv.next106
  %62 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %61) #6
  store ptr %62, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %63 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %61) #6
  store ptr %63, ptr %3, align 8
  %64 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %64, label %.lr.ph72, label %._crit_edge73

._crit_edge73:                                    ; preds = %.lr.ph72, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next108, %indvars.iv103
  br i1 %exitcond.not, label %56, label %57, !llvm.loop !12

.lr.ph72:                                         ; preds = %57, %.lr.ph72
  %65 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  %67 = load i32, ptr %66, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %68 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %69 = load i32, ptr %68, align 4, !tbaa !15
  %70 = xor i32 %69, %60
  store i32 %70, ptr %4, align 4, !tbaa !5
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %36, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, %67
  store i32 %73, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %74 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %75 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %61) #6
  store ptr %75, ptr %3, align 8
  %76 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br i1 %76, label %.lr.ph72, label %._crit_edge73, !llvm.loop !16

.loopexit:                                        ; preds = %._crit_edge81, %.preheader66
  %77 = phi i32 [ %80, %.preheader66 ], [ %98, %._crit_edge81 ]
  %indvars.iv.next119 = add nsw i64 %indvars.iv118, -1
  %78 = icmp sgt i64 %indvars.iv.next119, %55
  %79 = trunc nsw i64 %indvars.iv118 to i32
  br i1 %78, label %.preheader66, label %.preheader, !llvm.loop !17

.preheader66:                                     ; preds = %.preheader66.preheader, %.loopexit
  %80 = phi i32 [ %51, %.preheader66.preheader ], [ %77, %.loopexit ]
  %indvars.iv118 = phi i64 [ %54, %.preheader66.preheader ], [ %indvars.iv.next119, %.loopexit ]
  %.055.in87 = phi i32 [ %51, %.preheader66.preheader ], [ %79, %.loopexit ]
  %81 = sext i32 %80 to i64
  %.not6582 = icmp sgt i64 %indvars.iv118, %81
  br i1 %.not6582, label %.loopexit, label %.lr.ph85

.lr.ph85:                                         ; preds = %.preheader66
  %82 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %indvars.iv118
  br label %85

.preheader:                                       ; preds = %.loopexit, %._crit_edge78
  %.not6397 = icmp slt i32 %.lcssa, -2
  br i1 %.not6397, label %._crit_edge100, label %.lr.ph99

.lr.ph99:                                         ; preds = %.preheader
  %narrow = add nsw i32 %18, 1
  %83 = sext i32 %narrow to i64
  %smax127 = call i32 @llvm.smax.i32(i32 %18, i32 0)
  %84 = add nuw nsw i32 %smax127, 1
  %wide.trip.count = zext nneg i32 %84 to i64
  br label %114

85:                                               ; preds = %.lr.ph85, %._crit_edge81
  %indvars.iv115 = phi i64 [ 0, %.lr.ph85 ], [ %indvars.iv.next116, %._crit_edge81 ]
  %.05483 = phi i32 [ 0, %.lr.ph85 ], [ %89, %._crit_edge81 ]
  %86 = add nsw i64 %indvars.iv115, %indvars.iv118
  %87 = getelementptr inbounds [40 x i32], ptr @a, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i32 %88, %.05483
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %90 = trunc nuw nsw i64 %indvars.iv115 to i32
  %91 = add i32 %.055.in87, %90
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %92
  %94 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %93) #6
  store ptr %94, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %95 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %93) #6
  store ptr %95, ptr %7, align 8
  %96 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %96, label %.lr.ph80, label %._crit_edge81

._crit_edge81:                                    ; preds = %.lr.ph80, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %97 = add nsw i64 %indvars.iv.next116, %indvars.iv118
  %98 = load i32, ptr @n, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %.not65 = icmp sgt i64 %97, %99
  br i1 %.not65, label %.loopexit, label %85, !llvm.loop !18

.lr.ph80:                                         ; preds = %85, %.lr.ph80
  %100 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %101 = getelementptr inbounds i8, ptr %100, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %103 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %104 = load i32, ptr %103, align 4, !tbaa !15
  %105 = xor i32 %104, %89
  store i32 %105, ptr %8, align 4, !tbaa !5
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %82, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = add nsw i32 %107, %102
  store i32 %108, ptr %106, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  %109 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %110 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %93) #6
  store ptr %110, ptr %7, align 8
  %111 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %111, label %.lr.ph80, label %._crit_edge81, !llvm.loop !19

._crit_edge100:                                   ; preds = %._crit_edge96, %.preheader
  %112 = load i64, ptr @ans, align 8, !tbaa !20
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %112)
  br label %145

114:                                              ; preds = %.lr.ph99, %._crit_edge96
  %indvars.iv124 = phi i64 [ 0, %.lr.ph99 ], [ %indvars.iv.next125, %._crit_edge96 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %115 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %indvars.iv124
  %116 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %115) #6
  store ptr %116, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %117 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %115) #6
  store ptr %117, ptr %10, align 8
  %118 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %118, label %.lr.ph95, label %._crit_edge96

.lr.ph95:                                         ; preds = %114
  %119 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %indvars.iv124
  br label %120

._crit_edge96:                                    ; preds = %._crit_edge93, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count
  br i1 %exitcond128.not, label %._crit_edge100, label %114, !llvm.loop !22

120:                                              ; preds = %.lr.ph95, %._crit_edge93
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %.not6489.not = icmp slt i32 %18, %121
  br i1 %.not6489.not, label %.lr.ph92, label %._crit_edge93

._crit_edge93:                                    ; preds = %.lr.ph92, %120
  %122 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %9, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %123 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %115) #6
  store ptr %123, ptr %10, align 8
  %124 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %124, label %120, label %._crit_edge96, !llvm.loop !23

.lr.ph92:                                         ; preds = %120, %.lr.ph92
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %.lr.ph92 ], [ %83, %120 ]
  %125 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %126 = getelementptr inbounds i8, ptr %125, i64 4
  %127 = load i32, ptr %126, align 4, !tbaa !13
  %128 = sext i32 %127 to i64
  %indvars.iv.next122 = add nsw i64 %indvars.iv121, 1
  %129 = getelementptr inbounds [40 x %"class.std::map"], ptr @dp, i64 0, i64 %indvars.iv.next122
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #6
  %130 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %131 = load i32, ptr %130, align 4, !tbaa !15
  %132 = getelementptr inbounds [40 x i32], ptr @b, i64 0, i64 %indvars.iv121
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = load i32, ptr %119, align 4, !tbaa !5
  %135 = sub nsw i32 %133, %134
  %136 = xor i32 %135, %131
  store i32 %136, ptr %11, align 4, !tbaa !5
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48) %129, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = mul nsw i64 %139, %128
  %141 = load i64, ptr @ans, align 8, !tbaa !20
  %142 = add nsw i64 %140, %141
  store i64 %142, ptr @ans, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #6
  %143 = load i32, ptr @n, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %.not64.not = icmp slt i64 %indvars.iv121, %144
  br i1 %.not64.not, label %.lr.ph92, label %._crit_edge93, !llvm.loop !24

145:                                              ; preds = %._crit_edge100, %15
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(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 noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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

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

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

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

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

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"long long", !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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