; LLVM IR from ahr9n/psolving-paradigms :: 3.binary-search (CodeForces 1530C - Pursuit)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [200005 x i64], align 16
@b = external dso_local global [200005 x i64], align 16
@l = external dso_local global i64, align 8
@r = external dso_local global i64, align 8
@mid = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@all = external dso_local global i64, align 8
@s1 = external dso_local global i64, align 8
@s2 = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %5 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = load ptr, ptr @stdin, align 8, !tbaa !8
  %12 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %11)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @t)
  br label %14

14:                                               ; preds = %156, %0
  %15 = load i32, ptr @t, align 4, !tbaa !11
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @t, align 4, !tbaa !11
  %17 = icmp ne i32 %15, 0
  br i1 %17, label %18, label %160

18:                                               ; preds = %14
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %30, %18
  %21 = load i32, ptr %2, align 4, !tbaa !11
  %22 = load i32, ptr @n, align 4, !tbaa !11
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  br label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !11
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !11
  br label %20, !llvm.loop !13

33:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %44, %33
  %35 = load i32, ptr %3, align 4, !tbaa !11
  %36 = load i32, ptr @n, align 4, !tbaa !11
  %37 = icmp sle i32 %35, %36
  br i1 %37, label %39, label %38

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

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %42)
  br label %44

44:                                               ; preds = %39
  %45 = load i32, ptr %3, align 4, !tbaa !11
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %3, align 4, !tbaa !11
  br label %34, !llvm.loop !15

47:                                               ; preds = %38
  %48 = load i32, ptr @n, align 4, !tbaa !11
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i64, ptr @a, i64 %49
  %51 = getelementptr inbounds i64, ptr %50, i64 1
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @a, i64 1), ptr noundef %51)
  %52 = load i32, ptr @n, align 4, !tbaa !11
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i64, ptr @a, i64 %53
  %55 = getelementptr inbounds i64, ptr %54, i64 1
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @a, i64 1), ptr noundef %55)
  %56 = load i32, ptr @n, align 4, !tbaa !11
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i64, ptr @b, i64 %57
  %59 = getelementptr inbounds i64, ptr %58, i64 1
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @b, i64 1), ptr noundef %59)
  %60 = load i32, ptr @n, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i64, ptr @b, i64 %61
  %63 = getelementptr inbounds i64, ptr %62, i64 1
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef getelementptr inbounds (i64, ptr @b, i64 1), ptr noundef %63)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %90, %47
  %65 = load i32, ptr %4, align 4, !tbaa !11
  %66 = load i32, ptr @n, align 4, !tbaa !11
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %93

69:                                               ; preds = %64
  %70 = load i32, ptr %4, align 4, !tbaa !11
  %71 = sub nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !16
  %75 = load i32, ptr %4, align 4, !tbaa !11
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !16
  %79 = add nsw i64 %78, %74
  store i64 %79, ptr %77, align 8, !tbaa !16
  %80 = load i32, ptr %4, align 4, !tbaa !11
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !16
  %85 = load i32, ptr %4, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !16
  %89 = add nsw i64 %88, %84
  store i64 %89, ptr %87, align 8, !tbaa !16
  br label %90

90:                                               ; preds = %69
  %91 = load i32, ptr %4, align 4, !tbaa !11
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %4, align 4, !tbaa !11
  br label %64, !llvm.loop !18

93:                                               ; preds = %68
  store i64 0, ptr @ans, align 8, !tbaa !16
  store i64 0, ptr @l, align 8, !tbaa !16
  store i64 200000, ptr @r, align 8, !tbaa !16
  br label %94

94:                                               ; preds = %155, %93
  %95 = load i64, ptr @l, align 8, !tbaa !16
  %96 = load i64, ptr @r, align 8, !tbaa !16
  %97 = icmp sle i64 %95, %96
  br i1 %97, label %98, label %156

98:                                               ; preds = %94
  %99 = load i64, ptr @l, align 8, !tbaa !16
  %100 = load i64, ptr @r, align 8, !tbaa !16
  %101 = add nsw i64 %99, %100
  %102 = sdiv i64 %101, 2
  store i64 %102, ptr @mid, align 8, !tbaa !16
  %103 = load i64, ptr @mid, align 8, !tbaa !16
  %104 = load i32, ptr @n, align 4, !tbaa !11
  %105 = sext i32 %104 to i64
  %106 = add nsw i64 %103, %105
  %107 = load i64, ptr @mid, align 8, !tbaa !16
  %108 = load i32, ptr @n, align 4, !tbaa !11
  %109 = sext i32 %108 to i64
  %110 = add nsw i64 %107, %109
  %111 = sdiv i64 %110, 4
  %112 = sub nsw i64 %106, %111
  store i64 %112, ptr @all, align 8, !tbaa !16
  %113 = load i64, ptr @all, align 8, !tbaa !16
  %114 = load i64, ptr @mid, align 8, !tbaa !16
  %115 = icmp sle i64 %113, %114
  br i1 %115, label %116, label %119

116:                                              ; preds = %98
  %117 = load i64, ptr @all, align 8, !tbaa !16
  %118 = mul nsw i64 100, %117
  br label %128

119:                                              ; preds = %98
  %120 = load i64, ptr @mid, align 8, !tbaa !16
  %121 = mul nsw i64 100, %120
  %122 = load i64, ptr @all, align 8, !tbaa !16
  %123 = load i64, ptr @mid, align 8, !tbaa !16
  %124 = sub nsw i64 %122, %123
  %125 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !16
  %127 = add nsw i64 %121, %126
  br label %128

128:                                              ; preds = %119, %116
  %129 = phi i64 [ %118, %116 ], [ %127, %119 ]
  store i64 %129, ptr @s1, align 8, !tbaa !16
  %130 = load i64, ptr @all, align 8, !tbaa !16
  %131 = load i32, ptr @n, align 4, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = icmp sle i64 %130, %132
  br i1 %133, label %134, label %138

134:                                              ; preds = %128
  %135 = load i64, ptr @all, align 8, !tbaa !16
  %136 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !16
  br label %143

138:                                              ; preds = %128
  %139 = load i32, ptr @n, align 4, !tbaa !11
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !16
  br label %143

143:                                              ; preds = %138, %134
  %144 = phi i64 [ %137, %134 ], [ %142, %138 ]
  store i64 %144, ptr @s2, align 8, !tbaa !16
  %145 = load i64, ptr @s1, align 8, !tbaa !16
  %146 = load i64, ptr @s2, align 8, !tbaa !16
  %147 = icmp sge i64 %145, %146
  br i1 %147, label %148, label %152

148:                                              ; preds = %143
  %149 = load i64, ptr @mid, align 8, !tbaa !16
  store i64 %149, ptr @ans, align 8, !tbaa !16
  %150 = load i64, ptr @mid, align 8, !tbaa !16
  %151 = sub nsw i64 %150, 1
  store i64 %151, ptr @r, align 8, !tbaa !16
  br label %155

152:                                              ; preds = %143
  %153 = load i64, ptr @mid, align 8, !tbaa !16
  %154 = add nsw i64 %153, 1
  store i64 %154, ptr @l, align 8, !tbaa !16
  br label %155

155:                                              ; preds = %152, %148
  br label %94, !llvm.loop !19

156:                                              ; preds = %94
  %157 = load i64, ptr @ans, align 8, !tbaa !16
  %158 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %157)
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %158, i8 noundef signext 10)
  br label %14, !llvm.loop !20

160:                                              ; preds = %14
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

; 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)) #4 align 2

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

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

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

; 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) #4 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 = { "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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !10, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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

%"class.std::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" }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@a = external dso_local global [200005 x i64], align 16
@b = external dso_local global [200005 x i64], align 16
@l = external dso_local local_unnamed_addr global i64, align 8
@r = external dso_local local_unnamed_addr global i64, align 8
@mid = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@all = external dso_local local_unnamed_addr global i64, align 8
@s1 = external dso_local local_unnamed_addr global i64, align 8
@s2 = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @stdin, align 8, !tbaa !8
  %8 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %7)
  %9 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @t)
  %10 = load i32, ptr @t, align 4, !tbaa !11
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !11
  %.not51 = icmp eq i32 %10, 0
  br i1 %.not51, label %._crit_edge54, label %.lr.ph53

.lr.ph53:                                         ; preds = %0, %80
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = load i32, ptr @n, align 4, !tbaa !11
  %.not2129 = icmp slt i32 %13, 1
  br i1 %.not2129, label %.preheader.._crit_edge_crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not2231 = icmp slt i32 %17, 1
  br i1 %.not2231, label %.preheader.._crit_edge_crit_edge, label %.lr.ph33

.preheader.._crit_edge_crit_edge:                 ; preds = %.lr.ph53, %.preheader
  %14 = phi i32 [ %17, %.preheader ], [ %13, %.lr.ph53 ]
  %.pre68 = sext i32 %14 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph53, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph53 ]
  %15 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %indvars.iv
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !11
  %18 = sext i32 %17 to i64
  %.not21.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not21.not, label %.lr.ph, label %.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph33, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre68, %.preheader.._crit_edge_crit_edge ], [ %31, %.lr.ph33 ]
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %.pre-phi
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep)
  %19 = load i32, ptr @n, align 4, !tbaa !11
  %20 = sext i32 %19 to i64
  %gep48 = getelementptr i64, ptr getelementptr inbounds (i8, ptr @a, i64 8), i64 %20
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 8), ptr noundef nonnull %gep48)
  %21 = load i32, ptr @n, align 4, !tbaa !11
  %22 = sext i32 %21 to i64
  %gep49 = getelementptr i64, ptr getelementptr inbounds (i8, ptr @b, i64 8), i64 %22
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @b, i64 8), ptr noundef nonnull %gep49)
  %23 = load i32, ptr @n, align 4, !tbaa !11
  %24 = sext i32 %23 to i64
  %gep50 = getelementptr i64, ptr getelementptr inbounds (i8, ptr @b, i64 8), i64 %24
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @b, i64 8), ptr noundef nonnull %gep50)
  %25 = load i32, ptr @n, align 4, !tbaa !11
  %.not2334 = icmp slt i32 %25, 1
  br i1 %.not2334, label %.lr.ph42, label %.lr.ph37.preheader

.lr.ph37.preheader:                               ; preds = %._crit_edge
  %.pre = load i64, ptr @a, align 16, !tbaa !15
  %.pre67 = load i64, ptr @b, align 16, !tbaa !15
  %26 = zext nneg i32 %25 to i64
  %xtraiter = and i64 %26, 1
  %27 = icmp eq i32 %25, 1
  br i1 %27, label %.lr.ph42.loopexit.unr-lcssa, label %.lr.ph37.preheader.new

.lr.ph37.preheader.new:                           ; preds = %.lr.ph37.preheader
  %unroll_iter = and i64 %26, 2147483646
  br label %.lr.ph37

.lr.ph33:                                         ; preds = %.preheader, %.lr.ph33
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph33 ], [ 1, %.preheader ]
  %28 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %indvars.iv61
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %30 = load i32, ptr @n, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %.not22.not = icmp slt i64 %indvars.iv61, %31
  br i1 %.not22.not, label %.lr.ph33, label %._crit_edge, !llvm.loop !17

