; LLVM IR from vmartinv/eldiego :: string/suffix.automaton.ll (Z9sa_extendc)

; 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.state = type { i32, i32, %"class.std::map" }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@st = external dso_local global [20020 x %struct.state], align 16
@sz = external dso_local global i32, align 4
@last = external dso_local global i32, align 4

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9sa_extendc(i8 noundef signext %0) #1 {
  %2 = alloca i8, align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i8 %0, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  %7 = load i32, ptr @sz, align 4, !tbaa !8
  %8 = add nsw i32 %7, 1
  store i32 %8, ptr @sz, align 4, !tbaa !8
  store i32 %7, ptr %3, align 4, !tbaa !8
  %9 = load i32, ptr @last, align 4, !tbaa !8
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %10
  %12 = getelementptr inbounds %struct.state, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 8, !tbaa !10
  %14 = add nsw i32 %13, 1
  %15 = load i32, ptr %3, align 4, !tbaa !8
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %16
  %18 = getelementptr inbounds %struct.state, ptr %17, i32 0, i32 0
  store i32 %14, ptr %18, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %19 = load i32, ptr @last, align 4, !tbaa !8
  store i32 %19, ptr %4, align 4, !tbaa !8
  br label %20

20:                                               ; preds = %40, %1
  %21 = load i32, ptr %4, align 4, !tbaa !8
  %22 = icmp ne i32 %21, -1
  br i1 %22, label %23, label %31

23:                                               ; preds = %20
  %24 = load i32, ptr %4, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %25
  %27 = getelementptr inbounds %struct.state, ptr %26, i32 0, i32 2
  %28 = call noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %27, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %29 = icmp ne i64 %28, 0
  %30 = xor i1 %29, true
  br label %31

31:                                               ; preds = %23, %20
  %32 = phi i1 [ false, %20 ], [ %30, %23 ]
  br i1 %32, label %33, label %46

33:                                               ; preds = %31
  %34 = load i32, ptr %3, align 4, !tbaa !8
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.state, ptr %37, i32 0, i32 2
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %38, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 %34, ptr %39, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %33
  %41 = load i32, ptr %4, align 4, !tbaa !8
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.state, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !22
  store i32 %45, ptr %4, align 4, !tbaa !8
  br label %20, !llvm.loop !23

46:                                               ; preds = %31
  %47 = load i32, ptr %4, align 4, !tbaa !8
  %48 = icmp eq i32 %47, -1
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = load i32, ptr %3, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.state, ptr %52, i32 0, i32 1
  store i32 0, ptr %53, align 4, !tbaa !22
  br label %155

54:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %55 = load i32, ptr %4, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.state, ptr %57, i32 0, i32 2
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %58, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %60 = load i32, ptr %59, align 4, !tbaa !8
  store i32 %60, ptr %5, align 4, !tbaa !8
  %61 = load i32, ptr %4, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %62
  %64 = getelementptr inbounds %struct.state, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !10
  %66 = add nsw i32 %65, 1
  %67 = load i32, ptr %5, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.state, ptr %69, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !10
  %72 = icmp eq i32 %66, %71
  br i1 %72, label %73, label %79

73:                                               ; preds = %54
  %74 = load i32, ptr %5, align 4, !tbaa !8
  %75 = load i32, ptr %3, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.state, ptr %77, i32 0, i32 1
  store i32 %74, ptr %78, align 4, !tbaa !22
  br label %154

79:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %80 = load i32, ptr @sz, align 4, !tbaa !8
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr @sz, align 4, !tbaa !8
  store i32 %80, ptr %6, align 4, !tbaa !8
  %82 = load i32, ptr %4, align 4, !tbaa !8
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %83
  %85 = getelementptr inbounds %struct.state, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !10
  %87 = add nsw i32 %86, 1
  %88 = load i32, ptr %6, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.state, ptr %90, i32 0, i32 0
  store i32 %87, ptr %91, align 8, !tbaa !10
  %92 = load i32, ptr %5, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %93
  %95 = getelementptr inbounds %struct.state, ptr %94, i32 0, i32 2
  %96 = load i32, ptr %6, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.state, ptr %98, i32 0, i32 2
  %100 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEaSERKS6_(ptr noundef nonnull align 8 dereferenceable(48) %99, ptr noundef nonnull align 8 dereferenceable(48) %95)
  %101 = load i32, ptr %5, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %102
  %104 = getelementptr inbounds %struct.state, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !22
  %106 = load i32, ptr %6, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.state, ptr %108, i32 0, i32 1
  store i32 %105, ptr %109, align 4, !tbaa !22
  br label %110

110:                                              ; preds = %138, %79
  %111 = load i32, ptr %4, align 4, !tbaa !8
  %112 = icmp ne i32 %111, -1
  br i1 %112, label %113, label %129

113:                                              ; preds = %110
  %114 = load i32, ptr %4, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.state, ptr %116, i32 0, i32 2
  %118 = call noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %117, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %119 = icmp ne i64 %118, 0
  br i1 %119, label %120, label %129

120:                                              ; preds = %113
  %121 = load i32, ptr %4, align 4, !tbaa !8
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %122
  %124 = getelementptr inbounds %struct.state, ptr %123, i32 0, i32 2
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %124, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %126 = load i32, ptr %125, align 4, !tbaa !8
  %127 = load i32, ptr %5, align 4, !tbaa !8
  %128 = icmp eq i32 %126, %127
  br label %129

129:                                              ; preds = %120, %113, %110
  %130 = phi i1 [ false, %113 ], [ false, %110 ], [ %128, %120 ]
  br i1 %130, label %131, label %144

131:                                              ; preds = %129
  %132 = load i32, ptr %6, align 4, !tbaa !8
  %133 = load i32, ptr %4, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.state, ptr %135, i32 0, i32 2
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %136, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 %132, ptr %137, align 4, !tbaa !8
  br label %138

138:                                              ; preds = %131
  %139 = load i32, ptr %4, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.state, ptr %141, i32 0, i32 1
  %143 = load i32, ptr %142, align 4, !tbaa !22
  store i32 %143, ptr %4, align 4, !tbaa !8
  br label %110, !llvm.loop !25

144:                                              ; preds = %129
  %145 = load i32, ptr %6, align 4, !tbaa !8
  %146 = load i32, ptr %3, align 4, !tbaa !8
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %147
  %149 = getelementptr inbounds %struct.state, ptr %148, i32 0, i32 1
  store i32 %145, ptr %149, align 4, !tbaa !22
  %150 = load i32, ptr %5, align 4, !tbaa !8
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.state, ptr %152, i32 0, i32 1
  store i32 %145, ptr %153, align 4, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %154

154:                                              ; preds = %144, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %155

155:                                              ; preds = %154, %49
  %156 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %156, ptr @last, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEaSERKS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 0}
!11 = !{!"_ZTS5state", !9, i64 0, !9, i64 4, !12, i64 8}
!12 = !{!"_ZTSSt3mapIciSt4lessIcESaISt4pairIKciEEE", !13, i64 0}
!13 = !{!"_ZTSSt8_Rb_treeIcSt4pairIKciESt10_Select1stIS2_ESt4lessIcESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt8_Rb_treeIcSt4pairIKciESt10_Select1stIS2_ESt4lessIcESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !15, i64 0, !17, i64 8}
!15 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !16, i64 0}
!16 = !{!"_ZTSSt4lessIcE"}
!17 = !{!"_ZTSSt15_Rb_tree_header", !18, i64 0, !21, i64 32}
!18 = !{!"_ZTSSt18_Rb_tree_node_base", !19, i64 0, !20, i64 8, !20, i64 16, !20, i64 24}
!19 = !{!"_ZTSSt14_Rb_tree_color", !6, i64 0}
!20 = !{!"any pointer", !6, i64 0}
!21 = !{!"long", !6, i64 0}
!22 = !{!11, !9, i64 4}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}


; 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.state = type { i32, i32, %"class.std::map" }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@st = external dso_local global [20020 x %struct.state], align 16
@sz = external dso_local local_unnamed_addr global i32, align 4
@last = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9sa_extendc(i8 noundef signext %0) local_unnamed_addr #0 {
  %2 = alloca i8, align 1
  store i8 %0, ptr %2, align 1, !tbaa !5
  %3 = load i32, ptr @sz, align 4, !tbaa !8
  %4 = add nsw i32 %3, 1
  store i32 %4, ptr @sz, align 4, !tbaa !8
  %5 = load i32, ptr @last, align 4, !tbaa !8
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %6
  %8 = load i32, ptr %7, align 8, !tbaa !10
  %9 = add nsw i32 %8, 1
  %10 = sext i32 %3 to i64
  %11 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %10
  store i32 %9, ptr %11, align 8, !tbaa !10
  %cond38 = icmp eq i32 %5, -1
  br i1 %cond38, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %17
  %.039 = phi i32 [ %.0, %17 ], [ %5, %1 ]
  %12 = sext i32 %.039 to i64
  %13 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %12
  %14 = getelementptr inbounds i8, ptr %13, i64 8
  %15 = call noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %.not32 = icmp eq i64 %15, 0
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 1 dereferenceable(1) %2)
  br i1 %.not32, label %17, label %.critedge

17:                                               ; preds = %.lr.ph
  store i32 %3, ptr %16, align 4, !tbaa !8
  %18 = getelementptr inbounds i8, ptr %13, i64 4
  %.0 = load i32, ptr %18, align 4, !tbaa !8
  %cond = icmp eq i32 %.0, -1
  br i1 %cond, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %17, %1
  %19 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 0, ptr %19, align 4, !tbaa !24
  br label %52

.critedge:                                        ; preds = %.lr.ph
  %20 = load i32, ptr %16, align 4, !tbaa !8
  %21 = load i32, ptr %13, align 8, !tbaa !10
  %22 = add nsw i32 %21, 1
  %23 = sext i32 %20 to i64
  %24 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %23
  %25 = load i32, ptr %24, align 8, !tbaa !10
  %26 = icmp eq i32 %22, %25
  br i1 %26, label %27, label %.lr.ph43.preheader

27:                                               ; preds = %.critedge
  %28 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 %20, ptr %28, align 4, !tbaa !24
  br label %52

.lr.ph43.preheader:                               ; preds = %.critedge
  %29 = load i32, ptr @sz, align 4, !tbaa !8
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @sz, align 4, !tbaa !8
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %31
  store i32 %22, ptr %32, align 8, !tbaa !10
  %33 = getelementptr inbounds i8, ptr %24, i64 8
  %34 = getelementptr inbounds i8, ptr %32, i64 8
  %35 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEaSERKS6_(ptr noundef nonnull align 8 dereferenceable(48) %34, ptr noundef nonnull align 8 dereferenceable(48) %33)
  %36 = getelementptr inbounds i8, ptr %24, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !24
  %38 = getelementptr inbounds i8, ptr %32, i64 4
  store i32 %37, ptr %38, align 4, !tbaa !24
  br label %.lr.ph43

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %47
  %.141 = phi i32 [ %50, %47 ], [ %.039, %.lr.ph43.preheader ]
  %39 = sext i32 %.141 to i64
  %40 = getelementptr inbounds [20020 x %struct.state], ptr @st, i64 0, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = call noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %41, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %.not34 = icmp eq i64 %42, 0
  br i1 %.not34, label %.critedge2, label %43

43:                                               ; preds = %.lr.ph43
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %41, ptr noundef nonnull align 1 dereferenceable(1) %2)
  %45 = load i32, ptr %44, align 4, !tbaa !8
  %46 = icmp eq i32 %45, %20
  br i1 %46, label %47, label %.critedge2

47:                                               ; preds = %43
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %41, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 %29, ptr %48, align 4, !tbaa !8
  %49 = getelementptr inbounds i8, ptr %40, i64 4
  %50 = load i32, ptr %49, align 4, !tbaa !24
  %.not33 = icmp eq i32 %50, -1
  br i1 %.not33, label %.critedge2, label %.lr.ph43, !llvm.loop !25

.critedge2:                                       ; preds = %43, %47, %.lr.ph43
  %51 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 %29, ptr %51, align 4, !tbaa !24
  store i32 %29, ptr %36, align 4, !tbaa !24
  br label %52

52:                                               ; preds = %27, %.critedge2, %._crit_edge
  store i32 %3, ptr @last, align 4, !tbaa !8
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEaSERKS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 0}
!11 = !{!"_ZTS5state", !9, i64 0, !9, i64 4, !12, i64 8}
!12 = !{!"_ZTSSt3mapIciSt4lessIcESaISt4pairIKciEEE", !13, i64 0}
!13 = !{!"_ZTSSt8_Rb_treeIcSt4pairIKciESt10_Select1stIS2_ESt4lessIcESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt8_Rb_treeIcSt4pairIKciESt10_Select1stIS2_ESt4lessIcESaIS2_EE13_Rb_tree_implIS6_Lb1EEE", !15, i64 0, !17, i64 8}
!15 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !16, i64 0}
!16 = !{!"_ZTSSt4lessIcE"}
!17 = !{!"_ZTSSt15_Rb_tree_header", !18, i64 0, !21, i64 32}
!18 = !{!"_ZTSSt18_Rb_tree_node_base", !19, i64 0, !20, i64 8, !20, i64 16, !20, i64 24}
!19 = !{!"_ZTSSt14_Rb_tree_color", !6, i64 0}
!20 = !{!"any pointer", !6, i64 0}
!21 = !{!"long", !6, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!11, !9, i64 4}
!25 = distinct !{!25, !23}


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