; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Jan 2016/Plat (16 Jan P3)

; 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.anon = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }
%"class.std::basic_ostream" = type { ptr, %"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 }

@dp = external hidden global [200 x [200 x [200 x [2 x %struct.anon]]]], align 16
@N = external dso_local global i32, align 4
@nex = external dso_local global [200 x [200 x %"struct.std::pair"]], align 16
@_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 @_Z5inputv() #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3geni(i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  store i32 0, ptr %1, align 4
  call void @_Z5inputv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  %15 = sub nsw i32 %14, 1
  store i32 %15, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %22, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = icmp sge i32 %17, 0
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %16
  %21 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z3geni(i32 noundef %21)
  br label %22

22:                                               ; preds = %20
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

25:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = sub nsw i32 %26, 1
  store i32 %27, ptr %3, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %95, %25
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = icmp sge i32 %29, 0
  br i1 %30, label %32, label %31

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

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

33:                                               ; preds = %91, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr @N, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [200 x [200 x %"struct.std::pair"]], ptr @nex, i64 0, i64 %40
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = add nsw i32 %42, %43
  %45 = load i32, ptr @N, align 4, !tbaa !5
  %46 = srem i32 %44, %45
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [200 x %"struct.std::pair"], ptr %41, i64 0, i64 %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = add nsw i32 %49, %50
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = srem i32 %51, %52
  store i32 %53, ptr %7, align 4, !tbaa !5
  %54 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %7)
  store i64 %54, ptr %6, align 4
  %55 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %48, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br i1 %55, label %56, label %90

56:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %57, ptr %8, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %86, %56
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = add nsw i32 %60, %61
  %63 = add nsw i32 %62, 1
  %64 = icmp slt i32 %59, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %58
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %89

66:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %82, %66
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = icmp slt i32 %68, 2
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %85

71:                                               ; preds = %67
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = load i32, ptr @N, align 4, !tbaa !5
  %74 = srem i32 %72, %73
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = add nsw i32 %76, %77
  %79 = load i32, ptr @N, align 4, !tbaa !5
  %80 = srem i32 %78, %79
  %81 = load i32, ptr %9, align 4, !tbaa !5
  call void @_Z5solveiiii(i32 noundef %74, i32 noundef %75, i32 noundef %80, i32 noundef %81)
  br label %82

82:                                               ; preds = %71
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %9, align 4, !tbaa !5
  br label %67, !llvm.loop !11

85:                                               ; preds = %70
  br label %86

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

89:                                               ; preds = %65
  br label %90

90:                                               ; preds = %89, %38
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !13

94:                                               ; preds = %37
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %3, align 4, !tbaa !5
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %3, align 4, !tbaa !5
  br label %28, !llvm.loop !14

98:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %128, %98
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = load i32, ptr @N, align 4, !tbaa !5
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %131

104:                                              ; preds = %99
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [200 x [200 x %"struct.std::pair"]], ptr @nex, i64 0, i64 %106
  %108 = load i32, ptr %11, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200 x %"struct.std::pair"], ptr %107, i64 0, i64 %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %111 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %11)
  store i64 %111, ptr %12, align 4
  %112 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %110, ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br i1 %112, label %113, label %127

113:                                              ; preds = %104
  %114 = load i32, ptr %11, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [200 x [200 x [200 x [2 x %struct.anon]]]], ptr @dp, i64 0, i64 %115
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [200 x [200 x [2 x %struct.anon]]], ptr %116, i64 0, i64 %118
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200 x [2 x %struct.anon]], ptr %119, i64 0, i64 %121
  %123 = getelementptr inbounds [2 x %struct.anon], ptr %122, i64 0, i64 0
  %124 = getelementptr inbounds %struct.anon, ptr %123, i32 0, i32 2
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %124)
  %126 = load i32, ptr %125, align 4, !tbaa !5
  store i32 %126, ptr %10, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %113, %104
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %11, align 4, !tbaa !5
  br label %99, !llvm.loop !15

131:                                              ; preds = %103
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %132)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %134 = load i32, ptr %1, align 4
  ret i32 %134
}

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

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 = { 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 #3 = { 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 #4 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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.anon = type { i32, i32, i32 }
%"struct.std::pair" = type { i32, i32 }
%"class.std::basic_ostream" = type { ptr, %"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 }

@dp = external hidden global [200 x [200 x [200 x [2 x %struct.anon]]]], align 16
@N = external dso_local local_unnamed_addr global i32, align 4
@nex = external dso_local global [200 x [200 x %"struct.std::pair"]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", 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 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 @_Z5inputv() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3geni(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"struct.std::pair", align 8
  tail call void @_Z5inputv()
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, -1
  br i1 %8, label %.lr.ph, label %._crit_edge35.thread

._crit_edge:                                      ; preds = %.lr.ph
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  %9 = icmp sgt i32 %.pre, 0
  br i1 %9, label %.lr.ph34.split, label %._crit_edge35.thread

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.01823 = phi i32 [ %10, %.lr.ph ], [ %7, %0 ]
  tail call void @_Z3geni(i32 noundef %.01823)
  %10 = add nsw i32 %.01823, -1
  %.not = icmp eq i32 %.01823, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge35.thread:                             ; preds = %._crit_edge, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  br label %._crit_edge39

._crit_edge35:                                    ; preds = %._crit_edge29
  %11 = icmp sgt i32 %14, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br i1 %11, label %.lr.ph38, label %._crit_edge39

.lr.ph34.split:                                   ; preds = %._crit_edge, %._crit_edge29
  %12 = phi i32 [ %14, %._crit_edge29 ], [ %.pre, %._crit_edge ]
  %.017.in31 = phi i32 [ %.01732, %._crit_edge29 ], [ %.pre, %._crit_edge ]
  %.01732 = add nsw i32 %.017.in31, -1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph28, label %._crit_edge29

._crit_edge29:                                    ; preds = %.loopexit, %.lr.ph34.split
  %14 = phi i32 [ %12, %.lr.ph34.split ], [ %42, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %15 = icmp sgt i32 %.017.in31, 1
  br i1 %15, label %.lr.ph34.split, label %._crit_edge35, !llvm.loop !11

.lr.ph28:                                         ; preds = %.lr.ph34.split, %.loopexit
  %16 = phi i32 [ %42, %.loopexit ], [ %12, %.lr.ph34.split ]
  %storemerge2226 = phi i32 [ %41, %.loopexit ], [ 0, %.lr.ph34.split ]
  %17 = sext i32 %storemerge2226 to i64
  %18 = add nsw i32 %storemerge2226, %.01732
  %19 = srem i32 %18, %16
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [200 x [200 x %"struct.std::pair"]], ptr @nex, i64 0, i64 %17, i64 %20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 %19, ptr %3, align 4, !tbaa !5
  %22 = call i64 @_ZSt9make_pairIRiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %22, ptr %2, align 8
  %23 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %.pre41 = load i32, ptr %1, align 4, !tbaa !5
  %24 = add i32 %.pre41, %.017.in31
  %25 = icmp slt i32 %.pre41, %24
  %or.cond = select i1 %23, i1 %25, i1 false
  br i1 %or.cond, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %.lr.ph28, %.preheader
  %26 = phi i32 [ %37, %.preheader ], [ %.pre41, %.lr.ph28 ]
  %.01625 = phi i32 [ %36, %.preheader ], [ %.pre41, %.lr.ph28 ]
  %27 = load i32, ptr @N, align 4, !tbaa !5
  %28 = srem i32 %.01625, %27
  %29 = add nsw i32 %26, %.01732
  %30 = srem i32 %29, %27
  call void @_Z5solveiiii(i32 noundef %28, i32 noundef %26, i32 noundef %30, i32 noundef 0)
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = srem i32 %.01625, %31
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = add nsw i32 %33, %.01732
  %35 = srem i32 %34, %31
  call void @_Z5solveiiii(i32 noundef %32, i32 noundef %33, i32 noundef %35, i32 noundef 1)
  %36 = add nsw i32 %.01625, 1
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = add i32 %37, %.017.in31
  %39 = icmp slt i32 %36, %38
  br i1 %39, label %.preheader, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %.preheader, %.lr.ph28
  %40 = phi i32 [ %.pre41, %.lr.ph28 ], [ %37, %.preheader ]
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %1, align 4, !tbaa !5
  %42 = load i32, ptr @N, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %.lr.ph28, label %._crit_edge29, !llvm.loop !14

._crit_edge39.loopexit:                           ; preds = %56
  %.pre42 = load i32, ptr %4, align 4, !tbaa !5
  br label %._crit_edge39

._crit_edge39:                                    ; preds = %._crit_edge35.thread, %._crit_edge39.loopexit, %._crit_edge35
  %44 = phi i32 [ %.pre42, %._crit_edge39.loopexit ], [ 0, %._crit_edge35 ], [ 0, %._crit_edge35.thread ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %44)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  ret i32 0

.lr.ph38:                                         ; preds = %._crit_edge35, %56
  %storemerge36 = phi i32 [ %58, %56 ], [ 0, %._crit_edge35 ]
  %46 = sext i32 %storemerge36 to i64
  %47 = getelementptr inbounds [200 x [200 x %"struct.std::pair"]], ptr @nex, i64 0, i64 %46, i64 %46
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %48 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %48, ptr %6, align 8
  %49 = call noundef zeroext i1 @_ZSteqIiiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 4 dereferenceable(8) %47, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %49, label %50, label %56

50:                                               ; preds = %.lr.ph38
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200 x [200 x [200 x [2 x %struct.anon]]]], ptr @dp, i64 0, i64 %52, i64 %52, i64 %52, i64 0, i32 2
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %53)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr %4, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %.lr.ph38, %50
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %5, align 4, !tbaa !5
  %59 = load i32, ptr @N, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %.lr.ph38, label %._crit_edge39.loopexit, !llvm.loop !15
}

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress 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 = { 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 #3 = { 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 #4 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass