; LLVM IR from ahr9n/psolving-paradigms :: 3.binary-search (CodeForces 580B - Kefa and Company)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type { i64, i64 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7quickenv() #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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 ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z7quickenv()
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !5
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = add nsw i64 %16, 1
  %18 = call ptr @llvm.stacksave.p0()
  store ptr %18, ptr %6, align 8
  %19 = alloca %"struct.std::pair", i64 %17, align 16
  store i64 %17, ptr %7, align 8
  %20 = icmp eq i64 %17, 0
  br i1 %20, label %27, label %21

21:                                               ; preds = %0
  %22 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %17
  br label %23

23:                                               ; preds = %23, %21
  %24 = phi ptr [ %19, %21 ], [ %25, %23 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %24)
  %25 = getelementptr inbounds %"struct.std::pair", ptr %24, i64 1
  %26 = icmp eq ptr %25, %22
  br i1 %26, label %27, label %23

27:                                               ; preds = %23, %0
  %28 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 0
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 1
  store i64 0, ptr %29, align 8, !tbaa !9
  %30 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 0
  %31 = getelementptr inbounds %"struct.std::pair", ptr %30, i32 0, i32 0
  store i64 0, ptr %31, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %32

32:                                               ; preds = %51, %27
  %33 = load i32, ptr %8, align 4, !tbaa !12
  %34 = sext i32 %33 to i64
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %54

38:                                               ; preds = %32
  %39 = load i32, ptr %8, align 4, !tbaa !12
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %41
  %43 = getelementptr inbounds %"struct.std::pair", ptr %42, i32 0, i32 0
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i32, ptr %8, align 4, !tbaa !12
  %46 = add nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %47
  %49 = getelementptr inbounds %"struct.std::pair", ptr %48, i32 0, i32 1
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(8) %49)
  br label %51

51:                                               ; preds = %38
  %52 = load i32, ptr %8, align 4, !tbaa !12
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %8, align 4, !tbaa !12
  br label %32, !llvm.loop !14

54:                                               ; preds = %37
  %55 = load i64, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %55
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i64 1
  call void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef %19, ptr noundef %57)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !12
  br label %58

58:                                               ; preds = %77, %54
  %59 = load i32, ptr %9, align 4, !tbaa !12
  %60 = sext i32 %59 to i64
  %61 = load i64, ptr %2, align 8, !tbaa !5
  %62 = icmp slt i64 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %80

64:                                               ; preds = %58
  %65 = load i32, ptr %9, align 4, !tbaa !12
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %66
  %68 = getelementptr inbounds %"struct.std::pair", ptr %67, i32 0, i32 1
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = load i32, ptr %9, align 4, !tbaa !12
  %71 = add nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %72
  %74 = getelementptr inbounds %"struct.std::pair", ptr %73, i32 0, i32 1
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = add nsw i64 %75, %69
  store i64 %76, ptr %74, align 8, !tbaa !9
  br label %77

77:                                               ; preds = %64
  %78 = load i32, ptr %9, align 4, !tbaa !12
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %9, align 4, !tbaa !12
  br label %58, !llvm.loop !16

80:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !12
  br label %81

81:                                               ; preds = %138, %80
  %82 = load i32, ptr %13, align 4, !tbaa !12
  %83 = sext i32 %82 to i64
  %84 = load i64, ptr %2, align 8, !tbaa !5
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %141

87:                                               ; preds = %81
  %88 = load i32, ptr %13, align 4, !tbaa !12
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %10, align 4, !tbaa !12
  %90 = load i64, ptr %2, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  %92 = trunc i64 %91 to i32
  store i32 %92, ptr %11, align 4, !tbaa !12
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %134, %87
  %94 = load i32, ptr %10, align 4, !tbaa !12
  %95 = load i32, ptr %11, align 4, !tbaa !12
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %97, label %135

97:                                               ; preds = %93
  %98 = load i32, ptr %10, align 4, !tbaa !12
  %99 = load i32, ptr %11, align 4, !tbaa !12
  %100 = add nsw i32 %98, %99
  %101 = sdiv i32 %100, 2
  store i32 %101, ptr %12, align 4, !tbaa !12
  %102 = load i32, ptr %13, align 4, !tbaa !12
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %104
  %106 = getelementptr inbounds %"struct.std::pair", ptr %105, i32 0, i32 0
  %107 = load i64, ptr %106, align 16, !tbaa !11
  %108 = load i32, ptr %12, align 4, !tbaa !12
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %109
  %111 = getelementptr inbounds %"struct.std::pair", ptr %110, i32 0, i32 0
  %112 = load i64, ptr %111, align 16, !tbaa !11
  %113 = sub nsw i64 %107, %112
  %114 = call noundef i64 @_ZSt3absx(i64 noundef %113)
  %115 = load i64, ptr %3, align 8, !tbaa !5
  %116 = icmp slt i64 %114, %115
  br i1 %116, label %117, label %131

117:                                              ; preds = %97
  %118 = load i32, ptr %12, align 4, !tbaa !12
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %119
  %121 = getelementptr inbounds %"struct.std::pair", ptr %120, i32 0, i32 1
  %122 = load i64, ptr %121, align 8, !tbaa !9
  %123 = load i32, ptr %13, align 4, !tbaa !12
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %"struct.std::pair", ptr %19, i64 %124
  %126 = getelementptr inbounds %"struct.std::pair", ptr %125, i32 0, i32 1
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %128 = sub nsw i64 %122, %127
  store i64 %128, ptr %4, align 8, !tbaa !5
  %129 = load i32, ptr %12, align 4, !tbaa !12
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %10, align 4, !tbaa !12
  br label %134

131:                                              ; preds = %97
  %132 = load i32, ptr %12, align 4, !tbaa !12
  %133 = sub nsw i32 %132, 1
  store i32 %133, ptr %11, align 4, !tbaa !12
  br label %134

134:                                              ; preds = %131, %117
  br label %93, !llvm.loop !17

135:                                              ; preds = %93
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %137 = load i64, ptr %136, align 8, !tbaa !5
  store i64 %137, ptr %5, align 8, !tbaa !5
  br label %138

138:                                              ; preds = %135
  %139 = load i32, ptr %13, align 4, !tbaa !12
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %13, align 4, !tbaa !12
  br label %81, !llvm.loop !18

141:                                              ; preds = %86
  %142 = load i64, ptr %5, align 8, !tbaa !5
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %143, i8 noundef signext 10)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %145 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %145)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %146 = load i32, ptr %1, align 4
  ret i32 %146
}

; 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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"struct.std::pair" = type { i64, i64 }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7quickenv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  tail call void @_Z7quickenv()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 0, ptr %4, align 8, !tbaa !5
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = add nsw i64 %7, 1
  %9 = call ptr @llvm.stacksave.p0()
  %10 = alloca %"struct.std::pair", i64 %8, align 16
  %11 = icmp eq i64 %8, 0
  br i1 %11, label %.loopexit, label %12

12:                                               ; preds = %0
  %13 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %8
  br label %14

14:                                               ; preds = %14, %12
  %15 = phi ptr [ %10, %12 ], [ %16, %14 ]
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %15)
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  %17 = icmp eq ptr %16, %13
  br i1 %17, label %.loopexit, label %14

.loopexit:                                        ; preds = %14, %0
  %18 = getelementptr inbounds i8, ptr %10, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %10, i8 0, i64 16, i1 false)
  %19 = load i64, ptr %1, align 8, !tbaa !5
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.loopexit
  %.lcssa = phi i64 [ %19, %.loopexit ], [ %30, %.lr.ph ]
  %21 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %.lcssa
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  call void @_ZSt4sortIPSt4pairIxxEEvT_S3_(ptr noundef nonnull %10, ptr noundef nonnull %22)
  %23 = load i64, ptr %1, align 8, !tbaa !5
  %24 = icmp sgt i64 %23, 0
  br i1 %24, label %.lr.ph35.preheader, label %._crit_edge44

.lr.ph35.preheader:                               ; preds = %._crit_edge
  %.pre = load i64, ptr %18, align 8, !tbaa !9
  %xtraiter = and i64 %23, 3
  %25 = icmp ult i64 %23, 4
  br i1 %25, label %.preheader.unr-lcssa, label %.lr.ph35.preheader.new

.lr.ph35.preheader.new:                           ; preds = %.lr.ph35.preheader
  %unroll_iter = and i64 %23, 9223372036854775804
  br label %.lr.ph35

.lr.ph:                                           ; preds = %.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.loopexit ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  %28 = getelementptr inbounds i8, ptr %26, i64 8
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %1, align 8, !tbaa !5
  %31 = icmp sgt i64 %30, %indvars.iv.next
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader.unr-lcssa:                             ; preds = %.lr.ph35, %.lr.ph35.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph35.preheader ], [ %48, %.lr.ph35 ]
  %indvars.iv47.unr = phi i64 [ 0, %.lr.ph35.preheader ], [ %indvars.iv.next48.3, %.lr.ph35 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph35.epil

.lr.ph35.epil:                                    ; preds = %.preheader.unr-lcssa, %.lr.ph35.epil
  %32 = phi i64 [ %35, %.lr.ph35.epil ], [ %.unr, %.preheader.unr-lcssa ]
  %indvars.iv47.epil = phi i64 [ %indvars.iv.next48.epil, %.lr.ph35.epil ], [ %indvars.iv47.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph35.epil ], [ 0, %.preheader.unr-lcssa ]
  %indvars.iv.next48.epil = add nuw nsw i64 %indvars.iv47.epil, 1
  %33 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next48.epil, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = add nsw i64 %34, %32
  store i64 %35, ptr %33, align 8, !tbaa !9
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph35.epil, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph35.epil, %.preheader.unr-lcssa
  br i1 %24, label %.lr.ph43, label %._crit_edge44

.lr.ph35:                                         ; preds = %.lr.ph35, %.lr.ph35.preheader.new
  %36 = phi i64 [ %.pre, %.lr.ph35.preheader.new ], [ %48, %.lr.ph35 ]
  %indvars.iv47 = phi i64 [ 0, %.lr.ph35.preheader.new ], [ %indvars.iv.next48.3, %.lr.ph35 ]
  %niter = phi i64 [ 0, %.lr.ph35.preheader.new ], [ %niter.next.3, %.lr.ph35 ]
  %indvars.iv.next48 = or disjoint i64 %indvars.iv47, 1
  %37 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next48, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %39 = add nsw i64 %38, %36
  store i64 %39, ptr %37, align 8, !tbaa !9
  %indvars.iv.next48.1 = or disjoint i64 %indvars.iv47, 2
  %40 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next48.1, i32 1
  %41 = load i64, ptr %40, align 8, !tbaa !9
  %42 = add nsw i64 %41, %39
  store i64 %42, ptr %40, align 8, !tbaa !9
  %indvars.iv.next48.2 = or disjoint i64 %indvars.iv47, 3
  %43 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next48.2, i32 1
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = add nsw i64 %44, %42
  store i64 %45, ptr %43, align 8, !tbaa !9
  %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 4
  %46 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next48.3, i32 1
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = add nsw i64 %47, %45
  store i64 %48, ptr %46, align 8, !tbaa !9
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph35, !llvm.loop !15

._crit_edge44:                                    ; preds = %._crit_edge41, %._crit_edge, %.preheader
  %49 = phi i64 [ 0, %.preheader ], [ 0, %._crit_edge ], [ %80, %._crit_edge41 ]
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %49)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %50, i8 noundef signext 10)
  call void @llvm.stackrestore.p0(ptr %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

.lr.ph43:                                         ; preds = %.preheader, %._crit_edge41
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %._crit_edge41 ], [ 0, %.preheader ]
  %52 = phi i64 [ %81, %._crit_edge41 ], [ %23, %.preheader ]
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %53 = trunc i64 %52 to i32
  %54 = add i32 %53, 1
  store i64 0, ptr %3, align 8, !tbaa !5
  %55 = sext i32 %54 to i64
  %.not36.not = icmp slt i64 %indvars.iv50, %55
  br i1 %.not36.not, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %.lr.ph43
  %56 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv.next51
  %57 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %indvars.iv50, i32 1
  %58 = trunc nuw i64 %indvars.iv.next51 to i32
  br label %59

59:                                               ; preds = %.lr.ph40, %78
  %.02238 = phi i32 [ %54, %.lr.ph40 ], [ %.1, %78 ]
  %.02337 = phi i32 [ %58, %.lr.ph40 ], [ %.124, %78 ]
  %60 = add nsw i32 %.02238, %.02337
  %61 = sdiv i32 %60, 2
  %62 = load i64, ptr %56, align 16, !tbaa !16
  %63 = sext i32 %61 to i64
  %64 = getelementptr inbounds %"struct.std::pair", ptr %10, i64 %63
  %65 = load i64, ptr %64, align 16, !tbaa !16
  %66 = sub nsw i64 %62, %65
  %67 = call noundef i64 @_ZSt3absx(i64 noundef %66)
  %68 = load i64, ptr %2, align 8, !tbaa !5
  %69 = icmp slt i64 %67, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %59
  %71 = getelementptr inbounds i8, ptr %64, i64 8
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = load i64, ptr %57, align 8, !tbaa !9
  %74 = sub nsw i64 %72, %73
  store i64 %74, ptr %3, align 8, !tbaa !5
  %75 = add nsw i32 %61, 1
  br label %78

76:                                               ; preds = %59
  %77 = add nsw i32 %61, -1
  br label %78

78:                                               ; preds = %76, %70
  %.124 = phi i32 [ %75, %70 ], [ %.02337, %76 ]
  %.1 = phi i32 [ %.02238, %70 ], [ %77, %76 ]
  %.not = icmp sgt i32 %.124, %.1
  br i1 %.not, label %._crit_edge41, label %59, !llvm.loop !17

._crit_edge41:                                    ; preds = %78, %.lr.ph43
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %80 = load i64, ptr %79, align 8, !tbaa !5
  store i64 %80, ptr %4, align 8, !tbaa !5
  %81 = load i64, ptr %1, align 8, !tbaa !5
  %82 = icmp sgt i64 %81, %indvars.iv.next51
  br i1 %82, label %.lr.ph43, label %._crit_edge44, !llvm.loop !18
}

; 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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16)) 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) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 = !{!10, !6, i64 8}
!10 = !{!"_ZTSSt4pairIxxE", !6, i64 0, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !12}
!16 = !{!10, !6, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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