; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2011-12/Feb (12 Feb G2)

; 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<std::pair<std::pair<int, int>, int>, std::pair<const std::pair<std::pair<int, int>, int>, int>, std::_Select1st<std::pair<const std::pair<std::pair<int, int>, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<const std::pair<std::pair<int, int>, int>, int>, std::_Select1st<std::pair<const std::pair<std::pair<int, int>, int>, int>>, std::less<std::pair<std::pair<int, int>, 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 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type { %"struct.std::pair.3", i32 }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair.7" = type { %"struct.std::pair", i32 }

@N = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@c1 = external dso_local global %"class.std::map", align 8
@c2 = external dso_local global %"class.std::map", align 8
@cow = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z4perpSt4pairIiiES0_(i64, i64) #0

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z3colSt4pairIiiES0_(i64, i64) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z2onSt4pairIS_IiiEiES0_(i64, i32, i64) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca %"struct.std::pair.3", align 4
  %8 = alloca %"struct.std::pair.3", align 4
  %9 = alloca { i64, i32 }, align 8
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca %"struct.std::pair.3", align 4
  %12 = alloca %"struct.std::pair.3", align 4
  %13 = alloca { i64, i32 }, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %16 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %20 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %24 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %25 = alloca ptr, align 8
  %26 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca %"struct.std::pair", align 4
  %32 = alloca %"struct.std::pair.3", align 4
  %33 = alloca { i64, i32 }, align 4
  store i32 0, ptr %1, align 4
  %34 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %35 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %36 = getelementptr i8, ptr %35, i64 -24
  %37 = load i64, ptr %36, align 8
  %38 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %37
  %39 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %38, ptr noundef null)
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %41 = load i32, ptr @N, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %42)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %43

43:                                               ; preds = %59, %0
  %44 = load i32, ptr %2, align 4, !tbaa !8
  %45 = load i32, ptr @N, align 4, !tbaa !8
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  %49 = load i32, ptr %2, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %50) #6
  %52 = getelementptr inbounds %"struct.std::pair.3", ptr %51, i32 0, i32 0
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %52)
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %55) #6
  %57 = getelementptr inbounds %"struct.std::pair.3", ptr %56, i32 0, i32 1
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %53, ptr noundef nonnull align 4 dereferenceable(4) %57)
  br label %59

59:                                               ; preds = %48
  %60 = load i32, ptr %2, align 4, !tbaa !8
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %2, align 4, !tbaa !8
  br label %43, !llvm.loop !11

62:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %63

63:                                               ; preds = %105, %62
  %64 = load i32, ptr %3, align 4, !tbaa !8
  %65 = load i32, ptr @N, align 4, !tbaa !8
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %69 = load i32, ptr %3, align 4, !tbaa !8
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !8
  br label %71

71:                                               ; preds = %101, %68
  %72 = load i32, ptr %5, align 4, !tbaa !8
  %73 = load i32, ptr @N, align 4, !tbaa !8
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #6
  %77 = load i32, ptr %3, align 4, !tbaa !8
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %78) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %79, i64 8, i1 false)
  %80 = load i32, ptr %5, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %81) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %82, i64 8, i1 false)
  %83 = load i64, ptr %7, align 4
  %84 = load i64, ptr %8, align 4
  %85 = call { i64, i32 } @_Z4perpSt4pairIiiES0_(i64 %83, i64 %84)
  store { i64, i32 } %85, ptr %9, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 8 %9, i64 12, i1 false)
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @c1, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %86, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #6
  %89 = load i32, ptr %3, align 4, !tbaa !8
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %90) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %91, i64 8, i1 false)
  %92 = load i32, ptr %5, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %93) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %94, i64 8, i1 false)
  %95 = load i64, ptr %11, align 4
  %96 = load i64, ptr %12, align 4
  %97 = call { i64, i32 } @_Z3colSt4pairIiiES0_(i64 %95, i64 %96)
  store { i64, i32 } %97, ptr %13, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 8 %13, i64 12, i1 false)
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %10)
  %99 = load i32, ptr %98, align 4, !tbaa !8
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %98, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #6
  br label %101

101:                                              ; preds = %76
  %102 = load i32, ptr %5, align 4, !tbaa !8
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %5, align 4, !tbaa !8
  br label %71, !llvm.loop !13

104:                                              ; preds = %75
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %3, align 4, !tbaa !8
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %3, align 4, !tbaa !8
  br label %63, !llvm.loop !14

108:                                              ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr @c2, ptr %14, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %109 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #6
  %110 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %15, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %111 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #6
  %112 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %16, i32 0, i32 0
  store ptr %111, ptr %112, align 8
  br label %113

113:                                              ; preds = %131, %108
  %114 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br i1 %114, label %116, label %115

115:                                              ; preds = %113
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %133

116:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %117 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  store ptr %117, ptr %17, align 8, !tbaa !15
  %118 = load ptr, ptr %17, align 8, !tbaa !15
  %119 = getelementptr inbounds %"struct.std::pair.7", ptr %118, i32 0, i32 1
  %120 = load i32, ptr %119, align 4, !tbaa !17
  %121 = load i32, ptr @N, align 4, !tbaa !8
  %122 = load i32, ptr @N, align 4, !tbaa !8
  %123 = sub nsw i32 %122, 1
  %124 = mul nsw i32 %121, %123
  %125 = sdiv i32 %124, 2
  %126 = icmp eq i32 %120, %125
  br i1 %126, label %127, label %130

127:                                              ; preds = %116
  %128 = load i32, ptr @ans, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr @ans, align 4, !tbaa !8
  br label %130

130:                                              ; preds = %127, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %131

131:                                              ; preds = %130
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  br label %113

133:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  store ptr @c1, ptr %18, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %134 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #6
  %135 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %19, i32 0, i32 0
  store ptr %134, ptr %135, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %136 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #6
  %137 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  store ptr %136, ptr %137, align 8
  br label %138

138:                                              ; preds = %181, %133
  %139 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %20) #6
  br i1 %139, label %141, label %140

140:                                              ; preds = %138
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %183

141:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %142 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #6
  store ptr %142, ptr %21, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %143 = load i32, ptr @N, align 4, !tbaa !8
  %144 = load ptr, ptr %21, align 8, !tbaa !15
  %145 = getelementptr inbounds %"struct.std::pair.7", ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !17
  %147 = mul nsw i32 2, %146
  %148 = sub nsw i32 %143, %147
  store i32 %148, ptr %22, align 4, !tbaa !8
  %149 = load i32, ptr %22, align 4, !tbaa !8
  %150 = icmp eq i32 %149, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  br i1 %150, label %175, label %151

151:                                              ; preds = %141
  %152 = load i32, ptr %22, align 4, !tbaa !8
  %153 = icmp sge i32 %152, 2
  br i1 %153, label %154, label %173

154:                                              ; preds = %151
  %155 = load ptr, ptr %21, align 8, !tbaa !15
  %156 = getelementptr inbounds %"struct.std::pair.7", ptr %155, i32 0, i32 0
  %157 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %156)
  %158 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %23, i32 0, i32 0
  store ptr %157, ptr %158, align 8
  %159 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #6
  %160 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %24, i32 0, i32 0
  store ptr %159, ptr %160, align 8
  %161 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #6
  br i1 %161, label %162, label %173

162:                                              ; preds = %154
  %163 = load ptr, ptr %21, align 8, !tbaa !15
  %164 = getelementptr inbounds %"struct.std::pair.7", ptr %163, i32 0, i32 0
  %165 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %164)
  %166 = load i32, ptr %165, align 4, !tbaa !8
  %167 = load i32, ptr %22, align 4, !tbaa !8
  %168 = load i32, ptr %22, align 4, !tbaa !8
  %169 = sub nsw i32 %168, 1
  %170 = mul nsw i32 %167, %169
  %171 = sdiv i32 %170, 2
  %172 = icmp eq i32 %166, %171
  br label %173

173:                                              ; preds = %162, %154, %151
  %174 = phi i1 [ false, %154 ], [ false, %151 ], [ %172, %162 ]
  br label %175

175:                                              ; preds = %173, %141
  %176 = phi i1 [ true, %141 ], [ %174, %173 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br i1 %176, label %177, label %180

177:                                              ; preds = %175
  %178 = load i32, ptr @ans, align 4, !tbaa !8
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr @ans, align 4, !tbaa !8
  br label %180

180:                                              ; preds = %177, %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %181

181:                                              ; preds = %180
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #6
  br label %138

183:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  store ptr @c1, ptr %25, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %184 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #6
  %185 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %26, i32 0, i32 0
  store ptr %184, ptr %185, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %186 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #6
  %187 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %27, i32 0, i32 0
  store ptr %186, ptr %187, align 8
  br label %188

188:                                              ; preds = %234, %183
  %189 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(8) %27) #6
  br i1 %189, label %191, label %190

190:                                              ; preds = %188
  store i32 15, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %236

191:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %192 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #6
  store ptr %192, ptr %28, align 8, !tbaa !15
  %193 = load ptr, ptr %28, align 8, !tbaa !15
  %194 = getelementptr inbounds %"struct.std::pair.7", ptr %193, i32 0, i32 1
  %195 = load i32, ptr %194, align 4, !tbaa !17
  %196 = mul nsw i32 2, %195
  %197 = add nsw i32 %196, 1
  %198 = load i32, ptr @N, align 4, !tbaa !8
  %199 = icmp eq i32 %197, %198
  br i1 %199, label %200, label %233

200:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  store i32 0, ptr %29, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  store i32 0, ptr %30, align 4, !tbaa !8
  br label %201

201:                                              ; preds = %222, %200
  %202 = load i32, ptr %30, align 4, !tbaa !8
  %203 = load i32, ptr @N, align 4, !tbaa !8
  %204 = icmp slt i32 %202, %203
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  store i32 17, ptr %4, align 4
  br label %225

206:                                              ; preds = %201
  %207 = load ptr, ptr %28, align 8, !tbaa !15
  %208 = getelementptr inbounds %"struct.std::pair.7", ptr %207, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %208, i64 12, i1 false)
  %209 = load i32, ptr %30, align 4, !tbaa !8
  %210 = sext i32 %209 to i64
  %211 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %210) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %211, i64 8, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %31, i64 12, i1 false)
  %212 = getelementptr inbounds { i64, i32 }, ptr %33, i32 0, i32 0
  %213 = load i64, ptr %212, align 4
  %214 = getelementptr inbounds { i64, i32 }, ptr %33, i32 0, i32 1
  %215 = load i32, ptr %214, align 4
  %216 = load i64, ptr %32, align 4
  %217 = call noundef zeroext i1 @_Z2onSt4pairIS_IiiEiES0_(i64 %213, i32 %215, i64 %216)
  br i1 %217, label %218, label %221

218:                                              ; preds = %206
  %219 = load i32, ptr %29, align 4, !tbaa !8
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %29, align 4, !tbaa !8
  store i32 17, ptr %4, align 4
  br label %225

221:                                              ; preds = %206
  br label %222

222:                                              ; preds = %221
  %223 = load i32, ptr %30, align 4, !tbaa !8
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %30, align 4, !tbaa !8
  br label %201, !llvm.loop !21

225:                                              ; preds = %218, %205
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %29, align 4, !tbaa !8
  %228 = icmp eq i32 %227, 1
  br i1 %228, label %229, label %232

229:                                              ; preds = %226
  %230 = load i32, ptr @ans, align 4, !tbaa !8
  %231 = add nsw i32 %230, 1
  store i32 %231, ptr @ans, align 4, !tbaa !8
  br label %232

232:                                              ; preds = %229, %226
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  br label %233

233:                                              ; preds = %232, %191
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  br label %234

234:                                              ; preds = %233
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %26) #6
  br label %188

236:                                              ; preds = %190
  %237 = load i32, ptr @ans, align 4, !tbaa !8
  %238 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %237)
  %239 = load i32, ptr %1, align 4
  ret i32 %239
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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

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

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

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

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

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

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

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

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

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


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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<const std::pair<std::pair<int, int>, int>, int>, std::_Select1st<std::pair<const std::pair<std::pair<int, int>, int>, int>>, std::less<std::pair<std::pair<int, int>, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<int, int>, int>, std::pair<const std::pair<std::pair<int, int>, int>, int>, std::_Select1st<std::pair<const std::pair<std::pair<int, int>, int>, int>>, std::less<std::pair<std::pair<int, int>, 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 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type { %"struct.std::pair.3", i32 }
%"struct.std::pair.3" = type { i32, i32 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@N = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@c1 = external dso_local global %"class.std::map", align 8
@c2 = external dso_local global %"class.std::map", align 8
@cow = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z4perpSt4pairIiiES0_(i64, i64) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_Z3colSt4pairIiiES0_(i64, i64) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z2onSt4pairIS_IiiEiES0_(i64, i32, i64) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %18 = load i32, ptr @N, align 4, !tbaa !8
  %19 = sext i32 %18 to i64
  tail call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %19)
  %20 = load i32, ptr @N, align 4, !tbaa !8
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge

.preheader50:                                     ; preds = %.lr.ph
  %22 = icmp sgt i32 %28, 0
  br i1 %22, label %.lr.ph55, label %._crit_edge

.lr.ph55:                                         ; preds = %.preheader50
  %.sroa.226.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.220.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  br label %36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %23 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv) #5
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %25 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv) #5
  %26 = getelementptr inbounds i8, ptr %25, i64 4
  %27 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = load i32, ptr @N, align 4, !tbaa !8
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %.preheader50, !llvm.loop !11

.loopexit.loopexit:                               ; preds = %.lr.ph53
  %.pre = sext i32 %52 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %36
  %.pre-phi = phi i64 [ %.pre, %.loopexit.loopexit ], [ %38, %36 ]
  %31 = phi i32 [ %52, %.loopexit.loopexit ], [ %37, %36 ]
  %32 = icmp slt i64 %indvars.iv.next75, %.pre-phi
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  br i1 %32, label %36, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit, %0, %.preheader50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %33 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #5
  store ptr %33, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %34 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #5
  store ptr %34, ptr %4, align 8
  %35 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %35, label %.lr.ph57, label %._crit_edge58

36:                                               ; preds = %.lr.ph55, %.loopexit
  %37 = phi i32 [ %28, %.lr.ph55 ], [ %31, %.loopexit ]
  %indvars.iv74 = phi i64 [ 0, %.lr.ph55 ], [ %indvars.iv.next75, %.loopexit ]
  %indvars.iv69 = phi i64 [ 1, %.lr.ph55 ], [ %indvars.iv.next70, %.loopexit ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next75, %38
  br i1 %39, label %.lr.ph53, label %.loopexit

.lr.ph53:                                         ; preds = %36, %.lr.ph53
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph53 ], [ %indvars.iv69, %36 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #5
  %40 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv74) #5
  %.sroa.028.0.copyload = load i64, ptr %40, align 4
  %41 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv71) #5
  %.sroa.027.0.copyload = load i64, ptr %41, align 4
  %42 = call { i64, i32 } @_Z4perpSt4pairIiiES0_(i64 %.sroa.028.0.copyload, i64 %.sroa.027.0.copyload)
  %.fca.0.extract23 = extractvalue { i64, i32 } %42, 0
  %.fca.1.extract24 = extractvalue { i64, i32 } %42, 1
  store i64 %.fca.0.extract23, ptr %1, align 8
  store i32 %.fca.1.extract24, ptr %.sroa.226.0..sroa_idx, align 8
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @c1, ptr noundef nonnull align 4 dereferenceable(12) %1)
  %44 = load i32, ptr %43, align 4, !tbaa !8
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %43, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #5
  %46 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv74) #5
  %.sroa.022.0.copyload = load i64, ptr %46, align 4
  %47 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv71) #5
  %.sroa.021.0.copyload = load i64, ptr %47, align 4
  %48 = call { i64, i32 } @_Z3colSt4pairIiiES0_(i64 %.sroa.022.0.copyload, i64 %.sroa.021.0.copyload)
  %.fca.0.extract = extractvalue { i64, i32 } %48, 0
  %.fca.1.extract = extractvalue { i64, i32 } %48, 1
  store i64 %.fca.0.extract, ptr %2, align 8
  store i32 %.fca.1.extract, ptr %.sroa.220.0..sroa_idx, align 8
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %2)
  %50 = load i32, ptr %49, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %49, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #5
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %52 = load i32, ptr @N, align 4, !tbaa !8
  %53 = trunc nuw i64 %indvars.iv.next72 to i32
  %54 = icmp sgt i32 %52, %53
  br i1 %54, label %.lr.ph53, label %.loopexit.loopexit, !llvm.loop !14

._crit_edge58:                                    ; preds = %69, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %55 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #5
  store ptr %55, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %56 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #5
  store ptr %56, ptr %6, align 8
  %57 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  br i1 %57, label %.lr.ph60, label %._crit_edge61

.lr.ph57:                                         ; preds = %._crit_edge, %69
  %58 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %59 = getelementptr inbounds i8, ptr %58, i64 12
  %60 = load i32, ptr %59, align 4, !tbaa !15
  %61 = load i32, ptr @N, align 4, !tbaa !8
  %62 = add nsw i32 %61, -1
  %63 = mul nsw i32 %62, %61
  %64 = sdiv i32 %63, 2
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %69

66:                                               ; preds = %.lr.ph57
  %67 = load i32, ptr @ans, align 4, !tbaa !8
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr @ans, align 4, !tbaa !8
  br label %69

69:                                               ; preds = %66, %.lr.ph57
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %71 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %71, label %.lr.ph57, label %._crit_edge58

._crit_edge61:                                    ; preds = %98, %._crit_edge58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %72 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #5
  store ptr %72, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  %73 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c1) #5
  store ptr %73, ptr %10, align 8
  %74 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  br i1 %74, label %.lr.ph65, label %._crit_edge66

.lr.ph60:                                         ; preds = %._crit_edge58, %98
  %75 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %76 = load i32, ptr @N, align 4, !tbaa !8
  %77 = getelementptr inbounds i8, ptr %75, i64 12
  %78 = load i32, ptr %77, align 4, !tbaa !15
  %79 = shl nsw i32 %78, 1
  %80 = sub nsw i32 %76, %79
  %81 = icmp eq i32 %76, %79
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  br i1 %81, label %.critedge, label %82

82:                                               ; preds = %.lr.ph60
  %83 = icmp sgt i32 %80, 1
  br i1 %83, label %84, label %.critedge2

84:                                               ; preds = %82
  %85 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %75)
  store ptr %85, ptr %7, align 8
  %86 = call ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @c2) #5
  store ptr %86, ptr %8, align 8
  %87 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br i1 %87, label %88, label %.critedge2

88:                                               ; preds = %84
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IiiEiEiSt4lessIS2_ESaIS0_IKS2_iEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48) @c2, ptr noundef nonnull align 4 dereferenceable(12) %75)
  %90 = load i32, ptr %89, align 4, !tbaa !8
  %91 = add nsw i32 %80, -1
  %92 = mul nsw i32 %91, %80
  %93 = lshr i32 %92, 1
  %94 = icmp eq i32 %90, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %94, label %95, label %98

.critedge:                                        ; preds = %.lr.ph60
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %95

95:                                               ; preds = %.critedge, %88
  %96 = load i32, ptr @ans, align 4, !tbaa !8
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr @ans, align 4, !tbaa !8
  br label %98

.critedge2:                                       ; preds = %82, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %98

98:                                               ; preds = %.critedge2, %95, %88
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %100 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  br i1 %100, label %.lr.ph60, label %._crit_edge61

._crit_edge66:                                    ; preds = %.critedge49, %._crit_edge61
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  %101 = load i32, ptr @ans, align 4, !tbaa !8
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %101)
  ret i32 0

.lr.ph65:                                         ; preds = %._crit_edge61, %.critedge49
  %103 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %104 = getelementptr inbounds i8, ptr %103, i64 12
  %105 = load i32, ptr %104, align 4, !tbaa !15
  %106 = shl nsw i32 %105, 1
  %107 = or disjoint i32 %106, 1
  %108 = load i32, ptr @N, align 4
  %109 = icmp eq i32 %107, %108
  %110 = icmp sgt i32 %108, 0
  %or.cond = and i1 %109, %110
  br i1 %or.cond, label %.lr.ph63, label %.critedge49

.lr.ph63:                                         ; preds = %.lr.ph65
  %.sroa.25.0..sroa_idx = getelementptr inbounds i8, ptr %103, i64 8
  br label %115

111:                                              ; preds = %115
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %112 = load i32, ptr @N, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = icmp slt i64 %indvars.iv.next78, %113
  br i1 %114, label %115, label %.critedge49, !llvm.loop !19

115:                                              ; preds = %.lr.ph63, %111
  %indvars.iv77 = phi i64 [ 0, %.lr.ph63 ], [ %indvars.iv.next78, %111 ]
  %.sroa.04.0.copyload = load i64, ptr %103, align 4
  %.sroa.25.0.copyload = load i32, ptr %.sroa.25.0..sroa_idx, align 4
  %116 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @cow, i64 noundef %indvars.iv77) #5
  %.sroa.03.0.copyload = load i64, ptr %116, align 4
  %117 = call noundef zeroext i1 @_Z2onSt4pairIS_IiiEiES0_(i64 %.sroa.04.0.copyload, i32 %.sroa.25.0.copyload, i64 %.sroa.03.0.copyload)
  br i1 %117, label %118, label %111

118:                                              ; preds = %115
  %119 = load i32, ptr @ans, align 4, !tbaa !8
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr @ans, align 4, !tbaa !8
  br label %.critedge49

.critedge49:                                      ; preds = %111, %118, %.lr.ph65
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %122 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IS0_IiiEiEiEES7_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  br i1 %122, label %.lr.ph65, label %._crit_edge66
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

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

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

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

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

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


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