; LLVM IR from VastoLorde95/Competitive-Programming :: SPOJ/Random/COURIER (cour)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@graph = external dso_local global [101 x [101 x i32]], align 16
@u = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@num = external dso_local global i32, align 4
@coun = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@z = external dso_local global i32, align 4
@dp = external dso_local global [4096 x [101 x i32]], align 16
@orders = external dso_local global [12 x [2 x i32]], align 16
@INF = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3tspii(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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

; 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() #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 i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %12

12:                                               ; preds = %176, %0
  %13 = load i32, ptr @t, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @t, align 4, !tbaa !5
  %15 = icmp ne i32 %13, 0
  br i1 %15, label %16, label %183

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef @b)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %46, %16
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

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

24:                                               ; preds = %36, %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [101 x i32], ptr %32, i64 0, i64 %34
  store i32 10001, ptr %35, align 4, !tbaa !5
  br label %36

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

39:                                               ; preds = %28
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [101 x i32], ptr %42, i64 0, i64 %44
  store i32 0, ptr %45, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %39
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !11

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

50:                                               ; preds = %84, %49
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = load i32, ptr @m, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

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

55:                                               ; preds = %50
  %56 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @u, ptr noundef @v, ptr noundef @d)
  %57 = load i32, ptr @u, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %58
  %60 = load i32, ptr @v, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x i32], ptr %59, i64 0, i64 %61
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %62, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr @u, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %66
  %68 = load i32, ptr @v, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [101 x i32], ptr %67, i64 0, i64 %69
  store i32 %64, ptr %70, align 4, !tbaa !5
  %71 = load i32, ptr @u, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %72
  %74 = load i32, ptr @v, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [101 x i32], ptr %73, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr @v, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %79
  %81 = load i32, ptr @u, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [101 x i32], ptr %80, i64 0, i64 %82
  store i32 %77, ptr %83, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %55
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %5, align 4, !tbaa !5
  br label %50, !llvm.loop !12

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

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

92:                                               ; preds = %88
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %146

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

94:                                               ; preds = %139, %93
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %142

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %135, %99
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = icmp sle i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %138

105:                                              ; preds = %100
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %107
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [101 x i32], ptr %108, i64 0, i64 %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %112 = load i32, ptr %7, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %113
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [101 x i32], ptr %114, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %120
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [101 x i32], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = add nsw i32 %118, %125
  store i32 %126, ptr %9, align 4, !tbaa !5
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %111, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %130
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [101 x i32], ptr %131, i64 0, i64 %133
  store i32 %128, ptr %134, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %135

135:                                              ; preds = %105
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %8, align 4, !tbaa !5
  br label %100, !llvm.loop !13

138:                                              ; preds = %104
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %7, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %7, align 4, !tbaa !5
  br label %94, !llvm.loop !14

142:                                              ; preds = %98
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %6, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %6, align 4, !tbaa !5
  br label %88, !llvm.loop !15

146:                                              ; preds = %92
  %147 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @z)
  store i32 0, ptr @coun, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %173, %146
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = load i32, ptr @z, align 4, !tbaa !5
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %176

153:                                              ; preds = %148
  %154 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @u, ptr noundef @v, ptr noundef @num)
  br label %155

155:                                              ; preds = %159, %153
  %156 = load i32, ptr @num, align 4, !tbaa !5
  %157 = add nsw i32 %156, -1
  store i32 %157, ptr @num, align 4, !tbaa !5
  %158 = icmp ne i32 %156, 0
  br i1 %158, label %159, label %172

159:                                              ; preds = %155
  %160 = load i32, ptr @u, align 4, !tbaa !5
  %161 = load i32, ptr @coun, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %162
  %164 = getelementptr inbounds [2 x i32], ptr %163, i64 0, i64 0
  store i32 %160, ptr %164, align 8, !tbaa !5
  %165 = load i32, ptr @v, align 4, !tbaa !5
  %166 = load i32, ptr @coun, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %167
  %169 = getelementptr inbounds [2 x i32], ptr %168, i64 0, i64 1
  store i32 %165, ptr %169, align 4, !tbaa !5
  %170 = load i32, ptr @coun, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr @coun, align 4, !tbaa !5
  br label %155, !llvm.loop !16

172:                                              ; preds = %155
  br label %173

173:                                              ; preds = %172
  %174 = load i32, ptr %10, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %10, align 4, !tbaa !5
  br label %148, !llvm.loop !17

176:                                              ; preds = %152
  %177 = load i32, ptr @INF, align 4, !tbaa !5
  %178 = trunc i32 %177 to i8
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 %178, i64 1654784, i1 false)
  %179 = load i32, ptr @b, align 4, !tbaa !5
  %180 = call noundef i32 @_Z3tspii(i32 noundef %179, i32 noundef 0)
  %181 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %180)
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %181, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %12, !llvm.loop !18

183:                                              ; preds = %12
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@graph = external dso_local global [101 x [101 x i32]], align 16
@u = external dso_local global i32, align 4
@v = external dso_local global i32, align 4
@num = external dso_local global i32, align 4
@coun = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local global i32, align 4
@z = external dso_local global i32, align 4
@dp = external dso_local local_unnamed_addr global [4096 x [101 x i32]], align 16
@orders = external dso_local local_unnamed_addr global [12 x [2 x i32]], align 16
@INF = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3tspii(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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; 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 #3 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %3 = load i32, ptr @t, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr @t, align 4, !tbaa !5
  %.not66 = icmp eq i32 %3, 0
  br i1 %.not66, label %._crit_edge69, label %.lr.ph68

.lr.ph68:                                         ; preds = %0, %._crit_edge65
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @b)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not3244 = icmp slt i32 %6, 0
  br i1 %.not3244, label %.preheader41, label %.preheader39.preheader

.preheader39.preheader:                           ; preds = %.lr.ph68
  %7 = add nuw i32 %6, 1
  %wide.trip.count78 = zext i32 %7 to i64
  %min.iters.check104 = icmp ult i32 %6, 7
  %n.vec107 = and i64 %wide.trip.count78, 4294967288
  %cmp.n112 = icmp eq i64 %n.vec107, %wide.trip.count78
  br label %.preheader39

.preheader41:                                     ; preds = %._crit_edge, %.lr.ph68
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %.preheader40

.preheader39:                                     ; preds = %.preheader39.preheader, %._crit_edge
  %indvars.iv75 = phi i64 [ 0, %.preheader39.preheader ], [ %indvars.iv.next76, %._crit_edge ]
  br i1 %min.iters.check104, label %scalar.ph103.preheader, label %vector.body109

scalar.ph103.preheader:                           ; preds = %middle.block102, %.preheader39
  %indvars.iv.ph = phi i64 [ 0, %.preheader39 ], [ %n.vec107, %middle.block102 ]
  br label %scalar.ph103

vector.body109:                                   ; preds = %.preheader39, %vector.body109
  %index110 = phi i64 [ %index.next111, %vector.body109 ], [ 0, %.preheader39 ]
  %10 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv75, i64 %index110
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  store <4 x i32> <i32 10001, i32 10001, i32 10001, i32 10001>, ptr %10, align 4, !tbaa !5
  store <4 x i32> <i32 10001, i32 10001, i32 10001, i32 10001>, ptr %11, align 4, !tbaa !5
  %index.next111 = add nuw i64 %index110, 8
  %12 = icmp eq i64 %index.next111, %n.vec107
  br i1 %12, label %middle.block102, label %vector.body109, !llvm.loop !9

middle.block102:                                  ; preds = %vector.body109
  br i1 %cmp.n112, label %._crit_edge, label %scalar.ph103.preheader

._crit_edge:                                      ; preds = %scalar.ph103, %middle.block102
  %13 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv75, i64 %indvars.iv75
  store i32 0, ptr %13, align 4, !tbaa !5
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
  br i1 %exitcond79.not, label %.preheader41, label %.preheader39, !llvm.loop !13

scalar.ph103:                                     ; preds = %scalar.ph103.preheader, %scalar.ph103
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph103 ], [ %indvars.iv.ph, %scalar.ph103.preheader ]
  %14 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv75, i64 %indvars.iv
  store i32 10001, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count78
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph103, !llvm.loop !14

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

.preheader40:                                     ; preds = %.preheader40.loopexit, %.preheader41
  %15 = phi i32 [ %.pre, %.preheader40.loopexit ], [ %6, %.preheader41 ]
  %.not3354 = icmp slt i32 %15, 1
  br i1 %.not3354, label %._crit_edge56, label %.preheader38

.lr.ph:                                           ; preds = %.preheader41, %.lr.ph
  %.02946 = phi i32 [ %30, %.lr.ph ], [ 0, %.preheader41 ]
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @u, ptr noundef nonnull @v, ptr noundef nonnull @d)
  %17 = load i32, ptr @u, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = load i32, ptr @v, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %18, i64 %20
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = load i32, ptr @u, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = load i32, ptr @v, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %25, i64 %27
  store i32 %23, ptr %28, align 4, !tbaa !5
  %29 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %27, i64 %25
  store i32 %23, ptr %29, align 4, !tbaa !5
  %30 = add nuw nsw i32 %.02946, 1
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph, label %.preheader40.loopexit, !llvm.loop !15

.preheader38:                                     ; preds = %.preheader40, %._crit_edge53
  %33 = phi i32 [ %40, %._crit_edge53 ], [ %15, %.preheader40 ]
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %._crit_edge53 ], [ 1, %.preheader40 ]
  %.not3551 = icmp slt i32 %33, 1
  br i1 %.not3551, label %._crit_edge53, label %.preheader

._crit_edge56:                                    ; preds = %._crit_edge53, %.preheader40
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @z)
  store i32 0, ptr @coun, align 4, !tbaa !5
  %35 = load i32, ptr @z, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph64, label %._crit_edge65

.preheader:                                       ; preds = %.preheader38, %._crit_edge50
  %37 = phi i32 [ %42, %._crit_edge50 ], [ %33, %.preheader38 ]
  %38 = phi i32 [ %43, %._crit_edge50 ], [ %33, %.preheader38 ]
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %._crit_edge50 ], [ 1, %.preheader38 ]
  %.not3647 = icmp slt i32 %38, 1
  br i1 %.not3647, label %.preheader.._crit_edge50_crit_edge, label %.lr.ph49

.preheader.._crit_edge50_crit_edge:               ; preds = %.preheader
  %.pre92 = sext i32 %38 to i64
  br label %._crit_edge50

.lr.ph49:                                         ; preds = %.preheader
  %39 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv83, i64 %indvars.iv86
  br label %44

._crit_edge53:                                    ; preds = %._crit_edge50, %.preheader38
  %40 = phi i32 [ %33, %.preheader38 ], [ %42, %._crit_edge50 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %41 = sext i32 %40 to i64
  %.not33.not = icmp slt i64 %indvars.iv86, %41
  br i1 %.not33.not, label %.preheader38, label %._crit_edge56, !llvm.loop !16

._crit_edge50:                                    ; preds = %44, %.preheader.._crit_edge50_crit_edge
  %.pre-phi = phi i64 [ %.pre92, %.preheader.._crit_edge50_crit_edge ], [ %53, %44 ]
  %42 = phi i32 [ %37, %.preheader.._crit_edge50_crit_edge ], [ %52, %44 ]
  %43 = phi i32 [ %38, %.preheader.._crit_edge50_crit_edge ], [ %52, %44 ]
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %.not35.not = icmp slt i64 %indvars.iv83, %.pre-phi
  br i1 %.not35.not, label %.preheader, label %._crit_edge53, !llvm.loop !18

44:                                               ; preds = %.lr.ph49, %44
  %indvars.iv80 = phi i64 [ 1, %.lr.ph49 ], [ %indvars.iv.next81, %44 ]
  %45 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv83, i64 %indvars.iv80
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %46 = load i32, ptr %39, align 4, !tbaa !5
  %47 = getelementptr inbounds [101 x [101 x i32]], ptr @graph, i64 0, i64 %indvars.iv86, i64 %indvars.iv80
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i32 %48, %46
  store i32 %49, ptr %1, align 4, !tbaa !5
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %45, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %.not36.not = icmp slt i64 %indvars.iv80, %53
  br i1 %.not36.not, label %44, label %._crit_edge50, !llvm.loop !19

._crit_edge65:                                    ; preds = %75, %._crit_edge56
  %54 = load i32, ptr @INF, align 4, !tbaa !5
  %55 = trunc i32 %54 to i8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1654784) @dp, i8 %55, i64 1654784, i1 false)
  %56 = load i32, ptr @b, align 4, !tbaa !5
  %57 = call noundef i32 @_Z3tspii(i32 noundef %56, i32 noundef 0)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %57)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %60 = load i32, ptr @t, align 4, !tbaa !5
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %60, 0
  br i1 %.not, label %._crit_edge69, label %.lr.ph68, !llvm.loop !20

.lr.ph64:                                         ; preds = %._crit_edge56, %75
  %.062 = phi i32 [ %76, %75 ], [ 0, %._crit_edge56 ]
  %62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @u, ptr noundef nonnull @v, ptr noundef nonnull @num)
  %num.promoted = load i32, ptr @num, align 4, !tbaa !5
  %.not3457 = icmp eq i32 %num.promoted, 0
  br i1 %.not3457, label %75, label %.lr.ph59

.lr.ph59:                                         ; preds = %.lr.ph64
  %coun.promoted = load i32, ptr @coun, align 4, !tbaa !5
  %63 = load i32, ptr @u, align 4, !tbaa !5
  %64 = load i32, ptr @v, align 4, !tbaa !5
  %65 = sext i32 %coun.promoted to i64
  %66 = zext i32 %num.promoted to i64
  %min.iters.check = icmp ult i32 %num.promoted, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph59
  %n.vec = and i64 %66, 4294967292
  %ind.end = add nsw i64 %n.vec, %65
  %.cast = trunc nuw i64 %n.vec to i32
  %ind.end97 = sub i32 %num.promoted, %.cast
  %broadcast.splatinsert = insertelement <2 x i32> poison, i32 %63, i64 0
  %broadcast.splatinsert99 = insertelement <2 x i32> poison, i32 %64, i64 0
  %interleaved.vec = shufflevector <2 x i32> %broadcast.splatinsert, <2 x i32> %broadcast.splatinsert99, <4 x i32> <i32 0, i32 2, i32 0, i32 2>
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %65
  %67 = add i64 %offset.idx, 2
  %68 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %offset.idx
  %69 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %67
  store <4 x i32> %interleaved.vec, ptr %68, align 8, !tbaa !5
  store <4 x i32> %interleaved.vec, ptr %69, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %70 = icmp eq i64 %index.next, %n.vec
  br i1 %70, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %66
  br i1 %cmp.n, label %._crit_edge60, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph59
  %indvars.iv89.ph = phi i64 [ %65, %.lr.ph59 ], [ %ind.end, %middle.block ]
  %.in.ph = phi i32 [ %num.promoted, %.lr.ph59 ], [ %ind.end97, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %scalar.ph ], [ %indvars.iv89.ph, %scalar.ph.preheader ]
  %.in = phi i32 [ %71, %scalar.ph ], [ %.in.ph, %scalar.ph.preheader ]
  %71 = add nsw i32 %.in, -1
  %72 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %indvars.iv89
  store i32 %63, ptr %72, align 8, !tbaa !5
  %73 = getelementptr inbounds [12 x [2 x i32]], ptr @orders, i64 0, i64 %indvars.iv89, i64 1
  store i32 %64, ptr %73, align 4, !tbaa !5
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %.not34 = icmp eq i32 %71, 0
  br i1 %.not34, label %._crit_edge60, label %scalar.ph, !llvm.loop !22

._crit_edge60:                                    ; preds = %scalar.ph, %middle.block
  %indvars.iv.next90.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next90, %scalar.ph ]
  %74 = trunc nsw i64 %indvars.iv.next90.lcssa to i32
  store i32 %74, ptr @coun, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %._crit_edge60, %.lr.ph64
  store i32 -1, ptr @num, align 4, !tbaa !5
  %76 = add nuw nsw i32 %.062, 1
  %77 = load i32, ptr @z, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %.lr.ph64, label %._crit_edge65, !llvm.loop !23

._crit_edge69:                                    ; preds = %._crit_edge65, %0
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10, !12, !11}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !10, !17}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10, !11, !12}
!22 = distinct !{!22, !10, !12, !11}
!23 = distinct !{!23, !10}


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