; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Good Bye 2014/Problem D (D)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.0" = type { i32, %"struct.std::pair" }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@sz = external dso_local global [100100 x i32], align 16
@r = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@g = external dso_local global [100100 x %"class.std::vector"], align 16
@edges = external dso_local global [100100 x %"struct.std::pair.0"], align 16
@ans = external dso_local global x86_fp80, align 16
@ways = external dso_local global [100100 x x86_fp80], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z5countxx(i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 4
  %4 = alloca %"struct.std::pair", align 4
  %5 = alloca %"struct.std::pair.0", align 4
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca { i64, i32 }, align 8
  %8 = alloca i32, align 4
  %9 = alloca x86_fp80, align 16
  %10 = alloca x86_fp80, align 16
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %33, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, 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) #8
  br label %36

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @a, ptr noundef @b, ptr noundef @l)
  %19 = load i32, ptr @a, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %22 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @b, ptr noundef nonnull align 4 dereferenceable(4) @l)
  store i64 %22, ptr %3, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  %23 = load i32, ptr @b, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %26 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @l)
  store i64 %26, ptr %4, align 4
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %27 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @b)
  store i64 %27, ptr %6, align 4
  %28 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) @l, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store { i64, i32 } %28, ptr %7, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 8 %7, i64 12, i1 false)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %30
  %32 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIiS_IiiEEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12) %31, ptr noundef nonnull align 4 dereferenceable(12) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #8
  br label %33

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

36:                                               ; preds = %16
  %37 = call noundef i32 @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %88, %36
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %91

43:                                               ; preds = %38
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %45
  %47 = getelementptr inbounds %"struct.std::pair.0", ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds %"struct.std::pair", ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 4, !tbaa !11
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr @a, align 4, !tbaa !5
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %54
  %56 = getelementptr inbounds %"struct.std::pair.0", ptr %55, i32 0, i32 1
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i32 0, i32 1
  %58 = load i32, ptr %57, align 4, !tbaa !14
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  store i32 %61, ptr @b, align 4, !tbaa !5
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @b)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  store i32 %63, ptr @a, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = load i32, ptr @a, align 4, !tbaa !5
  %66 = sub nsw i32 %64, %65
  store i32 %66, ptr @b, align 4, !tbaa !5
  %67 = load i32, ptr @a, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = load i32, ptr @b, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = call noundef x86_fp80 @_Z5countxx(i64 noundef %68, i64 noundef %70)
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100100 x x86_fp80], ptr @ways, i64 0, i64 %73
  store x86_fp80 %71, ptr %74, align 16, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %75 = load i32, ptr %8, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %76
  %78 = getelementptr inbounds %"struct.std::pair.0", ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !17
  %80 = sitofp i32 %79 to x86_fp80
  store x86_fp80 %80, ptr %9, align 16, !tbaa !15
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100100 x x86_fp80], ptr @ways, i64 0, i64 %82
  %84 = load x86_fp80, ptr %83, align 16, !tbaa !15
  %85 = load x86_fp80, ptr %9, align 16, !tbaa !15
  %86 = load x86_fp80, ptr @ans, align 16, !tbaa !15
  %87 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %84, x86_fp80 %85, x86_fp80 %86)
  store x86_fp80 %87, ptr @ans, align 16, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  br label %88

88:                                               ; preds = %43
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %8, align 4, !tbaa !5
  br label %38, !llvm.loop !18

91:                                               ; preds = %42
  %92 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @q)
  br label %93

93:                                               ; preds = %97, %91
  %94 = load i32, ptr @q, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr @q, align 4, !tbaa !5
  %96 = icmp ne i32 %94, 0
  br i1 %96, label %97, label %124

97:                                               ; preds = %93
  %98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef @r, ptr noundef @w)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  %99 = load i32, ptr @r, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %100
  %102 = getelementptr inbounds %"struct.std::pair.0", ptr %101, i32 0, i32 0
  %103 = load i32, ptr %102, align 4, !tbaa !17
  %104 = load i32, ptr @w, align 4, !tbaa !5
  %105 = sub nsw i32 %103, %104
  %106 = sitofp i32 %105 to x86_fp80
  store x86_fp80 %106, ptr %10, align 16, !tbaa !15
  %107 = load i32, ptr @w, align 4, !tbaa !5
  %108 = load i32, ptr @r, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %109
  %111 = getelementptr inbounds %"struct.std::pair.0", ptr %110, i32 0, i32 0
  store i32 %107, ptr %111, align 4, !tbaa !17
  %112 = load i32, ptr @r, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100100 x x86_fp80], ptr @ways, i64 0, i64 %113
  %115 = load x86_fp80, ptr %114, align 16, !tbaa !15
  %116 = load x86_fp80, ptr %10, align 16, !tbaa !15
  %117 = load x86_fp80, ptr @ans, align 16, !tbaa !15
  %118 = fneg x86_fp80 %115
  %119 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %118, x86_fp80 %116, x86_fp80 %117)
  store x86_fp80 %119, ptr @ans, align 16, !tbaa !15
  %120 = load x86_fp80, ptr @ans, align 16, !tbaa !15
  %121 = fptrunc x86_fp80 %120 to double
  %122 = fmul double %121, 1.200000e+01
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %122)
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  br label %93, !llvm.loop !19

124:                                              ; preds = %93
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #0 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: mustprogress uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(8)) #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) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIiS_IiiEEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #2 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #7

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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, !6, i64 4}
!12 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !13, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"long double", !7, i64 0}
!17 = !{!12, !6, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair.0" = type { i32, %"struct.std::pair" }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@sz = external dso_local local_unnamed_addr global [100100 x i32], align 16
@r = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@g = external dso_local global [100100 x %"class.std::vector"], align 16
@edges = external dso_local global [100100 x %"struct.std::pair.0"], align 16
@ans = external dso_local local_unnamed_addr global x86_fp80, align 16
@ways = external dso_local local_unnamed_addr global [100100 x x86_fp80], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfsii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z5countxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 1
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  br label %11

._crit_edge:                                      ; preds = %11, %0
  %8 = call noundef i32 @_Z3dfsii(i32 noundef 1, i32 noundef -1)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %.lr.ph16, label %._crit_edge17

11:                                               ; preds = %.lr.ph, %11
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %11 ]
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @l)
  %13 = load i32, ptr @a, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %16 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @b, ptr noundef nonnull align 4 dereferenceable(4) @l)
  store i64 %16, ptr %1, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %17 = load i32, ptr @b, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %20 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @l)
  store i64 %20, ptr %2, align 8
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %21 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @b)
  store i64 %21, ptr %4, align 8
  %22 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) @l, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %.fca.0.extract = extractvalue { i64, i32 } %22, 0
  %.fca.1.extract = extractvalue { i64, i32 } %22, 1
  store i64 %.fca.0.extract, ptr %3, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %23 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %indvars.iv
  %24 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIiS_IiiEEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12) %23, ptr noundef nonnull align 4 dereferenceable(12) %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %11, label %._crit_edge, !llvm.loop !9

._crit_edge17:                                    ; preds = %.lr.ph16, %._crit_edge
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
  %29 = load i32, ptr @q, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr @q, align 4, !tbaa !5
  %.not18 = icmp eq i32 %29, 0
  br i1 %.not18, label %._crit_edge21, label %.lr.ph20

.lr.ph16:                                         ; preds = %._crit_edge, %.lr.ph16
  %indvars.iv23 = phi i64 [ %indvars.iv.next24, %.lr.ph16 ], [ 1, %._crit_edge ]
  %31 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %indvars.iv23
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  store i32 %36, ptr @a, align 4, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %31, i64 8
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100100 x i32], ptr @sz, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  store i32 %41, ptr @b, align 4, !tbaa !5
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(4) @b)
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr @a, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = sub nsw i32 %44, %43
  store i32 %45, ptr @b, align 4, !tbaa !5
  %46 = sext i32 %43 to i64
  %47 = sext i32 %45 to i64
  %48 = call noundef x86_fp80 @_Z5countxx(i64 noundef %46, i64 noundef %47)
  %49 = getelementptr inbounds [100100 x x86_fp80], ptr @ways, i64 0, i64 %indvars.iv23
  store x86_fp80 %48, ptr %49, align 16, !tbaa !15
  %50 = load i32, ptr %31, align 4, !tbaa !17
  %51 = sitofp i32 %50 to x86_fp80
  %52 = load x86_fp80, ptr @ans, align 16, !tbaa !15
  %53 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %48, x86_fp80 %51, x86_fp80 %52)
  store x86_fp80 %53, ptr @ans, align 16, !tbaa !15
  %indvars.iv.next24 = add nuw nsw i64 %indvars.iv23, 1
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next24, %55
  br i1 %56, label %.lr.ph16, label %._crit_edge17, !llvm.loop !18

.lr.ph20:                                         ; preds = %._crit_edge17, %.lr.ph20
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull @r, ptr noundef nonnull @w)
  %58 = load i32, ptr @r, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100100 x %"struct.std::pair.0"], ptr @edges, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !17
  %62 = load i32, ptr @w, align 4, !tbaa !5
  %63 = sub nsw i32 %61, %62
  %64 = sitofp i32 %63 to x86_fp80
  store i32 %62, ptr %60, align 4, !tbaa !17
  %65 = getelementptr inbounds [100100 x x86_fp80], ptr @ways, i64 0, i64 %59
  %66 = load x86_fp80, ptr %65, align 16, !tbaa !15
  %67 = load x86_fp80, ptr @ans, align 16, !tbaa !15
  %68 = fneg x86_fp80 %66
  %69 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %68, x86_fp80 %64, x86_fp80 %67)
  store x86_fp80 %69, ptr @ans, align 16, !tbaa !15
  %70 = fptrunc x86_fp80 %69 to double
  %71 = fmul double %70, 1.200000e+01
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, double noundef %71)
  %73 = load i32, ptr @q, align 4, !tbaa !5
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr @q, align 4, !tbaa !5
  %.not = icmp eq i32 %73, 0
  br i1 %.not, label %._crit_edge21, label %.lr.ph20, !llvm.loop !19

._crit_edge21:                                    ; preds = %.lr.ph20, %._crit_edge17
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0 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 uwtable
declare dso_local { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt4pairIiS_IiiEEaSEOS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #6

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { mustprogress 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, !6, i64 4}
!12 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !13, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!12, !6, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"long double", !7, i64 0}
!17 = !{!12, !6, i64 0}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass