; LLVM IR from reyadussalahin/problem-solving :: data_structure/priority_queue/codeforces/F1353D (Solution)

; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl" }
%"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl" = type { %"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Range = type { i32, i32 }

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

17:                                               ; preds = %115, %0
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %120

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #7
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %24 = load i32, ptr %5, align 4, !tbaa !5
  invoke void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef 1, i32 noundef %24)
          to label %25 unwind label %57

25:                                               ; preds = %22
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %26 unwind label %57

26:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %89, %26
  %28 = invoke noundef zeroext i1 @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %29 unwind label %61

29:                                               ; preds = %27
  %30 = xor i1 %28, true
  br i1 %30, label %31, label %92

31:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %32 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %33 unwind label %65

33:                                               ; preds = %31
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %32, i64 8, i1 false), !tbaa.struct !9
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %6)
          to label %34 unwind label %65

34:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %35 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 0
  %36 = load i32, ptr %35, align 4, !tbaa !10
  %37 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !12
  %39 = add nsw i32 %36, %38
  %40 = sdiv i32 %39, 2
  store i32 %40, ptr %12, align 4, !tbaa !5
  %41 = load i32, ptr %10, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %10, align 4, !tbaa !5
  %43 = load i32, ptr %12, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %44
  store i32 %41, ptr %45, align 4, !tbaa !5
  %46 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 0
  %47 = load i32, ptr %46, align 4, !tbaa !10
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %50, label %73

50:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %51 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 0
  %52 = load i32, ptr %51, align 4, !tbaa !10
  %53 = load i32, ptr %12, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  invoke void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %13, i32 noundef %52, i32 noundef %54)
          to label %55 unwind label %69

55:                                               ; preds = %50
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(8) %13)
          to label %56 unwind label %69

56:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %73

57:                                               ; preds = %25, %22
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %8, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %119

61:                                               ; preds = %112, %27
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %8, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %9, align 4
  br label %118

65:                                               ; preds = %33, %31
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %8, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %9, align 4
  br label %91

69:                                               ; preds = %55, %50
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %8, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %90

73:                                               ; preds = %56, %34
  %74 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 1
  %75 = load i32, ptr %74, align 4, !tbaa !12
  %76 = load i32, ptr %12, align 4, !tbaa !5
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %89

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %79 = load i32, ptr %12, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  %81 = getelementptr inbounds %struct.Range, ptr %11, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !12
  invoke void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %14, i32 noundef %80, i32 noundef %82)
          to label %83 unwind label %85

83:                                               ; preds = %78
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 4 dereferenceable(8) %14)
          to label %84 unwind label %85

84:                                               ; preds = %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %89

85:                                               ; preds = %83, %78
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %8, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %90

89:                                               ; preds = %84, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %27, !llvm.loop !13

90:                                               ; preds = %85, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %91

91:                                               ; preds = %90, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %118

92:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %105, %92
  %94 = load i32, ptr %15, align 4, !tbaa !5
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %112

98:                                               ; preds = %93
  %99 = load i32, ptr %15, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %102)
          to label %104 unwind label %108

104:                                              ; preds = %98
  br label %105

105:                                              ; preds = %104
  %106 = load i32, ptr %15, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %15, align 4, !tbaa !5
  br label %93, !llvm.loop !15

108:                                              ; preds = %98
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %8, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %118

112:                                              ; preds = %97
  %113 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %114 unwind label %61

114:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %3, align 4, !tbaa !5
  br label %17, !llvm.loop !16

118:                                              ; preds = %108, %91, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %119

119:                                              ; preds = %118, %57
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %6) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %122

120:                                              ; preds = %21
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %121 = load i32, ptr %1, align 4
  ret i32 %121

122:                                              ; preds = %119
  %123 = load ptr, ptr %8, align 8
  %124 = load i32, ptr %9, align 4
  %125 = insertvalue { ptr, i32 } poison, ptr %123, 0
  %126 = insertvalue { ptr, i32 } %125, i32 %124, 1
  resume { ptr, i32 } %126
}

; 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 @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #3 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 noundef zeroext i1 @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #6 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

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

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


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

%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl" }
%"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl" = type { %"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Range, std::allocator<Range>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Range = type { i32, i32 }

@a = external dso_local local_unnamed_addr global [200010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 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 i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::priority_queue", align 8
  %4 = alloca %struct.Range, align 4
  %5 = alloca %struct.Range, align 4
  %6 = alloca %struct.Range, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph34, label %._crit_edge35

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

.lr.ph34:                                         ; preds = %0, %._crit_edge
  %.01732 = phi i32 [ %42, %._crit_edge ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %11 = load i32, ptr %2, align 4, !tbaa !5
  call void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 1, i32 noundef %11)
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(8) %4)
          to label %12 unwind label %26

12:                                               ; preds = %.lr.ph34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %13 = call noundef zeroext i1 @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  br i1 %13, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %39, %12
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %.not29 = icmp slt i32 %14, 1
  br i1 %.not29, label %._crit_edge, label %.lr.ph31

.lr.ph:                                           ; preds = %12, %39
  %.01828 = phi i32 [ %19, %39 ], [ 1, %12 ]
  %15 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  %.sroa.0.0.copyload = load i32, ptr %15, align 4, !tbaa !5
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %15, i64 4
  %.sroa.7.0.copyload = load i32, ptr %.sroa.7.0..sroa_idx, align 4, !tbaa !5
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
          to label %16 unwind label %28

16:                                               ; preds = %.lr.ph
  %17 = add nsw i32 %.sroa.7.0.copyload, %.sroa.0.0.copyload
  %18 = sdiv i32 %17, 2
  %19 = add nuw nsw i32 %.01828, 1
  %20 = sext i32 %18 to i64
  %21 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %20
  store i32 %.01828, ptr %21, align 4, !tbaa !5
  %22 = icmp slt i32 %.sroa.0.0.copyload, %18
  br i1 %22, label %23, label %32

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %24 = add nsw i32 %18, -1
  call void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef %.sroa.0.0.copyload, i32 noundef %24)
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %25 unwind label %30

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

26:                                               ; preds = %.lr.ph34
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %50

28:                                               ; preds = %.lr.ph
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %50

30:                                               ; preds = %23
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %50

32:                                               ; preds = %25, %16
  %33 = icmp sgt i32 %.sroa.7.0.copyload, %18
  br i1 %33, label %34, label %39

34:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %35 = add nsw i32 %18, 1
  call void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %6, i32 noundef %35, i32 noundef %.sroa.7.0.copyload)
  invoke void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25) %3, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %36 unwind label %37

36:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %39

37:                                               ; preds = %34
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %50

39:                                               ; preds = %36, %32
  %40 = call noundef zeroext i1 @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) %3)
  br i1 %40, label %.preheader, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph31, %.preheader
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %42 = add nuw nsw i32 %.01732, 1
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %.lr.ph34, label %._crit_edge35, !llvm.loop !11

.lr.ph31:                                         ; preds = %.preheader, %.lr.ph31
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph31 ], [ 1, %.preheader ]
  %45 = getelementptr inbounds [200010 x i32], ptr @a, i64 0, i64 %indvars.iv
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %46)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %.not.not = icmp slt i64 %indvars.iv, %49
  br i1 %.not.not, label %.lr.ph31, label %._crit_edge, !llvm.loop !12

50:                                               ; preds = %28, %37, %30, %26
  %.pn.pn.pn = phi { ptr, i32 } [ %27, %26 ], [ %29, %28 ], [ %38, %37 ], [ %31, %30 ]
  call void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn.pn.pn
}

; 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 @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EEC2IS3_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushEOS0_(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5RangeC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #3 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 noundef zeroext i1 @_ZNKSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueI5RangeSt6vectorIS0_SaIS0_EESt4lessIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #5 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!"int", !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}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass