; LLVM IR from tangjz/acm-icpc :: codechef/SNCKEL19 (RECOVER)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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" = type { i32, i32 }
%"struct.std::pair.3" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@dt = external dso_local global %"class.std::vector", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@mat = external dso_local global [201 x [201 x i32]], align 16
@e = external dso_local global [40001 x %"class.std::set"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5solvev() #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

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

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

18:                                               ; preds = %15
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %45

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 -2, ptr %4, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %38, %19
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = icmp sle i32 %21, 2
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %41

24:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = call i32 @llvm.abs.i32(i32 %25, i1 true)
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = call i32 @llvm.abs.i32(i32 %27, i1 true)
  %29 = add nsw i32 %26, %28
  store i32 %29, ptr %5, align 4, !tbaa !5
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %35, label %32

32:                                               ; preds = %24
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp eq i32 %33, 2
  br i1 %34, label %35, label %37

35:                                               ; preds = %32, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %36 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %36, ptr %6, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @dt, ptr noundef nonnull align 4 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %37

37:                                               ; preds = %35, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %38

38:                                               ; preds = %37
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %4, align 4, !tbaa !5
  br label %20, !llvm.loop !9

41:                                               ; preds = %23
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

45:                                               ; preds = %18
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %47

47:                                               ; preds = %131, %45
  %48 = load i32, ptr @t, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr @t, align 4, !tbaa !5
  %50 = icmp ne i32 %48, 0
  br i1 %50, label %51, label %132

51:                                               ; preds = %47
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @n, ptr noundef @m)
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = mul nsw i32 %53, %54
  store i32 %55, ptr @s, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %60, %51
  %57 = load i32, ptr @m, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr @m, align 4, !tbaa !5
  %59 = icmp ne i32 %57, 0
  br i1 %59, label %60, label %78

60:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %7, ptr noundef %8)
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %63
  %65 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %64, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %66 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %67 = extractvalue { ptr, i8 } %65, 0
  store ptr %67, ptr %66, align 8
  %68 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %69 = extractvalue { ptr, i8 } %65, 1
  store i8 %69, ptr %68, align 8
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %71
  %73 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %72, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %74 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 0
  %75 = extractvalue { ptr, i8 } %73, 0
  store ptr %75, ptr %74, align 8
  %76 = getelementptr inbounds { ptr, i8 }, ptr %10, i32 0, i32 1
  %77 = extractvalue { ptr, i8 } %73, 1
  store i8 %77, ptr %76, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %56, !llvm.loop !12

78:                                               ; preds = %56
  %79 = call noundef zeroext i1 @_Z5solvev()
  br i1 %79, label %80, label %116

80:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %112, %80
  %82 = load i32, ptr %11, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp sle i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 12, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %115

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %108, %86
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load i32, ptr @n, align 4, !tbaa !5
  %90 = icmp sle i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 15, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %111

92:                                               ; preds = %87
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [201 x [201 x i32]], ptr @mat, i64 0, i64 %94
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [201 x i32], ptr %95, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = load i32, ptr @n, align 4, !tbaa !5
  %102 = icmp eq i32 %100, %101
  %103 = zext i1 %102 to i64
  %104 = getelementptr inbounds [3 x i8], ptr @.str.5, i64 0, i64 %103
  %105 = load i8, ptr %104, align 1, !tbaa !13
  %106 = sext i8 %105 to i32
  %107 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %99, i32 noundef %106)
  br label %108

108:                                              ; preds = %92
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %12, align 4, !tbaa !5
  br label %87, !llvm.loop !14

111:                                              ; preds = %91
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %11, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %11, align 4, !tbaa !5
  br label %81, !llvm.loop !15

115:                                              ; preds = %85
  br label %118

116:                                              ; preds = %78
  %117 = call i32 @puts(ptr noundef @.str.6)
  br label %118

118:                                              ; preds = %116, %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %128, %118
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = load i32, ptr @s, align 4, !tbaa !5
  %122 = icmp sle i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 18, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %131

124:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #7
  call void @llvm.memset.p0.i64(ptr align 8 %14, i8 0, i64 48, i1 false)
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #7
  %125 = load i32, ptr %13, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %126
  call void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 8 dereferenceable(48) %127) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #7
  br label %128

128:                                              ; preds = %124
  %129 = load i32, ptr %13, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %13, align 4, !tbaa !5
  br label %119, !llvm.loop !16

131:                                              ; preds = %123
  br label %47, !llvm.loop !17

132:                                              ; preds = %47
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 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 i32 @__isoc99_scanf(ptr noundef, ...) #6

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

declare i32 @printf(ptr noundef, ...) #6

declare i32 @puts(ptr noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { "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 #7 = { 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_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" = type { i32, i32 }

@dt = external dso_local global %"class.std::vector", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local local_unnamed_addr global i32, align 4
@mat = external dso_local local_unnamed_addr global [201 x [201 x i32]], align 16
@e = external dso_local global [40001 x %"class.std::set"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5solvev() local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::set", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 -2, ptr %1, align 4, !tbaa !5
  br label %11

7:                                                ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %9 = load i32, ptr @t, align 4, !tbaa !5
  %10 = add nsw i32 %9, -1
  store i32 %10, ptr @t, align 4, !tbaa !5
  %.not38 = icmp eq i32 %9, 0
  br i1 %.not38, label %._crit_edge41, label %.lr.ph40

11:                                               ; preds = %0, %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 -2, ptr %2, align 4, !tbaa !5
  br label %16

12:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %1, align 4, !tbaa !5
  %15 = icmp slt i32 %13, 2
  br i1 %15, label %11, label %7, !llvm.loop !9

16:                                               ; preds = %11, %24
  %storemerge2326 = phi i32 [ -2, %11 ], [ %26, %24 ]
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = call i32 @llvm.abs.i32(i32 %17, i1 true)
  %19 = call i32 @llvm.abs.i32(i32 %storemerge2326, i1 true)
  %20 = add nsw i32 %19, -1
  %21 = add i32 %20, %18
  %or.cond = icmp ult i32 %21, 2
  br i1 %or.cond, label %22, label %24

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %23 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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) %2)
  store i64 %23, ptr %3, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) @dt, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %16, %22
  %25 = phi i32 [ %storemerge2326, %16 ], [ %.pre, %22 ]
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %25, 2
  br i1 %27, label %16, label %12, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph37, %.loopexit25
  %28 = load i32, ptr @t, align 4, !tbaa !5
  %29 = add nsw i32 %28, -1
  store i32 %29, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %._crit_edge41, label %.lr.ph40, !llvm.loop !12

.lr.ph40:                                         ; preds = %7, %.loopexit
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = mul nsw i32 %31, %31
  store i32 %32, ptr @s, align 4, !tbaa !5
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr @m, align 4, !tbaa !5
  %.not1927 = icmp eq i32 %33, 0
  br i1 %.not1927, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph40, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %37
  %39 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %38, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %41
  %43 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) %42, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr @m, align 4, !tbaa !5
  %.not19 = icmp eq i32 %44, 0
  br i1 %.not19, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph40
  %46 = call noundef zeroext i1 @_Z5solvev()
  br i1 %46, label %.preheader24, label %62

.preheader24:                                     ; preds = %._crit_edge
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %.not2032 = icmp slt i32 %47, 1
  br i1 %.not2032, label %.loopexit25, label %.preheader

.preheader:                                       ; preds = %.preheader24, %._crit_edge31
  %48 = phi i32 [ %49, %._crit_edge31 ], [ %47, %.preheader24 ]
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %._crit_edge31 ], [ 1, %.preheader24 ]
  %.not2228 = icmp slt i32 %48, 1
  br i1 %.not2228, label %.preheader.._crit_edge31_crit_edge, label %.lr.ph30

.preheader.._crit_edge31_crit_edge:               ; preds = %.preheader
  %.pre50 = sext i32 %48 to i64
  br label %._crit_edge31

._crit_edge31:                                    ; preds = %.lr.ph30, %.preheader.._crit_edge31_crit_edge
  %.pre-phi = phi i64 [ %.pre50, %.preheader.._crit_edge31_crit_edge ], [ %61, %.lr.ph30 ]
  %49 = phi i32 [ %48, %.preheader.._crit_edge31_crit_edge ], [ %60, %.lr.ph30 ]
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %.not20.not = icmp slt i64 %indvars.iv44, %.pre-phi
  br i1 %.not20.not, label %.preheader, label %.loopexit25, !llvm.loop !14

.lr.ph30:                                         ; preds = %.preheader, %.lr.ph30
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph30 ], [ 1, %.preheader ]
  %50 = phi i32 [ %60, %.lr.ph30 ], [ %48, %.preheader ]
  %51 = getelementptr inbounds [201 x [201 x i32]], ptr @mat, i64 0, i64 %indvars.iv44, i64 %indvars.iv
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = zext i32 %50 to i64
  %54 = icmp eq i64 %indvars.iv, %53
  %55 = zext i1 %54 to i64
  %56 = getelementptr inbounds [3 x i8], ptr @.str.5, i64 0, i64 %55
  %57 = load i8, ptr %56, align 1, !tbaa !16
  %58 = sext i8 %57 to i32
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %52, i32 noundef %58)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %.not22.not = icmp slt i64 %indvars.iv, %61
  br i1 %.not22.not, label %.lr.ph30, label %._crit_edge31, !llvm.loop !17

62:                                               ; preds = %._crit_edge
  %63 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.loopexit25

.loopexit25:                                      ; preds = %._crit_edge31, %.preheader24, %62
  %64 = load i32, ptr @s, align 4, !tbaa !5
  %.not2134 = icmp slt i32 %64, 1
  br i1 %.not2134, label %.loopexit, label %.lr.ph37

.lr.ph37:                                         ; preds = %.loopexit25, %.lr.ph37
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph37 ], [ 1, %.loopexit25 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %6, i8 0, i64 48, i1 false)
  call void @_ZNSt3setIiSt4lessIiESaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #7
  %65 = getelementptr inbounds [40001 x %"class.std::set"], ptr @e, i64 0, i64 %indvars.iv47
  call void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(48) %65) #7
  call void @_ZNSt3setIiSt4lessIiESaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #7
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %66 = load i32, ptr @s, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %.not21.not = icmp slt i64 %indvars.iv47, %67
  br i1 %.not21.not, label %.lr.ph37, label %.loopexit, !llvm.loop !18

._crit_edge41:                                    ; preds = %.loopexit, %7
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIiSt4lessIiESaIiEE4swapERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nofree nounwind "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 #7 = { 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}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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