; LLVM IR from DionysiosB/CodeForces :: 0500-0599 (558B-AmrAndTheLargeArray)

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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, cont>, std::_Select1st<std::pair<const long, cont>>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, std::pair<const long, cont>, std::_Select1st<std::pair<const long, cont>>, std::less<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 }
%struct.cont = type { i64, i64, i64 }
%"struct.std::pair.0" = type { i64, %struct.cont }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_iterator" = type { ptr }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.std::map", align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.cont, align 8
  %13 = alloca %"struct.std::pair.0", align 8
  %14 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #5
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %130, %0
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %134

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %23 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %9)
          to label %24 unwind label %67

24:                                               ; preds = %22
  %25 = invoke noundef i64 @_ZNKSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %26 unwind label %67

26:                                               ; preds = %24
  %27 = icmp ugt i64 %25, 0
  br i1 %27, label %28, label %110

28:                                               ; preds = %26
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %32 unwind label %67

32:                                               ; preds = %28
  %33 = getelementptr inbounds %struct.cont, ptr %31, i32 0, i32 1
  store i64 %30, ptr %33, align 8, !tbaa !11
  %34 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %35 unwind label %67

35:                                               ; preds = %32
  %36 = getelementptr inbounds %struct.cont, ptr %34, i32 0, i32 2
  %37 = load i64, ptr %36, align 8, !tbaa !13
  %38 = add nsw i64 %37, 1
  store i64 %38, ptr %36, align 8, !tbaa !13
  %39 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %40 unwind label %67

40:                                               ; preds = %35
  %41 = getelementptr inbounds %struct.cont, ptr %39, i32 0, i32 2
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = load i64, ptr %5, align 8, !tbaa !5
  %44 = icmp sgt i64 %42, %43
  br i1 %44, label %45, label %71

45:                                               ; preds = %40
  %46 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %47 unwind label %67

47:                                               ; preds = %45
  %48 = getelementptr inbounds %struct.cont, ptr %46, i32 0, i32 2
  %49 = load i64, ptr %48, align 8, !tbaa !13
  store i64 %49, ptr %5, align 8, !tbaa !5
  %50 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %51 unwind label %67

51:                                               ; preds = %47
  %52 = getelementptr inbounds %struct.cont, ptr %50, i32 0, i32 0
  %53 = load i64, ptr %52, align 8, !tbaa !14
  store i64 %53, ptr %3, align 8, !tbaa !5
  %54 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %55 unwind label %67

55:                                               ; preds = %51
  %56 = getelementptr inbounds %struct.cont, ptr %54, i32 0, i32 1
  %57 = load i64, ptr %56, align 8, !tbaa !11
  store i64 %57, ptr %4, align 8, !tbaa !5
  %58 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %59 unwind label %67

59:                                               ; preds = %55
  %60 = getelementptr inbounds %struct.cont, ptr %58, i32 0, i32 1
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %63 unwind label %67

63:                                               ; preds = %59
  %64 = getelementptr inbounds %struct.cont, ptr %62, i32 0, i32 0
  %65 = load i64, ptr %64, align 8, !tbaa !14
  %66 = sub nsw i64 %61, %65
  store i64 %66, ptr %6, align 8, !tbaa !5
  br label %109

67:                                               ; preds = %100, %96, %92, %90, %81, %78, %71, %59, %55, %51, %47, %45, %35, %32, %28, %24, %22
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %10, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %11, align 4
  br label %133

71:                                               ; preds = %40
  %72 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %73 unwind label %67

73:                                               ; preds = %71
  %74 = getelementptr inbounds %struct.cont, ptr %72, i32 0, i32 2
  %75 = load i64, ptr %74, align 8, !tbaa !13
  %76 = load i64, ptr %5, align 8, !tbaa !5
  %77 = icmp eq i64 %75, %76
  br i1 %77, label %78, label %108

78:                                               ; preds = %73
  %79 = load i64, ptr %6, align 8, !tbaa !5
  %80 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %81 unwind label %67

81:                                               ; preds = %78
  %82 = getelementptr inbounds %struct.cont, ptr %80, i32 0, i32 1
  %83 = load i64, ptr %82, align 8, !tbaa !11
  %84 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %85 unwind label %67

85:                                               ; preds = %81
  %86 = getelementptr inbounds %struct.cont, ptr %84, i32 0, i32 0
  %87 = load i64, ptr %86, align 8, !tbaa !14
  %88 = sub nsw i64 %83, %87
  %89 = icmp sgt i64 %79, %88
  br i1 %89, label %90, label %108

90:                                               ; preds = %85
  %91 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %92 unwind label %67

92:                                               ; preds = %90
  %93 = getelementptr inbounds %struct.cont, ptr %91, i32 0, i32 0
  %94 = load i64, ptr %93, align 8, !tbaa !14
  store i64 %94, ptr %3, align 8, !tbaa !5
  %95 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %96 unwind label %67

96:                                               ; preds = %92
  %97 = getelementptr inbounds %struct.cont, ptr %95, i32 0, i32 1
  %98 = load i64, ptr %97, align 8, !tbaa !11
  store i64 %98, ptr %4, align 8, !tbaa !5
  %99 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %100 unwind label %67

100:                                              ; preds = %96
  %101 = getelementptr inbounds %struct.cont, ptr %99, i32 0, i32 1
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %104 unwind label %67

104:                                              ; preds = %100
  %105 = getelementptr inbounds %struct.cont, ptr %103, i32 0, i32 0
  %106 = load i64, ptr %105, align 8, !tbaa !14
  %107 = sub nsw i64 %102, %106
  store i64 %107, ptr %6, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %104, %85, %73
  br label %109

109:                                              ; preds = %108, %63
  br label %129

110:                                              ; preds = %26
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %struct.cont, ptr %12, i32 0, i32 0
  store i64 %112, ptr %113, align 8, !tbaa !14
  %114 = load i32, ptr %8, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds %struct.cont, ptr %12, i32 0, i32 1
  store i64 %115, ptr %116, align 8, !tbaa !11
  %117 = getelementptr inbounds %struct.cont, ptr %12, i32 0, i32 2
  store i64 1, ptr %117, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #5
  invoke void @_ZNSt4pairIl4contEC2IRlRS0_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %118 unwind label %125

118:                                              ; preds = %110
  %119 = invoke { ptr, i8 } @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEE6insertIS3_IlS0_EEENSt9enable_ifIXsr16is_constructibleIS5_T_EE5valueES3_ISt17_Rb_tree_iteratorIS5_EbEE4typeEOSB_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(32) %13)
          to label %120 unwind label %125

120:                                              ; preds = %118
  %121 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 0
  %122 = extractvalue { ptr, i8 } %119, 0
  store ptr %122, ptr %121, align 8
  %123 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 1
  %124 = extractvalue { ptr, i8 } %119, 1
  store i8 %124, ptr %123, align 8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  br label %129

125:                                              ; preds = %118, %110
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %10, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  br label %133

129:                                              ; preds = %120, %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %8, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %8, align 4, !tbaa !9
  br label %16, !llvm.loop !15

133:                                              ; preds = %125, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %153

134:                                              ; preds = %21
  %135 = load i64, ptr %5, align 8, !tbaa !5
  %136 = icmp sgt i64 %135, 1
  br i1 %136, label %137, label %148

137:                                              ; preds = %134
  %138 = load i64, ptr %3, align 8, !tbaa !5
  %139 = add nsw i64 1, %138
  %140 = load i64, ptr %4, align 8, !tbaa !5
  %141 = add nsw i64 1, %140
  %142 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %139, i64 noundef %141)
          to label %143 unwind label %144

143:                                              ; preds = %137
  br label %151

144:                                              ; preds = %148, %137
  %145 = landingpad { ptr, i32 }
          cleanup
  %146 = extractvalue { ptr, i32 } %145, 0
  store ptr %146, ptr %10, align 8
  %147 = extractvalue { ptr, i32 } %145, 1
  store i32 %147, ptr %11, align 4
  br label %153

148:                                              ; preds = %134
  %149 = invoke i32 @puts(ptr noundef @.str.3)
          to label %150 unwind label %144

150:                                              ; preds = %148
  br label %151

151:                                              ; preds = %150, %143
  store i32 0, ptr %1, align 4
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %152 = load i32, ptr %1, align 4
  ret i32 %152

153:                                              ; preds = %144, %133
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %154

154:                                              ; preds = %153
  %155 = load ptr, ptr %10, align 8
  %156 = load i32, ptr %11, align 4
  %157 = insertvalue { ptr, i32 } poison, ptr %155, 0
  %158 = insertvalue { ptr, i32 } %157, i32 %156, 1
  resume { ptr, i32 } %158
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIl4contEC2IRlRS0_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

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

declare i32 @puts(ptr noundef) #2

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

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

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

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


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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, cont>, std::_Select1st<std::pair<const long, cont>>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, std::pair<const long, cont>, std::_Select1st<std::pair<const long, cont>>, std::less<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 }
%struct.cont = type { i64, i64, i64 }
%"struct.std::pair.0" = type { i64, %struct.cont }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"class.std::map", align 8
  %3 = alloca i64, align 8
  %4 = alloca %struct.cont, align 8
  %5 = alloca %"struct.std::pair.0", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #5
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = icmp sgt i64 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %0
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  %10 = getelementptr inbounds i8, ptr %4, i64 16
  br label %12

._crit_edge:                                      ; preds = %89
  %11 = icmp sgt i64 %.119, 1
  br i1 %11, label %93, label %._crit_edge.thread

12:                                               ; preds = %.lr.ph, %89
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %89 ]
  %.034 = phi i64 [ 0, %.lr.ph ], [ %.1, %89 ]
  %.01632 = phi i64 [ 1, %.lr.ph ], [ %.117, %89 ]
  %.01831 = phi i64 [ 1, %.lr.ph ], [ %.119, %89 ]
  %.02030 = phi i64 [ 0, %.lr.ph ], [ %.121, %89 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3)
  %14 = invoke noundef i64 @_ZNKSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %15 unwind label %50

15:                                               ; preds = %12
  %.not = icmp eq i64 %14, 0
  br i1 %.not, label %84, label %16

16:                                               ; preds = %15
  %17 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %18 unwind label %50

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %17, i64 8
  store i64 %indvars.iv, ptr %19, align 8, !tbaa !9
  %20 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %21 unwind label %50

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %20, i64 16
  %23 = load i64, ptr %22, align 8, !tbaa !11
  %24 = add nsw i64 %23, 1
  store i64 %24, ptr %22, align 8, !tbaa !11
  %25 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %26 unwind label %50

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %25, i64 16
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = icmp sgt i64 %28, %.01831
  br i1 %29, label %30, label %52

30:                                               ; preds = %26
  %31 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %32 unwind label %50

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %31, i64 16
  %34 = load i64, ptr %33, align 8, !tbaa !11
  %35 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %36 unwind label %50

36:                                               ; preds = %32
  %37 = load i64, ptr %35, align 8, !tbaa !12
  %38 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %39 unwind label %50

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %38, i64 8
  %41 = load i64, ptr %40, align 8, !tbaa !9
  %42 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %43 unwind label %50

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %42, i64 8
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %47 unwind label %50

47:                                               ; preds = %43
  %48 = load i64, ptr %46, align 8, !tbaa !12
  %49 = sub nsw i64 %45, %48
  br label %89

50:                                               ; preds = %77, %73, %70, %68, %60, %58, %52, %43, %39, %36, %32, %30, %21, %18, %16, %12
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %92

52:                                               ; preds = %26
  %53 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %54 unwind label %50

54:                                               ; preds = %52
  %55 = getelementptr inbounds i8, ptr %53, i64 16
  %56 = load i64, ptr %55, align 8, !tbaa !11
  %57 = icmp eq i64 %56, %.01831
  br i1 %57, label %58, label %89

58:                                               ; preds = %54
  %59 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %60 unwind label %50

60:                                               ; preds = %58
  %61 = getelementptr inbounds i8, ptr %59, i64 8
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %64 unwind label %50

64:                                               ; preds = %60
  %65 = load i64, ptr %63, align 8, !tbaa !12
  %66 = sub nsw i64 %62, %65
  %67 = icmp sgt i64 %.01632, %66
  br i1 %67, label %68, label %89

68:                                               ; preds = %64
  %69 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %70 unwind label %50

70:                                               ; preds = %68
  %71 = load i64, ptr %69, align 8, !tbaa !12
  %72 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %73 unwind label %50

73:                                               ; preds = %70
  %74 = getelementptr inbounds i8, ptr %72, i64 8
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %77 unwind label %50

77:                                               ; preds = %73
  %78 = getelementptr inbounds i8, ptr %76, i64 8
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %81 unwind label %50

81:                                               ; preds = %77
  %82 = load i64, ptr %80, align 8, !tbaa !12
  %83 = sub nsw i64 %79, %82
  br label %89

84:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  store i64 %indvars.iv, ptr %4, align 8, !tbaa !12
  store i64 %indvars.iv, ptr %9, align 8, !tbaa !9
  store i64 1, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @_ZNSt4pairIl4contEC2IRlRS0_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  %85 = invoke { ptr, i8 } @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEE6insertIS3_IlS0_EEENSt9enable_ifIXsr16is_constructibleIS5_T_EE5valueES3_ISt17_Rb_tree_iteratorIS5_EbEE4typeEOSB_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %86 unwind label %87

86:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %89

87:                                               ; preds = %84
  %88 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %92

89:                                               ; preds = %47, %81, %64, %54, %86
  %.121 = phi i64 [ %41, %47 ], [ %75, %81 ], [ %.02030, %64 ], [ %.02030, %54 ], [ %.02030, %86 ]
  %.119 = phi i64 [ %34, %47 ], [ %.01831, %81 ], [ %.01831, %64 ], [ %.01831, %54 ], [ %.01831, %86 ]
  %.117 = phi i64 [ %49, %47 ], [ %83, %81 ], [ %.01632, %64 ], [ %.01632, %54 ], [ %.01632, %86 ]
  %.1 = phi i64 [ %37, %47 ], [ %71, %81 ], [ %.034, %64 ], [ %.034, %54 ], [ %.034, %86 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %90 = load i64, ptr %1, align 8, !tbaa !5
  %91 = icmp sgt i64 %90, %indvars.iv.next
  br i1 %91, label %12, label %._crit_edge, !llvm.loop !13

92:                                               ; preds = %87, %50
  %.pn = phi { ptr, i32 } [ %51, %50 ], [ %88, %87 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn

93:                                               ; preds = %._crit_edge
  %94 = add nsw i64 %.121, 1
  %95 = add nsw i64 %.1, 1
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %95, i64 noundef %94)
  br label %98

._crit_edge.thread:                               ; preds = %0, %._crit_edge
  %97 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %98

98:                                               ; preds = %._crit_edge.thread, %93
  call void @_ZNSt3mapIl4contSt4lessIlESaISt4pairIKlS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIl4contEC2IRlRS0_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS6_S7_EEEbE4typeELb1EEEOS6_OS7_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

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

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


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