; LLVM IR from Tunghohin/Competitive_Coding :: Daimayuan/295_NJ2021_H.ll (Z3dfsii)

; 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 { i32, i32 }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>

@val = external dso_local global [100010 x i64], align 16
@ti = external dso_local global [100010 x i32], align 16
@f = external dso_local global [100010 x i64], align 16
@h = external dso_local global [100010 x i64], align 16
@e = external dso_local global [200020 x %struct.edge], align 16
@head = external dso_local global [100010 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsii(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i64, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100010 x i32], ptr @head, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  store i32 %25, ptr %7, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %57, %2
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %63

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.edge, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !11
  store i32 %35, ptr %9, align 4, !tbaa !5
  %36 = load i32, ptr %9, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = icmp eq i32 %36, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %30
  store i32 4, ptr %8, align 4
  br label %54

40:                                               ; preds = %30
  %41 = load i32, ptr %9, align 4, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %41, i32 noundef %42)
  %43 = load i32, ptr %9, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = load i64, ptr %5, align 8, !tbaa !9
  %48 = add nsw i64 %47, %46
  store i64 %48, ptr %5, align 8, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %50
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %51)
  %53 = load i64, ptr %52, align 8, !tbaa !9
  store i64 %53, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %8, align 4
  br label %54

54:                                               ; preds = %40, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %55 = load i32, ptr %8, align 4
  switch i32 %55, label %187 [
    i32 0, label %56
    i32 4, label %57
  ]

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56, %54
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %59
  %61 = getelementptr inbounds %struct.edge, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !13
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %26, !llvm.loop !14

63:                                               ; preds = %29
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = load i64, ptr %5, align 8, !tbaa !9
  %66 = add nsw i64 %64, %65
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %68
  store i64 %66, ptr %69, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 -1061109567, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1061109567, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %15)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i32], ptr @head, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  store i32 %73, ptr %16, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %108, %63
  %75 = load i32, ptr %16, align 4, !tbaa !5
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %78, label %77

77:                                               ; preds = %74
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %114

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %79 = load i32, ptr %16, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %80
  %82 = getelementptr inbounds %struct.edge, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 8, !tbaa !11
  store i32 %83, ptr %17, align 4, !tbaa !5
  %84 = load i32, ptr %17, align 4, !tbaa !5
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = icmp eq i32 %84, %85
  br i1 %86, label %93, label %87

87:                                               ; preds = %78
  %88 = load i32, ptr %17, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100010 x i32], ptr @ti, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp ne i32 %91, 3
  br i1 %92, label %93, label %94

93:                                               ; preds = %87, %78
  store i32 7, ptr %8, align 4
  br label %105

94:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %95 = load i32, ptr %17, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %96
  call void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12) %18, ptr noundef nonnull align 8 dereferenceable(8) %97, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %98 = call noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12) %18, ptr noundef nonnull align 8 dereferenceable(12) %13)
  br i1 %98, label %99, label %101

99:                                               ; preds = %94
  %100 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt4pairIxiEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(12) %18)
  br label %101

101:                                              ; preds = %99, %94
  %102 = call noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(12) %10)
  br i1 %102, label %103, label %104

103:                                              ; preds = %101
  call void @_ZSt4swapIxiENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef nonnull align 8 dereferenceable(12) %10) #5
  br label %104

104:                                              ; preds = %103, %101
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  store i32 0, ptr %8, align 4
  br label %105

105:                                              ; preds = %104, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  %106 = load i32, ptr %8, align 4
  switch i32 %106, label %187 [
    i32 0, label %107
    i32 7, label %108
  ]

107:                                              ; preds = %105
  br label %108

108:                                              ; preds = %107, %105
  %109 = load i32, ptr %16, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.edge, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !13
  store i32 %113, ptr %16, align 4, !tbaa !5
  br label %74, !llvm.loop !16

114:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %115 = load i32, ptr %3, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100010 x i32], ptr @head, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  store i32 %118, ptr %19, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %171, %114
  %120 = load i32, ptr %19, align 4, !tbaa !5
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %123, label %122

122:                                              ; preds = %119
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %177

123:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %124 = load i32, ptr %19, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.edge, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %127, align 8, !tbaa !11
  store i32 %128, ptr %20, align 4, !tbaa !5
  %129 = load i32, ptr %20, align 4, !tbaa !5
  %130 = load i32, ptr %4, align 4, !tbaa !5
  %131 = icmp eq i32 %129, %130
  br i1 %131, label %132, label %133

132:                                              ; preds = %123
  store i32 10, ptr %8, align 4
  br label %168

133:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %134 = load i64, ptr %5, align 8, !tbaa !9
  %135 = load i32, ptr %20, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100010 x i64], ptr @h, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !9
  %139 = add nsw i64 %134, %138
  %140 = load i32, ptr %20, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !9
  %144 = sub nsw i64 %139, %143
  store i64 %144, ptr %21, align 8, !tbaa !9
  %145 = load i32, ptr %20, align 4, !tbaa !5
  %146 = getelementptr inbounds %"struct.std::pair", ptr %10, i32 0, i32 1
  %147 = load i32, ptr %146, align 8, !tbaa !17
  %148 = icmp eq i32 %145, %147
  br i1 %148, label %149, label %154

149:                                              ; preds = %133
  %150 = getelementptr inbounds %"struct.std::pair", ptr %13, i32 0, i32 0
  %151 = load i64, ptr %150, align 8, !tbaa !19
  %152 = load i64, ptr %21, align 8, !tbaa !9
  %153 = add nsw i64 %152, %151
  store i64 %153, ptr %21, align 8, !tbaa !9
  br label %159

154:                                              ; preds = %133
  %155 = getelementptr inbounds %"struct.std::pair", ptr %10, i32 0, i32 0
  %156 = load i64, ptr %155, align 8, !tbaa !19
  %157 = load i64, ptr %21, align 8, !tbaa !9
  %158 = add nsw i64 %157, %156
  store i64 %158, ptr %21, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %154, %149
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %161
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %162, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %164 = load i64, ptr %163, align 8, !tbaa !9
  %165 = load i32, ptr %3, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %166
  store i64 %164, ptr %167, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  store i32 0, ptr %8, align 4
  br label %168

168:                                              ; preds = %159, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  %169 = load i32, ptr %8, align 4
  switch i32 %169, label %187 [
    i32 0, label %170
    i32 10, label %171
  ]

170:                                              ; preds = %168
  br label %171

171:                                              ; preds = %170, %168
  %172 = load i32, ptr %19, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %173
  %175 = getelementptr inbounds %struct.edge, ptr %174, i32 0, i32 1
  %176 = load i32, ptr %175, align 4, !tbaa !13
  store i32 %176, ptr %19, align 4, !tbaa !5
  br label %119, !llvm.loop !20

177:                                              ; preds = %122
  %178 = load i64, ptr %5, align 8, !tbaa !9
  %179 = load i32, ptr %3, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !9
  %183 = add nsw i64 %178, %182
  %184 = load i32, ptr %3, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100010 x i64], ptr @h, i64 0, i64 %185
  store i64 %183, ptr %186, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret void

187:                                              ; preds = %168, %105, %54
  unreachable
}

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; 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 void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxiENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) #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 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 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 = { 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 #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 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS4edge", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!18, !6, i64 8}
!18 = !{!"_ZTSSt4pairIxiE", !10, i64 0, !6, i64 8}
!19 = !{!18, !10, i64 0}
!20 = distinct !{!20, !15}


; 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 { i32, i32 }
%"struct.std::pair" = type <{ i64, i32, [4 x i8] }>

@val = external dso_local global [100010 x i64], align 16
@ti = external dso_local local_unnamed_addr global [100010 x i32], align 16
@f = external dso_local global [100010 x i64], align 16
@h = external dso_local local_unnamed_addr global [100010 x i64], align 16
@e = external dso_local local_unnamed_addr global [200020 x %struct.edge], align 16
@head = external dso_local local_unnamed_addr global [100010 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i64 0, ptr %3, align 8, !tbaa !5
  %13 = sext i32 %0 to i64
  %14 = getelementptr inbounds [100010 x i32], ptr @head, i64 0, i64 %13
  %.03543 = load i32, ptr %14, align 4, !tbaa !9
  %.not44 = icmp eq i32 %.03543, 0
  br i1 %.not44, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %31, %2
  %15 = phi i64 [ 0, %2 ], [ %32, %31 ]
  %.0.lcssa = phi i64 [ 0, %2 ], [ %.1, %31 ]
  %16 = add nsw i64 %15, %.0.lcssa
  %17 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %13
  store i64 %16, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 -1061109567, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  store i32 -1061109567, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  %.03447 = load i32, ptr %14, align 4, !tbaa !9
  %.not3948 = icmp eq i32 %.03447, 0
  br i1 %.not3948, label %._crit_edge56, label %.lr.ph51

.lr.ph:                                           ; preds = %2, %31
  %18 = phi i64 [ %32, %31 ], [ 0, %2 ]
  %.03546 = phi i32 [ %.035, %31 ], [ %.03543, %2 ]
  %.045 = phi i64 [ %.1, %31 ], [ 0, %2 ]
  %19 = sext i32 %.03546 to i64
  %20 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %19
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = icmp eq i32 %21, %1
  br i1 %22, label %31, label %23

23:                                               ; preds = %.lr.ph
  call void @_Z3dfsii(i32 noundef %21, i32 noundef %0)
  %24 = sext i32 %21 to i64
  %25 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = add nsw i64 %26, %.045
  %28 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %24
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %29, align 8, !tbaa !5
  store i64 %30, ptr %3, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %.lr.ph, %23
  %32 = phi i64 [ %30, %23 ], [ %18, %.lr.ph ]
  %.1 = phi i64 [ %27, %23 ], [ %.045, %.lr.ph ]
  %33 = getelementptr inbounds i8, ptr %20, i64 4
  %.035 = load i32, ptr %33, align 4, !tbaa !9
  %.not = icmp eq i32 %.035, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader:                                       ; preds = %52
  %.03352.pre = load i32, ptr %14, align 4, !tbaa !9
  %.not4053 = icmp eq i32 %.03352.pre, 0
  br i1 %.not4053, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %.preheader
  %34 = getelementptr inbounds i8, ptr %4, i64 8
  br label %58

.lr.ph51:                                         ; preds = %._crit_edge, %52
  %.03449 = phi i32 [ %.034, %52 ], [ %.03447, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %35 = sext i32 %.03449 to i64
  %36 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %35
  %37 = load i32, ptr %36, align 8, !tbaa !11
  store i32 %37, ptr %10, align 4, !tbaa !9
  %38 = icmp eq i32 %37, %1
  br i1 %38, label %52, label %39

39:                                               ; preds = %.lr.ph51
  %40 = sext i32 %37 to i64
  %41 = getelementptr inbounds [100010 x i32], ptr @ti, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %.not41 = icmp eq i32 %42, 3
  br i1 %.not41, label %43, label %52

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #5
  %44 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %40
  call void @_ZNSt4pairIxiEC2IRxRiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS5_S6_EEEbE4typeELb1EEEOS5_OS6_(ptr noundef nonnull align 8 dereferenceable(12) %11, ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %45 = call noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12) %11, ptr noundef nonnull align 8 dereferenceable(12) %7)
  br i1 %45, label %46, label %48

46:                                               ; preds = %43
  %47 = call noundef nonnull align 8 dereferenceable(12) ptr @_ZNSt4pairIxiEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 8 dereferenceable(12) %11)
  br label %48

48:                                               ; preds = %46, %43
  %49 = call noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 8 dereferenceable(12) %4)
  br i1 %49, label %50, label %51

50:                                               ; preds = %48
  call void @_ZSt4swapIxiENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 8 dereferenceable(12) %4) #5
  br label %51

51:                                               ; preds = %50, %48
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #5
  br label %52

52:                                               ; preds = %.lr.ph51, %39, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  %53 = getelementptr inbounds i8, ptr %36, i64 4
  %.034 = load i32, ptr %53, align 4, !tbaa !9
  %.not39 = icmp eq i32 %.034, 0
  br i1 %.not39, label %.preheader, label %.lr.ph51, !llvm.loop !15

._crit_edge56:                                    ; preds = %75, %._crit_edge, %.preheader
  %54 = getelementptr inbounds [100010 x i64], ptr @val, i64 0, i64 %13
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = add nsw i64 %55, %.0.lcssa
  %57 = getelementptr inbounds [100010 x i64], ptr @h, i64 0, i64 %13
  store i64 %56, ptr %57, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret void

58:                                               ; preds = %.lr.ph55, %75
  %.03354 = phi i32 [ %.03352.pre, %.lr.ph55 ], [ %.033, %75 ]
  %59 = sext i32 %.03354 to i64
  %60 = getelementptr inbounds [200020 x %struct.edge], ptr @e, i64 0, i64 %59
  %61 = load i32, ptr %60, align 8, !tbaa !11
  %62 = icmp eq i32 %61, %1
  br i1 %62, label %75, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #5
  %64 = sext i32 %61 to i64
  %65 = getelementptr inbounds [100010 x i64], ptr @h, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %67 = add nsw i64 %66, %.0.lcssa
  %68 = getelementptr inbounds [100010 x i64], ptr @f, i64 0, i64 %64
  %69 = load i64, ptr %68, align 8, !tbaa !5
  %70 = sub i64 %67, %69
  %71 = load i32, ptr %34, align 8, !tbaa !16
  %72 = icmp eq i32 %61, %71
  %.val = load i64, ptr %7, align 8
  %.val42 = load i64, ptr %4, align 8
  %.pn = select i1 %72, i64 %.val, i64 %.val42
  %storemerge = add nsw i64 %.pn, %70
  store i64 %storemerge, ptr %12, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %74 = load i64, ptr %73, align 8, !tbaa !5
  store i64 %74, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #5
  br label %75

75:                                               ; preds = %58, %63
  %76 = getelementptr inbounds i8, ptr %60, i64 4
  %.033 = load i32, ptr %76, align 4, !tbaa !9
  %.not40 = icmp eq i32 %.033, 0
  br i1 %.not40, label %._crit_edge56, label %58, !llvm.loop !18
}

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; 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 void @_ZNSt4pairIxiEC2IiiTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS3_S4_EEEbE4typeELb1EEEOS3_OS4_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZStgtIxiEbRKSt4pairIT_T0_ES5_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxiENSt9enable_ifIXsr6__and_ISt14__is_swappableIT_ES1_IT0_EEE5valueEvE4typeERSt4pairIS2_S4_ESA_(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #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 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 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 = { 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 #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 = !{!"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 = !{!12, !10, i64 0}
!12 = !{!"_ZTS4edge", !10, i64 0, !10, i64 4}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !10, i64 8}
!17 = !{!"_ZTSSt4pairIxiE", !6, i64 0, !10, i64 8}
!18 = distinct !{!18, !14}


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