; LLVM IR from ADJA/algos :: Strings/UkkonenSuffixTree.ll (Z9st_inserti)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [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 }
%struct.node = type { i32, i32, i32, i32, i32 }

@pos = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@tree = external dso_local global %"class.std::vector", align 8
@active_e = external dso_local global i32, align 4
@active_node = external dso_local global i32, align 4
@active_len = external dso_local global i32, align 4
@needSL = external dso_local global i32, align 4
@rem = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8add_nodeii(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 void @_Z5addSLi(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11insert_edgeii(i32 noundef, i32 noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9walk_downi(i32 noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9st_inserti(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr @pos, align 4, !tbaa !5
  %9 = add nsw i32 %8, 1
  store i32 %9, ptr @pos, align 4, !tbaa !5
  store i32 0, ptr @needSL, align 4, !tbaa !5
  %10 = load i32, ptr @rem, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr @rem, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %122, %120, %1
  %13 = load i32, ptr @rem, align 4, !tbaa !5
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %123

15:                                               ; preds = %12
  %16 = load i32, ptr @active_len, align 4, !tbaa !5
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = load i32, ptr @pos, align 4, !tbaa !5
  store i32 %19, ptr @active_e, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %18, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %21 = load i32, ptr @active_node, align 4, !tbaa !5
  %22 = call noundef i32 @_Z11active_edgev()
  %23 = call noundef i32 @_Z9find_edgeii(i32 noundef %21, i32 noundef %22)
  store i32 %23, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %32

26:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %27 = load i32, ptr @pos, align 4, !tbaa !5
  %28 = call noundef i32 @_Z8add_nodeii(i32 noundef %27, i32 noundef 1000000000)
  store i32 %28, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @active_node, align 4, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z11insert_edgeii(i32 noundef %29, i32 noundef %30)
  %31 = load i32, ptr @active_node, align 4, !tbaa !5
  call void @_Z5addSLi(i32 noundef %31)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %89

32:                                               ; preds = %20
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = call noundef zeroext i1 @_Z9walk_downi(i32 noundef %33)
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  store i32 2, ptr %5, align 4
  br label %120, !llvm.loop !9

36:                                               ; preds = %32
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %38) #3
  %40 = getelementptr inbounds %struct.node, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = load i32, ptr @active_len, align 4, !tbaa !5
  %43 = add nsw i32 %41, %42
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %44)
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = sext i8 %46 to i32
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %50, label %54

50:                                               ; preds = %36
  %51 = load i32, ptr @active_len, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr @active_len, align 4, !tbaa !5
  %53 = load i32, ptr @active_node, align 4, !tbaa !5
  call void @_Z5addSLi(i32 noundef %53)
  store i32 3, ptr %5, align 4
  br label %120

54:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %56) #3
  %58 = getelementptr inbounds %struct.node, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !11
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %61) #3
  %63 = getelementptr inbounds %struct.node, ptr %62, i32 0, i32 0
  %64 = load i32, ptr %63, align 4, !tbaa !11
  %65 = load i32, ptr @active_len, align 4, !tbaa !5
  %66 = add nsw i32 %64, %65
  %67 = call noundef i32 @_Z8add_nodeii(i32 noundef %59, i32 noundef %66)
  store i32 %67, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %68 = load i32, ptr @pos, align 4, !tbaa !5
  %69 = call noundef i32 @_Z8add_nodeii(i32 noundef %68, i32 noundef 1000000000)
  store i32 %69, ptr %7, align 4, !tbaa !5
  %70 = load i32, ptr @active_node, align 4, !tbaa !5
  %71 = call noundef i32 @_Z11active_edgev()
  %72 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z11change_edgeiii(i32 noundef %70, i32 noundef %71, i32 noundef %72)
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z11insert_edgeii(i32 noundef %73, i32 noundef %74)
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z11insert_edgeii(i32 noundef %75, i32 noundef %76)
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %78) #3
  %80 = getelementptr inbounds %struct.node, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %80, align 4, !tbaa !11
  %82 = load i32, ptr @active_len, align 4, !tbaa !5
  %83 = add nsw i32 %81, %82
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %85) #3
  %87 = getelementptr inbounds %struct.node, ptr %86, i32 0, i32 0
  store i32 %83, ptr %87, align 4, !tbaa !11
  %88 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z5addSLi(i32 noundef %88)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %89

89:                                               ; preds = %54, %26
  %90 = load i32, ptr @rem, align 4, !tbaa !5
  %91 = add nsw i32 %90, -1
  store i32 %91, ptr @rem, align 4, !tbaa !5
  %92 = load i32, ptr @active_node, align 4, !tbaa !5
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %104

94:                                               ; preds = %89
  %95 = load i32, ptr @active_len, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %104

97:                                               ; preds = %94
  %98 = load i32, ptr @active_len, align 4, !tbaa !5
  %99 = add nsw i32 %98, -1
  store i32 %99, ptr @active_len, align 4, !tbaa !5
  %100 = load i32, ptr @pos, align 4, !tbaa !5
  %101 = load i32, ptr @rem, align 4, !tbaa !5
  %102 = sub nsw i32 %100, %101
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr @active_e, align 4, !tbaa !5
  br label %119

104:                                              ; preds = %94, %89
  %105 = load i32, ptr @active_node, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %106) #3
  %108 = getelementptr inbounds %struct.node, ptr %107, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !14
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %117

111:                                              ; preds = %104
  %112 = load i32, ptr @active_node, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %113) #3
  %115 = getelementptr inbounds %struct.node, ptr %114, i32 0, i32 2
  %116 = load i32, ptr %115, align 4, !tbaa !14
  store i32 %116, ptr @active_node, align 4, !tbaa !5
  br label %118

117:                                              ; preds = %104
  store i32 1, ptr @active_node, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %117, %111
  br label %119

119:                                              ; preds = %118, %97
  store i32 0, ptr %5, align 4
  br label %120

120:                                              ; preds = %119, %50, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %121 = load i32, ptr %5, align 4
  switch i32 %121, label %124 [
    i32 0, label %122
    i32 2, label %12
    i32 3, label %123
  ]

122:                                              ; preds = %120
  br label %12, !llvm.loop !9

123:                                              ; preds = %120, %12
  ret void

124:                                              ; preds = %120
  unreachable
}

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 = { 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 0}
!12 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = !{!7, !7, i64 0}
!14 = !{!12, !6, i64 8}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [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 }

@pos = external dso_local local_unnamed_addr global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@tree = external dso_local global %"class.std::vector", align 8
@active_e = external dso_local local_unnamed_addr global i32, align 4
@active_node = external dso_local local_unnamed_addr global i32, align 4
@active_len = external dso_local local_unnamed_addr global i32, align 4
@needSL = external dso_local local_unnamed_addr global i32, align 4
@rem = external dso_local local_unnamed_addr global i32, align 4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5addSLi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11insert_edgeii(i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z9walk_downi(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9st_inserti(i32 noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @pos, align 4, !tbaa !5
  %3 = add nsw i32 %2, 1
  store i32 %3, ptr @pos, align 4, !tbaa !5
  store i32 0, ptr @needSL, align 4, !tbaa !5
  %4 = load i32, ptr @rem, align 4, !tbaa !5
  %5 = add nsw i32 %4, 1
  store i32 %5, ptr @rem, align 4, !tbaa !5
  %.not.old = icmp eq i32 %5, 0
  br i1 %.not.old, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %1, %76
  %6 = load i32, ptr @active_len, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %10

8:                                                ; preds = %.preheader
  %9 = load i32, ptr @pos, align 4, !tbaa !5
  store i32 %9, ptr @active_e, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %8, %.preheader
  %11 = load i32, ptr @active_node, align 4, !tbaa !5
  %12 = tail call noundef i32 @_Z11active_edgev()
  %13 = tail call noundef i32 @_Z9find_edgeii(i32 noundef %11, i32 noundef %12)
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %20

15:                                               ; preds = %10
  %16 = load i32, ptr @pos, align 4, !tbaa !5
  %17 = tail call noundef i32 @_Z8add_nodeii(i32 noundef %16, i32 noundef 1000000000)
  %18 = load i32, ptr @active_node, align 4, !tbaa !5
  tail call void @_Z11insert_edgeii(i32 noundef %18, i32 noundef %17)
  %19 = load i32, ptr @active_node, align 4, !tbaa !5
  br label %53

20:                                               ; preds = %10
  %21 = tail call noundef zeroext i1 @_Z9walk_downi(i32 noundef %13)
  br i1 %21, label %76, label %22, !llvm.loop !9

22:                                               ; preds = %20
  %23 = sext i32 %13 to i64
  %24 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %23) #2
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = load i32, ptr @active_len, align 4, !tbaa !5
  %27 = add nsw i32 %26, %25
  %28 = sext i32 %27 to i64
  %29 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %28)
  %30 = load i8, ptr %29, align 1, !tbaa !13
  %31 = sext i8 %30 to i32
  %32 = icmp eq i32 %31, %0
  br i1 %32, label %.thread, label %36

.thread:                                          ; preds = %22
  %33 = load i32, ptr @active_len, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr @active_len, align 4, !tbaa !5
  %35 = load i32, ptr @active_node, align 4, !tbaa !5
  tail call void @_Z5addSLi(i32 noundef %35)
  br label %.loopexit

36:                                               ; preds = %22
  %37 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %23) #2
  %38 = load i32, ptr %37, align 4, !tbaa !11
  %39 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %23) #2
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = load i32, ptr @active_len, align 4, !tbaa !5
  %42 = add nsw i32 %41, %40
  %43 = tail call noundef i32 @_Z8add_nodeii(i32 noundef %38, i32 noundef %42)
  %44 = load i32, ptr @pos, align 4, !tbaa !5
  %45 = tail call noundef i32 @_Z8add_nodeii(i32 noundef %44, i32 noundef 1000000000)
  %46 = load i32, ptr @active_node, align 4, !tbaa !5
  %47 = tail call noundef i32 @_Z11active_edgev()
  tail call void @_Z11change_edgeiii(i32 noundef %46, i32 noundef %47, i32 noundef %43)
  tail call void @_Z11insert_edgeii(i32 noundef %43, i32 noundef %13)
  tail call void @_Z11insert_edgeii(i32 noundef %43, i32 noundef %45)
  %48 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %23) #2
  %49 = load i32, ptr %48, align 4, !tbaa !11
  %50 = load i32, ptr @active_len, align 4, !tbaa !5
  %51 = add nsw i32 %50, %49
  %52 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %23) #2
  store i32 %51, ptr %52, align 4, !tbaa !11
  br label %53

