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

; 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::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 }
%"struct.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }
%"struct.std::pair.2" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@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

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #3 {
  %1 = alloca i64, align 8
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca %"struct.std::pair.0", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair.0", align 8
  %7 = alloca %"struct.std::pair.0", align 8
  %8 = alloca %"struct.std::pair.0", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair.0", align 8
  %11 = alloca %"struct.std::pair.0", align 8
  %12 = alloca %"struct.std::pair.2", align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::pair.0", align 8
  %15 = alloca %"struct.std::pair.0", align 8
  %16 = alloca %"struct.std::pair.0", align 8
  %17 = alloca i64, align 8
  %18 = alloca %"struct.std::pair.0", align 8
  %19 = alloca %"struct.std::pair.0", align 8
  %20 = alloca %"struct.std::pair.0", align 8
  %21 = alloca %"struct.std::pair.0", align 8
  %22 = alloca %"struct.std::pair.0", align 8
  %23 = alloca %"struct.std::pair.0", align 8
  %24 = alloca %"struct.std::pair.0", align 8
  %25 = alloca %"struct.std::pair.0", align 8
  %26 = alloca %"struct.std::pair.2", align 8
  %27 = call noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @B)
  br i1 %27, label %28, label %29

28:                                               ; preds = %0
  call void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @B) #6
  br label %29

29:                                               ; preds = %28, %0
  %30 = call noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) @D)
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  call void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) @D) #6
  br label %32

32:                                               ; preds = %31, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %2, ptr align 8 @A, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 @B, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 @C, i64 24, i1 false)
  %33 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %2, ptr noundef byval(%"struct.std::pair.0") align 8 %3, ptr noundef byval(%"struct.std::pair.0") align 8 %4)
  store i64 %33, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 @A, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 @B, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 @D, i64 24, i1 false)
  %34 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %6, ptr noundef byval(%"struct.std::pair.0") align 8 %7, ptr noundef byval(%"struct.std::pair.0") align 8 %8)
  store i64 %34, ptr %5, align 8, !tbaa !5
  %35 = load i64, ptr %1, align 8, !tbaa !5
  %36 = load i64, ptr %5, align 8, !tbaa !5
  %37 = icmp sgt i64 %35, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br label %39

39:                                               ; preds = %38, %32
  %40 = load i64, ptr %1, align 8, !tbaa !5
  %41 = icmp sle i64 %40, 0
  br i1 %41, label %42, label %45

42:                                               ; preds = %39
  %43 = load i64, ptr %5, align 8, !tbaa !5
  %44 = icmp sge i64 %43, 0
  br i1 %44, label %46, label %45

45:                                               ; preds = %42, %39
  store i32 1, ptr %9, align 4
  br label %84

46:                                               ; preds = %42
  %47 = load i64, ptr %1, align 8, !tbaa !5
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %63

49:                                               ; preds = %46
  %50 = load i64, ptr %5, align 8, !tbaa !5
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %63

52:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #6
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3maxISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @C)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %53, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  %54 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3minISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 8 dereferenceable(24) @D)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %54, i64 24, i1 false)
  %55 = call noundef zeroext i1 @_ZSteqISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %11)
  br i1 %55, label %56, label %62

56:                                               ; preds = %52
  %57 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %58 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %59 = extractvalue { ptr, i8 } %57, 0
  store ptr %59, ptr %58, align 8
  %60 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %61 = extractvalue { ptr, i8 } %57, 1
  store i8 %61, ptr %60, align 8
  br label %62

62:                                               ; preds = %56, %52
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #6
  br label %84

63:                                               ; preds = %49, %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 @C, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 @D, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 @A, i64 24, i1 false)
  %64 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %14, ptr noundef byval(%"struct.std::pair.0") align 8 %15, ptr noundef byval(%"struct.std::pair.0") align 8 %16)
  store i64 %64, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 @C, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 @D, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 @B, i64 24, i1 false)
  %65 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8 %18, ptr noundef byval(%"struct.std::pair.0") align 8 %19, ptr noundef byval(%"struct.std::pair.0") align 8 %20)
  store i64 %65, ptr %17, align 8, !tbaa !5
  %66 = load i64, ptr %13, align 8, !tbaa !5
  %67 = load i64, ptr %17, align 8, !tbaa !5
  %68 = icmp sgt i64 %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %63
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br label %70

70:                                               ; preds = %69, %63
  %71 = load i64, ptr %13, align 8, !tbaa !5
  %72 = icmp sle i64 %71, 0
  br i1 %72, label %73, label %76

73:                                               ; preds = %70
  %74 = load i64, ptr %17, align 8, !tbaa !5
  %75 = icmp sge i64 %74, 0
  br i1 %75, label %77, label %76

76:                                               ; preds = %73, %70
  store i32 1, ptr %9, align 4
  br label %83

77:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 8 @A, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 @B, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %24, ptr align 8 @C, i64 24, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 @D, i64 24, i1 false)
  call void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %21, ptr noundef byval(%"struct.std::pair.0") align 8 %22, ptr noundef byval(%"struct.std::pair.0") align 8 %23, ptr noundef byval(%"struct.std::pair.0") align 8 %24, ptr noundef byval(%"struct.std::pair.0") align 8 %25)
  %78 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 8 dereferenceable(24) %21)
  %79 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 0
  %80 = extractvalue { ptr, i8 } %78, 0
  store ptr %80, ptr %79, align 8
  %81 = getelementptr inbounds { ptr, i8 }, ptr %26, i32 0, i32 1
  %82 = extractvalue { ptr, i8 } %78, 1
  store i8 %82, ptr %81, align 8
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  store i32 0, ptr %9, align 4
  br label %83

83:                                               ; preds = %77, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %84

84:                                               ; preds = %83, %62, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #6
  %85 = load i32, ptr %9, align 4
  switch i32 %85, label %87 [
    i32 0, label %86
    i32 1, label %86
  ]

86:                                               ; preds = %84, %84
  ret void

87:                                               ; preds = %84
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3maxISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3minISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSteqISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; 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::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 }
%"struct.std::pair.0" = type { %"struct.std::pair", i64 }
%"struct.std::pair" = type { i64, i64 }

@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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8, ptr noundef byval(%"struct.std::pair.0") align 8) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca %"struct.std::pair.0", align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::pair.0", align 8
  %8 = tail call noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @B)
  br i1 %8, label %9, label %10

9:                                                ; preds = %0
  tail call void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @B) #6
  br label %10

10:                                               ; preds = %9, %0
  %11 = tail call noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) @D)
  br i1 %11, label %12, label %13

12:                                               ; preds = %10
  tail call void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24) @C, ptr noundef nonnull align 8 dereferenceable(24) @D) #6
  br label %13

13:                                               ; preds = %12, %10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %14 = tail call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @A, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @B, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @C)
  store i64 %14, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %15 = tail call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @A, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @B, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @D)
  store i64 %15, ptr %2, align 8, !tbaa !5
  %16 = icmp sgt i64 %14, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %13
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %.pre = load i64, ptr %1, align 8, !tbaa !5
  %.pre9 = load i64, ptr %2, align 8
  br label %18

18:                                               ; preds = %17, %13
  %19 = phi i64 [ %.pre9, %17 ], [ %15, %13 ]
  %20 = phi i64 [ %.pre, %17 ], [ %14, %13 ]
  %21 = icmp slt i64 %20, 1
  %22 = icmp sgt i64 %19, -1
  %or.cond = select i1 %21, i1 %22, i1 false
  br i1 %or.cond, label %23, label %46

23:                                               ; preds = %18
  %24 = icmp eq i64 %20, 0
  %25 = icmp eq i64 %19, 0
  %or.cond3 = select i1 %24, i1 %25, i1 false
  br i1 %or.cond3, label %26, label %33

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %27 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3maxISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24) @A, ptr noundef nonnull align 8 dereferenceable(24) @C)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %27, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %28 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3minISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24) @B, ptr noundef nonnull align 8 dereferenceable(24) @D)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %28, i64 24, i1 false)
  %29 = call noundef zeroext i1 @_ZSteqISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  br i1 %29, label %30, label %32

30:                                               ; preds = %26
  %31 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 8 dereferenceable(24) %3)
  br label %32

32:                                               ; preds = %30, %26
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  br label %46

33:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %34 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @C, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @D, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @A)
  store i64 %34, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %35 = call noundef i64 @_Z3sgnSt4pairIS_IxxExES1_S1_(ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @C, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @D, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @B)
  store i64 %35, ptr %6, align 8, !tbaa !5
  %36 = icmp sgt i64 %34, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %.pre10 = load i64, ptr %5, align 8, !tbaa !5
  %.pre11 = load i64, ptr %6, align 8
  br label %38

38:                                               ; preds = %37, %33
  %39 = phi i64 [ %.pre11, %37 ], [ %35, %33 ]
  %40 = phi i64 [ %.pre10, %37 ], [ %34, %33 ]
  %41 = icmp slt i64 %40, 1
  %42 = icmp sgt i64 %39, -1
  %or.cond5 = select i1 %41, i1 %42, i1 false
  br i1 %or.cond5, label %43, label %45

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_Z3getSt4pairIS_IxxExES1_S1_S1_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %7, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @A, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @B, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @C, ptr noundef nonnull byval(%"struct.std::pair.0") align 8 @D)
  %44 = call { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) @S, ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  br label %45

45:                                               ; preds = %38, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %46

46:                                               ; preds = %18, %45, %32
  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 void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStgtISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapISt4pairIxxExENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES3_IT0_EEE5valueEvE4typeERS0_IS4_S6_ESB_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3maxISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZSt3minISt4pairIS0_IxxExEERKT_S5_S5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSteqISt4pairIxxExEbRKS0_IT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setISt4pairIS0_IxxExESt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass