; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 3/3.3 camelot (bad).ll (Z4fillii)

; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@C = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@dist = external dso_local global [26 x [30 x [26 x [30 x i32]]]], align 16
@xdir = external dso_local global [8 x i32], align 16
@ydir = external dso_local global [8 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4fillii(i32 noundef %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"struct.std::pair", align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr %5) #5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %15 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %16 unwind label %42

16:                                               ; preds = %2
  store i64 %15, ptr %6, align 4
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %17 unwind label %42

17:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %19
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [30 x [26 x [30 x i32]]], ptr %20, i64 0, i64 %22
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [26 x [30 x i32]], ptr %23, i64 0, i64 %25
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [30 x i32], ptr %26, i64 0, i64 %28
  store i32 0, ptr %29, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %141, %17
  %31 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %32 unwind label %46

32:                                               ; preds = %30
  %33 = icmp ne i64 %31, 0
  br i1 %33, label %34, label %143

34:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %35 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %36 unwind label %50

36:                                               ; preds = %34
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %35, i64 8, i1 false)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
          to label %37 unwind label %50

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

38:                                               ; preds = %134, %37
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = icmp slt i32 %39, 8
  br i1 %40, label %54, label %41

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

42:                                               ; preds = %16, %2
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %7, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %144

46:                                               ; preds = %30
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %7, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %8, align 4
  br label %144

50:                                               ; preds = %36, %34
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %7, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %8, align 4
  br label %142

54:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %55 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [8 x i32], ptr @xdir, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add nsw i32 %56, %60
  store i32 %61, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %62 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !11
  %64 = load i32, ptr %10, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [8 x i32], ptr @ydir, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %63, %67
  store i32 %68, ptr %13, align 4, !tbaa !5
  %69 = load i32, ptr %12, align 4, !tbaa !5
  %70 = icmp slt i32 %69, 0
  br i1 %70, label %82, label %71

71:                                               ; preds = %54
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = load i32, ptr @C, align 4, !tbaa !5
  %74 = icmp sge i32 %72, %73
  br i1 %74, label %82, label %75

75:                                               ; preds = %71
  %76 = load i32, ptr %13, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 0
  br i1 %77, label %82, label %78

78:                                               ; preds = %75
  %79 = load i32, ptr %13, align 4, !tbaa !5
  %80 = load i32, ptr @R, align 4, !tbaa !5
  %81 = icmp sge i32 %79, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %78, %75, %71, %54
  store i32 6, ptr %11, align 4
  br label %131

83:                                               ; preds = %78
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %85
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [30 x [26 x [30 x i32]]], ptr %86, i64 0, i64 %88
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [26 x [30 x i32]], ptr %89, i64 0, i64 %91
  %93 = load i32, ptr %13, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [30 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp ne i32 %96, 1000000007
  br i1 %97, label %98, label %99

98:                                               ; preds = %83
  store i32 6, ptr %11, align 4
  br label %131

99:                                               ; preds = %83
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %101
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [30 x [26 x [30 x i32]]], ptr %102, i64 0, i64 %104
  %106 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 0
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [26 x [30 x i32]], ptr %105, i64 0, i64 %108
  %110 = getelementptr inbounds %"struct.std::pair", ptr %9, i32 0, i32 1
  %111 = load i32, ptr %110, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [30 x i32], ptr %109, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %117
  %119 = load i32, ptr %4, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [30 x [26 x [30 x i32]]], ptr %118, i64 0, i64 %120
  %122 = load i32, ptr %12, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [26 x [30 x i32]], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %13, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [30 x i32], ptr %124, i64 0, i64 %126
  store i32 %115, ptr %127, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %128 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %129 unwind label %137

129:                                              ; preds = %99
  store i64 %128, ptr %14, align 4
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %14)
          to label %130 unwind label %137

130:                                              ; preds = %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  store i32 0, ptr %11, align 4
  br label %131

131:                                              ; preds = %130, %98, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %132 = load i32, ptr %11, align 4
  switch i32 %132, label %150 [
    i32 0, label %133
    i32 6, label %134
  ]

133:                                              ; preds = %131
  br label %134

134:                                              ; preds = %133, %131
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %10, align 4, !tbaa !5
  br label %38, !llvm.loop !12

137:                                              ; preds = %129, %99
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %7, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %142

141:                                              ; preds = %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %30, !llvm.loop !14

142:                                              ; preds = %137, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %144

143:                                              ; preds = %32
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #5
  ret void

144:                                              ; preds = %142, %46, %42
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %5) #5
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %7, align 8
  %147 = load i32, ptr %8, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149

150:                                              ; preds = %131
  unreachable
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@C = external dso_local local_unnamed_addr global i32, align 4
@R = external dso_local local_unnamed_addr global i32, align 4
@dist = external dso_local local_unnamed_addr global [26 x [30 x [26 x [30 x i32]]]], align 16
@xdir = external dso_local local_unnamed_addr global [8 x i32], align 16
@ydir = external dso_local local_unnamed_addr global [8 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4fillii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::queue", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %10 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %11 unwind label %27

11:                                               ; preds = %2
  store i64 %10, ptr %6, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %12 unwind label %27

12:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %14, i64 %16, i64 %14, i64 %16
  store i32 0, ptr %17, align 4, !tbaa !5
  %18 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %.not20 = icmp eq i64 %18, 0
  br i1 %.not20, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12, %.loopexit
  %19 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %.sroa.0.0.copyload = load i32, ptr %19, align 4
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %19, i64 4
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %20 = sext i32 %.sroa.0.0.copyload to i64
  %21 = sext i32 %.sroa.6.0.copyload to i64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %22 = load i32, ptr @xdir, align 16, !tbaa !5
  %23 = add nsw i32 %22, %.sroa.0.0.copyload
  store i32 %23, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %24 = load i32, ptr @ydir, align 16, !tbaa !5
  %25 = add nsw i32 %24, %.sroa.6.0.copyload
  store i32 %25, ptr %8, align 4, !tbaa !5
  %26 = icmp slt i32 %23, 0
  br i1 %26, label %50, label %29

27:                                               ; preds = %11, %2
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %242

29:                                               ; preds = %.lr.ph
  %30 = load i32, ptr @C, align 4, !tbaa !5
  %31 = icmp slt i32 %23, %30
  %32 = icmp sgt i32 %25, -1
  %or.cond.not18 = select i1 %31, i1 %32, i1 false
  %33 = load i32, ptr @R, align 4
  %.not12 = icmp slt i32 %25, %33
  %or.cond15 = select i1 %or.cond.not18, i1 %.not12, i1 false
  br i1 %or.cond15, label %34, label %50

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = zext nneg i32 %23 to i64
  %40 = zext nneg i32 %25 to i64
  %41 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %36, i64 %38, i64 %39, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %.not13 = icmp eq i32 %42, 1000000007
  br i1 %.not13, label %43, label %50

43:                                               ; preds = %34
  %44 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %36, i64 %38, i64 %20, i64 %21
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %47 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %48 unwind label %240

48:                                               ; preds = %43
  store i64 %47, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %49 unwind label %240

49:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %50

50:                                               ; preds = %34, %.lr.ph, %29, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 4), align 4, !tbaa !5
  %52 = add nsw i32 %51, %.sroa.0.0.copyload
  store i32 %52, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 4), align 4, !tbaa !5
  %54 = add nsw i32 %53, %.sroa.6.0.copyload
  store i32 %54, ptr %8, align 4, !tbaa !5
  %55 = icmp slt i32 %52, 0
  br i1 %55, label %77, label %56

56:                                               ; preds = %50
  %57 = load i32, ptr @C, align 4, !tbaa !5
  %58 = icmp slt i32 %52, %57
  %59 = icmp sgt i32 %54, -1
  %or.cond.not18.1 = select i1 %58, i1 %59, i1 false
  %60 = load i32, ptr @R, align 4
  %.not12.1 = icmp slt i32 %54, %60
  %or.cond15.1 = select i1 %or.cond.not18.1, i1 %.not12.1, i1 false
  br i1 %or.cond15.1, label %61, label %77

61:                                               ; preds = %56
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = zext nneg i32 %52 to i64
  %67 = zext nneg i32 %54 to i64
  %68 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %63, i64 %65, i64 %66, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %.not13.1 = icmp eq i32 %69, 1000000007
  br i1 %.not13.1, label %70, label %77

70:                                               ; preds = %61
  %71 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %63, i64 %65, i64 %20, i64 %21
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %68, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %74 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %75 unwind label %240

75:                                               ; preds = %70
  store i64 %74, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %76 unwind label %240

76:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %77

77:                                               ; preds = %76, %61, %56, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 8), align 8, !tbaa !5
  %79 = add nsw i32 %78, %.sroa.0.0.copyload
  store i32 %79, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %80 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 8), align 8, !tbaa !5
  %81 = add nsw i32 %80, %.sroa.6.0.copyload
  store i32 %81, ptr %8, align 4, !tbaa !5
  %82 = icmp slt i32 %79, 0
  br i1 %82, label %104, label %83

83:                                               ; preds = %77
  %84 = load i32, ptr @C, align 4, !tbaa !5
  %85 = icmp slt i32 %79, %84
  %86 = icmp sgt i32 %81, -1
  %or.cond.not18.2 = select i1 %85, i1 %86, i1 false
  %87 = load i32, ptr @R, align 4
  %.not12.2 = icmp slt i32 %81, %87
  %or.cond15.2 = select i1 %or.cond.not18.2, i1 %.not12.2, i1 false
  br i1 %or.cond15.2, label %88, label %104

88:                                               ; preds = %83
  %89 = load i32, ptr %3, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = zext nneg i32 %79 to i64
  %94 = zext nneg i32 %81 to i64
  %95 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %90, i64 %92, i64 %93, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %.not13.2 = icmp eq i32 %96, 1000000007
  br i1 %.not13.2, label %97, label %104

97:                                               ; preds = %88
  %98 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %90, i64 %92, i64 %20, i64 %21
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %95, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %101 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %102 unwind label %240

102:                                              ; preds = %97
  store i64 %101, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %103 unwind label %240

103:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %104

104:                                              ; preds = %103, %88, %83, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 12), align 4, !tbaa !5
  %106 = add nsw i32 %105, %.sroa.0.0.copyload
  store i32 %106, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 12), align 4, !tbaa !5
  %108 = add nsw i32 %107, %.sroa.6.0.copyload
  store i32 %108, ptr %8, align 4, !tbaa !5
  %109 = icmp slt i32 %106, 0
  br i1 %109, label %131, label %110

110:                                              ; preds = %104
  %111 = load i32, ptr @C, align 4, !tbaa !5
  %112 = icmp slt i32 %106, %111
  %113 = icmp sgt i32 %108, -1
  %or.cond.not18.3 = select i1 %112, i1 %113, i1 false
  %114 = load i32, ptr @R, align 4
  %.not12.3 = icmp slt i32 %108, %114
  %or.cond15.3 = select i1 %or.cond.not18.3, i1 %.not12.3, i1 false
  br i1 %or.cond15.3, label %115, label %131

115:                                              ; preds = %110
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = zext nneg i32 %106 to i64
  %121 = zext nneg i32 %108 to i64
  %122 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %117, i64 %119, i64 %120, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %.not13.3 = icmp eq i32 %123, 1000000007
  br i1 %.not13.3, label %124, label %131

124:                                              ; preds = %115
  %125 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %117, i64 %119, i64 %20, i64 %21
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %122, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %128 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %129 unwind label %240

