; LLVM IR from DionysiosB/CodeForces :: 1400-1499 (1454D-NumberIntoSequence)

; 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 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { i64, i64 }

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

19:                                               ; preds = %134, %0
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = add nsw i64 %20, -1
  store i64 %21, ptr %2, align 8, !tbaa !5
  %22 = icmp ne i64 %20, 0
  br i1 %22, label %23, label %137

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, 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
  %25 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %25, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 2, ptr %6, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %65, %23
  %27 = load i64, ptr %6, align 8, !tbaa !5
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = mul nsw i64 %27, %28
  %30 = load i64, ptr %3, align 8, !tbaa !5
  %31 = icmp sle i64 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %26
  store i32 4, ptr %7, align 4
  br label %68

33:                                               ; preds = %26
  %34 = load i64, ptr %6, align 8, !tbaa !5
  %35 = load i64, ptr %6, align 8, !tbaa !5
  %36 = mul nsw i64 %34, %35
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = icmp sgt i64 %36, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %33
  store i32 4, ptr %7, align 4
  br label %68

40:                                               ; preds = %33
  %41 = load i64, ptr %5, align 8, !tbaa !5
  %42 = load i64, ptr %6, align 8, !tbaa !5
  %43 = srem i64 %41, %42
  %44 = icmp ne i64 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  br label %65

46:                                               ; preds = %40
  br label %47

47:                                               ; preds = %54, %46
  %48 = load i64, ptr %5, align 8, !tbaa !5
  %49 = load i64, ptr %6, align 8, !tbaa !5
  %50 = srem i64 %48, %49
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %64

52:                                               ; preds = %47
  %53 = 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 %54 unwind label %60

54:                                               ; preds = %52
  %55 = load i64, ptr %53, align 8, !tbaa !5
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %53, align 8, !tbaa !5
  %57 = load i64, ptr %6, align 8, !tbaa !5
  %58 = load i64, ptr %5, align 8, !tbaa !5
  %59 = sdiv i64 %58, %57
  store i64 %59, ptr %5, align 8, !tbaa !5
  br label %47, !llvm.loop !9

60:                                               ; preds = %52
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %8, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %136

64:                                               ; preds = %47
  br label %65

65:                                               ; preds = %64, %45
  %66 = load i64, ptr %6, align 8, !tbaa !5
  %67 = add nsw i64 %66, 1
  store i64 %67, ptr %6, align 8, !tbaa !5
  br label %26, !llvm.loop !11

68:                                               ; preds = %39, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %69

69:                                               ; preds = %68
  %70 = load i64, ptr %5, align 8, !tbaa !5
  %71 = icmp sgt i64 %70, 0
  br i1 %71, label %72, label %79

72:                                               ; preds = %69
  %73 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %74 unwind label %75

74:                                               ; preds = %72
  store i64 1, ptr %73, align 8, !tbaa !5
  br label %79

75:                                               ; preds = %72
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %8, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %9, align 4
  br label %136

79:                                               ; preds = %74, %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 1, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %80 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %81 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %12, i32 0, i32 0
  store ptr %80, ptr %81, align 8
  br label %82

82:                                               ; preds = %101, %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %83 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %84 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %83, ptr %84, align 8
  %85 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 9, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %104

87:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %88 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %89 = getelementptr inbounds %"struct.std::pair", ptr %88, i32 0, i32 0
  %90 = load i64, ptr %89, align 8, !tbaa !12
  store i64 %90, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %91 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  %92 = getelementptr inbounds %"struct.std::pair", ptr %91, i32 0, i32 1
  %93 = load i64, ptr %92, align 8, !tbaa !14
  store i64 %93, ptr %15, align 8, !tbaa !5
  %94 = load i64, ptr %15, align 8, !tbaa !5
  %95 = load i64, ptr %10, align 8, !tbaa !5
  %96 = icmp sgt i64 %94, %95
  br i1 %96, label %97, label %100

97:                                               ; preds = %87
  %98 = load i64, ptr %15, align 8, !tbaa !5
  store i64 %98, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %14, align 8, !tbaa !5
  store i64 %99, ptr %11, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %97, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %101

101:                                              ; preds = %100
  %102 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %12, i32 noundef 0) #5
  %103 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %16, i32 0, i32 0
  store ptr %102, ptr %103, align 8
  br label %82, !llvm.loop !15

104:                                              ; preds = %86
  %105 = load i64, ptr %10, align 8, !tbaa !5
  %106 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %105)
          to label %107 unwind label %113

107:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store i64 1, ptr %17, align 8, !tbaa !5
  br label %108

108:                                              ; preds = %124, %107
  %109 = load i64, ptr %17, align 8, !tbaa !5
  %110 = load i64, ptr %10, align 8, !tbaa !5
  %111 = icmp slt i64 %109, %110
  br i1 %111, label %117, label %112

112:                                              ; preds = %108
  store i32 12, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %131

113:                                              ; preds = %131, %104
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %8, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %9, align 4
  br label %135

117:                                              ; preds = %108
  %118 = load i64, ptr %11, align 8, !tbaa !5
  %119 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %118)
          to label %120 unwind label %127

120:                                              ; preds = %117
  %121 = load i64, ptr %11, align 8, !tbaa !5
  %122 = load i64, ptr %3, align 8, !tbaa !5
  %123 = sdiv i64 %122, %121
  store i64 %123, ptr %3, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %120
  %125 = load i64, ptr %17, align 8, !tbaa !5
  %126 = add nsw i64 %125, 1
  store i64 %126, ptr %17, align 8, !tbaa !5
  br label %108, !llvm.loop !16

127:                                              ; preds = %117
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %8, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %135

131:                                              ; preds = %112
  %132 = load i64, ptr %3, align 8, !tbaa !5
  %133 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %132)
          to label %134 unwind label %113

134:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  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
  br label %19, !llvm.loop !17

135:                                              ; preds = %127, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %136

136:                                              ; preds = %135, %75, %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  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 %139

137:                                              ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %138 = load i32, ptr %1, align 4
  ret i32 %138

139:                                              ; preds = %136
  %140 = load ptr, ptr %8, align 8
  %141 = load i32, ptr %9, align 4
  %142 = insertvalue { ptr, i32 } poison, ptr %140, 0
  %143 = insertvalue { ptr, i32 } %142, i32 %141, 1
  resume { ptr, i32 } %143
}

; 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

; 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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3 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 = !{!13, !6, i64 0}
!13 = !{!"_ZTSSt4pairIKxxE", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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 }
%"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 [6 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 %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr %1, align 8, !tbaa !5
  %.not37 = icmp eq i64 %9, 0
  br i1 %.not37, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %0, %._crit_edge36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #6
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %12 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %12, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  store i64 2, ptr %5, align 8, !tbaa !5
  %.not2026 = icmp slt i64 %12, 4
  br i1 %.not2026, label %.loopexit24, label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph39, %.loopexit
  %13 = phi i64 [ %34, %.loopexit ], [ %12, %.lr.ph39 ]
  %14 = phi i64 [ %36, %.loopexit ], [ %12, %.lr.ph39 ]
  %15 = phi i64 [ %37, %.loopexit ], [ %12, %.lr.ph39 ]
  %16 = phi i64 [ %39, %.loopexit ], [ 4, %.lr.ph39 ]
  %17 = phi i64 [ %38, %.loopexit ], [ 2, %.lr.ph39 ]
  %18 = icmp sgt i64 %16, %15
  br i1 %18, label %.loopexit24, label %19

19:                                               ; preds = %.lr.ph28
  %20 = srem i64 %15, %17
  %.not21 = icmp eq i64 %20, 0
  br i1 %.not21, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %19
  %21 = srem i64 %14, %17
  %22 = icmp eq i64 %21, 0
  br i1 %22, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %24
  %23 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %24 unwind label %32

24:                                               ; preds = %.lr.ph
  %25 = load i64, ptr %23, align 8, !tbaa !5
  %26 = add nsw i64 %25, 1
  store i64 %26, ptr %23, align 8, !tbaa !5
  %27 = load i64, ptr %5, align 8, !tbaa !5
  %28 = load i64, ptr %4, align 8, !tbaa !5
  %29 = sdiv i64 %28, %27
  store i64 %29, ptr %4, align 8, !tbaa !5
  %30 = srem i64 %29, %27
  %31 = icmp eq i64 %30, 0
  br i1 %31, label %.lr.ph, label %.loopexit.loopexit, !llvm.loop !9

32:                                               ; preds = %.lr.ph
  %33 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %71

.loopexit.loopexit:                               ; preds = %24
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.preheader, %19
  %34 = phi i64 [ %.pre, %.loopexit.loopexit ], [ %13, %.preheader ], [ %13, %19 ]
  %35 = phi i64 [ %27, %.loopexit.loopexit ], [ %17, %.preheader ], [ %17, %19 ]
  %36 = phi i64 [ %29, %.loopexit.loopexit ], [ %14, %.preheader ], [ %14, %19 ]
  %37 = phi i64 [ %29, %.loopexit.loopexit ], [ %14, %.preheader ], [ %15, %19 ]
  %38 = add nsw i64 %35, 1
  store i64 %38, ptr %5, align 8, !tbaa !5
  %39 = mul nsw i64 %38, %38
  %.not20 = icmp sgt i64 %39, %34
  br i1 %.not20, label %.loopexit24, label %.lr.ph28, !llvm.loop !11

.loopexit24:                                      ; preds = %.lr.ph28, %.loopexit, %.lr.ph39
  %40 = phi i64 [ %12, %.lr.ph39 ], [ %15, %.lr.ph28 ], [ %36, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %41 = icmp sgt i64 %40, 0
  br i1 %41, label %42, label %47

42:                                               ; preds = %.loopexit24
  %43 = 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 %44 unwind label %45

44:                                               ; preds = %42
  store i64 1, ptr %43, align 8, !tbaa !5
  br label %47

45:                                               ; preds = %42
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %71

47:                                               ; preds = %44, %.loopexit24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %48 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  store ptr %48, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %49 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  store ptr %49, ptr %7, align 8
  %50 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %50, label %.lr.ph31, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef 0)
  br label %._crit_edge.._crit_edge36_crit_edge

._crit_edge:                                      ; preds = %.lr.ph31
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %spec.select)
  %53 = icmp sgt i64 %spec.select, 1
  br i1 %53, label %.lr.ph35, label %._crit_edge.._crit_edge36_crit_edge

._crit_edge.._crit_edge36_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %.pre44 = load i64, ptr %2, align 8, !tbaa !5
  br label %._crit_edge36

.lr.ph31:                                         ; preds = %47, %.lr.ph31
  %.01430 = phi i64 [ %spec.select23, %.lr.ph31 ], [ 1, %47 ]
  %.01529 = phi i64 [ %spec.select, %.lr.ph31 ], [ 0, %47 ]
  %54 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %55 = load i64, ptr %54, align 8, !tbaa !12
  %56 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %57 = getelementptr inbounds i8, ptr %56, i64 8
  %58 = load i64, ptr %57, align 8, !tbaa !14
  %59 = icmp sgt i64 %58, %.01529
  %spec.select = call i64 @llvm.smax.i64(i64 %58, i64 %.01529)
  %spec.select23 = select i1 %59, i64 %55, i64 %.01430
  %60 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %61 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  store ptr %61, ptr %7, align 8
  %62 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %62, label %.lr.ph31, label %._crit_edge, !llvm.loop !15

._crit_edge36:                                    ; preds = %.lr.ph35, %._crit_edge.._crit_edge36_crit_edge
  %63 = phi i64 [ %.pre44, %._crit_edge.._crit_edge36_crit_edge ], [ %69, %.lr.ph35 ]
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %63)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %65 = load i64, ptr %1, align 8, !tbaa !5
  %66 = add nsw i64 %65, -1
  store i64 %66, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %65, 0
  br i1 %.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !16

.lr.ph35:                                         ; preds = %._crit_edge, %.lr.ph35
  %.033 = phi i64 [ %70, %.lr.ph35 ], [ 1, %._crit_edge ]
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select23)
  %68 = load i64, ptr %2, align 8, !tbaa !5
  %69 = sdiv i64 %68, %spec.select23
  store i64 %69, ptr %2, align 8, !tbaa !5
  %70 = add nuw nsw i64 %.033, 1
  %exitcond.not = icmp eq i64 %70, %spec.select
  br i1 %exitcond.not, label %._crit_edge36, label %.lr.ph35, !llvm.loop !17

71:                                               ; preds = %45, %32
  %.pn = phi { ptr, i32 } [ %46, %45 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn

._crit_edge40:                                    ; preds = %._crit_edge36, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  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 @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; 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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!13, !6, i64 0}
!13 = !{!"_ZTSSt4pairIKxxE", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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