; LLVM IR from bqi343/cp-notebook :: Contests/Other Solutions/VT HSPC/2017 (Criss-Cross)

; 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.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<long long, long long>, long long>, std::pair<std::pair<long long, long long>, long long>, std::_Identity<std::pair<std::pair<long long, long long>, long long>>, std::less<std::pair<std::pair<long long, long long>, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<long long, long long>, long long>, std::pair<std::pair<long long, long long>, long long>, std::_Identity<std::pair<std::pair<long long, long long>, long long>>, std::less<std::pair<std::pair<long long, long long>, long long>>>::_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::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" }

@n = external dso_local global i32, align 4
@x = external dso_local global [1000 x %"struct.std::pair.0"], align 16
@y = external dso_local global [1000 x %"struct.std::pair.0"], align 16
@S = external dso_local global %"class.std::set", align 8
@A = external dso_local global %"struct.std::pair.0", align 8
@B = external dso_local global %"struct.std::pair.0", align 8
@C = external dso_local global %"struct.std::pair.0", align 8
@D = external dso_local global %"struct.std::pair.0", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvev() #1

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

13:                                               ; preds = %51, %0
  %14 = load i32, ptr %2, align 4, !tbaa !8
  %15 = load i32, ptr @n, align 4, !tbaa !8
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %54

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !8
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %20
  %22 = getelementptr inbounds %"struct.std::pair.0", ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.std::pair", ptr %22, i32 0, i32 0
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %26
  %28 = getelementptr inbounds %"struct.std::pair.0", ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 1
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %32
  %34 = getelementptr inbounds %"struct.std::pair.0", ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds %"struct.std::pair", ptr %34, i32 0, i32 0
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(8) %35)
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %38
  %40 = getelementptr inbounds %"struct.std::pair.0", ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %"struct.std::pair", ptr %40, i32 0, i32 1
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(8) %41)
  %43 = load i32, ptr %2, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %44
  %46 = getelementptr inbounds %"struct.std::pair.0", ptr %45, i32 0, i32 1
  store i64 1, ptr %46, align 8, !tbaa !11
  %47 = load i32, ptr %2, align 4, !tbaa !8
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %48
  %50 = getelementptr inbounds %"struct.std::pair.0", ptr %49, i32 0, i32 1
  store i64 1, ptr %50, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %18
  %52 = load i32, ptr %2, align 4, !tbaa !8
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %2, align 4, !tbaa !8
  br label %13, !llvm.loop !15

54:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %55

55:                                               ; preds = %89, %54
  %56 = load i32, ptr %3, align 4, !tbaa !8
  %57 = load i32, ptr @n, align 4, !tbaa !8
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %92

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %61 = load i32, ptr %3, align 4, !tbaa !8
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %5, align 4, !tbaa !8
  br label %63

63:                                               ; preds = %85, %60
  %64 = load i32, ptr %5, align 4, !tbaa !8
  %65 = load i32, ptr @n, align 4, !tbaa !8
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %88

68:                                               ; preds = %63
  %69 = load i32, ptr %3, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %70
  %72 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) %71)
  %73 = load i32, ptr %3, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %74
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 8 dereferenceable(24) %75)
  %77 = load i32, ptr %5, align 4, !tbaa !8
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %78
  %80 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) %79)
  %81 = load i32, ptr %5, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %82
  %84 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @D, ptr noundef nonnull align 8 dereferenceable(24) %83)
  call void @_Z5solvev()
  br label %85

85:                                               ; preds = %68
  %86 = load i32, ptr %5, align 4, !tbaa !8
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %5, align 4, !tbaa !8
  br label %63, !llvm.loop !17

88:                                               ; preds = %67
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %3, align 4, !tbaa !8
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %3, align 4, !tbaa !8
  br label %55, !llvm.loop !18

92:                                               ; preds = %59
  %93 = call noundef i64 @_ZNKSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #5
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %93)
  %95 = load i32, ptr %1, align 4
  ret i32 %95
}

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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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)) #1 align 2

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

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

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

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

%"struct.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<std::pair<long long, long long>, long long>, std::pair<std::pair<long long, long long>, long long>, std::_Identity<std::pair<std::pair<long long, long long>, long long>>, std::less<std::pair<std::pair<long long, long long>, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<std::pair<long long, long long>, long long>, std::pair<std::pair<long long, long long>, long long>, std::_Identity<std::pair<std::pair<long long, long long>, long long>>, std::less<std::pair<std::pair<long long, long long>, long long>>>::_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::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" }

@n = external dso_local global i32, align 4
@x = external dso_local global [1000 x %"struct.std::pair.0"], align 16
@y = external dso_local global [1000 x %"struct.std::pair.0"], align 16
@S = external dso_local global %"class.std::set", align 8
@A = external dso_local global %"struct.std::pair.0", align 8
@B = external dso_local global %"struct.std::pair.0", align 8
@C = external dso_local global %"struct.std::pair.0", align 8
@D = external dso_local global %"struct.std::pair.0", align 8
@_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 @_Z5solvev() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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 = 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)
  %8 = load i32, ptr @n, align 4, !tbaa !8
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %10 = icmp sgt i32 %21, 0
  br i1 %10, label %.lr.ph24, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %indvars.iv
  %12 = 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) %11)
  %13 = getelementptr inbounds i8, ptr %11, i64 8
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %indvars.iv
  %16 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %17 = getelementptr inbounds i8, ptr %15, i64 8
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %19 = getelementptr inbounds i8, ptr %15, i64 16
  store i64 1, ptr %19, align 8, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %11, i64 16
  store i64 1, ptr %20, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr @n, align 4, !tbaa !8
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph, label %.preheader, !llvm.loop !15

.loopexit.loopexit:                               ; preds = %33
  %.pre = sext i32 %40 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph24
  %.pre-phi = phi i64 [ %.pre, %.loopexit.loopexit ], [ %29, %.lr.ph24 ]
  %24 = phi i32 [ %40, %.loopexit.loopexit ], [ %28, %.lr.ph24 ]
  %25 = icmp slt i64 %indvars.iv.next32, %.pre-phi
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  br i1 %25, label %.lr.ph24, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %0, %.preheader
  %26 = tail call noundef i64 @_ZNKSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @S) #4
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %26)
  ret i32 0

.lr.ph24:                                         ; preds = %.preheader, %.loopexit
  %28 = phi i32 [ %24, %.loopexit ], [ %21, %.preheader ]
  %indvars.iv31 = phi i64 [ %indvars.iv.next32, %.loopexit ], [ 0, %.preheader ]
  %indvars.iv26 = phi i64 [ %indvars.iv.next27, %.loopexit ], [ 1, %.preheader ]
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next32, %29
  br i1 %30, label %.lr.ph22, label %.loopexit

.lr.ph22:                                         ; preds = %.lr.ph24
  %31 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %indvars.iv31
  %32 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %indvars.iv31
  br label %33

33:                                               ; preds = %.lr.ph22, %33
  %indvars.iv28 = phi i64 [ %indvars.iv26, %.lr.ph22 ], [ %indvars.iv.next29, %33 ]
  %34 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) %31)
  %35 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 8 dereferenceable(24) %32)
  %36 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @x, i64 0, i64 %indvars.iv28
  %37 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) %36)
  %38 = getelementptr inbounds [1000 x %"struct.std::pair.0"], ptr @y, i64 0, i64 %indvars.iv28
  %39 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt4pairIS_IxxExEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @D, ptr noundef nonnull align 8 dereferenceable(24) %38)
  tail call void @_Z5solvev()
  %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
  %40 = load i32, ptr @n, align 4, !tbaa !8
  %41 = trunc nuw i64 %indvars.iv.next29 to i32
  %42 = icmp sgt i32 %40, %41
  br i1 %42, label %33, label %.loopexit.loopexit, !llvm.loop !18
}

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

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

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

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

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !14, i64 16}
!12 = !{!"_ZTSSt4pairIS_IxxExE", !13, i64 0, !14, i64 16}
!13 = !{!"_ZTSSt4pairIxxE", !14, i64 0, !14, i64 8}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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