129:                                              ; preds = %124
  store i64 %128, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %130 unwind label %240

130:                                              ; preds = %129
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %131

131:                                              ; preds = %130, %115, %110, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %132 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 16), align 16, !tbaa !5
  %133 = add nsw i32 %132, %.sroa.0.0.copyload
  store i32 %133, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %134 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 16), align 16, !tbaa !5
  %135 = add nsw i32 %134, %.sroa.6.0.copyload
  store i32 %135, ptr %8, align 4, !tbaa !5
  %136 = icmp slt i32 %133, 0
  br i1 %136, label %158, label %137

137:                                              ; preds = %131
  %138 = load i32, ptr @C, align 4, !tbaa !5
  %139 = icmp slt i32 %133, %138
  %140 = icmp sgt i32 %135, -1
  %or.cond.not18.4 = select i1 %139, i1 %140, i1 false
  %141 = load i32, ptr @R, align 4
  %.not12.4 = icmp slt i32 %135, %141
  %or.cond15.4 = select i1 %or.cond.not18.4, i1 %.not12.4, i1 false
  br i1 %or.cond15.4, label %142, label %158

142:                                              ; preds = %137
  %143 = load i32, ptr %3, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = load i32, ptr %4, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = zext nneg i32 %133 to i64
  %148 = zext nneg i32 %135 to i64
  %149 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %144, i64 %146, i64 %147, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %.not13.4 = icmp eq i32 %150, 1000000007
  br i1 %.not13.4, label %151, label %158

151:                                              ; preds = %142
  %152 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %144, i64 %146, i64 %20, i64 %21
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %155 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %156 unwind label %240

156:                                              ; preds = %151
  store i64 %155, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %157 unwind label %240

157:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %158

158:                                              ; preds = %157, %142, %137, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %159 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 20), align 4, !tbaa !5
  %160 = add nsw i32 %159, %.sroa.0.0.copyload
  store i32 %160, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %161 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 20), align 4, !tbaa !5
  %162 = add nsw i32 %161, %.sroa.6.0.copyload
  store i32 %162, ptr %8, align 4, !tbaa !5
  %163 = icmp slt i32 %160, 0
  br i1 %163, label %185, label %164

164:                                              ; preds = %158
  %165 = load i32, ptr @C, align 4, !tbaa !5
  %166 = icmp slt i32 %160, %165
  %167 = icmp sgt i32 %162, -1
  %or.cond.not18.5 = select i1 %166, i1 %167, i1 false
  %168 = load i32, ptr @R, align 4
  %.not12.5 = icmp slt i32 %162, %168
  %or.cond15.5 = select i1 %or.cond.not18.5, i1 %.not12.5, i1 false
  br i1 %or.cond15.5, label %169, label %185

169:                                              ; preds = %164
  %170 = load i32, ptr %3, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = load i32, ptr %4, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = zext nneg i32 %160 to i64
  %175 = zext nneg i32 %162 to i64
  %176 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %171, i64 %173, i64 %174, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %.not13.5 = icmp eq i32 %177, 1000000007
  br i1 %.not13.5, label %178, label %185

178:                                              ; preds = %169
  %179 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %171, i64 %173, i64 %20, i64 %21
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %176, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %182 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %183 unwind label %240

183:                                              ; preds = %178
  store i64 %182, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %184 unwind label %240

184:                                              ; preds = %183
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %185

185:                                              ; preds = %184, %169, %164, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %186 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 24), align 8, !tbaa !5
  %187 = add nsw i32 %186, %.sroa.0.0.copyload
  store i32 %187, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %188 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 24), align 8, !tbaa !5
  %189 = add nsw i32 %188, %.sroa.6.0.copyload
  store i32 %189, ptr %8, align 4, !tbaa !5
  %190 = icmp slt i32 %187, 0
  br i1 %190, label %212, label %191

191:                                              ; preds = %185
  %192 = load i32, ptr @C, align 4, !tbaa !5
  %193 = icmp slt i32 %187, %192
  %194 = icmp sgt i32 %189, -1
  %or.cond.not18.6 = select i1 %193, i1 %194, i1 false
  %195 = load i32, ptr @R, align 4
  %.not12.6 = icmp slt i32 %189, %195
  %or.cond15.6 = select i1 %or.cond.not18.6, i1 %.not12.6, i1 false
  br i1 %or.cond15.6, label %196, label %212

196:                                              ; preds = %191
  %197 = load i32, ptr %3, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = load i32, ptr %4, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = zext nneg i32 %187 to i64
  %202 = zext nneg i32 %189 to i64
  %203 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %198, i64 %200, i64 %201, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %.not13.6 = icmp eq i32 %204, 1000000007
  br i1 %.not13.6, label %205, label %212

205:                                              ; preds = %196
  %206 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %198, i64 %200, i64 %20, i64 %21
  %207 = load i32, ptr %206, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %203, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %209 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %210 unwind label %240

210:                                              ; preds = %205
  store i64 %209, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %211 unwind label %240

211:                                              ; preds = %210
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %212

212:                                              ; preds = %211, %196, %191, %185
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %213 = load i32, ptr getelementptr inbounds (i8, ptr @xdir, i64 28), align 4, !tbaa !5
  %214 = add nsw i32 %213, %.sroa.0.0.copyload
  store i32 %214, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %215 = load i32, ptr getelementptr inbounds (i8, ptr @ydir, i64 28), align 4, !tbaa !5
  %216 = add nsw i32 %215, %.sroa.6.0.copyload
  store i32 %216, ptr %8, align 4, !tbaa !5
  %217 = icmp slt i32 %214, 0
  br i1 %217, label %.loopexit, label %218

218:                                              ; preds = %212
  %219 = load i32, ptr @C, align 4, !tbaa !5
  %220 = icmp slt i32 %214, %219
  %221 = icmp sgt i32 %216, -1
  %or.cond.not18.7 = select i1 %220, i1 %221, i1 false
  %222 = load i32, ptr @R, align 4
  %.not12.7 = icmp slt i32 %216, %222
  %or.cond15.7 = select i1 %or.cond.not18.7, i1 %.not12.7, i1 false
  br i1 %or.cond15.7, label %223, label %.loopexit

223:                                              ; preds = %218
  %224 = load i32, ptr %3, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = load i32, ptr %4, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = zext nneg i32 %214 to i64
  %229 = zext nneg i32 %216 to i64
  %230 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %225, i64 %227, i64 %228, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %.not13.7 = icmp eq i32 %231, 1000000007
  br i1 %.not13.7, label %232, label %.loopexit

232:                                              ; preds = %223
  %233 = getelementptr inbounds [26 x [30 x [26 x [30 x i32]]]], ptr @dist, i64 0, i64 %225, i64 %227, i64 %20, i64 %21
  %234 = load i32, ptr %233, align 4, !tbaa !5
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %230, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  %236 = invoke i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %237 unwind label %240

237:                                              ; preds = %232
  store i64 %236, ptr %9, align 8
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %238 unwind label %240

238:                                              ; preds = %237
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  br label %.loopexit

.loopexit:                                        ; preds = %238, %223, %218, %212
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  %239 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %.not = icmp eq i64 %239, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

240:                                              ; preds = %237, %232, %210, %205, %183, %178, %156, %151, %129, %124, %102, %97, %75, %70, %48, %43
  %241 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  br label %242

._crit_edge:                                      ; preds = %.loopexit, %12
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  ret void

242:                                              ; preds = %240, %27
  %.pn = phi { ptr, i32 } [ %241, %240 ], [ %28, %27 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #4
  resume { ptr, i32 } %.pn
}

; 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 uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #0 align 2

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

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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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 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 = { 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 #4 = { 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"}


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