; LLVM IR from DionysiosB/CodeForces :: 1400-1499 (1496B-MaxAndMex)

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

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

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

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

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #5
  call void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %47, %22
  %25 = load i64, ptr %8, align 8, !tbaa !5
  %26 = load i64, ptr %3, align 8, !tbaa !5
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %54

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %30 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %9)
          to label %31 unwind label %50

31:                                               ; preds = %29
  %32 = invoke { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %33 unwind label %50

33:                                               ; preds = %31
  %34 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %35 = extractvalue { ptr, i8 } %32, 0
  store ptr %35, ptr %34, align 8
  %36 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %37 = extractvalue { ptr, i8 } %32, 1
  store i8 %37, ptr %36, align 8
  %38 = load i64, ptr %5, align 8, !tbaa !5
  %39 = load i64, ptr %9, align 8, !tbaa !5
  %40 = icmp sgt i64 %38, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %33
  %42 = load i64, ptr %5, align 8, !tbaa !5
  br label %45

43:                                               ; preds = %33
  %44 = load i64, ptr %9, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %43, %41
  %46 = phi i64 [ %42, %41 ], [ %44, %43 ]
  store i64 %46, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %47

47:                                               ; preds = %45
  %48 = load i64, ptr %8, align 8, !tbaa !5
  %49 = add nsw i64 %48, 1
  store i64 %49, ptr %8, align 8, !tbaa !5
  br label %24, !llvm.loop !9

50:                                               ; preds = %31, %29
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %10, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %115

54:                                               ; preds = %28
  %55 = load i64, ptr %5, align 8, !tbaa !5
  %56 = load i64, ptr %3, align 8, !tbaa !5
  %57 = sub nsw i64 %56, 1
  %58 = icmp eq i64 %55, %57
  br i1 %58, label %59, label %69

59:                                               ; preds = %54
  %60 = load i64, ptr %3, align 8, !tbaa !5
  %61 = load i64, ptr %4, align 8, !tbaa !5
  %62 = add nsw i64 %60, %61
  %63 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %62)
          to label %64 unwind label %65

64:                                               ; preds = %59
  store i32 2, ptr %13, align 4
  br label %108, !llvm.loop !11

65:                                               ; preds = %59
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %10, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %11, align 4
  br label %115

69:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %86, %69
  %71 = load i64, ptr %14, align 8, !tbaa !5
  %72 = sitofp i64 %71 to double
  %73 = fcmp olt double %72, 0x41CDCD6503800000
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 7, ptr %13, align 4
  br label %89

75:                                               ; preds = %70
  %76 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %77 unwind label %81

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

79:                                               ; preds = %77
  %80 = load i64, ptr %14, align 8, !tbaa !5
  store i64 %80, ptr %6, align 8, !tbaa !5
  store i32 7, ptr %13, align 4
  br label %89

81:                                               ; preds = %75
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %10, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %115

85:                                               ; preds = %77
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %14, align 8, !tbaa !5
  %88 = add nsw i64 %87, 1
  store i64 %88, ptr %14, align 8, !tbaa !5
  br label %70, !llvm.loop !12

89:                                               ; preds = %79, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %90

90:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %91 = load i64, ptr %5, align 8, !tbaa !5
  %92 = load i64, ptr %6, align 8, !tbaa !5
  %93 = add nsw i64 %91, %92
  %94 = add nsw i64 %93, 1
  %95 = sdiv i64 %94, 2
  store i64 %95, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %96 = load i64, ptr %4, align 8, !tbaa !5
  %97 = icmp sgt i64 %96, 0
  %98 = zext i1 %97 to i64
  %99 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %100 unwind label %111

100:                                              ; preds = %90
  %101 = sub i64 1, %99
  %102 = mul i64 %98, %101
  store i64 %102, ptr %16, align 8, !tbaa !5
  %103 = call noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  %104 = load i64, ptr %16, align 8, !tbaa !5
  %105 = add i64 %103, %104
  %106 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %105)
          to label %107 unwind label %111

107:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  store i32 0, ptr %13, align 4
  br label %108

108:                                              ; preds = %107, %64
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %109 = load i32, ptr %13, align 4
  switch i32 %109, label %123 [
    i32 0, label %110
    i32 2, label %18
  ]

110:                                              ; preds = %108
  br label %18, !llvm.loop !11

111:                                              ; preds = %100, %90
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %10, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %115

115:                                              ; preds = %111, %81, %65, %50
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %118

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

118:                                              ; preds = %115
  %119 = load ptr, ptr %10, align 8
  %120 = load i32, ptr %11, align 4
  %121 = insertvalue { ptr, i32 } poison, ptr %119, 0
  %122 = insertvalue { ptr, i32 } %121, i32 %120, 1
  resume { ptr, i32 } %122

123:                                              ; preds = %108
  unreachable
}

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(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

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, long, std::_Identity<long>, std::less<long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 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 i64, align 8
  %4 = alloca %"class.std::set", align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, 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
  %.not22 = icmp eq i64 %9, 0
  br i1 %.not22, label %._crit_edge25, label %.lr.ph24

.lr.ph24:                                         ; preds = %0, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %18, %.lr.ph24
  %.0.lcssa = phi i64 [ 0, %.lr.ph24 ], [ %20, %18 ]
  %.lcssa = phi i64 [ %12, %.lr.ph24 ], [ %22, %18 ]
  %14 = add nsw i64 %.lcssa, -1
  %15 = icmp eq i64 %.0.lcssa, %14
  br i1 %15, label %26, label %30

.lr.ph:                                           ; preds = %.lr.ph24, %18
  %.020 = phi i64 [ %20, %18 ], [ 0, %.lr.ph24 ]
  %.01119 = phi i64 [ %21, %18 ], [ 0, %.lr.ph24 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5)
  %17 = invoke { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %18 unwind label %24

18:                                               ; preds = %.lr.ph
  %19 = load i64, ptr %5, align 8
  %20 = call i64 @llvm.smax.i64(i64 %.020, i64 %19)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %21 = add nuw nsw i64 %.01119, 1
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !9

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

26:                                               ; preds = %._crit_edge
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = add nsw i64 %27, %.lcssa
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %28)
  br label %52, !llvm.loop !11

30:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %30, %37
  %32 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %33 unwind label %35

33:                                               ; preds = %31
  %.not15 = icmp eq i64 %32, 0
  %34 = load i64, ptr %6, align 8, !tbaa !5
  br i1 %.not15, label %.loopexit, label %37

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

37:                                               ; preds = %33
  %38 = add nsw i64 %34, 1
  store i64 %38, ptr %6, align 8, !tbaa !5
  %39 = icmp slt i64 %34, 1000000006
  br i1 %39, label %31, label %.loopexit, !llvm.loop !12

.loopexit:                                        ; preds = %37, %33
  %.010 = phi i64 [ %34, %33 ], [ 0, %37 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %40 = add nuw i64 %.0.lcssa, 1
  %41 = add i64 %40, %.010
  %42 = sdiv i64 %41, 2
  store i64 %42, ptr %7, align 8, !tbaa !5
  %43 = load i64, ptr %3, align 8, !tbaa !5
  %44 = invoke noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE5countERKl(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %45 unwind label %55

45:                                               ; preds = %.loopexit
  %46 = icmp sgt i64 %43, 0
  %47 = sub i64 1, %44
  %48 = select i1 %46, i64 %47, i64 0
  %49 = call noundef i64 @_ZNKSt3setIlSt4lessIlESaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  %50 = add i64 %49, %48
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %52

52:                                               ; preds = %45, %26
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %53 = load i64, ptr %1, align 8, !tbaa !5
  %54 = add nsw i64 %53, -1
  store i64 %54, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %53, 0
  br i1 %.not, label %._crit_edge25, label %.lr.ph24

55:                                               ; preds = %.loopexit
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %57

57:                                               ; preds = %55, %35, %24
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %56, %55 ], [ %36, %35 ]
  call void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, 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_edge25:                                    ; preds = %52, %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 @_ZNSt3setIlSt4lessIlESaIlEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIlSt4lessIlESaIlEE6insertERKl(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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIlSt4lessIlESaIlEED2Ev(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", !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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass