; LLVM IR from DionysiosB/CodeForces :: 1000-1099 (1003D-CoinsAndQueries)

; 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 long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 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 %"class.std::map", align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca %"class.std::map", align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr %4) #5
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %29, %0
  %18 = load i64, ptr %5, align 8, !tbaa !5
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %22, label %21

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

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

24:                                               ; preds = %22
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %26 unwind label %32

26:                                               ; preds = %24
  %27 = load i64, ptr %25, align 8, !tbaa !5
  %28 = add nsw i64 %27, 1
  store i64 %28, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %29

29:                                               ; preds = %26
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = add nsw i64 %30, 1
  store i64 %31, ptr %5, align 8, !tbaa !5
  br label %17, !llvm.loop !9

32:                                               ; preds = %24, %22
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %7, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %149

36:                                               ; preds = %21
  br label %37

37:                                               ; preds = %139, %36
  %38 = load i64, ptr %3, align 8, !tbaa !5
  %39 = add nsw i64 %38, -1
  store i64 %39, ptr %3, align 8, !tbaa !5
  %40 = icmp ne i64 %38, 0
  br i1 %40, label %41, label %147

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %42 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %9)
          to label %43 unwind label %50

43:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 48, ptr %10) #5
  invoke void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2ERKS6_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(48) %4)
          to label %44 unwind label %54

44:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 1, ptr %12, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %132, %44
  %46 = load i64, ptr %12, align 8, !tbaa !5
  %47 = sitofp i64 %46 to double
  %48 = fcmp ole double %47, 2.000000e+09
  br i1 %48, label %58, label %49

49:                                               ; preds = %45
  store i32 7, ptr %13, align 4
  br label %135

50:                                               ; preds = %41
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %7, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %8, align 4
  br label %146

54:                                               ; preds = %43
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %7, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %8, align 4
  br label %145

58:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %59 = load i64, ptr %12, align 8, !tbaa !5
  %60 = load i64, ptr %9, align 8, !tbaa !5
  %61 = load i64, ptr %12, align 8, !tbaa !5
  %62 = sdiv i64 %60, %61
  %63 = srem i64 %62, 2
  %64 = mul nsw i64 %59, %63
  store i64 %64, ptr %14, align 8, !tbaa !5
  %65 = load i64, ptr %14, align 8, !tbaa !5
  %66 = icmp eq i64 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %58
  store i32 9, ptr %13, align 4
  br label %129

68:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %69 = load i64, ptr %12, align 8, !tbaa !5
  store i64 %69, ptr %15, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %120, %68
  %71 = load i64, ptr %15, align 8, !tbaa !5
  %72 = icmp sge i64 %71, 1
  br i1 %72, label %74, label %73

73:                                               ; preds = %70
  store i32 10, ptr %13, align 4
  br label %123

74:                                               ; preds = %70
  %75 = invoke noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %76 unwind label %79

76:                                               ; preds = %74
  %77 = icmp ne i64 %75, 0
  br i1 %77, label %83, label %78

78:                                               ; preds = %76
  br label %120

79:                                               ; preds = %111, %106, %104, %91, %83, %74
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %7, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %144

83:                                               ; preds = %76
  %84 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %85 unwind label %79

85:                                               ; preds = %83
  %86 = load i64, ptr %84, align 8, !tbaa !5
  %87 = load i64, ptr %15, align 8, !tbaa !5
  %88 = mul nsw i64 %86, %87
  %89 = load i64, ptr %14, align 8, !tbaa !5
  %90 = icmp sge i64 %88, %89
  br i1 %90, label %91, label %104

91:                                               ; preds = %85
  %92 = load i64, ptr %14, align 8, !tbaa !5
  %93 = load i64, ptr %15, align 8, !tbaa !5
  %94 = sdiv i64 %92, %93
  %95 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %96 unwind label %79

96:                                               ; preds = %91
  %97 = load i64, ptr %95, align 8, !tbaa !5
  %98 = sub nsw i64 %97, %94
  store i64 %98, ptr %95, align 8, !tbaa !5
  %99 = load i64, ptr %14, align 8, !tbaa !5
  %100 = load i64, ptr %15, align 8, !tbaa !5
  %101 = sdiv i64 %99, %100
  %102 = load i64, ptr %11, align 8, !tbaa !5
  %103 = add nsw i64 %102, %101
  store i64 %103, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %14, align 8, !tbaa !5
  store i32 10, ptr %13, align 4
  br label %123

104:                                              ; preds = %85
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %106 unwind label %79

106:                                              ; preds = %104
  %107 = load i64, ptr %105, align 8, !tbaa !5
  %108 = load i64, ptr %11, align 8, !tbaa !5
  %109 = add nsw i64 %108, %107
  store i64 %109, ptr %11, align 8, !tbaa !5
  %110 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %111 unwind label %79

111:                                              ; preds = %106
  %112 = load i64, ptr %110, align 8, !tbaa !5
  %113 = load i64, ptr %15, align 8, !tbaa !5
  %114 = mul nsw i64 %112, %113
  %115 = load i64, ptr %14, align 8, !tbaa !5
  %116 = sub nsw i64 %115, %114
  store i64 %116, ptr %14, align 8, !tbaa !5
  %117 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %118 unwind label %79

118:                                              ; preds = %111
  store i64 0, ptr %117, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119, %78
  %121 = load i64, ptr %15, align 8, !tbaa !5
  %122 = sdiv i64 %121, 2
  store i64 %122, ptr %15, align 8, !tbaa !5
  br label %70, !llvm.loop !11

123:                                              ; preds = %96, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %14, align 8, !tbaa !5
  %126 = icmp sgt i64 %125, 0
  br i1 %126, label %127, label %128

127:                                              ; preds = %124
  store i64 -1, ptr %11, align 8, !tbaa !5
  store i32 7, ptr %13, align 4
  br label %129

128:                                              ; preds = %124
  store i32 0, ptr %13, align 4
  br label %129

129:                                              ; preds = %128, %127, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %130 = load i32, ptr %13, align 4
  switch i32 %130, label %135 [
    i32 0, label %131
    i32 9, label %132
  ]

131:                                              ; preds = %129
  br label %132

132:                                              ; preds = %131, %129
  %133 = load i64, ptr %12, align 8, !tbaa !5
  %134 = mul nsw i64 %133, 2
  store i64 %134, ptr %12, align 8, !tbaa !5
  br label %45, !llvm.loop !12

135:                                              ; preds = %129, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %136

136:                                              ; preds = %135
  %137 = load i64, ptr %11, align 8, !tbaa !5
  %138 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %137)
          to label %139 unwind label %140

139:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %37, !llvm.loop !13

140:                                              ; preds = %136
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %7, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %8, align 4
  br label %144

144:                                              ; preds = %140, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #5
  br label %145

145:                                              ; preds = %144, %54
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #5
  br label %146

146:                                              ; preds = %145, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %149

147:                                              ; preds = %37
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, 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
  %148 = load i32, ptr %1, align 4
  ret i32 %148

149:                                              ; preds = %146, %32
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, 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 %150

150:                                              ; preds = %149
  %151 = load ptr, ptr %7, align 8
  %152 = load i32, ptr %8, align 4
  %153 = insertvalue { ptr, i32 } poison, ptr %151, 0
  %154 = insertvalue { ptr, i32 } %153, i32 %152, 1
  resume { ptr, i32 } %154
}

; 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 @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(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 nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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

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

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

.preheader42:                                     ; preds = %15, %0
  %11 = load i64, ptr %2, align 8, !tbaa !5
  %12 = add nsw i64 %11, -1
  store i64 %12, ptr %2, align 8, !tbaa !5
  %.not52 = icmp eq i64 %11, 0
  br i1 %.not52, label %._crit_edge, label %.lr.ph53

.lr.ph:                                           ; preds = %0, %15
  %.02847 = phi i64 [ %18, %15 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %4)
  %14 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %15 unwind label %21

15:                                               ; preds = %.lr.ph
  %16 = load i64, ptr %14, align 8, !tbaa !5
  %17 = add nsw i64 %16, 1
  store i64 %17, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %18 = add nuw nsw i64 %.02847, 1
  %19 = load i64, ptr %1, align 8, !tbaa !5
  %20 = icmp slt i64 %18, %19
  br i1 %20, label %.lr.ph, label %.preheader42, !llvm.loop !9

21:                                               ; preds = %.lr.ph
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %77

.lr.ph53:                                         ; preds = %.preheader42, %72
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #5
  invoke void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2ERKS6_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %3)
          to label %.preheader unwind label %24

24:                                               ; preds = %.lr.ph53
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %76

.preheader:                                       ; preds = %.lr.ph53, %69
  %.02051 = phi i64 [ %70, %69 ], [ 1, %.lr.ph53 ]
  %.02150 = phi i64 [ %.4.ph, %69 ], [ 0, %.lr.ph53 ]
  %26 = load i64, ptr %5, align 8, !tbaa !5
  %27 = sdiv i64 %26, %.02051
  %28 = srem i64 %27, 2
  %29 = icmp eq i64 %28, 0
  br i1 %29, label %69, label %30

30:                                               ; preds = %.preheader
  %31 = mul nsw i64 %28, %.02051
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 %.02051, ptr %7, align 8, !tbaa !5
  br label %32

32:                                               ; preds = %30, %63
  %.049 = phi i64 [ %31, %30 ], [ %.1, %63 ]
  %.12248 = phi i64 [ %.02150, %30 ], [ %.223, %63 ]
  %33 = invoke noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %34 unwind label %.loopexit

34:                                               ; preds = %32
  %.not30 = icmp eq i64 %33, 0
  br i1 %.not30, label %63, label %36

.loopexit:                                        ; preds = %32, %36, %50, %52, %56
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %35

.loopexit.split-lp:                               ; preds = %42
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %35

35:                                               ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #5
  br label %76

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %38 unwind label %.loopexit

38:                                               ; preds = %36
  %39 = load i64, ptr %37, align 8, !tbaa !5
  %40 = load i64, ptr %7, align 8, !tbaa !5
  %41 = mul nsw i64 %40, %39
  %.not31 = icmp slt i64 %41, %.049
  br i1 %.not31, label %50, label %42

42:                                               ; preds = %38
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %.thread38 unwind label %.loopexit.split-lp

.thread38:                                        ; preds = %42
  %44 = sdiv i64 %.049, %40
  %45 = load i64, ptr %43, align 8, !tbaa !5
  %46 = sub nsw i64 %45, %44
  store i64 %46, ptr %43, align 8, !tbaa !5
  %47 = load i64, ptr %7, align 8, !tbaa !5
  %48 = sdiv i64 %.049, %47
  %49 = add nsw i64 %48, %.12248
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %69

50:                                               ; preds = %38
  %51 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %52 unwind label %.loopexit

52:                                               ; preds = %50
  %53 = load i64, ptr %51, align 8, !tbaa !5
  %54 = add nsw i64 %53, %.12248
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %56 unwind label %.loopexit

56:                                               ; preds = %52
  %57 = load i64, ptr %55, align 8, !tbaa !5
  %58 = load i64, ptr %7, align 8, !tbaa !5
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %60 unwind label %.loopexit

60:                                               ; preds = %56
  %61 = mul nsw i64 %58, %57
  %62 = sub nsw i64 %.049, %61
  store i64 0, ptr %59, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %34, %60
  %.223 = phi i64 [ %54, %60 ], [ %.12248, %34 ]
  %.1 = phi i64 [ %62, %60 ], [ %.049, %34 ]
  %64 = load i64, ptr %7, align 8, !tbaa !5
  %65 = sdiv i64 %64, 2
  store i64 %65, ptr %7, align 8, !tbaa !5
  %66 = icmp sgt i64 %64, 1
  br i1 %66, label %32, label %67, !llvm.loop !11

67:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %68 = icmp sgt i64 %.1, 0
  br i1 %68, label %72, label %69

69:                                               ; preds = %.thread38, %.preheader, %67
  %.4.ph = phi i64 [ %.223, %67 ], [ %.02150, %.preheader ], [ %49, %.thread38 ]
  %70 = shl nuw nsw i64 %.02051, 1
  %71 = icmp ult i64 %.02051, 1000000001
  br i1 %71, label %.preheader, label %72, !llvm.loop !12

72:                                               ; preds = %67, %69
  %.5 = phi i64 [ %.4.ph, %69 ], [ -1, %67 ]
  %73 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.5)
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %74 = load i64, ptr %2, align 8, !tbaa !5
  %75 = add nsw i64 %74, -1
  store i64 %75, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %74, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph53, !llvm.loop !13

76:                                               ; preds = %35, %24
  %.pn = phi { ptr, i32 } [ %lpad.phi, %35 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %77

._crit_edge:                                      ; preds = %72, %.preheader42
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0

77:                                               ; preds = %76, %21
  %.pn33 = phi { ptr, i32 } [ %22, %21 ], [ %.pn, %76 ]
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn33
}

; 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 @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(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 nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 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: mustprogress uwtable
declare dso_local void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2ERKS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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