; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2018.03 (talent)

; 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
@.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
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca [250 x %"struct.std::pair"], align 16
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %10 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = load ptr, ptr @stdin, align 8, !tbaa !8
  %17 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %16)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !8
  %19 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %20 = 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)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.start.p0(i64 4000, ptr %4) #6
  %22 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.std::pair", ptr %22, i64 250
  br label %24

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

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %46, %28
  %30 = load i32, ptr %5, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = load i64, ptr %2, align 8, !tbaa !13
  %33 = icmp slt i64 %31, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %29
  %36 = load i32, ptr %5, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i64 0, i64 %37
  %39 = getelementptr inbounds %"struct.std::pair", ptr %38, i32 0, i32 0
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = load i32, ptr %5, align 4, !tbaa !11
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i64 0, i64 %42
  %44 = getelementptr inbounds %"struct.std::pair", ptr %43, i32 0, i32 1
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 8 dereferenceable(8) %44)
  br label %46

46:                                               ; preds = %35
  %47 = load i32, ptr %5, align 4, !tbaa !11
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %5, align 4, !tbaa !11
  br label %29, !llvm.loop !15

49:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 10000000, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !13
  br label %50

50:                                               ; preds = %78, %49
  %51 = load i32, ptr %6, align 4, !tbaa !11
  %52 = load i32, ptr %7, align 4, !tbaa !11
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %79

54:                                               ; preds = %50
  %55 = load i32, ptr %6, align 4, !tbaa !11
  %56 = load i32, ptr %7, align 4, !tbaa !11
  %57 = add nsw i32 %55, %56
  %58 = sdiv i32 %57, 2
  %59 = sext i32 %58 to i64
  store i64 %59, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %60 = load i64, ptr %2, align 8, !tbaa !13
  %61 = trunc i64 %60 to i32
  %62 = load i64, ptr %3, align 8, !tbaa !13
  %63 = trunc i64 %62 to i32
  %64 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i64 0, i64 0
  %65 = load i64, ptr %8, align 8, !tbaa !13
  %66 = trunc i64 %65 to i32
  %67 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %61, i32 noundef %63, ptr noundef %64, i32 noundef %66)
  store i64 %67, ptr %9, align 8, !tbaa !13
  %68 = load i64, ptr %9, align 8, !tbaa !13
  %69 = icmp slt i64 %68, 0
  br i1 %69, label %70, label %74

70:                                               ; preds = %54
  %71 = load i64, ptr %8, align 8, !tbaa !13
  %72 = sub nsw i64 %71, 1
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %7, align 4, !tbaa !11
  br label %78

74:                                               ; preds = %54
  %75 = load i64, ptr %8, align 8, !tbaa !13
  %76 = add nsw i64 %75, 1
  %77 = trunc i64 %76 to i32
  store i32 %77, ptr %6, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %74, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %50, !llvm.loop !17

79:                                               ; preds = %50
  br label %80

80:                                               ; preds = %90, %79
  %81 = load i64, ptr %2, align 8, !tbaa !13
  %82 = trunc i64 %81 to i32
  %83 = load i64, ptr %3, align 8, !tbaa !13
  %84 = trunc i64 %83 to i32
  %85 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i64 0, i64 0
  %86 = load i64, ptr %8, align 8, !tbaa !13
  %87 = trunc i64 %86 to i32
  %88 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %82, i32 noundef %84, ptr noundef %85, i32 noundef %87)
  %89 = icmp sgt i64 %88, 0
  br i1 %89, label %90, label %93

90:                                               ; preds = %80
  %91 = load i64, ptr %8, align 8, !tbaa !13
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %8, align 8, !tbaa !13
  br label %80, !llvm.loop !18

93:                                               ; preds = %80
  br label %94

94:                                               ; preds = %104, %93
  %95 = load i64, ptr %2, align 8, !tbaa !13
  %96 = trunc i64 %95 to i32
  %97 = load i64, ptr %3, align 8, !tbaa !13
  %98 = trunc i64 %97 to i32
  %99 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %4, i64 0, i64 0
  %100 = load i64, ptr %8, align 8, !tbaa !13
  %101 = trunc i64 %100 to i32
  %102 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %96, i32 noundef %98, ptr noundef %99, i32 noundef %101)
  %103 = icmp slt i64 %102, 0
  br i1 %103, label %104, label %107

104:                                              ; preds = %94
  %105 = load i64, ptr %8, align 8, !tbaa !13
  %106 = add nsw i64 %105, -1
  store i64 %106, ptr %8, align 8, !tbaa !13
  br label %94, !llvm.loop !19

107:                                              ; preds = %94
  %108 = load i64, ptr %8, align 8, !tbaa !13
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4000, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  ret i32 0
}

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

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #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)) #0 align 2

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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
@.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
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca [250 x %"struct.std::pair"], align 16
  %4 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = load ptr, ptr @stdin, align 8, !tbaa !8
  %11 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %10)
  %12 = load ptr, ptr @stdout, align 8, !tbaa !8
  %13 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %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) %1)
  %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) %2)
  call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %3) #6
  br label %16

16:                                               ; preds = %16, %0
  %.idx = phi i64 [ 0, %0 ], [ %.add, %16 ]
  %.ptr = getelementptr inbounds i8, ptr %3, i64 %.idx
  call void @_ZNSt4pairIxxEC2IxxTnNSt9enable_ifIXsr6__and_ISt37__is_implicitly_default_constructibleIT_ES3_IT0_EEE5valueEbE4typeELb1EEEv(ptr noundef nonnull align 8 dereferenceable(16) %.ptr)
  %.add = add nuw nsw i64 %.idx, 16
  %17 = icmp eq i64 %.add, 4000
  br i1 %17, label %.preheader26, label %16

.preheader26:                                     ; preds = %16
  %18 = load i64, ptr %1, align 8, !tbaa !11
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph, label %.preheader25.preheader

.preheader25.preheader:                           ; preds = %.lr.ph, %.preheader26
  br label %.preheader25

.lr.ph:                                           ; preds = %.preheader26, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader26 ]
  %20 = getelementptr inbounds [250 x %"struct.std::pair"], ptr %3, i64 0, i64 %indvars.iv
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %22 = getelementptr inbounds i8, ptr %20, i64 8
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i64, ptr %1, align 8, !tbaa !11
  %25 = icmp sgt i64 %24, %indvars.iv.next
  br i1 %25, label %.lr.ph, label %.preheader25.preheader, !llvm.loop !13

.preheader24:                                     ; preds = %.preheader25
  %26 = sext i32 %28 to i64
  br label %38

.preheader25:                                     ; preds = %.preheader25.preheader, %.preheader25
  %.01829 = phi i32 [ %.119, %.preheader25 ], [ 10000000, %.preheader25.preheader ]
  %.02028 = phi i32 [ %.121, %.preheader25 ], [ 0, %.preheader25.preheader ]
  %27 = add nsw i32 %.01829, %.02028
  %28 = sdiv i32 %27, 2
  %29 = load i64, ptr %1, align 8, !tbaa !11
  %30 = trunc i64 %29 to i32
  %31 = load i64, ptr %2, align 8, !tbaa !11
  %32 = trunc i64 %31 to i32
  %33 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %30, i32 noundef %32, ptr noundef nonnull %3, i32 noundef %28)
  %34 = icmp slt i64 %33, 0
  %35 = add nsw i32 %28, -1
  %36 = add nsw i32 %28, 1
  %.121 = select i1 %34, i32 %.02028, i32 %36
  %.119 = select i1 %34, i32 %35, i32 %.01829
  %37 = icmp slt i32 %.121, %.119
  br i1 %37, label %.preheader25, label %.preheader24, !llvm.loop !15

38:                                               ; preds = %38, %.preheader24
  %.1 = phi i64 [ %46, %38 ], [ %26, %.preheader24 ]
  %39 = load i64, ptr %1, align 8, !tbaa !11
  %40 = trunc i64 %39 to i32
  %41 = load i64, ptr %2, align 8, !tbaa !11
  %42 = trunc i64 %41 to i32
  %43 = trunc i64 %.1 to i32
  %44 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %40, i32 noundef %42, ptr noundef nonnull %3, i32 noundef %43)
  %45 = icmp sgt i64 %44, 0
  %46 = add nsw i64 %.1, 1
  br i1 %45, label %38, label %.preheader, !llvm.loop !16

.preheader:                                       ; preds = %38, %.preheader
  %.2 = phi i64 [ %54, %.preheader ], [ %.1, %38 ]
  %47 = load i64, ptr %1, align 8, !tbaa !11
  %48 = trunc i64 %47 to i32
  %49 = load i64, ptr %2, align 8, !tbaa !11
  %50 = trunc i64 %49 to i32
  %51 = trunc i64 %.2 to i32
  %52 = call noundef i64 @_Z5worksiiPSt4pairIxxEi(i32 noundef %48, i32 noundef %50, ptr noundef nonnull %3, i32 noundef %51)
  %53 = icmp slt i64 %52, 0
  %54 = add nsw i64 %.2, -1
  br i1 %53, label %.preheader, label %55, !llvm.loop !17

55:                                               ; preds = %.preheader
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.2)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0
}

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

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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)) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { 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 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


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