.lr.ph42.loopexit.unr-lcssa:                      ; preds = %.lr.ph37, %.lr.ph37.preheader
  %.unr = phi i64 [ %.pre67, %.lr.ph37.preheader ], [ %52, %.lr.ph37 ]
  %.unr88 = phi i64 [ %.pre, %.lr.ph37.preheader ], [ %49, %.lr.ph37 ]
  %indvars.iv64.unr = phi i64 [ 1, %.lr.ph37.preheader ], [ %indvars.iv.next65.1, %.lr.ph37 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph42, label %.lr.ph37.epil

.lr.ph37.epil:                                    ; preds = %.lr.ph42.loopexit.unr-lcssa
  %32 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %indvars.iv64.unr
  %33 = load i64, ptr %32, align 8, !tbaa !15
  %34 = add nsw i64 %33, %.unr88
  store i64 %34, ptr %32, align 8, !tbaa !15
  %35 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %indvars.iv64.unr
  %36 = load i64, ptr %35, align 8, !tbaa !15
  %37 = add nsw i64 %36, %.unr
  store i64 %37, ptr %35, align 8, !tbaa !15
  br label %.lr.ph42

.lr.ph42:                                         ; preds = %.lr.ph37.epil, %.lr.ph42.loopexit.unr-lcssa, %._crit_edge
  store i64 0, ptr @ans, align 8, !tbaa !15
  store i64 0, ptr @l, align 8, !tbaa !15
  store i64 200000, ptr @r, align 8, !tbaa !15
  %38 = sext i32 %25 to i64
  br label %53

.lr.ph37:                                         ; preds = %.lr.ph37, %.lr.ph37.preheader.new
  %39 = phi i64 [ %.pre67, %.lr.ph37.preheader.new ], [ %52, %.lr.ph37 ]
  %40 = phi i64 [ %.pre, %.lr.ph37.preheader.new ], [ %49, %.lr.ph37 ]
  %indvars.iv64 = phi i64 [ 1, %.lr.ph37.preheader.new ], [ %indvars.iv.next65.1, %.lr.ph37 ]
  %niter = phi i64 [ 0, %.lr.ph37.preheader.new ], [ %niter.next.1, %.lr.ph37 ]
  %41 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %indvars.iv64
  %42 = load i64, ptr %41, align 8, !tbaa !15
  %43 = add nsw i64 %42, %40
  store i64 %43, ptr %41, align 8, !tbaa !15
  %44 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %indvars.iv64
  %45 = load i64, ptr %44, align 8, !tbaa !15
  %46 = add nsw i64 %45, %39
  store i64 %46, ptr %44, align 8, !tbaa !15
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %47 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %indvars.iv.next65
  %48 = load i64, ptr %47, align 8, !tbaa !15
  %49 = add nsw i64 %48, %43
  store i64 %49, ptr %47, align 8, !tbaa !15
  %50 = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %indvars.iv.next65
  %51 = load i64, ptr %50, align 8, !tbaa !15
  %52 = add nsw i64 %51, %46
  store i64 %52, ptr %50, align 8, !tbaa !15
  %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.lr.ph42.loopexit.unr-lcssa, label %.lr.ph37, !llvm.loop !18

53:                                               ; preds = %.lr.ph42, %76
  %54 = phi i64 [ 0, %.lr.ph42 ], [ %77, %76 ]
  %55 = phi i64 [ 0, %.lr.ph42 ], [ %79, %76 ]
  %56 = phi i64 [ 200000, %.lr.ph42 ], [ %78, %76 ]
  %57 = add nsw i64 %56, %55
  %58 = sdiv i64 %57, 2
  %59 = add nsw i64 %58, %38
  %.neg = sdiv i64 %59, -4
  %60 = add nsw i64 %.neg, %59
  %.not25 = icmp sgt i64 %60, %58
  br i1 %.not25, label %63, label %61

61:                                               ; preds = %53
  %62 = mul nsw i64 %60, 100
  br label %69

63:                                               ; preds = %53
  %64 = mul nsw i64 %58, 100
  %65 = sub nsw i64 %60, %58
  %66 = getelementptr inbounds [200005 x i64], ptr @a, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !15
  %68 = add nsw i64 %67, %64
  br label %69

69:                                               ; preds = %63, %61
  %70 = phi i64 [ %62, %61 ], [ %68, %63 ]
  %. = tail call i64 @llvm.smin.i64(i64 %60, i64 %38)
  %.in = getelementptr inbounds [200005 x i64], ptr @b, i64 0, i64 %.
  %71 = load i64, ptr %.in, align 8, !tbaa !15
  %.not27 = icmp slt i64 %70, %71
  br i1 %.not27, label %74, label %72

72:                                               ; preds = %69
  store i64 %58, ptr @ans, align 8, !tbaa !15
  %73 = add nsw i64 %58, -1
  store i64 %73, ptr @r, align 8, !tbaa !15
  br label %76

74:                                               ; preds = %69
  %75 = add nsw i64 %58, 1
  store i64 %75, ptr @l, align 8, !tbaa !15
  br label %76

76:                                               ; preds = %74, %72
  %77 = phi i64 [ %54, %74 ], [ %58, %72 ]
  %78 = phi i64 [ %56, %74 ], [ %73, %72 ]
  %79 = phi i64 [ %75, %74 ], [ %55, %72 ]
  %.not24 = icmp sgt i64 %79, %78
  br i1 %.not24, label %80, label %53, !llvm.loop !19

80:                                               ; preds = %76
  store i64 %58, ptr @mid, align 8, !tbaa !15
  store i64 %60, ptr @all, align 8, !tbaa !15
  store i64 %70, ptr @s1, align 8, !tbaa !15
  store i64 %71, ptr @s2, align 8, !tbaa !15
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %77)
  %82 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %81, i8 noundef signext 10)
  %83 = load i32, ptr @t, align 4, !tbaa !11
  %84 = add nsw i32 %83, -1
  store i32 %84, ptr @t, align 4, !tbaa !11
  %.not = icmp eq i32 %83, 0
  br i1 %.not, label %._crit_edge54, label %.lr.ph53, !llvm.loop !20

._crit_edge54:                                    ; preds = %80, %0
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; 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 #3 align 2

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

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

; 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 #4

; 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 #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #5

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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