; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 6/1517. Freedom of Choice.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 [200000 x %struct.state], align 16
@sz = external dso_local global i32, align 4
@last = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9sa_extendc(i8 noundef signext %0) #0 {
  %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 [200000 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 [200000 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 [200000 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 [200000 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 [200000 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 [200000 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 %148

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 [200000 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 [200000 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 [200000 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 [200000 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 %147

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 [200000 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 [200000 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 [200000 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 [200000 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 [200000 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 [200000 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 = %131, %79
  %111 = load i32, ptr %4, align 4, !tbaa !8
  %112 = icmp ne i32 %111, -1
  br i1 %112, label %113, label %122

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

122:                                              ; preds = %113, %110
  %123 = phi i1 [ false, %110 ], [ %121, %113 ]
  br i1 %123, label %124, label %137

124:                                              ; preds = %122
  %125 = load i32, ptr %6, align 4, !tbaa !8
  %126 = load i32, ptr %4, align 4, !tbaa !8
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [200000 x %struct.state], ptr @st, i64 0, i64 %127
  %129 = getelementptr inbounds %struct.state, ptr %128, i32 0, i32 2
  %130 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %129, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 %125, ptr %130, align 4, !tbaa !8
  br label %131

131:                                              ; preds = %124
  %132 = load i32, ptr %4, align 4, !tbaa !8
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [200000 x %struct.state], ptr @st, i64 0, i64 %133
  %135 = getelementptr inbounds %struct.state, ptr %134, i32 0, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !22
  store i32 %136, ptr %4, align 4, !tbaa !8
  br label %110, !llvm.loop !25

137:                                              ; preds = %122
  %138 = load i32, ptr %6, align 4, !tbaa !8
  %139 = load i32, ptr %3, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [200000 x %struct.state], ptr @st, i64 0, i64 %140
  %142 = getelementptr inbounds %struct.state, ptr %141, i32 0, i32 1
  store i32 %138, ptr %142, align 4, !tbaa !22
  %143 = load i32, ptr %5, align 4, !tbaa !8
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [200000 x %struct.state], ptr @st, i64 0, i64 %144
  %146 = getelementptr inbounds %struct.state, ptr %145, i32 0, i32 1
  store i32 %138, ptr %146, align 4, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %147

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

148:                                              ; preds = %147, %49
  %149 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %149, 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIciSt4lessIcESaISt4pairIKciEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #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)) #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)) #0 align 2

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

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 = { 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 [200000 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 [200000 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 [200000 x %struct.state], ptr @st, i64 0, i64 %10
  store i32 %9, ptr %11, align 8, !tbaa !10
  %cond36 = icmp eq i32 %5, -1
  br i1 %cond36, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %17
  %.037 = phi i32 [ %.0, %17 ], [ %5, %1 ]
  %12 = sext i32 %.037 to i64
  %13 = getelementptr inbounds [200000 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)
  %.not31 = 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 %.not31, 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 %50

.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 [200000 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.ph41.preheader

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

.lr.ph41.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 [200000 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.ph41

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %45
  %.139 = phi i32 [ %48, %45 ], [ %.037, %.lr.ph41.preheader ]
  %39 = sext i32 %.139 to i64
  %40 = getelementptr inbounds [200000 x %struct.state], ptr @st, i64 0, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 8
  %42 = 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)
  %43 = load i32, ptr %42, align 4, !tbaa !8
  %44 = icmp eq i32 %43, %20
  br i1 %44, label %45, label %.critedge2

45:                                               ; preds = %.lr.ph41
  %46 = 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 %46, align 4, !tbaa !8
  %47 = getelementptr inbounds i8, ptr %40, i64 4
  %48 = load i32, ptr %47, align 4, !tbaa !24
  %.not32 = icmp eq i32 %48, -1
  br i1 %.not32, label %.critedge2, label %.lr.ph41, !llvm.loop !25

.critedge2:                                       ; preds = %.lr.ph41, %45
  %49 = getelementptr inbounds i8, ptr %11, i64 4
  store i32 %29, ptr %49, align 4, !tbaa !24
  store i32 %29, ptr %36, align 4, !tbaa !24
  br label %50

50:                                               ; 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