; LLVM IR from Aryansh-S/USACO :: USACO/2008/January/Old Silver (Now Gold)/CowContest (CowContest)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@adj = external dso_local global [105 x %"class.std::vector"], align 16
@vis = external dso_local global [105 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %20 = call noalias ptr @fopen(ptr noundef @.str.2, ptr noundef @.str.3)
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %27

22:                                               ; preds = %0
  %23 = load ptr, ptr @stdin, align 8, !tbaa !8
  %24 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %23)
  %25 = load ptr, ptr @stdout, align 8, !tbaa !8
  %26 = call ptr @freopen(ptr noundef @.str.4, ptr noundef @.str.5, ptr noundef %25)
  br label %27

27:                                               ; preds = %22, %0
  call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %28 = load i32, ptr @m, align 4, !tbaa !11
  %29 = icmp sgt i32 0, %28
  %30 = zext i1 %29 to i32
  %31 = sub nsw i32 0, %30
  store i32 %31, ptr %2, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %54, %27
  %33 = load i32, ptr %2, align 4, !tbaa !11
  %34 = load i32, ptr @m, align 4, !tbaa !11
  %35 = load i32, ptr @m, align 4, !tbaa !11
  %36 = icmp sgt i32 0, %35
  %37 = zext i1 %36 to i32
  %38 = sub nsw i32 %34, %37
  %39 = icmp ne i32 %33, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %42 = load i32, ptr %3, align 4, !tbaa !11
  %43 = add nsw i32 %42, -1
  store i32 %43, ptr %3, align 4, !tbaa !11
  %44 = load i32, ptr %4, align 4, !tbaa !11
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr %4, align 4, !tbaa !11
  %46 = load i32, ptr %4, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [105 x %"class.std::vector"], ptr @adj, i64 0, i64 %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !11
  %49 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %49, ptr %5, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %50 = load i32, ptr %3, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [105 x %"class.std::vector"], ptr @adj, i64 0, i64 %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !11
  %53 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %53, ptr %7, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %52, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %54

54:                                               ; preds = %41
  %55 = load i32, ptr @m, align 4, !tbaa !11
  %56 = icmp sgt i32 0, %55
  %57 = zext i1 %56 to i64
  %58 = select i1 %56, i32 -1, i32 1
  %59 = load i32, ptr %2, align 4, !tbaa !11
  %60 = add nsw i32 %59, %58
  store i32 %60, ptr %2, align 4, !tbaa !11
  br label %32, !llvm.loop !13

61:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %62 = load i32, ptr @n, align 4, !tbaa !11
  %63 = icmp sgt i32 0, %62
  %64 = zext i1 %63 to i32
  %65 = sub nsw i32 0, %64
  store i32 %65, ptr %9, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %136, %61
  %67 = load i32, ptr %9, align 4, !tbaa !11
  %68 = load i32, ptr @n, align 4, !tbaa !11
  %69 = load i32, ptr @n, align 4, !tbaa !11
  %70 = icmp sgt i32 0, %69
  %71 = zext i1 %70 to i32
  %72 = sub nsw i32 %68, %71
  %73 = icmp ne i32 %67, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %66
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %143

75:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  store i8 1, ptr %11, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %76 = load i32, ptr @n, align 4, !tbaa !11
  %77 = icmp sgt i32 0, %76
  %78 = zext i1 %77 to i32
  %79 = sub nsw i32 0, %78
  store i32 %79, ptr %12, align 4, !tbaa !11
  br label %80

80:                                               ; preds = %93, %75
  %81 = load i32, ptr %12, align 4, !tbaa !11
  %82 = load i32, ptr @n, align 4, !tbaa !11
  %83 = load i32, ptr @n, align 4, !tbaa !11
  %84 = icmp sgt i32 0, %83
  %85 = zext i1 %84 to i32
  %86 = sub nsw i32 %82, %85
  %87 = icmp ne i32 %81, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %80
  %90 = load i32, ptr %12, align 4, !tbaa !11
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [105 x i8], ptr @vis, i64 0, i64 %91
  store i8 0, ptr %92, align 1, !tbaa !15
  br label %93

93:                                               ; preds = %89
  %94 = load i32, ptr @n, align 4, !tbaa !11
  %95 = icmp sgt i32 0, %94
  %96 = zext i1 %95 to i64
  %97 = select i1 %95, i32 -1, i32 1
  %98 = load i32, ptr %12, align 4, !tbaa !11
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr %12, align 4, !tbaa !11
  br label %80, !llvm.loop !17

100:                                              ; preds = %88
  %101 = load i32, ptr %9, align 4, !tbaa !11
  call void @_Z3dfsii(i32 noundef %101, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %102 = load i32, ptr @n, align 4, !tbaa !11
  %103 = icmp sgt i32 0, %102
  %104 = zext i1 %103 to i32
  %105 = sub nsw i32 0, %104
  store i32 %105, ptr %13, align 4, !tbaa !11
  br label %106

106:                                              ; preds = %123, %100
  %107 = load i32, ptr %13, align 4, !tbaa !11
  %108 = load i32, ptr @n, align 4, !tbaa !11
  %109 = load i32, ptr @n, align 4, !tbaa !11
  %110 = icmp sgt i32 0, %109
  %111 = zext i1 %110 to i32
  %112 = sub nsw i32 %108, %111
  %113 = icmp ne i32 %107, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %106
  store i32 11, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %130

115:                                              ; preds = %106
  %116 = load i32, ptr %13, align 4, !tbaa !11
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [105 x i8], ptr @vis, i64 0, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !15, !range !18, !noundef !19
  %120 = trunc i8 %119 to i1
  br i1 %120, label %122, label %121

121:                                              ; preds = %115
  store i8 0, ptr %11, align 1, !tbaa !15
  br label %122

122:                                              ; preds = %121, %115
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr @n, align 4, !tbaa !11
  %125 = icmp sgt i32 0, %124
  %126 = zext i1 %125 to i64
  %127 = select i1 %125, i32 -1, i32 1
  %128 = load i32, ptr %13, align 4, !tbaa !11
  %129 = add nsw i32 %128, %127
  store i32 %129, ptr %13, align 4, !tbaa !11
  br label %106, !llvm.loop !20

130:                                              ; preds = %114
  %131 = load i8, ptr %11, align 1, !tbaa !15, !range !18, !noundef !19
  %132 = trunc i8 %131 to i1
  %133 = zext i1 %132 to i32
  %134 = load i32, ptr @ans, align 4, !tbaa !11
  %135 = add nsw i32 %134, %133
  store i32 %135, ptr @ans, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  br label %136

136:                                              ; preds = %130
  %137 = load i32, ptr @n, align 4, !tbaa !11
  %138 = icmp sgt i32 0, %137
  %139 = zext i1 %138 to i64
  %140 = select i1 %138, i32 -1, i32 1
  %141 = load i32, ptr %9, align 4, !tbaa !11
  %142 = add nsw i32 %141, %140
  store i32 %142, ptr %9, align 4, !tbaa !11
  br label %66, !llvm.loop !21

143:                                              ; preds = %74
  %144 = load i32, ptr @ans, align 4, !tbaa !11
  call void @_Z3outIiEvT_(i32 noundef %144)
  ret i32 0
}

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

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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; 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)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3outIiEvT_(i32 noundef) #0

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@adj = external dso_local global [105 x %"class.std::vector"], align 16
@vis = external dso_local local_unnamed_addr global [105 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %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 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %13 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3)
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %19, label %14

14:                                               ; preds = %0
  %15 = load ptr, ptr @stdin, align 8, !tbaa !8
  %16 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !8
  %18 = tail call ptr @freopen(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5, ptr noundef %17)
  br label %19

19:                                               ; preds = %14, %0
  tail call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %20 = load i32, ptr @m, align 4, !tbaa !11
  %.not1731 = icmp eq i32 %20, 0
  br i1 %.not1731, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %19
  %.lobit.neg = ashr i32 %20, 31
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %19
  %21 = load i32, ptr @n, align 4, !tbaa !11
  %.not1944 = icmp eq i32 %21, 0
  br i1 %.not1944, label %._crit_edge.._crit_edge47_crit_edge, label %.preheader.preheader

._crit_edge.._crit_edge47_crit_edge:              ; preds = %._crit_edge
  %.pre = load i32, ptr @ans, align 4, !tbaa !11
  br label %._crit_edge47

.preheader.preheader:                             ; preds = %._crit_edge
  %.lobit.neg18 = ashr i32 %21, 31
  %22 = add i32 %.lobit.neg18, %21
  br label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.01532 = phi i32 [ %36, %.lr.ph ], [ %.lobit.neg, %.lr.ph.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %23 = load i32, ptr %1, align 4, !tbaa !11
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %1, align 4, !tbaa !11
  %25 = load i32, ptr %2, align 4, !tbaa !11
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %2, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [105 x %"class.std::vector"], ptr @adj, i64 0, i64 %27
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  store i32 1, ptr %4, align 4, !tbaa !11
  %29 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i64 %29, ptr %3, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %30 = load i32, ptr %1, align 4, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [105 x %"class.std::vector"], ptr @adj, i64 0, i64 %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 -1, ptr %6, align 4, !tbaa !11
  %33 = call i64 @_ZSt9make_pairIiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %2)
  store i64 %33, ptr %5, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %34 = load i32, ptr @m, align 4, !tbaa !11
  %.inv29 = icmp sgt i32 %34, -1
  %35 = select i1 %.inv29, i32 1, i32 -1
  %36 = add nsw i32 %35, %.01532
  %.lobit.neg16 = ashr i32 %34, 31
  %37 = add i32 %.lobit.neg16, %34
  %.not17 = icmp eq i32 %36, %37
  br i1 %.not17, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge42
  %38 = phi i32 [ %44, %._crit_edge42 ], [ %22, %.preheader.preheader ]
  %.lobit.neg2146 = phi i32 [ %.lobit.neg24, %._crit_edge42 ], [ %.lobit.neg18, %.preheader.preheader ]
  %39 = phi i32 [ %43, %._crit_edge42 ], [ %21, %.preheader.preheader ]
  %.01445 = phi i32 [ %55, %._crit_edge42 ], [ %.lobit.neg18, %.preheader.preheader ]
  %.not2333 = icmp eq i32 %.lobit.neg2146, %38
  br i1 %.not2333, label %._crit_edge36, label %.lr.ph35

.lr.ph35:                                         ; preds = %.preheader
  %.inv28 = icmp sgt i32 %39, -1
  %40 = select i1 %.inv28, i64 1, i64 -1
  %41 = sext i32 %.lobit.neg2146 to i64
  %sext = sext i32 %38 to i64
  br label %47

._crit_edge47:                                    ; preds = %._crit_edge42, %._crit_edge.._crit_edge47_crit_edge
  %42 = phi i32 [ %.pre, %._crit_edge.._crit_edge47_crit_edge ], [ %53, %._crit_edge42 ]
  call void @_Z3outIiEvT_(i32 noundef %42)
  ret i32 0

._crit_edge36:                                    ; preds = %47, %.preheader
  call void @_Z3dfsii(i32 noundef %.01445, i32 noundef 0)
  %43 = load i32, ptr @n, align 4, !tbaa !11
  %.lobit.neg24 = ashr i32 %43, 31
  %44 = add i32 %.lobit.neg24, %43
  %.not2637 = icmp eq i32 %43, 0
  br i1 %.not2637, label %._crit_edge42, label %.lr.ph41

.lr.ph41:                                         ; preds = %._crit_edge36
  %.inv27 = icmp sgt i32 %43, -1
  %45 = select i1 %.inv27, i64 1, i64 -1
  %46 = sext i32 %.lobit.neg24 to i64
  %sext51 = sext i32 %44 to i64
  br label %56

47:                                               ; preds = %.lr.ph35, %47
  %indvars.iv = phi i64 [ %41, %.lr.ph35 ], [ %indvars.iv.next, %47 ]
  %48 = getelementptr inbounds [105 x i8], ptr @vis, i64 0, i64 %indvars.iv
  store i8 0, ptr %48, align 1, !tbaa !15
  %indvars.iv.next = add nsw i64 %indvars.iv, %40
  %49 = icmp eq i64 %indvars.iv.next, %sext
  br i1 %49, label %._crit_edge36, label %47, !llvm.loop !17

._crit_edge42:                                    ; preds = %56, %._crit_edge36
  %.013.lcssa = phi i8 [ 1, %._crit_edge36 ], [ %spec.select, %56 ]
  %50 = and i8 %.013.lcssa, 1
  %51 = zext nneg i8 %50 to i32
  %52 = load i32, ptr @ans, align 4, !tbaa !11
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr @ans, align 4, !tbaa !11
  %.inv = icmp sgt i32 %43, -1
  %54 = select i1 %.inv, i32 1, i32 -1
  %55 = add nsw i32 %54, %.01445
  %.not19 = icmp eq i32 %55, %44
  br i1 %.not19, label %._crit_edge47, label %.preheader, !llvm.loop !18

56:                                               ; preds = %.lr.ph41, %56
  %indvars.iv49 = phi i64 [ %46, %.lr.ph41 ], [ %indvars.iv.next50, %56 ]
  %.01338 = phi i8 [ 1, %.lr.ph41 ], [ %spec.select, %56 ]
  %57 = getelementptr inbounds [105 x i8], ptr @vis, i64 0, i64 %indvars.iv49
  %58 = load i8, ptr %57, align 1, !tbaa !15, !range !19, !noundef !20
  %59 = trunc nuw i8 %58 to i1
  %spec.select = select i1 %59, i8 %.01338, i8 0
  %indvars.iv.next50 = add nsw i64 %indvars.iv49, %45
  %60 = icmp eq i64 %indvars.iv.next50, %sext51
  br i1 %60, label %._crit_edge42, label %56, !llvm.loop !21
}

; 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 zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #5

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z2inIiJiEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; 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 #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiRiESt4pairINSt25__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 #0

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !14}


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