; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Company Contests/Sears 2016/Problem F (F)

; 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<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { %"struct.std::pair.0", i32 }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@edges = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = 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 [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca %"struct.std::pair.0", align 4
  %11 = alloca { i64, i32 }, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @c)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %39, %0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp sle i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %42

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

27:                                               ; preds = %35, %26
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @c, align 4, !tbaa !5
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z6createii(i32 noundef %33, i32 noundef %34)
  br label %35

35:                                               ; preds = %32
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !9

38:                                               ; preds = %31
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !11

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

43:                                               ; preds = %52, %42
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6, ptr noundef %7, ptr noundef %8)
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %50 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__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) %7)
  store i64 %50, ptr %10, align 4
  %51 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(4) %8)
  store { i64, i32 } %51, ptr %11, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 8 %11, i64 12, i1 false)
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @edges, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %52

52:                                               ; preds = %48
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %5, align 4, !tbaa !5
  br label %43, !llvm.loop !12

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %94, %55
  %57 = load i32, ptr %12, align 4, !tbaa !5
  %58 = load i32, ptr @c, align 4, !tbaa !5
  %59 = icmp sle i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %97

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %90, %61
  %63 = load i32, ptr %13, align 4, !tbaa !5
  %64 = load i32, ptr @m, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %93

67:                                               ; preds = %62
  %68 = load i32, ptr %13, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %69) #6
  %71 = getelementptr inbounds %"struct.std::pair", ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !13
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %67
  br label %90

76:                                               ; preds = %67
  %77 = load i32, ptr %13, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %78) #6
  %80 = getelementptr inbounds %"struct.std::pair", ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %"struct.std::pair.0", ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 4, !tbaa !16
  %83 = load i32, ptr %13, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %84) #6
  %86 = getelementptr inbounds %"struct.std::pair", ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %"struct.std::pair.0", ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 4, !tbaa !17
  %89 = load i32, ptr %12, align 4, !tbaa !5
  call void @_Z5mergeiii(i32 noundef %82, i32 noundef %88, i32 noundef %89)
  br label %90

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

93:                                               ; preds = %66
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %12, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %12, align 4, !tbaa !5
  br label %56, !llvm.loop !19

97:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %140, %97
  %100 = load i32, ptr %15, align 4, !tbaa !5
  %101 = load i32, ptr %14, align 4, !tbaa !5
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

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

104:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %105 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %16, ptr noundef %17)
  %106 = load i32, ptr %16, align 4, !tbaa !5
  %107 = call noundef i32 @_Z4findii(i32 noundef %106, i32 noundef 0)
  %108 = load i32, ptr %17, align 4, !tbaa !5
  %109 = call noundef i32 @_Z4findii(i32 noundef %108, i32 noundef 0)
  %110 = icmp ne i32 %107, %109
  br i1 %110, label %111, label %113

111:                                              ; preds = %104
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 19, ptr %3, align 4
  br label %137

113:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %131, %113
  %115 = load i32, ptr %19, align 4, !tbaa !5
  %116 = load i32, ptr @c, align 4, !tbaa !5
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %134

119:                                              ; preds = %114
  %120 = load i32, ptr %16, align 4, !tbaa !5
  %121 = load i32, ptr %19, align 4, !tbaa !5
  %122 = call noundef i32 @_Z4findii(i32 noundef %120, i32 noundef %121)
  %123 = load i32, ptr %17, align 4, !tbaa !5
  %124 = load i32, ptr %19, align 4, !tbaa !5
  %125 = call noundef i32 @_Z4findii(i32 noundef %123, i32 noundef %124)
  %126 = icmp ne i32 %122, %125
  br i1 %126, label %127, label %130

127:                                              ; preds = %119
  %128 = load i32, ptr %18, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %18, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %127, %119
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %19, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %19, align 4, !tbaa !5
  br label %114, !llvm.loop !20

134:                                              ; preds = %118
  %135 = load i32, ptr %18, align 4, !tbaa !5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %135)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  store i32 0, ptr %3, align 4
  br label %137

137:                                              ; preds = %134, %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  %138 = load i32, ptr %3, align 4
  switch i32 %138, label %145 [
    i32 0, label %139
    i32 19, label %140
  ]

139:                                              ; preds = %137
  br label %140

140:                                              ; preds = %139, %137
  %141 = load i32, ptr %15, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %15, align 4, !tbaa !5
  br label %99, !llvm.loop !21

143:                                              ; preds = %103
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  %144 = load i32, ptr %1, align 4
  ret i32 %144

145:                                              ; preds = %137
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) #1

; 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

; 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) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = !{!14, !6, i64 8}
!14 = !{!"_ZTSSt4pairIS_IiiEiE", !15, i64 0, !6, i64 8}
!15 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!16 = !{!14, !6, i64 0}
!17 = !{!14, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { %"struct.std::pair.0", i32 }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@edges = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = 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 [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair.0", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @c)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not44 = icmp slt i32 %10, 1
  %11 = load i32, ptr @c, align 4
  %12 = icmp slt i32 %11, 0
  %or.cond70 = select i1 %.not44, i1 true, i1 %12
  br i1 %or.cond70, label %.preheader40, label %.preheader41

.preheader41:                                     ; preds = %0, %._crit_edge
  %13 = phi i32 [ %17, %._crit_edge ], [ %10, %0 ]
  %14 = phi i32 [ %18, %._crit_edge ], [ %11, %0 ]
  %.03045 = phi i32 [ %19, %._crit_edge ], [ 1, %0 ]
  %.not3742 = icmp slt i32 %14, 0
  br i1 %.not3742, label %._crit_edge, label %.lr.ph

.preheader40:                                     ; preds = %._crit_edge, %0
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph47, label %.preheader39

.lr.ph47:                                         ; preds = %.preheader40
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  br label %25

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader41
  %17 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %13, %.preheader41 ]
  %18 = phi i32 [ %21, %._crit_edge.loopexit ], [ %14, %.preheader41 ]
  %19 = add nuw nsw i32 %.03045, 1
  %.not.not = icmp slt i32 %.03045, %17
  br i1 %.not.not, label %.preheader41, label %.preheader40, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader41, %.lr.ph
  %.03243 = phi i32 [ %20, %.lr.ph ], [ 0, %.preheader41 ]
  tail call void @_Z6createii(i32 noundef %.03045, i32 noundef %.03243)
  %20 = add nuw nsw i32 %.03243, 1
  %21 = load i32, ptr @c, align 4, !tbaa !5
  %.not37.not = icmp slt i32 %.03243, %21
  br i1 %.not37.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

.preheader39:                                     ; preds = %25, %.preheader40
  %22 = phi i32 [ %15, %.preheader40 ], [ %30, %25 ]
  %23 = load i32, ptr @c, align 4, !tbaa !5
  %.not3351 = icmp sgt i32 %23, -1
  %24 = icmp sgt i32 %22, 0
  %or.cond = and i1 %.not3351, %24
  br i1 %or.cond, label %.preheader38, label %._crit_edge53

25:                                               ; preds = %.lr.ph47, %25
  %.03146 = phi i32 [ 0, %.lr.ph47 ], [ %29, %25 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %27 = 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 %27, ptr %5, align 8
  %28 = call { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.fca.0.extract = extractvalue { i64, i32 } %28, 0
  %.fca.1.extract = extractvalue { i64, i32 } %28, 1
  store i64 %.fca.0.extract, ptr %4, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @edges, ptr noundef nonnull align 4 dereferenceable(12) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %29 = add nuw nsw i32 %.03146, 1
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %25, label %.preheader39, !llvm.loop !13

.preheader38:                                     ; preds = %.preheader39, %._crit_edge50
  %32 = phi i32 [ %38, %._crit_edge50 ], [ %23, %.preheader39 ]
  %33 = phi i32 [ %39, %._crit_edge50 ], [ %22, %.preheader39 ]
  %.02952 = phi i32 [ %40, %._crit_edge50 ], [ 0, %.preheader39 ]
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph49, label %._crit_edge50

._crit_edge53:                                    ; preds = %._crit_edge50, %.preheader39
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %6)
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph61, label %._crit_edge62

._crit_edge50.loopexit:                           ; preds = %51
  %.pre66 = load i32, ptr @c, align 4, !tbaa !5
  br label %._crit_edge50

._crit_edge50:                                    ; preds = %._crit_edge50.loopexit, %.preheader38
  %38 = phi i32 [ %.pre66, %._crit_edge50.loopexit ], [ %32, %.preheader38 ]
  %39 = phi i32 [ %52, %._crit_edge50.loopexit ], [ %33, %.preheader38 ]
  %40 = add nuw nsw i32 %.02952, 1
  %.not33.not = icmp slt i32 %.02952, %38
  br i1 %.not33.not, label %.preheader38, label %._crit_edge53, !llvm.loop !14

.lr.ph49:                                         ; preds = %.preheader38, %51
  %indvars.iv = phi i64 [ %indvars.iv.next, %51 ], [ 0, %.preheader38 ]
  %41 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv) #5
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load i32, ptr %42, align 4, !tbaa !15
  %44 = icmp eq i32 %43, %.02952
  br i1 %44, label %51, label %45

45:                                               ; preds = %.lr.ph49
  %46 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv) #5
  %47 = load i32, ptr %46, align 4, !tbaa !18
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @edges, i64 noundef %indvars.iv) #5
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %50 = load i32, ptr %49, align 4, !tbaa !19
  call void @_Z5mergeiii(i32 noundef %47, i32 noundef %50, i32 noundef %.02952)
  br label %51

51:                                               ; preds = %.lr.ph49, %45
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %52 = load i32, ptr @m, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next, %53
  br i1 %54, label %.lr.ph49, label %._crit_edge50.loopexit, !llvm.loop !20

._crit_edge62:                                    ; preds = %71, %._crit_edge53
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  ret i32 0

.lr.ph61:                                         ; preds = %._crit_edge53, %71
  %.02759 = phi i32 [ %72, %71 ], [ 0, %._crit_edge53 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = call noundef i32 @_Z4findii(i32 noundef %56, i32 noundef 0)
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = call noundef i32 @_Z4findii(i32 noundef %58, i32 noundef 0)
  %.not34 = icmp eq i32 %57, %59
  br i1 %.not34, label %.preheader, label %61

.preheader:                                       ; preds = %.lr.ph61
  %60 = load i32, ptr @c, align 4, !tbaa !5
  %.not3554 = icmp slt i32 %60, 1
  br i1 %.not3554, label %._crit_edge58, label %.lr.ph57

61:                                               ; preds = %.lr.ph61
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %71

._crit_edge58:                                    ; preds = %.lr.ph57, %.preheader
  %.026.lcssa = phi i32 [ 0, %.preheader ], [ %spec.select, %.lr.ph57 ]
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %.026.lcssa)
  br label %71

.lr.ph57:                                         ; preds = %.preheader, %.lr.ph57
  %.056 = phi i32 [ %69, %.lr.ph57 ], [ 1, %.preheader ]
  %.02655 = phi i32 [ %spec.select, %.lr.ph57 ], [ 0, %.preheader ]
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = call noundef i32 @_Z4findii(i32 noundef %64, i32 noundef %.056)
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = call noundef i32 @_Z4findii(i32 noundef %66, i32 noundef %.056)
  %.not36 = icmp ne i32 %65, %67
  %68 = zext i1 %.not36 to i32
  %spec.select = add nuw nsw i32 %.02655, %68
  %69 = add nuw nsw i32 %.056, 1
  %70 = load i32, ptr @c, align 4, !tbaa !5
  %.not35.not = icmp slt i32 %.056, %70
  br i1 %.not35.not, label %.lr.ph57, label %._crit_edge58, !llvm.loop !21

71:                                               ; preds = %._crit_edge58, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %72 = add nuw nsw i32 %.02759, 1
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph61, label %._crit_edge62, !llvm.loop !22
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairISt4pairIiiERiES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIS0_IiiEiESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !11}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIS_IiiEiE", !17, i64 0, !6, i64 8}
!17 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!18 = !{!16, !6, i64 0}
!19 = !{!16, !6, i64 4}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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