; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/101 Hacks/101 Hack 2015/101 Hack Oct/Problem C (C)

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

%"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" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<long long, int>, std::_Identity<std::pair<long long, int>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<long long, int>, std::_Identity<std::pair<long long, int>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1fx(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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::set", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair.0", align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca { i64, i32 }, align 8
  %16 = alloca %"struct.std::pair", align 8
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair.0", align 8
  %19 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %20 = alloca %"struct.std::pair", align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca i32, align 4
  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 @_ZSt4cerr, align 8, !tbaa !5
  %32 = getelementptr i8, ptr %31, i64 -24
  %33 = load i64, ptr %32, align 8
  %34 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %33
  %35 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef null)
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(8) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %38

38:                                               ; preds = %49, %0
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = sext i32 %39 to i64
  %41 = load i64, ptr @n, align 8, !tbaa !11
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %38
  %45 = load i32, ptr %2, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %46
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %47)
  br label %49

49:                                               ; preds = %44
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !8
  br label %38, !llvm.loop !13

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

53:                                               ; preds = %64, %52
  %54 = load i32, ptr %3, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = load i64, ptr @n, align 8, !tbaa !11
  %57 = icmp slt i64 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %53
  %60 = load i32, ptr %3, align 4, !tbaa !8
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %61
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %62)
  br label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %3, align 4, !tbaa !8
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !8
  br label %53, !llvm.loop !15

67:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store i64 0, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 1152921504606846976, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  br label %68

68:                                               ; preds = %88, %67
  %69 = load i64, ptr %4, align 8, !tbaa !11
  %70 = load i64, ptr %5, align 8, !tbaa !11
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %72, label %89

72:                                               ; preds = %68
  %73 = load i64, ptr %4, align 8, !tbaa !11
  %74 = load i64, ptr %5, align 8, !tbaa !11
  %75 = load i64, ptr %4, align 8, !tbaa !11
  %76 = sub nsw i64 %74, %75
  %77 = sdiv i64 %76, 2
  %78 = add nsw i64 %73, %77
  store i64 %78, ptr %6, align 8, !tbaa !11
  %79 = load i64, ptr %6, align 8, !tbaa !11
  %80 = call noundef i64 @_Z1fx(i64 noundef %79)
  %81 = load i64, ptr @k, align 8, !tbaa !11
  %82 = icmp sle i64 %80, %81
  br i1 %82, label %83, label %85

83:                                               ; preds = %72
  %84 = load i64, ptr %6, align 8, !tbaa !11
  store i64 %84, ptr %5, align 8, !tbaa !11
  br label %88

85:                                               ; preds = %72
  %86 = load i64, ptr %6, align 8, !tbaa !11
  %87 = add nsw i64 %86, 1
  store i64 %87, ptr %4, align 8, !tbaa !11
  br label %88

88:                                               ; preds = %85, %83
  br label %68, !llvm.loop !16

89:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %90 = load i64, ptr %5, align 8, !tbaa !11
  store i64 %90, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !8
  br label %91

91:                                               ; preds = %133, %89
  %92 = load i32, ptr %8, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = load i64, ptr @n, align 8, !tbaa !11
  %95 = icmp slt i64 %93, %94
  br i1 %95, label %97, label %96

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

97:                                               ; preds = %91
  %98 = load i32, ptr %8, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = load i32, ptr %8, align 4, !tbaa !8
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !11
  %106 = mul nsw i64 %101, %105
  %107 = load i64, ptr %7, align 8, !tbaa !11
  %108 = icmp sgt i64 %106, %107
  br i1 %108, label %109, label %132

109:                                              ; preds = %97
  %110 = load i32, ptr %8, align 4, !tbaa !8
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !11
  %114 = load i64, ptr %7, align 8, !tbaa !11
  %115 = load i32, ptr %8, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !11
  %119 = sdiv i64 %114, %118
  %120 = sub nsw i64 %113, %119
  %121 = load i64, ptr @k, align 8, !tbaa !11
  %122 = sub nsw i64 %121, %120
  store i64 %122, ptr @k, align 8, !tbaa !11
  %123 = load i64, ptr %7, align 8, !tbaa !11
  %124 = load i32, ptr %8, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !11
  %128 = sdiv i64 %123, %127
  %129 = load i32, ptr %8, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %130
  store i64 %128, ptr %131, align 8, !tbaa !11
  br label %132

132:                                              ; preds = %109, %97
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %8, align 4, !tbaa !8
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %8, align 4, !tbaa !8
  br label %91, !llvm.loop !17

136:                                              ; preds = %96
  %137 = load i64, ptr @k, align 8, !tbaa !11
  %138 = icmp sgt i64 %137, 0
  br i1 %138, label %139, label %241

139:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #7
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %140

140:                                              ; preds = %165, %139
  %141 = load i32, ptr %10, align 4, !tbaa !8
  %142 = sext i32 %141 to i64
  %143 = load i64, ptr @n, align 8, !tbaa !11
  %144 = icmp slt i64 %142, %143
  br i1 %144, label %146, label %145

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

146:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %147 = load i32, ptr %10, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !11
  %151 = load i32, ptr %10, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = mul nsw i64 %150, %154
  %156 = sub nsw i64 0, %155
  store i64 %156, ptr %12, align 8, !tbaa !11
  %157 = invoke { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %10)
          to label %158 unwind label %168

158:                                              ; preds = %146
  store { i64, i32 } %157, ptr %15, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %15, i64 12, i1 false)
  %159 = invoke { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(12) %11)
          to label %160 unwind label %168

160:                                              ; preds = %158
  %161 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %162 = extractvalue { ptr, i8 } %159, 0
  store ptr %162, ptr %161, align 8
  %163 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %164 = extractvalue { ptr, i8 } %159, 1
  store i8 %164, ptr %163, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %165

165:                                              ; preds = %160
  %166 = load i32, ptr %10, align 4, !tbaa !8
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %10, align 4, !tbaa !8
  br label %140, !llvm.loop !18

168:                                              ; preds = %158, %146
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %13, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %240

172:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !8
  br label %173

173:                                              ; preds = %208, %172
  %174 = load i32, ptr %17, align 4, !tbaa !8
  %175 = sext i32 %174 to i64
  %176 = load i64, ptr @k, align 8, !tbaa !11
  %177 = icmp slt i64 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %211

179:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %180 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  %181 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %19, i32 0, i32 0
  store ptr %180, ptr %181, align 8
  %182 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %19) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %182, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  %183 = invoke noundef i64 @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(12) %18)
          to label %184 unwind label %197

184:                                              ; preds = %179
  %185 = getelementptr inbounds %"struct.std::pair.0", ptr %18, i32 0, i32 0
  %186 = load i64, ptr %185, align 8, !tbaa !19
  %187 = icmp ne i64 %186, 0
  br i1 %187, label %188, label %201

188:                                              ; preds = %184
  %189 = getelementptr inbounds %"struct.std::pair.0", ptr %18, i32 0, i32 1
  %190 = load i32, ptr %189, align 8, !tbaa !21
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %191
  %193 = load i64, ptr %192, align 8, !tbaa !11
  %194 = getelementptr inbounds %"struct.std::pair.0", ptr %18, i32 0, i32 0
  %195 = load i64, ptr %194, align 8, !tbaa !19
  %196 = add nsw i64 %195, %193
  store i64 %196, ptr %194, align 8, !tbaa !19
  br label %201

197:                                              ; preds = %201, %179
  %198 = landingpad { ptr, i32 }
          cleanup
  %199 = extractvalue { ptr, i32 } %198, 0
  store ptr %199, ptr %13, align 8
  %200 = extractvalue { ptr, i32 } %198, 1
  store i32 %200, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %240

201:                                              ; preds = %188, %184
  %202 = invoke { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(12) %18)
          to label %203 unwind label %197

203:                                              ; preds = %201
  %204 = getelementptr inbounds { ptr, i8 }, ptr %20, i32 0, i32 0
  %205 = extractvalue { ptr, i8 } %202, 0
  store ptr %205, ptr %204, align 8
  %206 = getelementptr inbounds { ptr, i8 }, ptr %20, i32 0, i32 1
  %207 = extractvalue { ptr, i8 } %202, 1
  store i8 %207, ptr %206, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  br label %208

208:                                              ; preds = %203
  %209 = load i32, ptr %17, align 4, !tbaa !8
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %17, align 4, !tbaa !8
  br label %173, !llvm.loop !22

211:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %212 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  %213 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %212, ptr %213, align 8
  br label %214

214:                                              ; preds = %236, %211
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %215 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  %216 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %215, ptr %216, align 8
  %217 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIxiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br i1 %217, label %219, label %218

218:                                              ; preds = %214
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %239

219:                                              ; preds = %214
  %220 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %221 = getelementptr inbounds %"struct.std::pair.0", ptr %220, i32 0, i32 0
  %222 = load i64, ptr %221, align 8, !tbaa !19
  %223 = sub nsw i64 0, %222
  %224 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %225 = getelementptr inbounds %"struct.std::pair.0", ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 8, !tbaa !21
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %227
  %229 = load i64, ptr %228, align 8, !tbaa !11
  %230 = sdiv i64 %223, %229
  %231 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %232 = getelementptr inbounds %"struct.std::pair.0", ptr %231, i32 0, i32 1
  %233 = load i32, ptr %232, align 8, !tbaa !21
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %234
  store i64 %230, ptr %235, align 8, !tbaa !11
  br label %236

236:                                              ; preds = %219
  %237 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIxiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %21, i32 noundef 0) #7
  %238 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %237, ptr %238, align 8
  br label %214, !llvm.loop !23

239:                                              ; preds = %218
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  br label %241

240:                                              ; preds = %197, %168
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  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 8, ptr %4) #7
  br label %260

241:                                              ; preds = %239, %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  store i32 0, ptr %24, align 4, !tbaa !8
  br label %242

242:                                              ; preds = %255, %241
  %243 = load i32, ptr %24, align 4, !tbaa !8
  %244 = sext i32 %243 to i64
  %245 = load i64, ptr @n, align 8, !tbaa !11
  %246 = icmp slt i64 %244, %245
  br i1 %246, label %248, label %247

247:                                              ; preds = %242
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %258

248:                                              ; preds = %242
  %249 = load i32, ptr %24, align 4, !tbaa !8
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %250
  %252 = load i64, ptr %251, align 8, !tbaa !11
  %253 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %252)
  %254 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %253, i8 noundef signext 32)
  br label %255

255:                                              ; preds = %248
  %256 = load i32, ptr %24, align 4, !tbaa !8
  %257 = add nsw i32 %256, 1
  store i32 %257, ptr %24, align 4, !tbaa !8
  br label %242, !llvm.loop !24

258:                                              ; preds = %247
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  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 8, ptr %4) #7
  ret i32 0

260:                                              ; preds = %240
  %261 = load ptr, ptr %13, align 8
  %262 = load i32, ptr %14, align 4
  %263 = insertvalue { ptr, i32 } poison, ptr %261, 0
  %264 = insertvalue { ptr, i32 } %263, i32 %262, 1
  resume { ptr, i32 } %264
}

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(12)) #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; 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) #5

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(12)) #4 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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}
!19 = !{!20, !12, i64 0}
!20 = !{!"_ZTSSt4pairIxiE", !12, i64 0, !9, i64 8}
!21 = !{!20, !9, i64 8}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !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_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" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<long long, int>, std::_Identity<std::pair<long long, int>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, int>, std::pair<long long, int>, std::_Identity<std::pair<long long, int>>, std::less<std::pair<long long, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.0" = type <{ i64, i32, [4 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i64, align 8
@k = external dso_local global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1fx(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 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::set", align 8
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair.0", align 8
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %17
  %19 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) @k)
  %22 = load i64, ptr @n, align 8, !tbaa !8
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph, label %.preheader53.preheader

.preheader54:                                     ; preds = %.lr.ph
  %24 = icmp sgt i64 %27, 0
  br i1 %24, label %.lr.ph57, label %.preheader53.preheader

.preheader53.preheader:                           ; preds = %.lr.ph57, %0, %.preheader54
  br label %.preheader53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %25 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i64, ptr @n, align 8, !tbaa !8
  %28 = icmp sgt i64 %27, %indvars.iv.next
  br i1 %28, label %.lr.ph, label %.preheader54, !llvm.loop !11

.lr.ph57:                                         ; preds = %.preheader54, %.lr.ph57
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.lr.ph57 ], [ 0, %.preheader54 ]
  %29 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv77
  %30 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %31 = load i64, ptr @n, align 8, !tbaa !8
  %32 = icmp sgt i64 %31, %indvars.iv.next78
  br i1 %32, label %.lr.ph57, label %.preheader53.preheader, !llvm.loop !13

.preheader:                                       ; preds = %.preheader53
  %33 = load i64, ptr @n, align 8, !tbaa !8
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.lr.ph61, label %._crit_edge

.preheader53:                                     ; preds = %.preheader53.preheader, %.preheader53
  %.03859 = phi i64 [ %.1, %.preheader53 ], [ 0, %.preheader53.preheader ]
  %.04058 = phi i64 [ %.141, %.preheader53 ], [ 1152921504606846976, %.preheader53.preheader ]
  %35 = sub nsw i64 %.04058, %.03859
  %36 = sdiv i64 %35, 2
  %37 = add nsw i64 %36, %.03859
  %38 = tail call noundef i64 @_Z1fx(i64 noundef %37)
  %39 = load i64, ptr @k, align 8, !tbaa !8
  %.not51 = icmp sgt i64 %38, %39
  %40 = add nsw i64 %37, 1
  %.141 = select i1 %.not51, i64 %.04058, i64 %37
  %.1 = select i1 %.not51, i64 %40, i64 %.03859
  %41 = icmp slt i64 %.1, %.141
  br i1 %41, label %.preheader53, label %.preheader, !llvm.loop !14

._crit_edge:                                      ; preds = %54, %.preheader
  %42 = phi i64 [ %39, %.preheader ], [ %55, %54 ]
  %43 = icmp sgt i64 %42, 0
  br i1 %43, label %56, label %122

.lr.ph61:                                         ; preds = %.preheader, %54
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %54 ], [ 0, %.preheader ]
  %44 = phi i64 [ %55, %54 ], [ %39, %.preheader ]
  %45 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv80
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv80
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = mul nsw i64 %48, %46
  %50 = icmp sgt i64 %49, %.141
  br i1 %50, label %51, label %54

51:                                               ; preds = %.lr.ph61
  %52 = sdiv i64 %.141, %48
  %.neg = sub i64 %52, %46
  %53 = add i64 %.neg, %44
  store i64 %53, ptr @k, align 8, !tbaa !8
  store i64 %52, ptr %45, align 8, !tbaa !8
  br label %54

54:                                               ; preds = %.lr.ph61, %51
  %55 = phi i64 [ %44, %.lr.ph61 ], [ %53, %51 ]
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next81, %33
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph61, !llvm.loop !15

56:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #7
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 0, ptr %2, align 4, !tbaa !16
  %57 = load i64, ptr @n, align 8, !tbaa !8
  %58 = icmp sgt i64 %57, 0
  br i1 %58, label %.lr.ph63, label %._crit_edge64

.lr.ph63:                                         ; preds = %56
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  br label %62

._crit_edge64:                                    ; preds = %73, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %59 = load i64, ptr @k, align 8, !tbaa !8
  %60 = icmp sgt i64 %59, 0
  br i1 %60, label %.lr.ph67, label %._crit_edge68

.lr.ph67:                                         ; preds = %._crit_edge64
  %61 = getelementptr inbounds i8, ptr %5, i64 8
  br label %84

62:                                               ; preds = %.lr.ph63, %73
  %63 = phi i64 [ 0, %.lr.ph63 ], [ %76, %73 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %64 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %66 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %63
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = mul i64 %65, %67
  %69 = sub i64 0, %68
  store i64 %69, ptr %4, align 8, !tbaa !8
  %70 = invoke { i64, i32 } @_ZSt9make_pairIxRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %71 unwind label %79

71:                                               ; preds = %62
  %.fca.0.extract = extractvalue { i64, i32 } %70, 0
  %.fca.1.extract = extractvalue { i64, i32 } %70, 1
  store i64 %.fca.0.extract, ptr %3, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %72 = invoke { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertEOS1_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(12) %3)
          to label %73 unwind label %79

73:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  %74 = load i32, ptr %2, align 4, !tbaa !16
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %2, align 4, !tbaa !16
  %76 = sext i32 %75 to i64
  %77 = load i64, ptr @n, align 8, !tbaa !8
  %78 = icmp sgt i64 %77, %76
  br i1 %78, label %62, label %._crit_edge64, !llvm.loop !18

79:                                               ; preds = %71, %62
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  br label %121

._crit_edge68:                                    ; preds = %100, %._crit_edge64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %81 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  store ptr %81, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %82 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  store ptr %82, ptr %8, align 8
  %83 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIxiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br i1 %83, label %.lr.ph70, label %._crit_edge71

84:                                               ; preds = %.lr.ph67, %100
  %indvars.iv83 = phi i64 [ 0, %.lr.ph67 ], [ %indvars.iv.next84, %100 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %85 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  store ptr %85, ptr %6, align 8
  %86 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %86, i64 16, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %87 = invoke noundef i64 @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE5eraseERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(12) %5)
          to label %88 unwind label %96

88:                                               ; preds = %84
  %89 = load i64, ptr %5, align 8, !tbaa !19
  %.not = icmp eq i64 %89, 0
  br i1 %.not, label %98, label %90

90:                                               ; preds = %88
  %91 = load i32, ptr %61, align 8, !tbaa !21
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  %95 = add nsw i64 %94, %89
  store i64 %95, ptr %5, align 8, !tbaa !19
  br label %98

96:                                               ; preds = %98, %84
  %97 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %121

98:                                               ; preds = %90, %88
  %99 = invoke { ptr, i8 } @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE6insertERKS1_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(12) %5)
          to label %100 unwind label %96

100:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %101 = load i64, ptr @k, align 8, !tbaa !8
  %102 = icmp sgt i64 %101, %indvars.iv.next84
  br i1 %102, label %84, label %._crit_edge68, !llvm.loop !22

._crit_edge71:                                    ; preds = %.lr.ph70, %._crit_edge68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  %.pre = load i64, ptr @n, align 8, !tbaa !8
  br label %122

.lr.ph70:                                         ; preds = %._crit_edge68, %.lr.ph70
  %103 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %104 = load i64, ptr %103, align 8, !tbaa !19
  %105 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %106 = getelementptr inbounds i8, ptr %105, i64 8
  %107 = load i32, ptr %106, align 8, !tbaa !21
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !8
  %111 = sdiv i64 %104, %110
  %112 = sub nsw i64 0, %111
  %113 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIxiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  %114 = getelementptr inbounds i8, ptr %113, i64 8
  %115 = load i32, ptr %114, align 8, !tbaa !21
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %116
  store i64 %112, ptr %117, align 8, !tbaa !8
  %118 = call ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIxiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %119 = call ptr @_ZNKSt3setISt4pairIxiESt4lessIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  store ptr %119, ptr %8, align 8
  %120 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIxiEES4_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  br i1 %120, label %.lr.ph70, label %._crit_edge71, !llvm.loop !23

121:                                              ; preds = %96, %79
  %.pn = phi { ptr, i32 } [ %80, %79 ], [ %97, %96 ]
  call void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  resume { ptr, i32 } %.pn

122:                                              ; preds = %._crit_edge71, %._crit_edge
  %123 = phi i64 [ %.pre, %._crit_edge71 ], [ %33, %._crit_edge ]
  %124 = icmp sgt i64 %123, 0
  br i1 %124, label %.lr.ph74, label %._crit_edge75

._crit_edge75:                                    ; preds = %.lr.ph74, %122
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  ret i32 0

.lr.ph74:                                         ; preds = %122, %.lr.ph74
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %.lr.ph74 ], [ 0, %122 ]
  %126 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv86
  %127 = load i64, ptr %126, align 8, !tbaa !8
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %127)
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %128, i8 noundef signext 32)
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %130 = load i64, ptr @n, align 8, !tbaa !8
  %131 = icmp sgt i64 %130, %indvars.iv.next87
  br i1 %131, label %.lr.ph74, label %._crit_edge75, !llvm.loop !24
}

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress 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) #5

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setISt4pairIxiESt4lessIS1_ESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !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 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !10, i64 0}
!18 = distinct !{!18, !12}
!19 = !{!20, !9, i64 0}
!20 = !{!"_ZTSSt4pairIxiE", !9, i64 0, !17, i64 8}
!21 = !{!20, !17, i64 8}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


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