; LLVM IR from kazunetakahashi/atcoder :: 201610_12/1127_cf16-relay (G)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@A = external dso_local global [100010 x i32], align 16
@B = external dso_local global [100010 x i32], align 16
@h = external dso_local global [100010 x i32], align 16
@visited = external dso_local global [100010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %36, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @Q, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %39

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %19
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %23
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %28, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, -1
  store i32 %35, ptr %33, align 4, !tbaa !5
  br label %36

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

39:                                               ; preds = %16
  store i32 0, ptr @h, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %94, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @Q, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %97

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp eq i32 %49, %53
  br i1 %54, label %55, label %64

55:                                               ; preds = %45
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %62
  store i32 %59, ptr %63, align 4, !tbaa !5
  br label %93

64:                                               ; preds = %45
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %68, %72
  br i1 %73, label %74, label %83

74:                                               ; preds = %64
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %81
  store i32 %78, ptr %82, align 4, !tbaa !5
  br label %92

83:                                               ; preds = %64
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %90
  store i32 %87, ptr %91, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %83, %74
  br label %93

93:                                               ; preds = %92, %55
  br label %94

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

97:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #6
  store i8 0, ptr %4, align 1, !tbaa !12
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef @visited, ptr noundef getelementptr inbounds (i8, ptr @visited, i64 100010), ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  store i8 1, ptr @visited, align 16, !tbaa !12
  store i8 1, ptr getelementptr inbounds ([100010 x i8], ptr @visited, i64 0, i64 1), align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %178, %97
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = load i32, ptr @Q, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

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

103:                                              ; preds = %98
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %108
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %114
  call void @_ZSt4swapIbENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %109, ptr noundef nonnull align 1 dereferenceable(1) %115) #6
  %116 = load i32, ptr %5, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = sub nsw i32 %120, 1
  %122 = icmp sle i32 0, %121
  br i1 %122, label %123, label %141

123:                                              ; preds = %103
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sub nsw i32 %128, 1
  %130 = load i32, ptr @N, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %132, label %141

132:                                              ; preds = %123
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %139
  store i8 1, ptr %140, align 1, !tbaa !12
  br label %141

141:                                              ; preds = %132, %123, %103
  %142 = load i32, ptr %5, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  %148 = icmp sle i32 0, %147
  br i1 %148, label %149, label %167

149:                                              ; preds = %141
  %150 = load i32, ptr %5, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  %156 = load i32, ptr @N, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %158, label %167

158:                                              ; preds = %149
  %159 = load i32, ptr %5, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %165
  store i8 1, ptr %166, align 1, !tbaa !12
  br label %167

167:                                              ; preds = %158, %149, %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %174, %167
  %169 = load i32, ptr %7, align 4, !tbaa !5
  %170 = load i32, ptr @N, align 4, !tbaa !5
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %177

173:                                              ; preds = %168
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %7, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %7, align 4, !tbaa !5
  br label %168, !llvm.loop !14

177:                                              ; preds = %172
  br label %178

178:                                              ; preds = %177
  %179 = load i32, ptr %5, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %5, align 4, !tbaa !5
  br label %98, !llvm.loop !15

181:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %197, %181
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = load i32, ptr @N, align 4, !tbaa !5
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %187, label %186

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

187:                                              ; preds = %182
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %189
  %191 = load i8, ptr %190, align 1, !tbaa !12, !range !16, !noundef !17
  %192 = trunc i8 %191 to i1
  br i1 %192, label %193, label %196

193:                                              ; preds = %187
  %194 = load i32, ptr %8, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr %8, align 4, !tbaa !5
  br label %196

196:                                              ; preds = %193, %187
  br label %197

197:                                              ; preds = %196
  %198 = load i32, ptr %9, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %9, align 4, !tbaa !5
  br label %182, !llvm.loop !18