53:                                               ; preds = %36, %15
  %.sink = phi i32 [ %43, %36 ], [ %19, %15 ]
  tail call void @_Z5addSLi(i32 noundef %.sink)
  %54 = load i32, ptr @rem, align 4, !tbaa !5
  %55 = add nsw i32 %54, -1
  store i32 %55, ptr @rem, align 4, !tbaa !5
  %56 = load i32, ptr @active_node, align 4, !tbaa !5
  %57 = icmp eq i32 %56, 1
  %58 = load i32, ptr @active_len, align 4
  %59 = icmp ne i32 %58, 0
  %or.cond = select i1 %57, i1 %59, i1 false
  br i1 %or.cond, label %60, label %64

60:                                               ; preds = %53
  %61 = add nsw i32 %58, -1
  store i32 %61, ptr @active_len, align 4, !tbaa !5
  %62 = load i32, ptr @pos, align 4, !tbaa !5
  %reass.sub = sub i32 %62, %54
  %63 = add i32 %reass.sub, 2
  store i32 %63, ptr @active_e, align 4, !tbaa !5
  br label %76

64:                                               ; preds = %53
  %65 = sext i32 %56 to i64
  %66 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %65) #2
  %67 = getelementptr inbounds i8, ptr %66, i64 8
  %68 = load i32, ptr %67, align 4, !tbaa !14
  %.not19 = icmp eq i32 %68, 0
  br i1 %.not19, label %75, label %69

69:                                               ; preds = %64
  %70 = load i32, ptr @active_node, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZNSt6vectorI4nodeSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @tree, i64 noundef %71) #2
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  %74 = load i32, ptr %73, align 4, !tbaa !14
  store i32 %74, ptr @active_node, align 4, !tbaa !5
  br label %76

75:                                               ; preds = %64
  store i32 1, ptr @active_node, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %60, %75, %69, %20
  %77 = load i32, ptr @rem, align 4
  %.not = icmp eq i32 %77, 0
  br i1 %.not, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %76, %.thread, %1
  ret void
}

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 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 #2 = { 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 0}
!12 = !{!"_ZTS4node", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = !{!7, !7, i64 0}
!14 = !{!12, !6, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass