; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/362 Division 1/Problem A (A)

; 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::basic_ostream" = type { ptr, %"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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"struct.std::pair" = type { i64, i64 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@cost = external dso_local global %"class.std::map", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

37:                                               ; preds = %173, %0
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %46 = load i32, ptr %4, align 4, !tbaa !8
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %48, label %109

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %50 = load i64, ptr %5, align 8, !tbaa !11
  %51 = call noundef i32 @_Z3hgtx(i64 noundef %50)
  store i32 %51, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %52 = load i64, ptr %6, align 8, !tbaa !11
  %53 = call noundef i32 @_Z3hgtx(i64 noundef %52)
  store i32 %53, ptr %9, align 4, !tbaa !8
  %54 = load i32, ptr %8, align 4, !tbaa !8
  %55 = load i32, ptr %9, align 4, !tbaa !8
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %57, label %58

57:                                               ; preds = %48
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9) #7
  br label %58

58:                                               ; preds = %57, %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  br label %59

59:                                               ; preds = %63, %58
  %60 = load i32, ptr %8, align 4, !tbaa !8
  %61 = load i32, ptr %9, align 4, !tbaa !8
  %62 = icmp sgt i32 %60, %61
  br i1 %62, label %63, label %78

63:                                               ; preds = %59
  %64 = load i64, ptr %5, align 8, !tbaa !11
  %65 = sdiv i64 %64, 2
  store i64 %65, ptr %10, align 8, !tbaa !11
  %66 = load i64, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %67 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %68 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %69 = extractvalue { i64, i64 } %67, 0
  store i64 %69, ptr %68, align 8
  %70 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %71 = extractvalue { i64, i64 } %67, 1
  store i64 %71, ptr %70, align 8
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %73 = load i64, ptr %72, align 8, !tbaa !11
  %74 = add nsw i64 %73, %66
  store i64 %74, ptr %72, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  %75 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %75, ptr %5, align 8, !tbaa !11
  %76 = load i32, ptr %8, align 4, !tbaa !8
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr %8, align 4, !tbaa !8
  br label %59, !llvm.loop !13

78:                                               ; preds = %59
  br label %79

79:                                               ; preds = %83, %78
  %80 = load i64, ptr %5, align 8, !tbaa !11
  %81 = load i64, ptr %6, align 8, !tbaa !11
  %82 = icmp ne i64 %80, %81
  br i1 %82, label %83, label %108

83:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %84 = load i64, ptr %5, align 8, !tbaa !11
  %85 = sdiv i64 %84, 2
  store i64 %85, ptr %12, align 8, !tbaa !11
  %86 = load i64, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #7
  %87 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %88 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %89 = extractvalue { i64, i64 } %87, 0
  store i64 %89, ptr %88, align 8
  %90 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %91 = extractvalue { i64, i64 } %87, 1
  store i64 %91, ptr %90, align 8
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %13)
  %93 = load i64, ptr %92, align 8, !tbaa !11
  %94 = add nsw i64 %93, %86
  store i64 %94, ptr %92, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %95 = load i64, ptr %6, align 8, !tbaa !11
  %96 = sdiv i64 %95, 2
  store i64 %96, ptr %14, align 8, !tbaa !11
  %97 = load i64, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  %98 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %99 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %100 = extractvalue { i64, i64 } %98, 0
  store i64 %100, ptr %99, align 8
  %101 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %102 = extractvalue { i64, i64 } %98, 1
  store i64 %102, ptr %101, align 8
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = add nsw i64 %104, %97
  store i64 %105, ptr %103, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  %106 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %106, ptr %5, align 8, !tbaa !11
  %107 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %107, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %79, !llvm.loop !15

108:                                              ; preds = %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %172

109:                                              ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %110 = load i64, ptr %5, align 8, !tbaa !11
  %111 = call noundef i32 @_Z3hgtx(i64 noundef %110)
  store i32 %111, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %112 = load i64, ptr %6, align 8, !tbaa !11
  %113 = call noundef i32 @_Z3hgtx(i64 noundef %112)
  store i32 %113, ptr %17, align 4, !tbaa !8
  %114 = load i32, ptr %16, align 4, !tbaa !8
  %115 = load i32, ptr %17, align 4, !tbaa !8
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %109
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17) #7
  br label %118

118:                                              ; preds = %117, %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 0, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  br label %119

119:                                              ; preds = %123, %118
  %120 = load i32, ptr %16, align 4, !tbaa !8
  %121 = load i32, ptr %17, align 4, !tbaa !8
  %122 = icmp sgt i32 %120, %121
  br i1 %122, label %123, label %138

123:                                              ; preds = %119
  %124 = load i64, ptr %5, align 8, !tbaa !11
  %125 = sdiv i64 %124, 2
  store i64 %125, ptr %19, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #7
  %126 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %127 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %128 = extractvalue { i64, i64 } %126, 0
  store i64 %128, ptr %127, align 8
  %129 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %130 = extractvalue { i64, i64 } %126, 1
  store i64 %130, ptr %129, align 8
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %20)
  %132 = load i64, ptr %131, align 8, !tbaa !11
  %133 = load i64, ptr %18, align 8, !tbaa !11
  %134 = add nsw i64 %133, %132
  store i64 %134, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #7
  %135 = load i64, ptr %19, align 8, !tbaa !11
  store i64 %135, ptr %5, align 8, !tbaa !11
  %136 = load i32, ptr %16, align 4, !tbaa !8
  %137 = add nsw i32 %136, -1
  store i32 %137, ptr %16, align 4, !tbaa !8
  br label %119, !llvm.loop !16

138:                                              ; preds = %119
  br label %139

139:                                              ; preds = %143, %138
  %140 = load i64, ptr %5, align 8, !tbaa !11
  %141 = load i64, ptr %6, align 8, !tbaa !11
  %142 = icmp ne i64 %140, %141
  br i1 %142, label %143, label %168

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %144 = load i64, ptr %5, align 8, !tbaa !11
  %145 = sdiv i64 %144, 2
  store i64 %145, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #7
  %146 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %147 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 0
  %148 = extractvalue { i64, i64 } %146, 0
  store i64 %148, ptr %147, align 8
  %149 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 1
  %150 = extractvalue { i64, i64 } %146, 1
  store i64 %150, ptr %149, align 8
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %22)
  %152 = load i64, ptr %151, align 8, !tbaa !11
  %153 = load i64, ptr %18, align 8, !tbaa !11
  %154 = add nsw i64 %153, %152
  store i64 %154, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %155 = load i64, ptr %6, align 8, !tbaa !11
  %156 = sdiv i64 %155, 2
  store i64 %156, ptr %23, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #7
  %157 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %158 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 0
  %159 = extractvalue { i64, i64 } %157, 0
  store i64 %159, ptr %158, align 8
  %160 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 1
  %161 = extractvalue { i64, i64 } %157, 1
  store i64 %161, ptr %160, align 8
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %24)
  %163 = load i64, ptr %162, align 8, !tbaa !11
  %164 = load i64, ptr %18, align 8, !tbaa !11
  %165 = add nsw i64 %164, %163
  store i64 %165, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #7
  %166 = load i64, ptr %21, align 8, !tbaa !11
  store i64 %166, ptr %5, align 8, !tbaa !11
  %167 = load i64, ptr %23, align 8, !tbaa !11
  store i64 %167, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %139, !llvm.loop !17

168:                                              ; preds = %139
  %169 = load i64, ptr %18, align 8, !tbaa !11
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %169)
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %170, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %172

172:                                              ; preds = %168, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %3, align 4, !tbaa !8
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %3, align 4, !tbaa !8
  br label %37, !llvm.loop !18

176:                                              ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 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)) #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

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

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


; 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::basic_ostream" = type { ptr, %"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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"struct.std::pair" = type { i64, i64 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@cost = external dso_local global %"class.std::map", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3hgtx(i64 noundef) 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i64, align 8
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::pair", align 8
  %18 = alloca i64, align 8
  %19 = alloca %"struct.std::pair", align 8
  %20 = alloca i64, align 8
  %21 = alloca %"struct.std::pair", align 8
  %22 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %23 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %24 = getelementptr i8, ptr %23, i64 -24
  %25 = load i64, ptr %24, align 8
  %26 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %25
  %27 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %26, ptr noundef null)
  %28 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %29 = getelementptr i8, ptr %28, i64 -24
  %30 = load i64, ptr %29, align 8
  %31 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %30
  %32 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %31, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %34 = load i32, ptr %1, align 4, !tbaa !8
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph21, label %._crit_edge22

.lr.ph21:                                         ; preds = %0
  %36 = getelementptr inbounds i8, ptr %17, i64 8
  %37 = getelementptr inbounds i8, ptr %19, i64 8
  %38 = getelementptr inbounds i8, ptr %21, i64 8
  %39 = getelementptr inbounds i8, ptr %9, i64 8
  %40 = getelementptr inbounds i8, ptr %11, i64 8
  %41 = getelementptr inbounds i8, ptr %13, i64 8
  br label %42

._crit_edge22:                                    ; preds = %144, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

42:                                               ; preds = %.lr.ph21, %144
  %.0619 = phi i32 [ 0, %.lr.ph21 ], [ %145, %144 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %46 = load i32, ptr %2, align 4, !tbaa !8
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %48, label %97

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %50 = load i64, ptr %3, align 8, !tbaa !11
  %51 = call noundef i32 @_Z3hgtx(i64 noundef %50)
  store i32 %51, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  %52 = load i64, ptr %4, align 8, !tbaa !11
  %53 = call noundef i32 @_Z3hgtx(i64 noundef %52)
  store i32 %53, ptr %7, align 4, !tbaa !8
  %54 = load i32, ptr %6, align 4, !tbaa !8
  %55 = icmp slt i32 %54, %53
  br i1 %55, label %56, label %57

56:                                               ; preds = %48
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7) #7
  %.pre27 = load i32, ptr %6, align 4, !tbaa !8
  %.pre28 = load i32, ptr %7, align 4, !tbaa !8
  br label %57

57:                                               ; preds = %56, %48
  %58 = phi i32 [ %.pre28, %56 ], [ %53, %48 ]
  %59 = phi i32 [ %.pre27, %56 ], [ %54, %48 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %60 = icmp sgt i32 %59, %58
  %.pre30 = load i64, ptr %3, align 8, !tbaa !11
  br i1 %60, label %.lr.ph15, label %.preheader

.preheader:                                       ; preds = %.lr.ph15, %57
  %61 = phi i64 [ %.pre30, %57 ], [ %72, %.lr.ph15 ]
  %62 = load i64, ptr %4, align 8, !tbaa !11
  %.not716 = icmp eq i64 %61, %62
  br i1 %.not716, label %._crit_edge18, label %.lr.ph17

.lr.ph15:                                         ; preds = %57, %.lr.ph15
  %63 = phi i64 [ %72, %.lr.ph15 ], [ %.pre30, %57 ]
  %64 = sdiv i64 %63, 2
  store i64 %64, ptr %8, align 8, !tbaa !11
  %65 = load i64, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #7
  %66 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %67 = extractvalue { i64, i64 } %66, 0
  store i64 %67, ptr %9, align 8
  %68 = extractvalue { i64, i64 } %66, 1
  store i64 %68, ptr %39, align 8
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = add nsw i64 %70, %65
  store i64 %71, ptr %69, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #7
  %72 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %72, ptr %3, align 8, !tbaa !11
  %73 = load i32, ptr %6, align 4, !tbaa !8
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %6, align 4, !tbaa !8
  %75 = load i32, ptr %7, align 4, !tbaa !8
  %76 = icmp sgt i32 %74, %75
  br i1 %76, label %.lr.ph15, label %.preheader, !llvm.loop !13

.lr.ph17:                                         ; preds = %.preheader, %.lr.ph17
  %77 = phi i64 [ %95, %.lr.ph17 ], [ %61, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %78 = sdiv i64 %77, 2
  store i64 %78, ptr %10, align 8, !tbaa !11
  %79 = load i64, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #7
  %80 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %81 = extractvalue { i64, i64 } %80, 0
  store i64 %81, ptr %11, align 8
  %82 = extractvalue { i64, i64 } %80, 1
  store i64 %82, ptr %40, align 8
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = add nsw i64 %84, %79
  store i64 %85, ptr %83, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %86 = load i64, ptr %4, align 8, !tbaa !11
  %87 = sdiv i64 %86, 2
  store i64 %87, ptr %12, align 8, !tbaa !11
  %88 = load i64, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #7
  %89 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %90 = extractvalue { i64, i64 } %89, 0
  store i64 %90, ptr %13, align 8
  %91 = extractvalue { i64, i64 } %89, 1
  store i64 %91, ptr %41, align 8
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %13)
  %93 = load i64, ptr %92, align 8, !tbaa !11
  %94 = add nsw i64 %93, %88
  store i64 %94, ptr %92, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #7
  %95 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %95, ptr %3, align 8, !tbaa !11
  %96 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %96, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %.not7 = icmp eq i64 %95, %96
  br i1 %.not7, label %._crit_edge18, label %.lr.ph17, !llvm.loop !15

._crit_edge18:                                    ; preds = %.lr.ph17, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  br label %144

97:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #7
  %98 = load i64, ptr %3, align 8, !tbaa !11
  %99 = call noundef i32 @_Z3hgtx(i64 noundef %98)
  store i32 %99, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #7
  %100 = load i64, ptr %4, align 8, !tbaa !11
  %101 = call noundef i32 @_Z3hgtx(i64 noundef %100)
  store i32 %101, ptr %15, align 4, !tbaa !8
  %102 = load i32, ptr %14, align 4, !tbaa !8
  %103 = icmp slt i32 %102, %101
  br i1 %103, label %104, label %105

104:                                              ; preds = %97
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15) #7
  %.pre = load i32, ptr %14, align 4, !tbaa !8
  %.pre24 = load i32, ptr %15, align 4, !tbaa !8
  br label %105

105:                                              ; preds = %104, %97
  %106 = phi i32 [ %.pre24, %104 ], [ %101, %97 ]
  %107 = phi i32 [ %.pre, %104 ], [ %102, %97 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #7
  %108 = icmp sgt i32 %107, %106
  %.pre26 = load i64, ptr %3, align 8, !tbaa !11
  br i1 %108, label %.lr.ph, label %.preheader8

.preheader8:                                      ; preds = %.lr.ph, %105
  %109 = phi i64 [ %.pre26, %105 ], [ %119, %.lr.ph ]
  %.0.lcssa = phi i64 [ 0, %105 ], [ %118, %.lr.ph ]
  %110 = load i64, ptr %4, align 8, !tbaa !11
  %.not10 = icmp eq i64 %109, %110
  br i1 %.not10, label %._crit_edge, label %.lr.ph12

.lr.ph:                                           ; preds = %105, %.lr.ph
  %111 = phi i64 [ %119, %.lr.ph ], [ %.pre26, %105 ]
  %.09 = phi i64 [ %118, %.lr.ph ], [ 0, %105 ]
  %112 = sdiv i64 %111, 2
  store i64 %112, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #7
  %113 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %114 = extractvalue { i64, i64 } %113, 0
  store i64 %114, ptr %17, align 8
  %115 = extractvalue { i64, i64 } %113, 1
  store i64 %115, ptr %36, align 8
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %17)
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = add nsw i64 %117, %.09
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #7
  %119 = load i64, ptr %16, align 8, !tbaa !11
  store i64 %119, ptr %3, align 8, !tbaa !11
  %120 = load i32, ptr %14, align 4, !tbaa !8
  %121 = add nsw i32 %120, -1
  store i32 %121, ptr %14, align 4, !tbaa !8
  %122 = load i32, ptr %15, align 4, !tbaa !8
  %123 = icmp sgt i32 %121, %122
  br i1 %123, label %.lr.ph, label %.preheader8, !llvm.loop !16

.lr.ph12:                                         ; preds = %.preheader8, %.lr.ph12
  %124 = phi i64 [ %140, %.lr.ph12 ], [ %109, %.preheader8 ]
  %.111 = phi i64 [ %139, %.lr.ph12 ], [ %.0.lcssa, %.preheader8 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #7
  %125 = sdiv i64 %124, 2
  store i64 %125, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %19) #7
  %126 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %18)
  %127 = extractvalue { i64, i64 } %126, 0
  store i64 %127, ptr %19, align 8
  %128 = extractvalue { i64, i64 } %126, 1
  store i64 %128, ptr %37, align 8
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %19)
  %130 = load i64, ptr %129, align 8, !tbaa !11
  %131 = add nsw i64 %130, %.111
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %19) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #7
  %132 = load i64, ptr %4, align 8, !tbaa !11
  %133 = sdiv i64 %132, 2
  store i64 %133, ptr %20, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %21) #7
  %134 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %135 = extractvalue { i64, i64 } %134, 0
  store i64 %135, ptr %21, align 8
  %136 = extractvalue { i64, i64 } %134, 1
  store i64 %136, ptr %38, align 8
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @cost, ptr noundef nonnull align 8 dereferenceable(16) %21)
  %138 = load i64, ptr %137, align 8, !tbaa !11
  %139 = add nsw i64 %131, %138
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %21) #7
  %140 = load i64, ptr %18, align 8, !tbaa !11
  store i64 %140, ptr %3, align 8, !tbaa !11
  %141 = load i64, ptr %20, align 8, !tbaa !11
  store i64 %141, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #7
  %.not = icmp eq i64 %140, %141
  br i1 %.not, label %._crit_edge, label %.lr.ph12, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph12, %.preheader8
  %.1.lcssa = phi i64 [ %.0.lcssa, %.preheader8 ], [ %139, %.lr.ph12 ]
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.1.lcssa)
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %142, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #7
  br label %144

144:                                              ; preds = %._crit_edge, %._crit_edge18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %145 = add nuw nsw i32 %.0619, 1
  %146 = load i32, ptr %1, align 4, !tbaa !8
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %42, label %._crit_edge22, !llvm.loop !18
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 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 #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #6

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

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


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