; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 1004A. Sonya and Hotels (main)

; 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<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

18:                                               ; preds = %143, %0
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %4)
  %20 = icmp ne i32 %19, -1
  br i1 %20, label %21, label %149

21:                                               ; preds = %18
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %30, %21
  %23 = load i64, ptr %3, align 8, !tbaa !5
  %24 = load i64, ptr %2, align 8, !tbaa !5
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %26, label %33

26:                                               ; preds = %22
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %28)
  br label %30

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

33:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #5
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %137, %33
  %35 = load i64, ptr %3, align 8, !tbaa !5
  %36 = load i64, ptr %2, align 8, !tbaa !5
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %38, label %140

38:                                               ; preds = %34
  %39 = load i64, ptr %3, align 8, !tbaa !5
  %40 = icmp ne i64 %39, 0
  br i1 %40, label %41, label %69

41:                                               ; preds = %38
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = load i64, ptr %4, align 8, !tbaa !5
  %46 = sub nsw i64 %44, %45
  store i64 %46, ptr %6, align 8, !tbaa !5
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = load i64, ptr %3, align 8, !tbaa !5
  %49 = sub nsw i64 %48, 1
  %50 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !5
  %52 = load i64, ptr %4, align 8, !tbaa !5
  %53 = add nsw i64 %51, %52
  %54 = icmp sge i64 %47, %53
  br i1 %54, label %55, label %68

55:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %56 = load i64, ptr %6, align 8, !tbaa !5
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %8, align 4, !tbaa !11
  %58 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %59 unwind label %64

59:                                               ; preds = %55
  %60 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %61 = extractvalue { ptr, i8 } %58, 0
  store ptr %61, ptr %60, align 8
  %62 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %63 = extractvalue { ptr, i8 } %58, 1
  store i8 %63, ptr %62, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %68

64:                                               ; preds = %55
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %9, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %148

68:                                               ; preds = %59, %41
  br label %86

69:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %70 = load i64, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = load i64, ptr %4, align 8, !tbaa !5
  %74 = sub nsw i64 %72, %73
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %12, align 4, !tbaa !11
  %76 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %77 unwind label %82

77:                                               ; preds = %69
  %78 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 0
  %79 = extractvalue { ptr, i8 } %76, 0
  store ptr %79, ptr %78, align 8
  %80 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 1
  %81 = extractvalue { ptr, i8 } %76, 1
  store i8 %81, ptr %80, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %86

82:                                               ; preds = %69
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %9, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %148

86:                                               ; preds = %77, %68
  %87 = load i64, ptr %3, align 8, !tbaa !5
  %88 = load i64, ptr %2, align 8, !tbaa !5
  %89 = sub nsw i64 %88, 1
  %90 = icmp eq i64 %87, %89
  br i1 %90, label %91, label %108

91:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %92 = load i64, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = load i64, ptr %4, align 8, !tbaa !5
  %96 = add nsw i64 %94, %95
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %14, align 4, !tbaa !11
  %98 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %99 unwind label %104

99:                                               ; preds = %91
  %100 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 0
  %101 = extractvalue { ptr, i8 } %98, 0
  store ptr %101, ptr %100, align 8
  %102 = getelementptr inbounds { ptr, i8 }, ptr %15, i32 0, i32 1
  %103 = extractvalue { ptr, i8 } %98, 1
  store i8 %103, ptr %102, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %136

104:                                              ; preds = %91
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %9, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %148

108:                                              ; preds = %86
  %109 = load i64, ptr %3, align 8, !tbaa !5
  %110 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !5
  %112 = load i64, ptr %4, align 8, !tbaa !5
  %113 = add nsw i64 %111, %112
  store i64 %113, ptr %6, align 8, !tbaa !5
  %114 = load i64, ptr %6, align 8, !tbaa !5
  %115 = load i64, ptr %3, align 8, !tbaa !5
  %116 = add nsw i64 %115, 1
  %117 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !5
  %119 = load i64, ptr %4, align 8, !tbaa !5
  %120 = sub nsw i64 %118, %119
  %121 = icmp sle i64 %114, %120
  br i1 %121, label %122, label %135

122:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %123 = load i64, ptr %6, align 8, !tbaa !5
  %124 = trunc i64 %123 to i32
  store i32 %124, ptr %16, align 4, !tbaa !11
  %125 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %126 unwind label %131

126:                                              ; preds = %122
  %127 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 0
  %128 = extractvalue { ptr, i8 } %125, 0
  store ptr %128, ptr %127, align 8
  %129 = getelementptr inbounds { ptr, i8 }, ptr %17, i32 0, i32 1
  %130 = extractvalue { ptr, i8 } %125, 1
  store i8 %130, ptr %129, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %135

131:                                              ; preds = %122
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %9, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %148

135:                                              ; preds = %126, %108
  br label %136

136:                                              ; preds = %135, %99
  br label %137

137:                                              ; preds = %136
  %138 = load i64, ptr %3, align 8, !tbaa !5
  %139 = add nsw i64 %138, 1
  store i64 %139, ptr %3, align 8, !tbaa !5
  br label %34, !llvm.loop !13

140:                                              ; preds = %34
  %141 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  %142 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %141)
          to label %143 unwind label %144

143:                                              ; preds = %140
  call void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #5
  br label %18, !llvm.loop !14

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

148:                                              ; preds = %144, %131, %104, %82, %64
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(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 840, 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 %150

149:                                              ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 840, 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
  ret i32 0

150:                                              ; preds = %148
  %151 = load ptr, ptr %9, align 8
  %152 = load i32, ptr %10, 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 @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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 [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca [105 x i64], align 16
  %4 = alloca %"class.std::set", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 840, ptr nonnull %3) #5
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not37 = icmp eq i32 %9, -1
  br i1 %.not37, label %._crit_edge38, label %.preheader.preheader

.preheader.preheader:                             ; preds = %0
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge36
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.032 = phi i64 [ %15, %.lr.ph ], [ 0, %.preheader ]
  %13 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %.032
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %13)
  %15 = add nuw nsw i64 %.032, 1
  %16 = load i64, ptr %1, align 8, !tbaa !5
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #5
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph35.preheader, label %._crit_edge36

.lr.ph35.preheader:                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %20 = load i64, ptr %3, align 16, !tbaa !5
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %22 = sub nsw i64 %20, %21
  %23 = trunc i64 %22 to i32
  store i32 %23, ptr %6, align 4, !tbaa !11
  %24 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %25 unwind label %61

25:                                               ; preds = %.lr.ph35.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %.pre = load i64, ptr %1, align 8, !tbaa !5
  %26 = icmp eq i64 %.pre, 1
  br i1 %26, label %37, label %27

27:                                               ; preds = %25
  %28 = load i64, ptr %3, align 16, !tbaa !5
  %29 = load i64, ptr %2, align 8, !tbaa !5
  %30 = add nsw i64 %29, %28
  %31 = load i64, ptr %10, align 8, !tbaa !5
  %32 = sub nsw i64 %31, %29
  %.not30.peel = icmp sgt i64 %30, %32
  br i1 %.not30.peel, label %44, label %33

33:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %34 = trunc i64 %30 to i32
  store i32 %34, ptr %8, align 4, !tbaa !11
  %35 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %36 unwind label %.loopexit.split-lp46

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

37:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %38 = load i64, ptr %3, align 16, !tbaa !5
  %39 = load i64, ptr %2, align 8, !tbaa !5
  %40 = add nsw i64 %39, %38
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %7, align 4, !tbaa !11
  %42 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %43 unwind label %.loopexit.split-lp51

43:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %44

44:                                               ; preds = %43, %36, %27
  %45 = load i64, ptr %1, align 8, !tbaa !5
  %46 = icmp sgt i64 %45, 1
  br i1 %46, label %.lr.ph35.peel.next, label %._crit_edge36

.lr.ph35.peel.next:                               ; preds = %44, %89
  %47 = phi i64 [ %90, %89 ], [ %45, %44 ]
  %.133 = phi i64 [ %.pre-phi, %89 ], [ 1, %44 ]
  %48 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %.133
  %49 = load i64, ptr %48, align 8, !tbaa !5
  %50 = load i64, ptr %2, align 8, !tbaa !5
  %51 = sub nsw i64 %49, %50
  %52 = add nsw i64 %.133, -1
  %53 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = add nsw i64 %54, %50
  %.not29 = icmp slt i64 %51, %55
  br i1 %.not29, label %62, label %56

56:                                               ; preds = %.lr.ph35.peel.next
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %57 = trunc i64 %51 to i32
  store i32 %57, ptr %5, align 4, !tbaa !11
  %58 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %59 unwind label %60

59:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %.pre56 = load i64, ptr %1, align 8, !tbaa !5
  br label %62

60:                                               ; preds = %56
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  br label %95

61:                                               ; preds = %.lr.ph35.preheader
  %lpad.loopexit.split-lp43 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  br label %95

62:                                               ; preds = %.lr.ph35.peel.next, %59
  %63 = phi i64 [ %47, %.lr.ph35.peel.next ], [ %.pre56, %59 ]
  %64 = add nsw i64 %63, -1
  %65 = icmp eq i64 %.133, %64
  br i1 %65, label %66, label %75

66:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %67 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %.133
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = load i64, ptr %2, align 8, !tbaa !5
  %70 = add nsw i64 %69, %68
  %71 = trunc i64 %70 to i32
  store i32 %71, ptr %7, align 4, !tbaa !11
  %72 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %73 unwind label %.loopexit50

73:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %.pre57 = add nuw nsw i64 %.133, 1
  br label %89

.loopexit50:                                      ; preds = %66
  %lpad.loopexit52 = landingpad { ptr, i32 }
          cleanup
  br label %74

.loopexit.split-lp51:                             ; preds = %37
  %lpad.loopexit.split-lp53 = landingpad { ptr, i32 }
          cleanup
  br label %74

74:                                               ; preds = %.loopexit.split-lp51, %.loopexit50
  %lpad.phi54 = phi { ptr, i32 } [ %lpad.loopexit52, %.loopexit50 ], [ %lpad.loopexit.split-lp53, %.loopexit.split-lp51 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %95

75:                                               ; preds = %62
  %76 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %.133
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = load i64, ptr %2, align 8, !tbaa !5
  %79 = add nsw i64 %78, %77
  %80 = add nuw nsw i64 %.133, 1
  %81 = getelementptr inbounds [105 x i64], ptr %3, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !5
  %83 = sub nsw i64 %82, %78
  %.not30 = icmp sgt i64 %79, %83
  br i1 %.not30, label %89, label %84

84:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %85 = trunc i64 %79 to i32
  store i32 %85, ptr %8, align 4, !tbaa !11
  %86 = invoke { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %87 unwind label %.loopexit45

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

.loopexit45:                                      ; preds = %84
  %lpad.loopexit47 = landingpad { ptr, i32 }
          cleanup
  br label %88

.loopexit.split-lp46:                             ; preds = %33
  %lpad.loopexit.split-lp48 = landingpad { ptr, i32 }
          cleanup
  br label %88

88:                                               ; preds = %.loopexit.split-lp46, %.loopexit45
  %lpad.phi49 = phi { ptr, i32 } [ %lpad.loopexit47, %.loopexit45 ], [ %lpad.loopexit.split-lp48, %.loopexit.split-lp46 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  br label %95

89:                                               ; preds = %73, %87, %75
  %.pre-phi = phi i64 [ %.pre57, %73 ], [ %80, %87 ], [ %80, %75 ]
  %90 = load i64, ptr %1, align 8, !tbaa !5
  %91 = icmp slt i64 %.pre-phi, %90
  br i1 %91, label %.lr.ph35.peel.next, label %._crit_edge36, !llvm.loop !13

._crit_edge36:                                    ; preds = %89, %44, %._crit_edge
  %92 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %92)
  call void @_ZNSt3setIiSt4lessIiESaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  %94 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not = icmp eq i32 %94, -1
  br i1 %.not, label %._crit_edge38, label %.preheader, !llvm.loop !15

95:                                               ; preds = %88, %74, %61, %60
  %.pn = phi { ptr, i32 } [ %lpad.phi54, %74 ], [ %lpad.phi49, %88 ], [ %lpad.loopexit, %60 ], [ %lpad.loopexit.split-lp43, %61 ]
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 840, 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 } %.pn

._crit_edge38:                                    ; preds = %._crit_edge36, %0
  call void @llvm.lifetime.end.p0(i64 840, 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
}

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10, !14}
!14 = !{!"llvm.loop.peeled.count", i32 1}
!15 = distinct !{!15, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass