; LLVM IR from VastoLorde95/Competitive-Programming :: SPOJ/Random/NICEDAY (nice)

; 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"

%struct.person = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<person, person, std::_Identity<person>, std::less<person>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<person, person, std::_Identity<person>, std::less<person>>::_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 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl" }
%"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl" = type { %"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl_data" }
%"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl_data" = type { 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 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@res = external dso_local global i32, align 4
@ranks = external dso_local global [100000 x %struct.person], align 16
@S = external dso_local global %"class.std::set", align 8
@to_erase = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4compRK6personS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9is_insidei(i32 noundef) #1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %12

12:                                               ; preds = %108, %0
  %13 = load i32, ptr @t, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @t, align 4, !tbaa !5
  %15 = icmp ne i32 %13, 0
  br i1 %15, label %16, label %111

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %31, %16
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %34

23:                                               ; preds = %18
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @a, ptr noundef @b, ptr noundef @c)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %26
  %28 = load i32, ptr @a, align 4, !tbaa !5
  %29 = load i32, ptr @b, align 4, !tbaa !5
  %30 = load i32, ptr @c, align 4, !tbaa !5
  call void @_ZN6person6assignEiii(ptr noundef nonnull align 4 dereferenceable(12) %27, i32 noundef %28, i32 noundef %29, i32 noundef %30)
  br label %31

31:                                               ; preds = %23
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !9

34:                                               ; preds = %22
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds %struct.person, ptr @ranks, i64 %36
  call void @_ZSt4sortIP6personPFbRKS0_S3_EEvT_S6_T0_(ptr noundef @ranks, ptr noundef %37, ptr noundef @_Z4compRK6personS1_)
  %38 = call { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) @ranks)
  %39 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 0
  %40 = extractvalue { ptr, i8 } %38, 0
  store ptr %40, ptr %39, align 8
  %41 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 1
  %42 = extractvalue { ptr, i8 } %38, 1
  store i8 %42, ptr %41, align 8
  store i32 1, ptr @res, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %105, %34
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 7, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %108

48:                                               ; preds = %43
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = call noundef zeroext i1 @_Z9is_insidei(i32 noundef %49)
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  br label %105

52:                                               ; preds = %48
  %53 = load i32, ptr @res, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr @res, align 4, !tbaa !5
  call void @_ZNSt6vectorI6personSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @to_erase) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %56
  %58 = call ptr @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE11lower_boundERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %57)
  %59 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %6, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  br label %60

60:                                               ; preds = %78, %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %61 = call ptr @_ZNKSt3setI6personSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #6
  %62 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %7, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  %63 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI6personES3_(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 %7) #6
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %81

65:                                               ; preds = %60
  %66 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %67 = getelementptr inbounds %struct.person, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %70
  %72 = getelementptr inbounds %struct.person, ptr %71, i32 0, i32 1
  %73 = load i32, ptr %72, align 4, !tbaa !11
  %74 = icmp sgt i32 %68, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %65
  %76 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @_ZNSt6vectorI6personSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @to_erase, ptr noundef nonnull align 4 dereferenceable(12) %76)
  br label %77

77:                                               ; preds = %75, %65
  br label %78

78:                                               ; preds = %77
  %79 = call ptr @_ZNSt23_Rb_tree_const_iteratorI6personEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  %80 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %79, ptr %80, align 8
  br label %60, !llvm.loop !13

81:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %93, %81
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = zext i32 %83 to i64
  %85 = call noundef i64 @_ZNKSt6vectorI6personSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @to_erase) #6
  %86 = icmp ult i64 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %82
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %96

88:                                               ; preds = %82
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = zext i32 %89 to i64
  %91 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI6personSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @to_erase, i64 noundef %90) #6
  %92 = call noundef i64 @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %91)
  br label %93

93:                                               ; preds = %88
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = add i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !5
  br label %82, !llvm.loop !14

96:                                               ; preds = %87
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %98
  %100 = call { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %99)
  %101 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %102 = extractvalue { ptr, i8 } %100, 0
  store ptr %102, ptr %101, align 8
  %103 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %104 = extractvalue { ptr, i8 } %100, 1
  store i8 %104, ptr %103, align 8
  br label %105

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

108:                                              ; preds = %47
  %109 = load i32, ptr @res, align 4, !tbaa !5
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %109)
  br label %12, !llvm.loop !16

111:                                              ; preds = %12
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6person6assignEiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP6personPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI6personSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI6personSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorI6personEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6personSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI6personSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 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 = !{!12, !6, i64 4}
!12 = !{!"_ZTS6person", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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"

%struct.person = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<person, person, std::_Identity<person>, std::less<person>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<person, person, std::_Identity<person>, std::less<person>>::_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 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl" }
%"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl" = type { %"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl_data" }
%"struct.std::_Vector_base<person, std::allocator<person>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@res = external dso_local local_unnamed_addr global i32, align 4
@ranks = external dso_local global [100000 x %struct.person], align 16
@S = external dso_local global %"class.std::set", align 8
@to_erase = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4compRK6personS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z9is_insidei(i32 noundef) local_unnamed_addr #1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not31 = icmp eq i32 %4, 0
  br i1 %.not31, label %._crit_edge34, label %.lr.ph33

.lr.ph33:                                         ; preds = %0, %._crit_edge30
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #6
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.lr.ph33.._crit_edge_crit_edge

.lr.ph33.._crit_edge_crit_edge:                   ; preds = %.lr.ph33
  %.pre41 = sext i32 %7 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph33.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre41, %.lr.ph33.._crit_edge_crit_edge ], [ %19, %.lr.ph ]
  %9 = getelementptr inbounds %struct.person, ptr @ranks, i64 %.pre-phi
  call void @_ZSt4sortIP6personPFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull @ranks, ptr noundef nonnull %9, ptr noundef nonnull @_Z4compRK6personS1_)
  %10 = call { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) @ranks)
  store i32 1, ptr @res, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 1
  br i1 %12, label %.lr.ph29, label %._crit_edge30

.lr.ph:                                           ; preds = %.lr.ph33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph33 ]
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @c)
  %14 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %indvars.iv
  %15 = load i32, ptr @a, align 4, !tbaa !5
  %16 = load i32, ptr @b, align 4, !tbaa !5
  %17 = load i32, ptr @c, align 4, !tbaa !5
  call void @_ZN6person6assignEiii(ptr noundef nonnull align 4 dereferenceable(12) %14, i32 noundef %15, i32 noundef %16, i32 noundef %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge30.loopexit:                           ; preds = %56
  %.pre = load i32, ptr @res, align 4, !tbaa !5
  br label %._crit_edge30

._crit_edge30:                                    ; preds = %._crit_edge30.loopexit, %._crit_edge
  %21 = phi i32 [ %.pre, %._crit_edge30.loopexit ], [ 1, %._crit_edge ]
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %21)
  %23 = load i32, ptr @t, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %._crit_edge34, label %.lr.ph33, !llvm.loop !11

.lr.ph29:                                         ; preds = %._crit_edge, %56
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %56 ], [ 1, %._crit_edge ]
  %25 = trunc nuw nsw i64 %indvars.iv38 to i32
  %26 = call noundef zeroext i1 @_Z9is_insidei(i32 noundef %25)
  br i1 %26, label %56, label %27

27:                                               ; preds = %.lr.ph29
  %28 = load i32, ptr @res, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr @res, align 4, !tbaa !5
  call void @_ZNSt6vectorI6personSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @to_erase) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %30 = getelementptr inbounds [100000 x %struct.person], ptr @ranks, i64 0, i64 %indvars.iv38
  %31 = call ptr @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE11lower_boundERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %30)
  store ptr %31, ptr %1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %32 = call ptr @_ZNKSt3setI6personSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #6
  store ptr %32, ptr %2, align 8
  %33 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI6personES3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br i1 %33, label %.lr.ph21, label %._crit_edge22

.lr.ph21:                                         ; preds = %27
  %34 = getelementptr inbounds i8, ptr %30, i64 4
  br label %36

._crit_edge22:                                    ; preds = %44, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %35 = call noundef i64 @_ZNKSt6vectorI6personSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @to_erase) #6
  %.not35 = icmp eq i64 %35, 0
  br i1 %.not35, label %._crit_edge26, label %.lr.ph25

36:                                               ; preds = %.lr.ph21, %44
  %37 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !12
  %40 = load i32, ptr %34, align 4, !tbaa !12
  %41 = icmp sgt i32 %39, %40
  br i1 %41, label %42, label %44

42:                                               ; preds = %36
  %43 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @_ZNSt6vectorI6personSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) @to_erase, ptr noundef nonnull align 4 dereferenceable(12) %43)
  br label %44

44:                                               ; preds = %36, %42
  %45 = call ptr @_ZNSt23_Rb_tree_const_iteratorI6personEppEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %46 = call ptr @_ZNKSt3setI6personSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #6
  store ptr %46, ptr %2, align 8
  %47 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI6personES3_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br i1 %47, label %36, label %._crit_edge22, !llvm.loop !14

._crit_edge26:                                    ; preds = %.lr.ph25, %._crit_edge22
  %48 = call { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %30)
  br label %56

.lr.ph25:                                         ; preds = %._crit_edge22, %.lr.ph25
  %49 = phi i64 [ %53, %.lr.ph25 ], [ 0, %._crit_edge22 ]
  %.01623 = phi i32 [ %52, %.lr.ph25 ], [ 0, %._crit_edge22 ]
  %50 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI6personSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @to_erase, i64 noundef %49) #6
  %51 = call noundef i64 @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE5eraseERKS0_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 4 dereferenceable(12) %50)
  %52 = add i32 %.01623, 1
  %53 = zext i32 %52 to i64
  %54 = call noundef i64 @_ZNKSt6vectorI6personSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @to_erase) #6
  %55 = icmp ugt i64 %54, %53
  br i1 %55, label %.lr.ph25, label %._crit_edge26, !llvm.loop !15

56:                                               ; preds = %.lr.ph29, %._crit_edge26
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next39, %58
  br i1 %59, label %.lr.ph29, label %._crit_edge30.loopexit, !llvm.loop !16

._crit_edge34:                                    ; preds = %._crit_edge30, %0
  ret i32 0
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6person6assignEiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP6personPFbRKS0_S3_EEvT_S6_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setI6personSt4lessIS0_ESaIS0_EE6insertERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI6personSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI6personSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt23_Rb_tree_const_iteratorI6personEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorI6personEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6personSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI6personSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { inlinehint 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 #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 = !{!13, !6, i64 4}
!13 = !{!"_ZTS6person", !6, i64 0, !6, i64 4, !6, i64 8}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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