; LLVM IR from upupming/algorithm :: acwing/寒假每日一题（入门组）/week5/1101. 献给阿尔吉侬的花束.ll (Z3bfsv)

; 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"

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

@r = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@d = external dso_local global [210 x [210 x i32]], align 16
@dx = external dso_local global [4 x i32], align 16
@dy = external dso_local global [4 x i32], align 16
@g = external dso_local global [210 x [210 x i8]], align 16
@st = external dso_local global %"struct.std::pair", align 4
@ed = external dso_local global %"struct.std::pair", align 4

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

10:                                               ; preds = %0
  %11 = load i32, ptr @st, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %12
  %14 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @st, i32 0, i32 1), align 4, !tbaa !10
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [210 x i32], ptr %13, i64 0, i64 %15
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %136, %10
  %18 = invoke noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
          to label %19 unwind label %29

19:                                               ; preds = %17
  %20 = icmp ne i64 %18, 0
  br i1 %20, label %21, label %138

21:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %22 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
          to label %23 unwind label %33

23:                                               ; preds = %21
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %22, i64 8, i1 false)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %2)
          to label %24 unwind label %33

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

25:                                               ; preds = %124, %24
  %26 = load i32, ptr %6, align 4, !tbaa !11
  %27 = icmp slt i32 %26, 4
  br i1 %27, label %37, label %28

28:                                               ; preds = %25
  store i32 4, ptr %7, align 4
  br label %131

29:                                               ; preds = %17, %0
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %3, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %4, align 4
  br label %141

33:                                               ; preds = %23, %21
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %3, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %4, align 4
  br label %137

37:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %38 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = load i32, ptr %6, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [4 x i32], ptr @dx, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = add nsw i32 %39, %43
  store i32 %44, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %45 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !10
  %47 = load i32, ptr %6, align 4, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [4 x i32], ptr @dy, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = add nsw i32 %46, %50
  store i32 %51, ptr %9, align 4, !tbaa !11
  %52 = load i32, ptr %8, align 4, !tbaa !11
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %65, label %54

54:                                               ; preds = %37
  %55 = load i32, ptr %8, align 4, !tbaa !11
  %56 = load i32, ptr @r, align 4, !tbaa !11
  %57 = icmp sge i32 %55, %56
  br i1 %57, label %65, label %58

58:                                               ; preds = %54
  %59 = load i32, ptr %9, align 4, !tbaa !11
  %60 = icmp slt i32 %59, 0
  br i1 %60, label %65, label %61

61:                                               ; preds = %58
  %62 = load i32, ptr %9, align 4, !tbaa !11
  %63 = load i32, ptr @c, align 4, !tbaa !11
  %64 = icmp sge i32 %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %61, %58, %54, %37
  store i32 6, ptr %7, align 4
  br label %121

66:                                               ; preds = %61
  %67 = load i32, ptr %8, align 4, !tbaa !11
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [210 x [210 x i8]], ptr @g, i64 0, i64 %68
  %70 = load i32, ptr %9, align 4, !tbaa !11
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [210 x i8], ptr %69, i64 0, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !12
  %74 = sext i8 %73 to i32
  %75 = icmp eq i32 %74, 35
  br i1 %75, label %85, label %76

76:                                               ; preds = %66
  %77 = load i32, ptr %8, align 4, !tbaa !11
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %78
  %80 = load i32, ptr %9, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [210 x i32], ptr %79, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = icmp ne i32 %83, -1
  br i1 %84, label %85, label %86

85:                                               ; preds = %76, %66
  store i32 6, ptr %7, align 4
  br label %121

86:                                               ; preds = %76
  %87 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 0
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %89
  %91 = getelementptr inbounds %"struct.std::pair", ptr %5, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !10
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [210 x i32], ptr %90, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !11
  %96 = add nsw i32 %95, 1
  %97 = load i32, ptr %8, align 4, !tbaa !11
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %98
  %100 = load i32, ptr %9, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [210 x i32], ptr %99, i64 0, i64 %101
  store i32 %96, ptr %102, align 4, !tbaa !11
  %103 = load i32, ptr %8, align 4, !tbaa !11
  %104 = load i32, ptr @ed, align 4, !tbaa !5
  %105 = icmp eq i32 %103, %104
  br i1 %105, label %106, label %118

106:                                              ; preds = %86
  %107 = load i32, ptr %9, align 4, !tbaa !11
  %108 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @ed, i32 0, i32 1), align 4, !tbaa !10
  %109 = icmp eq i32 %107, %108
  br i1 %109, label %110, label %118

110:                                              ; preds = %106
  %111 = load i32, ptr %8, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %112
  %114 = load i32, ptr %9, align 4, !tbaa !11
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [210 x i32], ptr %113, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !11
  store i32 %117, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %121

118:                                              ; preds = %106, %86
  %119 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
          to label %120 unwind label %127

120:                                              ; preds = %118
  store i32 0, ptr %7, align 4
  br label %121

121:                                              ; preds = %120, %110, %85, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %122 = load i32, ptr %7, align 4
  switch i32 %122, label %131 [
    i32 0, label %123
    i32 6, label %124
  ]

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123, %121
  %125 = load i32, ptr %6, align 4, !tbaa !11
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %6, align 4, !tbaa !11
  br label %25, !llvm.loop !13

127:                                              ; preds = %118
  %128 = landingpad { ptr, i32 }
          cleanup
  %129 = extractvalue { ptr, i32 } %128, 0
  store ptr %129, ptr %3, align 8
  %130 = extractvalue { ptr, i32 } %128, 1
  store i32 %130, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %137

131:                                              ; preds = %121, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %132 = load i32, ptr %7, align 4
  switch i32 %132, label %134 [
    i32 4, label %133
  ]

133:                                              ; preds = %131
  store i32 0, ptr %7, align 4
  br label %134

134:                                              ; preds = %133, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  %135 = load i32, ptr %7, align 4
  switch i32 %135, label %139 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %17, !llvm.loop !15

137:                                              ; preds = %127, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %141

138:                                              ; preds = %19
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %7, align 4
  br label %139

139:                                              ; preds = %138, %134
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %2) #5
  %140 = load i32, ptr %1, align 4
  ret i32 %140

141:                                              ; preds = %137, %29
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %2) #5
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %3, align 8
  %144 = load i32, ptr %4, align 4
  %145 = insertvalue { ptr, i32 } poison, ptr %143, 0
  %146 = insertvalue { ptr, i32 } %145, i32 %144, 1
  resume { ptr, i32 } %146
}

; 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_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

; 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, !7, i64 0}
!6 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{!8, !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@r = external dso_local local_unnamed_addr global i32, align 4
@c = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local local_unnamed_addr global [210 x [210 x i32]], align 16
@dx = external dso_local local_unnamed_addr global [4 x i32], align 16
@dy = external dso_local local_unnamed_addr global [4 x i32], align 16
@g = external dso_local local_unnamed_addr global [210 x [210 x i8]], align 16
@st = external dso_local global %"struct.std::pair", align 4
@ed = external dso_local local_unnamed_addr global %"struct.std::pair", align 4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsv() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::queue", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(8) @st)
          to label %4 unwind label %20

4:                                                ; preds = %0
  %5 = load i32, ptr @st, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @st, i64 4), align 4, !tbaa !10
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %6, i64 %8
  store i32 0, ptr %9, align 4, !tbaa !11
  %10 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.not44 = icmp eq i64 %10, 0
  br i1 %.not44, label %.loopexit39, label %.lr.ph

.lr.ph:                                           ; preds = %4, %.loopexit
  %11 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.sroa.0.0.copyload = load i32, ptr %11, align 4
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %11, 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) %1)
  %12 = sext i32 %.sroa.0.0.copyload to i64
  %13 = sext i32 %.sroa.6.0.copyload to i64
  %14 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %12, i64 %13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %15 = load i32, ptr @dx, align 16, !tbaa !11
  %16 = add nsw i32 %15, %.sroa.0.0.copyload
  store i32 %16, ptr %2, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %17 = load i32, ptr @dy, align 16, !tbaa !11
  %18 = add nsw i32 %17, %.sroa.6.0.copyload
  store i32 %18, ptr %3, align 4, !tbaa !11
  %19 = icmp slt i32 %16, 0
  br i1 %19, label %46, label %22

20:                                               ; preds = %0
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %136

22:                                               ; preds = %.lr.ph
  %23 = load i32, ptr @r, align 4, !tbaa !11
  %24 = icmp slt i32 %16, %23
  %25 = icmp sgt i32 %18, -1
  %or.cond.not38 = select i1 %24, i1 %25, i1 false
  %26 = load i32, ptr @c, align 4
  %.not22 = icmp slt i32 %18, %26
  %or.cond26 = select i1 %or.cond.not38, i1 %.not22, i1 false
  br i1 %or.cond26, label %27, label %46

27:                                               ; preds = %22
  %28 = zext nneg i32 %16 to i64
  %29 = zext nneg i32 %18 to i64
  %30 = getelementptr inbounds [210 x [210 x i8]], ptr @g, i64 0, i64 %28, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !12
  %32 = icmp eq i8 %31, 35
  br i1 %32, label %46, label %33

33:                                               ; preds = %27
  %34 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %28, i64 %29
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %.not23 = icmp eq i32 %35, -1
  br i1 %.not23, label %36, label %46

36:                                               ; preds = %33
  %37 = load i32, ptr %14, align 4, !tbaa !11
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %34, align 4, !tbaa !11
  %39 = load i32, ptr @ed, align 4, !tbaa !5
  %40 = icmp eq i32 %16, %39
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @ed, i64 4), align 4
  %42 = icmp eq i32 %18, %41
  %or.cond35 = select i1 %40, i1 %42, i1 false
  br i1 %or.cond35, label %.thread30, label %43

43:                                               ; preds = %36
  %44 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %46 unwind label %134

.thread30:                                        ; preds = %124, %95, %66, %36
  %45 = phi i32 [ %126, %124 ], [ %97, %95 ], [ %68, %66 ], [ %38, %36 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %.loopexit39

46:                                               ; preds = %22, %.lr.ph, %33, %27, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 4), align 4, !tbaa !11
  %48 = add nsw i32 %47, %.sroa.0.0.copyload
  store i32 %48, ptr %2, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 4), align 4, !tbaa !11
  %50 = add nsw i32 %49, %.sroa.6.0.copyload
  store i32 %50, ptr %3, align 4, !tbaa !11
  %51 = icmp slt i32 %48, 0
  br i1 %51, label %75, label %52

52:                                               ; preds = %46
  %53 = load i32, ptr @r, align 4, !tbaa !11
  %54 = icmp slt i32 %48, %53
  %55 = icmp sgt i32 %50, -1
  %or.cond.not38.1 = select i1 %54, i1 %55, i1 false
  %56 = load i32, ptr @c, align 4
  %.not22.1 = icmp slt i32 %50, %56
  %or.cond26.1 = select i1 %or.cond.not38.1, i1 %.not22.1, i1 false
  br i1 %or.cond26.1, label %57, label %75

57:                                               ; preds = %52
  %58 = zext nneg i32 %48 to i64
  %59 = zext nneg i32 %50 to i64
  %60 = getelementptr inbounds [210 x [210 x i8]], ptr @g, i64 0, i64 %58, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !12
  %62 = icmp eq i8 %61, 35
  br i1 %62, label %75, label %63

63:                                               ; preds = %57
  %64 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %58, i64 %59
  %65 = load i32, ptr %64, align 4, !tbaa !11
  %.not23.1 = icmp eq i32 %65, -1
  br i1 %.not23.1, label %66, label %75

66:                                               ; preds = %63
  %67 = load i32, ptr %14, align 4, !tbaa !11
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %64, align 4, !tbaa !11
  %69 = load i32, ptr @ed, align 4, !tbaa !5
  %70 = icmp eq i32 %48, %69
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @ed, i64 4), align 4
  %72 = icmp eq i32 %50, %71
  %or.cond35.1 = select i1 %70, i1 %72, i1 false
  br i1 %or.cond35.1, label %.thread30, label %73

73:                                               ; preds = %66
  %74 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %75 unwind label %134

75:                                               ; preds = %73, %63, %57, %52, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 8), align 8, !tbaa !11
  %77 = add nsw i32 %76, %.sroa.0.0.copyload
  store i32 %77, ptr %2, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 8), align 8, !tbaa !11
  %79 = add nsw i32 %78, %.sroa.6.0.copyload
  store i32 %79, ptr %3, align 4, !tbaa !11
  %80 = icmp slt i32 %77, 0
  br i1 %80, label %104, label %81

81:                                               ; preds = %75
  %82 = load i32, ptr @r, align 4, !tbaa !11
  %83 = icmp slt i32 %77, %82
  %84 = icmp sgt i32 %79, -1
  %or.cond.not38.2 = select i1 %83, i1 %84, i1 false
  %85 = load i32, ptr @c, align 4
  %.not22.2 = icmp slt i32 %79, %85
  %or.cond26.2 = select i1 %or.cond.not38.2, i1 %.not22.2, i1 false
  br i1 %or.cond26.2, label %86, label %104

86:                                               ; preds = %81
  %87 = zext nneg i32 %77 to i64
  %88 = zext nneg i32 %79 to i64
  %89 = getelementptr inbounds [210 x [210 x i8]], ptr @g, i64 0, i64 %87, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !12
  %91 = icmp eq i8 %90, 35
  br i1 %91, label %104, label %92

92:                                               ; preds = %86
  %93 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %87, i64 %88
  %94 = load i32, ptr %93, align 4, !tbaa !11
  %.not23.2 = icmp eq i32 %94, -1
  br i1 %.not23.2, label %95, label %104

95:                                               ; preds = %92
  %96 = load i32, ptr %14, align 4, !tbaa !11
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %93, align 4, !tbaa !11
  %98 = load i32, ptr @ed, align 4, !tbaa !5
  %99 = icmp eq i32 %77, %98
  %100 = load i32, ptr getelementptr inbounds (i8, ptr @ed, i64 4), align 4
  %101 = icmp eq i32 %79, %100
  %or.cond35.2 = select i1 %99, i1 %101, i1 false
  br i1 %or.cond35.2, label %.thread30, label %102

102:                                              ; preds = %95
  %103 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %104 unwind label %134

104:                                              ; preds = %102, %92, %86, %81, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @dx, i64 12), align 4, !tbaa !11
  %106 = add nsw i32 %105, %.sroa.0.0.copyload
  store i32 %106, ptr %2, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %107 = load i32, ptr getelementptr inbounds (i8, ptr @dy, i64 12), align 4, !tbaa !11
  %108 = add nsw i32 %107, %.sroa.6.0.copyload
  store i32 %108, ptr %3, align 4, !tbaa !11
  %109 = icmp slt i32 %106, 0
  br i1 %109, label %.loopexit, label %110

110:                                              ; preds = %104
  %111 = load i32, ptr @r, align 4, !tbaa !11
  %112 = icmp slt i32 %106, %111
  %113 = icmp sgt i32 %108, -1
  %or.cond.not38.3 = select i1 %112, i1 %113, i1 false
  %114 = load i32, ptr @c, align 4
  %.not22.3 = icmp slt i32 %108, %114
  %or.cond26.3 = select i1 %or.cond.not38.3, i1 %.not22.3, i1 false
  br i1 %or.cond26.3, label %115, label %.loopexit

115:                                              ; preds = %110
  %116 = zext nneg i32 %106 to i64
  %117 = zext nneg i32 %108 to i64
  %118 = getelementptr inbounds [210 x [210 x i8]], ptr @g, i64 0, i64 %116, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !12
  %120 = icmp eq i8 %119, 35
  br i1 %120, label %.loopexit, label %121

121:                                              ; preds = %115
  %122 = getelementptr inbounds [210 x [210 x i32]], ptr @d, i64 0, i64 %116, i64 %117
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %.not23.3 = icmp eq i32 %123, -1
  br i1 %.not23.3, label %124, label %.loopexit

124:                                              ; preds = %121
  %125 = load i32, ptr %14, align 4, !tbaa !11
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %122, align 4, !tbaa !11
  %127 = load i32, ptr @ed, align 4, !tbaa !5
  %128 = icmp eq i32 %106, %127
  %129 = load i32, ptr getelementptr inbounds (i8, ptr @ed, i64 4), align 4
  %130 = icmp eq i32 %108, %129
  %or.cond35.3 = select i1 %128, i1 %130, i1 false
  br i1 %or.cond35.3, label %.thread30, label %131

131:                                              ; preds = %124
  %132 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %.loopexit unwind label %134

.loopexit:                                        ; preds = %131, %121, %115, %110, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %133 = call noundef i64 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %.not = icmp eq i64 %133, 0
  br i1 %.not, label %.loopexit39, label %.lr.ph

134:                                              ; preds = %131, %102, %73, %43
  %135 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %136

.loopexit39:                                      ; preds = %.loopexit, %4, %.thread30
  %.4 = phi i32 [ %45, %.thread30 ], [ -1, %4 ], [ -1, %.loopexit ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #4
  ret i32 %.4

136:                                              ; preds = %134, %20
  %.pn = phi { ptr, i32 } [ %135, %134 ], [ %21, %20 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %1) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #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_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE7emplaceIJRiS7_EEEDcDpOT_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 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: 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, !7, i64 0}
!6 = !{!"_ZTSSt4pairIiiE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!7, !7, i64 0}
!12 = !{!8, !8, i64 0}


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