200:                                              ; preds = %186
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %201)
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %202, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %204 = load i32, ptr %1, align 4
  ret i32 %204
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIbENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #4

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 = { 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 = { 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 #6 = { nounwind }

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

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


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@A = external dso_local global [100010 x i32], align 16
@B = external dso_local global [100010 x i32], align 16
@h = external dso_local local_unnamed_addr global [100010 x i32], align 16
@visited = external dso_local global [100010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i8, align 1
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @Q)
  %4 = load i32, ptr @Q, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  store i32 0, ptr @h, align 16, !tbaa !5
  br label %._crit_edge51

._crit_edge:                                      ; preds = %.lr.ph
  store i32 0, ptr @h, align 16, !tbaa !5
  %6 = icmp sgt i32 %15, 0
  br i1 %6, label %.lr.ph50.preheader, label %._crit_edge51

.lr.ph50.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %15 to i64
  br label %.lr.ph50

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %7 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %9 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %11 = load i32, ptr %7, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr %7, align 4, !tbaa !5
  %13 = load i32, ptr %9, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %9, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @Q, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge51:                                    ; preds = %36, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #7
  store i8 0, ptr %1, align 1, !tbaa !11
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull @visited, ptr noundef nonnull getelementptr inbounds (i8, ptr @visited, i64 100010), ptr noundef nonnull align 1 dereferenceable(1) %1)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #7
  store i8 1, ptr @visited, align 16, !tbaa !11
  store i8 1, ptr getelementptr inbounds (i8, ptr @visited, i64 1), align 1, !tbaa !11
  %18 = load i32, ptr @Q, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph54, label %._crit_edge51..preheader_crit_edge

._crit_edge51..preheader_crit_edge:               ; preds = %._crit_edge51
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %.preheader

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %36
  %indvars.iv62 = phi i64 [ 0, %.lr.ph50.preheader ], [ %indvars.iv.next63.pre-phi, %36 ]
  %20 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv62
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %indvars.iv62
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp eq i32 %21, %23
  %25 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv62
  %26 = load i32, ptr %25, align 4, !tbaa !5
  br i1 %24, label %27, label %30

27:                                               ; preds = %.lr.ph50
  %28 = add nuw nsw i64 %indvars.iv62, 1
  %29 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  br label %36

30:                                               ; preds = %.lr.ph50
  %31 = icmp eq i32 %26, %23
  %32 = add nuw nsw i64 %indvars.iv62, 1
  %33 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %32
  br i1 %31, label %34, label %35

34:                                               ; preds = %30
  store i32 %21, ptr %33, align 4, !tbaa !5
  br label %36

35:                                               ; preds = %30
  store i32 %23, ptr %33, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %27, %35, %34
  %indvars.iv.next63.pre-phi = phi i64 [ %28, %27 ], [ %32, %35 ], [ %32, %34 ]
  %exitcond.not = icmp eq i64 %indvars.iv.next63.pre-phi, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge51, label %.lr.ph50, !llvm.loop !13

.preheader:                                       ; preds = %.loopexit, %._crit_edge51..preheader_crit_edge
  %37 = phi i32 [ %.pre, %._crit_edge51..preheader_crit_edge ], [ %58, %.loopexit ]
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph57.preheader, label %._crit_edge58

.lr.ph57.preheader:                               ; preds = %.preheader
  %wide.trip.count71 = zext nneg i32 %37 to i64
  %min.iters.check = icmp ult i32 %37, 8
  br i1 %min.iters.check, label %.lr.ph57.preheader78, label %vector.ph

.lr.ph57.preheader78:                             ; preds = %middle.block, %.lr.ph57.preheader
  %indvars.iv68.ph = phi i64 [ 0, %.lr.ph57.preheader ], [ %n.vec, %middle.block ]
  %.03655.ph = phi i32 [ 0, %.lr.ph57.preheader ], [ %46, %middle.block ]
  br label %.lr.ph57

vector.ph:                                        ; preds = %.lr.ph57.preheader
  %n.vec = and i64 %wide.trip.count71, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %43, %vector.body ]
  %vec.phi76 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %44, %vector.body ]
  %39 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %index
  %40 = getelementptr inbounds i8, ptr %39, i64 4
  %wide.load = load <4 x i8>, ptr %39, align 8, !tbaa !11
  %wide.load77 = load <4 x i8>, ptr %40, align 4, !tbaa !11
  %41 = zext <4 x i8> %wide.load to <4 x i32>
  %42 = zext <4 x i8> %wide.load77 to <4 x i32>
  %43 = add <4 x i32> %vec.phi, %41
  %44 = add <4 x i32> %vec.phi76, %42
  %index.next = add nuw i64 %index, 8
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %44, %43
  %46 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count71
  br i1 %cmp.n, label %._crit_edge58, label %.lr.ph57.preheader78

.lr.ph54:                                         ; preds = %._crit_edge51, %.loopexit
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %.loopexit ], [ 0, %._crit_edge51 ]
  %47 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv65
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %49
  %51 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv65
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %53
  call void @_ZSt4swapIbENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1) %50, ptr noundef nonnull align 1 dereferenceable(1) %54) #7
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %55 = getelementptr inbounds [100010 x i32], ptr @h, i64 0, i64 %indvars.iv.next66
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 1
  %58 = load i32, ptr @N, align 4
  %.not = icmp sgt i32 %56, %58
  %or.cond = select i1 %57, i1 true, i1 %.not
  br i1 %or.cond, label %63, label %59

59:                                               ; preds = %.lr.ph54
  %60 = add nsw i32 %56, -1
  %61 = zext nneg i32 %60 to i64
  %62 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %61
  store i8 1, ptr %62, align 1, !tbaa !11
  br label %63

63:                                               ; preds = %59, %.lr.ph54
  %64 = add nsw i32 %56, 1
  %65 = icmp sgt i32 %56, -2
  %66 = icmp slt i32 %64, %58
  %or.cond46 = select i1 %65, i1 %66, i1 false
  br i1 %or.cond46, label %67, label %.loopexit

67:                                               ; preds = %63
  %68 = zext nneg i32 %64 to i64
  %69 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %68
  store i8 1, ptr %69, align 1, !tbaa !11
  br label %.loopexit

.loopexit:                                        ; preds = %67, %63
  %70 = load i32, ptr @Q, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next66, %71
  br i1 %72, label %.lr.ph54, label %.preheader, !llvm.loop !17

._crit_edge58:                                    ; preds = %.lr.ph57, %middle.block, %.preheader
  %.036.lcssa = phi i32 [ 0, %.preheader ], [ %46, %middle.block ], [ %spec.select, %.lr.ph57 ]
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.036.lcssa)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph57:                                         ; preds = %.lr.ph57.preheader78, %.lr.ph57
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %.lr.ph57 ], [ %indvars.iv68.ph, %.lr.ph57.preheader78 ]
  %.03655 = phi i32 [ %spec.select, %.lr.ph57 ], [ %.03655.ph, %.lr.ph57.preheader78 ]
  %75 = getelementptr inbounds [100010 x i8], ptr @visited, i64 0, i64 %indvars.iv68
  %76 = load i8, ptr %75, align 1, !tbaa !11, !range !18, !noundef !19
  %77 = zext nneg i8 %76 to i32
  %spec.select = add nuw nsw i32 %.03655, %77
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
  br i1 %exitcond72.not, label %._crit_edge58, label %.lr.ph57, !llvm.loop !20
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIbENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #6

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

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

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


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