; LLVM IR from lzyrapx/Competitive-Programming :: 百度之星/百度之星2017-资格赛/02（pb_ds）.ll (Z6findSTRiS_)

; 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.Edge = type { i64, i32, i32, i32 }
%"class.__gnu_pbds::priority_queue" = type { ptr, %"class.__gnu_pbds::detail::pairing_heap" }
%"class.__gnu_pbds::detail::pairing_heap" = type { %"class.__gnu_pbds::detail::left_child_next_sibling_heap" }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap" = type { ptr, i64 }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_" = type { %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_" }

@n = external dso_local global i32, align 4
@edge = external dso_local global [444444 x %struct.Edge], align 16
@head = external dso_local global [3333 x i32], align 16
@dist = external dso_local global [3333 x i32], align 16
@pq = external dso_local global %"class.__gnu_pbds::priority_queue", align 8
@pqIterator = external dso_local global [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z6findSTRiS_(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 4 dereferenceable(4) %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_", align 8
  %7 = alloca %"struct.std::pair", align 4
  %8 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_", align 8
  %11 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_", align 8
  %12 = alloca %"struct.std::pair", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %36, %2
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = load i32, ptr @n, align 4, !tbaa !9
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %13
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [3333 x i32], ptr @head, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = icmp ne i32 %22, -2
  br i1 %23, label %24, label %35

24:                                               ; preds = %18
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %26
  store i32 0, ptr %27, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %29
  %31 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %30, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 %31, ptr %7, align 4
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE4pushERKS3_(ptr dead_on_unwind writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8), ptr noundef nonnull align 4 dereferenceable(8) %7)
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %33
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %35

35:                                               ; preds = %24, %18
  br label %36

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

39:                                               ; preds = %17
  br label %40

40:                                               ; preds = %106, %39
  %41 = call noundef i64 @_ZNK10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %42 = icmp ugt i64 %41, 1
  br i1 %42, label %43, label %107

43:                                               ; preds = %40
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3topEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %45 = getelementptr inbounds %"struct.std::pair", ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !14
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  store i32 %46, ptr %47, align 4, !tbaa !9
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3popEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %50
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %51, ptr align 8 %8, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [3333 x i32], ptr @head, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  store i32 %56, ptr %9, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %100, %43
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = icmp ne i32 %58, -1
  br i1 %59, label %61, label %60

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

61:                                               ; preds = %57
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.Edge, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 8, !tbaa !16
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %69 = call noundef zeroext i1 @_ZNK10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EneERKS8_(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br i1 %69, label %70, label %99

70:                                               ; preds = %61
  %71 = load i32, ptr %9, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %72
  %74 = getelementptr inbounds %struct.Edge, ptr %73, i32 0, i32 1
  %75 = load i32, ptr %74, align 8, !tbaa !16
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %76
  call void @_ZN10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EC2ERKS8_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %77)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.Edge, ptr %80, i32 0, i32 0
  %82 = load i64, ptr %81, align 8, !tbaa !19
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.Edge, ptr %85, i32 0, i32 1
  %87 = load i32, ptr %86, align 8, !tbaa !16
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = add nsw i64 %91, %82
  %93 = trunc i64 %92 to i32
  store i32 %93, ptr %89, align 4, !tbaa !9
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %95
  %97 = getelementptr inbounds %struct.Edge, ptr %96, i32 0, i32 1
  %98 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %89, ptr noundef nonnull align 4 dereferenceable(4) %97)
  store i64 %98, ptr %12, align 4
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE6modifyENS0_55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_IS3_NS_9null_typeES6_EES6_EERKS3_(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8), ptr noundef %11, ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %99

99:                                               ; preds = %70, %61
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %9, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %102
  %104 = getelementptr inbounds %struct.Edge, ptr %103, i32 0, i32 2
  %105 = load i32, ptr %104, align 4, !tbaa !20
  store i32 %105, ptr %9, align 4, !tbaa !9
  br label %57, !llvm.loop !21

106:                                              ; preds = %60
  br label %40, !llvm.loop !22

107:                                              ; preds = %40
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3topEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %109 = getelementptr inbounds %"struct.std::pair", ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 4, !tbaa !14
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %110, ptr %111, align 4, !tbaa !9
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3popEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !9
  ret i32 %116
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE4pushERKS3_(ptr dead_on_unwind noalias writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

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

; 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: 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 noundef i64 @_ZNK10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind noalias writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8, ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EneERKS8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EC2ERKS8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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 = { 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 #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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 8, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !10, i64 4}
!15 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTS4Edge", !18, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!18 = !{!"long long", !7, i64 0}
!19 = !{!17, !18, i64 0}
!20 = !{!17, !10, i64 12}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


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

%struct.Edge = type { i64, i32, i32, i32 }
%"class.__gnu_pbds::priority_queue" = type { ptr, %"class.__gnu_pbds::detail::pairing_heap" }
%"class.__gnu_pbds::detail::pairing_heap" = type { %"class.__gnu_pbds::detail::left_child_next_sibling_heap" }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap" = type { ptr, i64 }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_" = type { ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_" = type { %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_" }

@n = external dso_local local_unnamed_addr global i32, align 4
@edge = external dso_local global [444444 x %struct.Edge], align 16
@head = external dso_local local_unnamed_addr global [3333 x i32], align 16
@dist = external dso_local global [3333 x i32], align 16
@pq = external dso_local global %"class.__gnu_pbds::priority_queue", align 8
@pqIterator = external dso_local global [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z6findSTRiS_(ptr nocapture noundef nonnull align 4 dereferenceable(4) %0, ptr nocapture noundef nonnull align 4 dereferenceable(4) %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_", align 8
  %7 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_", align 8
  %8 = alloca %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_", align 8
  %9 = alloca %"struct.std::pair", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not14 = icmp slt i32 %10, 1
  br i1 %.not14, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %24, %2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %11 = call noundef i64 @_ZNK10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %12 = icmp ugt i64 %11, 1
  br i1 %12, label %.lr.ph22, label %._crit_edge23

.lr.ph:                                           ; preds = %2, %24
  %13 = phi i32 [ %25, %24 ], [ %10, %2 ]
  %storemerge15 = phi i32 [ %27, %24 ], [ 1, %2 ]
  %14 = sext i32 %storemerge15 to i64
  %15 = getelementptr inbounds [3333 x i32], ptr @head, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %.not13 = icmp eq i32 %16, -2
  br i1 %.not13, label %24, label %17

17:                                               ; preds = %.lr.ph
  %18 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %14
  store i32 0, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %19 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %18, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 %19, ptr %5, align 8
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE4pushERKS3_(ptr dead_on_unwind nonnull writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8), ptr noundef nonnull align 4 dereferenceable(8) %5)
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %21
  %23 = load i64, ptr %4, align 8, !tbaa !9
  store i64 %23, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %.lr.ph, %17
  %25 = phi i32 [ %13, %.lr.ph ], [ %.pre, %17 ]
  %26 = phi i32 [ %storemerge15, %.lr.ph ], [ %20, %17 ]
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %3, align 4, !tbaa !5
  %.not.not = icmp slt i32 %26, %25
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.loopexit:                                        ; preds = %57, %.lr.ph22
  %28 = call noundef i64 @_ZNK10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %29 = icmp ugt i64 %28, 1
  br i1 %29, label %.lr.ph22, label %._crit_edge23, !llvm.loop !13

.lr.ph22:                                         ; preds = %._crit_edge, %.loopexit
  %30 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3topEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !14
  store i32 %32, ptr %0, align 4, !tbaa !5
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3popEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %33 = load i32, ptr %0, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %34
  %36 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %36, ptr %35, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %37 = getelementptr inbounds [3333 x i32], ptr @head, i64 0, i64 %34
  %.016 = load i32, ptr %37, align 4, !tbaa !5
  %.not1217 = icmp eq i32 %.016, -1
  br i1 %.not1217, label %.loopexit, label %.lr.ph20

.lr.ph20:                                         ; preds = %.lr.ph22, %57
  %.018 = phi i32 [ %.0, %57 ], [ %.016, %.lr.ph22 ]
  %38 = sext i32 %.018 to i64
  %39 = getelementptr inbounds [444444 x %struct.Edge], ptr @edge, i64 0, i64 %38
  %40 = getelementptr inbounds i8, ptr %39, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !16
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind nonnull writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %44 = call noundef zeroext i1 @_ZNK10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EneERKS8_(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br i1 %44, label %45, label %57

45:                                               ; preds = %.lr.ph20
  %46 = load i32, ptr %40, align 8, !tbaa !16
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [3333 x %"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_"], ptr @pqIterator, i64 0, i64 %47
  call void @_ZN10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EC2ERKS8_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %48)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %49 = load i64, ptr %39, align 8, !tbaa !19
  %50 = load i32, ptr %40, align 8, !tbaa !16
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = trunc i64 %49 to i32
  %55 = add i32 %53, %54
  store i32 %55, ptr %52, align 4, !tbaa !5
  %56 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %52, ptr noundef nonnull align 4 dereferenceable(4) %40)
  store i64 %56, ptr %9, align 8
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE6modifyENS0_55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_IS3_NS_9null_typeES6_EES6_EERKS3_(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8), ptr noundef nonnull %8, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br label %57

57:                                               ; preds = %.lr.ph20, %45
  %58 = getelementptr inbounds i8, ptr %39, i64 12
  %.0 = load i32, ptr %58, align 4, !tbaa !5
  %.not12 = icmp eq i32 %.0, -1
  br i1 %.not12, label %.loopexit, label %.lr.ph20, !llvm.loop !20

._crit_edge23:                                    ; preds = %.loopexit, %._crit_edge
  %59 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3topEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = load i32, ptr %60, align 4, !tbaa !14
  store i32 %61, ptr %1, align 4, !tbaa !5
  call void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3popEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @pq, i64 8))
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [3333 x i32], ptr @dist, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  ret i32 %65
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE4pushERKS3_(ptr dead_on_unwind noalias writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_node_point_const_iterator_") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

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

; 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 noundef i64 @_ZNK10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNK10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3topEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds6detail12pairing_heapISt4pairIiiESt4lessIS3_ESaIcEE3popEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10__gnu_pbds6detail28left_child_next_sibling_heapISt4pairIiiESt4lessIS3_ENS_9null_typeESaIcEE3endEv(ptr dead_on_unwind noalias writable sret(%"class.__gnu_pbds::detail::left_child_next_sibling_heap_const_iterator_") align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EneERKS8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10__gnu_pbds6detail55left_child_next_sibling_heap_node_point_const_iterator_INS0_34left_child_next_sibling_heap_node_ISt4pairIiiENS_9null_typeESaIcEEES6_EC2ERKS8_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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 = { 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 #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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass