; LLVM IR from lzyrapx/Competitive-Programming :: Xiangtan Invitation Contest 2017 (1266(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"

%struct.node = type { i64, i64 }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@l = external dso_local global [100010 x i64], align 16
@cost = external dso_local global [100010 x i64], align 16
@c = external dso_local global i8, align 1
@p = external dso_local global %struct.node, align 8
@que = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  br label %9

9:                                                ; preds = %119, %0
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %11 = xor i32 %10, -1
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %122

13:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %14

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

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %54

19:                                               ; preds = %14
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %21
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %22, ptr noundef @c, ptr noundef %25)
  %27 = load i8, ptr @c, align 1, !tbaa !11
  %28 = sext i8 %27 to i32
  %29 = icmp eq i32 %28, 40
  br i1 %29, label %30, label %50

30:                                               ; preds = %19
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = load i32, ptr %3, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !5
  %39 = mul nsw i64 %34, %38
  %40 = load i64, ptr %2, align 8, !tbaa !5
  %41 = add nsw i64 %40, %39
  store i64 %41, ptr %2, align 8, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = sub nsw i64 0, %45
  %47 = load i32, ptr %3, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %48
  store i64 %46, ptr %49, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %30, %19
  br label %51

51:                                               ; preds = %50
  %52 = load i32, ptr %3, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %3, align 4, !tbaa !9
  br label %14, !llvm.loop !12

54:                                               ; preds = %18
  br label %55

55:                                               ; preds = %58, %54
  %56 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  %57 = xor i1 %56, true
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  br label %55, !llvm.loop !14

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

60:                                               ; preds = %116, %59
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = load i32, ptr @n, align 4, !tbaa !9
  %63 = icmp sle i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %119

65:                                               ; preds = %60
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !5
  store i64 %69, ptr @p, align 8, !tbaa !15
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !5
  store i64 %73, ptr getelementptr inbounds (%struct.node, ptr @p, i32 0, i32 1), align 8, !tbaa !17
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) @que, ptr noundef nonnull align 8 dereferenceable(16) @p)
  %74 = load i32, ptr %7, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = load i64, ptr %5, align 8, !tbaa !5
  %79 = add nsw i64 %78, %77
  store i64 %79, ptr %5, align 8, !tbaa !5
  %80 = load i64, ptr %5, align 8, !tbaa !5
  %81 = add nsw i64 %80, 1
  %82 = sdiv i64 %81, 2
  %83 = load i64, ptr %4, align 8, !tbaa !5
  %84 = sub nsw i64 %82, %83
  store i64 %84, ptr %6, align 8, !tbaa !5
  %85 = load i64, ptr %5, align 8, !tbaa !5
  %86 = add nsw i64 %85, 1
  %87 = sdiv i64 %86, 2
  store i64 %87, ptr %4, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %114, %65
  %89 = load i64, ptr %6, align 8, !tbaa !5
  %90 = icmp sgt i64 %89, 0
  br i1 %90, label %91, label %94

91:                                               ; preds = %88
  %92 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  %93 = xor i1 %92, true
  br label %94

94:                                               ; preds = %91, %88
  %95 = phi i1 [ false, %88 ], [ %93, %91 ]
  br i1 %95, label %96, label %115

96:                                               ; preds = %94
  %97 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @p, ptr align 8 %97, i64 16, i1 false), !tbaa.struct !18
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @p, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %99 = load i64, ptr %98, align 8, !tbaa !5
  store i64 %99, ptr %8, align 8, !tbaa !5
  %100 = load i64, ptr %8, align 8, !tbaa !5
  %101 = load i64, ptr %6, align 8, !tbaa !5
  %102 = sub nsw i64 %101, %100
  store i64 %102, ptr %6, align 8, !tbaa !5
  %103 = load i64, ptr %8, align 8, !tbaa !5
  %104 = load i64, ptr getelementptr inbounds (%struct.node, ptr @p, i32 0, i32 1), align 8, !tbaa !17
  %105 = mul nsw i64 %103, %104
  %106 = load i64, ptr %2, align 8, !tbaa !5
  %107 = add nsw i64 %106, %105
  store i64 %107, ptr %2, align 8, !tbaa !5
  %108 = load i64, ptr %8, align 8, !tbaa !5
  %109 = load i64, ptr @p, align 8, !tbaa !15
  %110 = sub nsw i64 %109, %108
  store i64 %110, ptr @p, align 8, !tbaa !15
  %111 = load i64, ptr @p, align 8, !tbaa !15
  %112 = icmp sgt i64 %111, 0
  br i1 %112, label %113, label %114

113:                                              ; preds = %96
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) @que, ptr noundef nonnull align 8 dereferenceable(16) @p)
  br label %114

114:                                              ; preds = %113, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %88, !llvm.loop !19

115:                                              ; preds = %94
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %7, align 4, !tbaa !9
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %7, align 4, !tbaa !9
  br label %60, !llvm.loop !20

119:                                              ; preds = %64
  %120 = load i64, ptr %2, align 8, !tbaa !5
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %120)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %9, !llvm.loop !21

122:                                              ; preds = %9
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

declare i32 @printf(ptr noundef, ...) #1

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 = { 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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS4node", !6, i64 0, !6, i64 8}
!17 = !{!16, !6, i64 8}
!18 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !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.node = type { i64, i64 }
%"class.std::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl" = type { %"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<node, std::allocator<node>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@l = external dso_local global [100010 x i64], align 16
@cost = external dso_local global [100010 x i64], align 16
@c = external dso_local global i8, align 1
@p = external dso_local global %struct.node, align 8
@que = external dso_local global %"class.std::priority_queue", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not49 = icmp eq i32 %2, -1
  br i1 %.not49, label %._crit_edge50, label %.preheader29

.preheader29:                                     ; preds = %0, %._crit_edge47
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not2730 = icmp slt i32 %3, 1
  br i1 %.not2730, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %16, %.preheader29
  %.0.lcssa = phi i64 [ 0, %.preheader29 ], [ %.1, %16 ]
  %4 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  br i1 %4, label %._crit_edge, label %.lr.ph33

.lr.ph:                                           ; preds = %.preheader29, %16
  %indvars.iv = phi i64 [ %indvars.iv.next, %16 ], [ 1, %.preheader29 ]
  %.032 = phi i64 [ %.1, %16 ], [ 0, %.preheader29 ]
  %5 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %indvars.iv
  %6 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %indvars.iv
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %5, ptr noundef nonnull @c, ptr noundef nonnull %6)
  %8 = load i8, ptr @c, align 1, !tbaa !9
  %9 = icmp eq i8 %8, 40
  br i1 %9, label %10, label %16

10:                                               ; preds = %.lr.ph
  %11 = load i64, ptr %5, align 8, !tbaa !10
  %12 = load i64, ptr %6, align 8, !tbaa !10
  %13 = mul nsw i64 %12, %11
  %14 = add nsw i64 %13, %.032
  %15 = sub nsw i64 0, %12
  store i64 %15, ptr %6, align 8, !tbaa !10
  br label %16

16:                                               ; preds = %.lr.ph, %10
  %.1 = phi i64 [ %14, %10 ], [ %.032, %.lr.ph ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %.not27.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not27.not, label %.lr.ph, label %.preheader, !llvm.loop !12

.lr.ph33:                                         ; preds = %.preheader, %.lr.ph33
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  %19 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  br i1 %19, label %._crit_edge, label %.lr.ph33, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph33, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  store i64 0, ptr %1, align 8, !tbaa !10
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %.not2840 = icmp slt i32 %20, 1
  br i1 %.not2840, label %._crit_edge47, label %.lr.ph46

._crit_edge47:                                    ; preds = %.critedge, %._crit_edge
  %.2.lcssa = phi i64 [ %.0.lcssa, %._crit_edge ], [ %.3.lcssa, %.critedge ]
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.2.lcssa)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not = icmp eq i32 %22, -1
  br i1 %.not, label %._crit_edge50, label %.preheader29, !llvm.loop !15

.lr.ph46:                                         ; preds = %._crit_edge, %.critedge
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %.critedge ], [ 1, %._crit_edge ]
  %.244 = phi i64 [ %.3.lcssa, %.critedge ], [ %.0.lcssa, %._crit_edge ]
  %.02442 = phi i64 [ %28, %.critedge ], [ 0, %._crit_edge ]
  %.02541 = phi i64 [ %30, %.critedge ], [ 0, %._crit_edge ]
  %23 = getelementptr inbounds [100010 x i64], ptr @l, i64 0, i64 %indvars.iv52
  %24 = load i64, ptr %23, align 8, !tbaa !10
  store i64 %24, ptr @p, align 8, !tbaa !16
  %25 = getelementptr inbounds [100010 x i64], ptr @cost, i64 0, i64 %indvars.iv52
  %26 = load i64, ptr %25, align 8, !tbaa !10
  store i64 %26, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !18
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) @que, ptr noundef nonnull align 8 dereferenceable(16) @p)
  %27 = load i64, ptr %23, align 8, !tbaa !10
  %28 = add nsw i64 %27, %.02442
  %29 = add nsw i64 %28, 1
  %30 = sdiv i64 %29, 2
  %31 = sub nsw i64 %30, %.02541
  store i64 %31, ptr %1, align 8, !tbaa !10
  %32 = icmp sgt i64 %31, 0
  br i1 %32, label %.lr.ph36, label %.critedge

.lr.ph36:                                         ; preds = %.lr.ph46, %47
  %.334 = phi i64 [ %42, %47 ], [ %.244, %.lr.ph46 ]
  %33 = call noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  br i1 %33, label %.critedge, label %34

34:                                               ; preds = %.lr.ph36
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3topEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) @p, ptr noundef nonnull align 8 dereferenceable(16) %35, i64 16, i1 false), !tbaa.struct !19
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25) @que)
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @p, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %37 = load i64, ptr %36, align 8, !tbaa !10
  %38 = load i64, ptr %1, align 8, !tbaa !10
  %39 = sub nsw i64 %38, %37
  store i64 %39, ptr %1, align 8, !tbaa !10
  %40 = load i64, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !18
  %41 = mul nsw i64 %40, %37
  %42 = add nsw i64 %41, %.334
  %43 = load i64, ptr @p, align 8, !tbaa !16
  %44 = sub nsw i64 %43, %37
  store i64 %44, ptr @p, align 8, !tbaa !16
  %45 = icmp sgt i64 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %34
  call void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE4pushERKS0_(ptr noundef nonnull align 8 dereferenceable(25) @que, ptr noundef nonnull align 8 dereferenceable(16) @p)
  %.pr.pre = load i64, ptr %1, align 8, !tbaa !10
  br label %47

47:                                               ; preds = %46, %34
  %.pr = phi i64 [ %.pr.pre, %46 ], [ %39, %34 ]
  %48 = icmp sgt i64 %.pr, 0
  br i1 %48, label %.lr.ph36, label %.critedge, !llvm.loop !20

.critedge:                                        ; preds = %47, %.lr.ph36, %.lr.ph46
  %.3.lcssa = phi i64 [ %.244, %.lr.ph46 ], [ %.334, %.lr.ph36 ], [ %42, %47 ]
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %.not28.not = icmp slt i64 %indvars.iv52, %50
  br i1 %.not28.not, label %.lr.ph46, label %._crit_edge47, !llvm.loop !21

._crit_edge50:                                    ; preds = %._crit_edge47, %0
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueI4nodeSt6vectorIS0_SaIS0_EESt4lessIS0_EE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress 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) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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 = { nofree nounwind "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 = { 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 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !11, i64 0}
!17 = !{!"_ZTS4node", !11, i64 0, !11, i64 8}
!18 = !{!17, !11, i64 8}
!19 = !{i64 0, i64 8, !10, i64 8, i64 8, !10}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass