; LLVM IR from brpapa/algorithms :: solutions/uva/12797.ll (Z3bfsii)

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

@N = external dso_local global i32, align 4
@grid = external dso_local global [101 x [101 x i8]], align 16
@state = external dso_local global [101 x [101 x i32]], align 16
@lvl = external dso_local global [101 x [101 x i32]], align 16
@dr = external dso_local global [4 x i32], align 16
@dc = external dso_local global [4 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkc(i8 noundef signext) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsii(i32 noundef %0, i32 noundef %1) #1 personality ptr @__gxx_personality_v0 {
  %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 %"class.std::queue", align 8
  %9 = alloca %"struct.std::pair", align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"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 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %18

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

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

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

24:                                               ; preds = %42, %23
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %31
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [101 x i32], ptr %32, i64 0, i64 %34
  store i32 0, ptr %35, align 4, !tbaa !5
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %37
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [101 x i32], ptr %38, i64 0, i64 %40
  store i32 1073741824, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %29
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %7, align 4, !tbaa !5
  br label %24, !llvm.loop !9

45:                                               ; preds = %28
  br label %46

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

49:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 80, ptr %8) #4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [101 x i8], ptr %52, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !12
  %57 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %56)
  br i1 %57, label %58, label %65

58:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %59 unwind label %61

59:                                               ; preds = %58
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %60 unwind label %61

60:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %65

61:                                               ; preds = %59, %58
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %10, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %195

65:                                               ; preds = %60, %49
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [101 x i32], ptr %68, i64 0, i64 %70
  store i32 1, ptr %71, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %182, %65
  %73 = invoke noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %74 unwind label %96

74:                                               ; preds = %72
  %75 = xor i1 %73, true
  br i1 %75, label %76, label %185

76:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %77 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %78 unwind label %100

78:                                               ; preds = %76
  %79 = getelementptr inbounds %"struct.std::pair", ptr %77, i32 0, i32 0
  %80 = load i32, ptr %79, align 4, !tbaa !13
  store i32 %80, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %81 = invoke noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %82 unwind label %104

82:                                               ; preds = %78
  %83 = getelementptr inbounds %"struct.std::pair", ptr %81, i32 0, i32 1
  %84 = load i32, ptr %83, align 4, !tbaa !15
  store i32 %84, ptr %13, align 4, !tbaa !5
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %8)
          to label %85 unwind label %104

85:                                               ; preds = %82
  %86 = load i32, ptr %12, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %87
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [101 x i32], ptr %88, i64 0, i64 %90
  store i32 1, ptr %91, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %179, %85
  %93 = load i32, ptr %14, align 4, !tbaa !5
  %94 = icmp slt i32 %93, 4
  br i1 %94, label %108, label %95

95:                                               ; preds = %92
  store i32 10, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %182

96:                                               ; preds = %72
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %10, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %11, align 4
  br label %195

100:                                              ; preds = %76
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %10, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %11, align 4
  br label %184

104:                                              ; preds = %82, %78
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %10, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %11, align 4
  br label %183

108:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %109 = load i32, ptr %12, align 4, !tbaa !5
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [4 x i32], ptr @dr, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = add nsw i32 %109, %113
  store i32 %114, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = load i32, ptr %14, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [4 x i32], ptr @dc, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = add nsw i32 %115, %119
  store i32 %120, ptr %16, align 4, !tbaa !5
  %121 = load i32, ptr %15, align 4, !tbaa !5
  %122 = icmp slt i32 %121, 0
  br i1 %122, label %134, label %123

123:                                              ; preds = %108
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = load i32, ptr @N, align 4, !tbaa !5
  %126 = icmp eq i32 %124, %125
  br i1 %126, label %134, label %127

127:                                              ; preds = %123
  %128 = load i32, ptr %16, align 4, !tbaa !5
  %129 = icmp slt i32 %128, 0
  br i1 %129, label %134, label %130

130:                                              ; preds = %127
  %131 = load i32, ptr %16, align 4, !tbaa !5
  %132 = load i32, ptr @N, align 4, !tbaa !5
  %133 = icmp eq i32 %131, %132
  br i1 %133, label %134, label %135

134:                                              ; preds = %130, %127, %123, %108
  store i32 12, ptr %6, align 4
  br label %176

135:                                              ; preds = %130
  %136 = load i32, ptr %15, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %137
  %139 = load i32, ptr %16, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [101 x i32], ptr %138, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = icmp eq i32 %142, 1
  br i1 %143, label %144, label %145

144:                                              ; preds = %135
  store i32 12, ptr %6, align 4
  br label %176

145:                                              ; preds = %135
  %146 = load i32, ptr %15, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %147
  %149 = load i32, ptr %16, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [101 x i8], ptr %148, i64 0, i64 %150
  %152 = load i8, ptr %151, align 1, !tbaa !12
  %153 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %152)
  br i1 %153, label %154, label %175

154:                                              ; preds = %145
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %156
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [101 x i32], ptr %157, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  %163 = load i32, ptr %15, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %164
  %166 = load i32, ptr %16, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [101 x i32], ptr %165, i64 0, i64 %167
  store i32 %162, ptr %168, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
          to label %169 unwind label %171

169:                                              ; preds = %154
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %8, ptr noundef nonnull align 4 dereferenceable(8) %17)
          to label %170 unwind label %171

170:                                              ; preds = %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %175

171:                                              ; preds = %169, %154
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %10, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %183

175:                                              ; preds = %170, %145
  store i32 0, ptr %6, align 4
  br label %176

176:                                              ; preds = %175, %144, %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  %177 = load i32, ptr %6, align 4
  switch i32 %177, label %201 [
    i32 0, label %178
    i32 12, label %179
  ]

178:                                              ; preds = %176
  br label %179

179:                                              ; preds = %178, %176
  %180 = load i32, ptr %14, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %14, align 4, !tbaa !5
  br label %92, !llvm.loop !16

182:                                              ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %72, !llvm.loop !17

183:                                              ; preds = %171, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %184

184:                                              ; preds = %183, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %195

185:                                              ; preds = %74
  %186 = load i32, ptr @N, align 4, !tbaa !5
  %187 = sub nsw i32 %186, 1
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %188
  %190 = load i32, ptr @N, align 4, !tbaa !5
  %191 = sub nsw i32 %190, 1
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [101 x i32], ptr %189, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  store i32 1, ptr %6, align 4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %8) #4
  ret i32 %194

195:                                              ; preds = %184, %96, %61
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %8) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %8) #4
  br label %196

196:                                              ; preds = %195
  %197 = load ptr, ptr %10, align 8
  %198 = load i32, ptr %11, align 4
  %199 = insertvalue { ptr, i32 } poison, ptr %197, 0
  %200 = insertvalue { ptr, i32 } %199, i32 %198, 1
  resume { ptr, i32 } %200

201:                                              ; preds = %176
  unreachable
}

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 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)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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::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 }

@N = external dso_local local_unnamed_addr global i32, align 4
@grid = external dso_local local_unnamed_addr global [101 x [101 x i8]], align 16
@state = external dso_local local_unnamed_addr global [101 x [101 x i32]], align 16
@lvl = external dso_local local_unnamed_addr global [101 x [101 x i32]], align 16
@dr = external dso_local local_unnamed_addr global [4 x i32], align 16
@dc = external dso_local local_unnamed_addr global [4 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkc(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z3bfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %10 = load i32, ptr @N, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.preheader.us.preheader, label %._crit_edge31

.preheader.us.preheader:                          ; preds = %2
  %12 = zext nneg i32 %10 to i64
  %13 = shl nuw nsw i64 %12, 2
  %min.iters.check = icmp ult i32 %10, 8
  %n.vec = and i64 %12, 2147483640
  %cmp.n = icmp eq i64 %n.vec, %12
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvar = phi i64 [ 0, %.preheader.us.preheader ], [ %indvar.next, %._crit_edge.us ]
  %14 = mul nuw nsw i64 %indvar, 404
  %scevgep = getelementptr i8, ptr @state, i64 %14
  tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %13, i1 false), !tbaa !5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader.us ]
  %15 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %indvar, i64 %index
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824>, ptr %15, align 4, !tbaa !5
  store <4 x i32> <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824>, ptr %16, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %17 = icmp eq i64 %index.next, %n.vec
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader.us
  %indvars.iv.ph = phi i64 [ 0, %.preheader.us ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %18 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %indvar, i64 %indvars.iv
  store i32 1073741824, ptr %18, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %12
  br i1 %exitcond.not, label %._crit_edge.us, label %scalar.ph, !llvm.loop !13

._crit_edge.us:                                   ; preds = %scalar.ph, %middle.block
  %indvar.next = add nuw nsw i64 %indvar, 1
  %exitcond36.not = icmp eq i64 %indvar.next, %12
  br i1 %exitcond36.not, label %._crit_edge31, label %.preheader.us, !llvm.loop !14

._crit_edge31:                                    ; preds = %._crit_edge.us, %2
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %20, i64 %22
  %24 = load i8, ptr %23, align 1, !tbaa !15
  %25 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %24)
  br i1 %25, label %26, label %30

26:                                               ; preds = %._crit_edge31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %6)
          to label %27 unwind label %28

27:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %30

28:                                               ; preds = %26
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %177

30:                                               ; preds = %27, %._crit_edge31
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %32, i64 %34
  store i32 1, ptr %35, align 4, !tbaa !5
  %36 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %36, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %30, %.loopexit
  %37 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %38 = load i32, ptr %37, align 4, !tbaa !16
  %39 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %40 = getelementptr inbounds i8, ptr %39, i64 4
  %41 = load i32, ptr %40, align 4, !tbaa !18
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %42 = sext i32 %38 to i64
  %43 = sext i32 %41 to i64
  %44 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %42, i64 %43
  store i32 1, ptr %44, align 4, !tbaa !5
  %45 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %42, i64 %43
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %46 = load i32, ptr @dr, align 16, !tbaa !5
  %47 = add nsw i32 %46, %38
  store i32 %47, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %48 = load i32, ptr @dc, align 16, !tbaa !5
  %49 = add nsw i32 %48, %41
  store i32 %49, ptr %8, align 4, !tbaa !5
  %50 = icmp slt i32 %47, 0
  br i1 %50, label %78, label %51

51:                                               ; preds = %.lr.ph
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = icmp eq i32 %47, %52
  %54 = icmp slt i32 %49, 0
  %55 = icmp eq i32 %49, %52
  %56 = or i1 %54, %55
  %or.cond28 = select i1 %53, i1 true, i1 %56
  br i1 %or.cond28, label %78, label %57

57:                                               ; preds = %51
  %58 = zext nneg i32 %47 to i64
  %59 = zext nneg i32 %49 to i64
  %60 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %58, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %78, label %63

63:                                               ; preds = %57
  %64 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %58, i64 %59
  %65 = load i8, ptr %64, align 1, !tbaa !15
  %66 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %65)
  br i1 %66, label %67, label %78

67:                                               ; preds = %63
  %68 = load i32, ptr %45, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %71, i64 %73
  store i32 %69, ptr %74, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %75 unwind label %76

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

76:                                               ; preds = %162, %131, %100, %67
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %177

78:                                               ; preds = %63, %75, %57, %.lr.ph, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %79 = load i32, ptr getelementptr inbounds (i8, ptr @dr, i64 4), align 4, !tbaa !5
  %80 = add nsw i32 %79, %38
  store i32 %80, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %81 = load i32, ptr getelementptr inbounds (i8, ptr @dc, i64 4), align 4, !tbaa !5
  %82 = add nsw i32 %81, %41
  store i32 %82, ptr %8, align 4, !tbaa !5
  %83 = icmp slt i32 %80, 0
  br i1 %83, label %109, label %84

84:                                               ; preds = %78
  %85 = load i32, ptr @N, align 4, !tbaa !5
  %86 = icmp eq i32 %80, %85
  %87 = icmp slt i32 %82, 0
  %88 = icmp eq i32 %82, %85
  %89 = or i1 %87, %88
  %or.cond28.1 = select i1 %86, i1 true, i1 %89
  br i1 %or.cond28.1, label %109, label %90

90:                                               ; preds = %84
  %91 = zext nneg i32 %80 to i64
  %92 = zext nneg i32 %82 to i64
  %93 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %91, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp eq i32 %94, 1
  br i1 %95, label %109, label %96

96:                                               ; preds = %90
  %97 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %91, i64 %92
  %98 = load i8, ptr %97, align 1, !tbaa !15
  %99 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %98)
  br i1 %99, label %100, label %109

100:                                              ; preds = %96
  %101 = load i32, ptr %45, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %104, i64 %106
  store i32 %102, ptr %107, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %108 unwind label %76

108:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br label %109

109:                                              ; preds = %108, %96, %90, %84, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %110 = load i32, ptr getelementptr inbounds (i8, ptr @dr, i64 8), align 8, !tbaa !5
  %111 = add nsw i32 %110, %38
  store i32 %111, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %112 = load i32, ptr getelementptr inbounds (i8, ptr @dc, i64 8), align 8, !tbaa !5
  %113 = add nsw i32 %112, %41
  store i32 %113, ptr %8, align 4, !tbaa !5
  %114 = icmp slt i32 %111, 0
  br i1 %114, label %140, label %115

115:                                              ; preds = %109
  %116 = load i32, ptr @N, align 4, !tbaa !5
  %117 = icmp eq i32 %111, %116
  %118 = icmp slt i32 %113, 0
  %119 = icmp eq i32 %113, %116
  %120 = or i1 %118, %119
  %or.cond28.2 = select i1 %117, i1 true, i1 %120
  br i1 %or.cond28.2, label %140, label %121

121:                                              ; preds = %115
  %122 = zext nneg i32 %111 to i64
  %123 = zext nneg i32 %113 to i64
  %124 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %122, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = icmp eq i32 %125, 1
  br i1 %126, label %140, label %127

127:                                              ; preds = %121
  %128 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %122, i64 %123
  %129 = load i8, ptr %128, align 1, !tbaa !15
  %130 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %129)
  br i1 %130, label %131, label %140

131:                                              ; preds = %127
  %132 = load i32, ptr %45, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %135, i64 %137
  store i32 %133, ptr %138, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %139 unwind label %76

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

140:                                              ; preds = %139, %127, %121, %115, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %141 = load i32, ptr getelementptr inbounds (i8, ptr @dr, i64 12), align 4, !tbaa !5
  %142 = add nsw i32 %141, %38
  store i32 %142, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %143 = load i32, ptr getelementptr inbounds (i8, ptr @dc, i64 12), align 4, !tbaa !5
  %144 = add nsw i32 %143, %41
  store i32 %144, ptr %8, align 4, !tbaa !5
  %145 = icmp slt i32 %142, 0
  br i1 %145, label %.loopexit, label %146

146:                                              ; preds = %140
  %147 = load i32, ptr @N, align 4, !tbaa !5
  %148 = icmp eq i32 %142, %147
  %149 = icmp slt i32 %144, 0
  %150 = icmp eq i32 %144, %147
  %151 = or i1 %149, %150
  %or.cond28.3 = select i1 %148, i1 true, i1 %151
  br i1 %or.cond28.3, label %.loopexit, label %152

152:                                              ; preds = %146
  %153 = zext nneg i32 %142 to i64
  %154 = zext nneg i32 %144 to i64
  %155 = getelementptr inbounds [101 x [101 x i32]], ptr @state, i64 0, i64 %153, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = icmp eq i32 %156, 1
  br i1 %157, label %.loopexit, label %158

158:                                              ; preds = %152
  %159 = getelementptr inbounds [101 x [101 x i8]], ptr @grid, i64 0, i64 %153, i64 %154
  %160 = load i8, ptr %159, align 1, !tbaa !15
  %161 = call noundef zeroext i1 @_Z5checkc(i8 noundef signext %160)
  br i1 %161, label %162, label %.loopexit

162:                                              ; preds = %158
  %163 = load i32, ptr %45, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = load i32, ptr %8, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %166, i64 %168
  store i32 %164, ptr %169, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  invoke void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(8) %9)
          to label %170 unwind label %76

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

.loopexit:                                        ; preds = %170, %158, %152, %146, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %171 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %171, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.loopexit, %30
  %172 = load i32, ptr @N, align 4, !tbaa !5
  %173 = add nsw i32 %172, -1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [101 x [101 x i32]], ptr @lvl, i64 0, i64 %174, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #5
  ret i32 %176

177:                                              ; preds = %76, %28
  %.pn = phi { ptr, i32 } [ %77, %76 ], [ %29, %28 ]
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #5
  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) #2

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 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 #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 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

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

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

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

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


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