; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 5/5.5 twofive.ll (Z6solve1B5cxx11i)

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

@cur = external dso_local global %struct.state, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3get5state(ptr noundef byval(%struct.state) align 8) #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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6solve1B5cxx11i(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i32 noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i1, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.state, align 4
  %17 = alloca %struct.state, align 8
  %18 = alloca %struct.state, align 8
  store ptr %0, ptr %3, align 8
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  store i1 false, ptr %6, align 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %167, %2
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = icmp slt i32 %20, 25
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = sdiv i32 %24, 5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 1), i64 0, i64 %26
  %28 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 1
  %29 = load i8, ptr %28, align 4, !tbaa !9
  %30 = sext i8 %29 to i32
  %31 = sub nsw i32 %30, 65
  store i32 %31, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = srem i32 %32, 5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 2), i64 0, i64 %34
  %36 = getelementptr inbounds %"struct.std::pair", ptr %35, i32 0, i32 1
  %37 = load i8, ptr %36, align 4, !tbaa !9
  %38 = sext i8 %37 to i32
  %39 = sub nsw i32 %38, 65
  store i32 %39, ptr %13, align 4, !tbaa !5
  %40 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %41 unwind label %51

41:                                               ; preds = %23
  %42 = load i32, ptr %40, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %11, align 4, !tbaa !5
  %44 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %45 unwind label %51

45:                                               ; preds = %41
  %46 = load i32, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  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.end.p0(i64 4, ptr %10) #5
  store i32 %46, ptr %9, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %161, %45
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = icmp slt i32 %48, 25
  br i1 %49, label %55, label %50

50:                                               ; preds = %47
  store i32 5, ptr %8, align 4
  br label %164

51:                                               ; preds = %41, %23
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %14, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  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.end.p0(i64 4, ptr %10) #5
  br label %165

55:                                               ; preds = %47
  %56 = load i32, ptr @cur, align 4, !tbaa !11
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = shl i32 1, %57
  %59 = and i32 %56, %58
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %160

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 84, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 @cur, i64 84, i1 false), !tbaa.struct !13
  %62 = getelementptr inbounds %struct.state, ptr %16, i32 0, i32 1
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = sdiv i32 %63, 5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %62, i64 0, i64 %65
  %67 = getelementptr inbounds %"struct.std::pair", ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %67, align 4, !tbaa !15
  %70 = getelementptr inbounds %struct.state, ptr %16, i32 0, i32 2
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = srem i32 %71, 5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %70, i64 0, i64 %73
  %75 = getelementptr inbounds %"struct.std::pair", ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 4, !tbaa !15
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %75, align 4, !tbaa !15
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = add nsw i32 65, %78
  %80 = trunc i32 %79 to i8
  %81 = getelementptr inbounds %struct.state, ptr %16, i32 0, i32 1
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = sdiv i32 %82, 5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %81, i64 0, i64 %84
  %86 = getelementptr inbounds %"struct.std::pair", ptr %85, i32 0, i32 1
  store i8 %80, ptr %86, align 4, !tbaa !9
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = add nsw i32 65, %87
  %89 = trunc i32 %88 to i8
  %90 = getelementptr inbounds %struct.state, ptr %16, i32 0, i32 2
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = srem i32 %91, 5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %90, i64 0, i64 %93
  %95 = getelementptr inbounds %"struct.std::pair", ptr %94, i32 0, i32 1
  store i8 %89, ptr %95, align 4, !tbaa !9
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = shl i32 1, %96
  %98 = getelementptr inbounds %struct.state, ptr %16, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %100 = xor i32 %99, %97
  store i32 %100, ptr %98, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %16, i64 84, i1 false), !tbaa.struct !13
  %101 = invoke noundef i32 @_Z3get5state(ptr noundef byval(%struct.state) align 8 %17)
          to label %102 unwind label %152

102:                                              ; preds = %61
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = add nsw i32 %103, %101
  store i32 %104, ptr %5, align 4, !tbaa !5
  %105 = load i32, ptr %5, align 4, !tbaa !5
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = icmp sge i32 %105, %106
  br i1 %107, label %108, label %156

108:                                              ; preds = %102
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %16, i64 84, i1 false), !tbaa.struct !13
  %109 = invoke noundef i32 @_Z3get5state(ptr noundef byval(%struct.state) align 8 %18)
          to label %110 unwind label %152

110:                                              ; preds = %108
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = sub nsw i32 %111, %109
  store i32 %112, ptr %5, align 4, !tbaa !5
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = add nsw i32 65, %113
  %115 = trunc i32 %114 to i8
  %116 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %115)
          to label %117 unwind label %152

117:                                              ; preds = %110
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sdiv i32 %118, 5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 1), i64 0, i64 %120
  %122 = getelementptr inbounds %"struct.std::pair", ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !15
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %122, align 4, !tbaa !15
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = srem i32 %125, 5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 2), i64 0, i64 %127
  %129 = getelementptr inbounds %"struct.std::pair", ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 4, !tbaa !15
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %129, align 4, !tbaa !15
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = add nsw i32 65, %132
  %134 = trunc i32 %133 to i8
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sdiv i32 %135, 5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 1), i64 0, i64 %137
  %139 = getelementptr inbounds %"struct.std::pair", ptr %138, i32 0, i32 1
  store i8 %134, ptr %139, align 4, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !5
  %141 = add nsw i32 65, %140
  %142 = trunc i32 %141 to i8
  %143 = load i32, ptr %7, align 4, !tbaa !5
  %144 = srem i32 %143, 5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (%struct.state, ptr @cur, i32 0, i32 2), i64 0, i64 %145
  %147 = getelementptr inbounds %"struct.std::pair", ptr %146, i32 0, i32 1
  store i8 %142, ptr %147, align 4, !tbaa !9
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = shl i32 1, %148
  %150 = load i32, ptr @cur, align 4, !tbaa !11
  %151 = xor i32 %150, %149
  store i32 %151, ptr @cur, align 4, !tbaa !11
  store i32 5, ptr %8, align 4
  br label %157

152:                                              ; preds = %110, %108, %61
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %14, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 84, ptr %16) #5
  br label %165

156:                                              ; preds = %102
  store i32 0, ptr %8, align 4
  br label %157

157:                                              ; preds = %156, %117
  call void @llvm.lifetime.end.p0(i64 84, ptr %16) #5
  %158 = load i32, ptr %8, align 4
  switch i32 %158, label %164 [
    i32 0, label %159
  ]

159:                                              ; preds = %157
  br label %160

160:                                              ; preds = %159, %55
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %9, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %9, align 4, !tbaa !5
  br label %47, !llvm.loop !16

164:                                              ; preds = %157, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %166

165:                                              ; preds = %152, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %174

166:                                              ; preds = %164
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %7, align 4, !tbaa !5
  br label %19, !llvm.loop !18

170:                                              ; preds = %22
  store i1 true, ptr %6, align 1
  store i32 1, ptr %8, align 4
  %171 = load i1, ptr %6, align 1
  br i1 %171, label %173, label %172

172:                                              ; preds = %170
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %173

173:                                              ; preds = %172, %170
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret void

174:                                              ; preds = %165
  %175 = load ptr, ptr %14, align 8
  %176 = load i32, ptr %15, align 4
  %177 = insertvalue { ptr, i32 } poison, ptr %175, 0
  %178 = insertvalue { ptr, i32 } %177, i32 %176, 1
  resume { ptr, i32 } %178
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #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, !7, i64 4}
!10 = !{!"_ZTSSt4pairIicE", !6, i64 0, !7, i64 4}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5state", !6, i64 0, !7, i64 4, !7, i64 44}
!13 = !{i64 0, i64 4, !5, i64 4, i64 40, !14, i64 44, i64 40, !14}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !6, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

@cur = external dso_local local_unnamed_addr global %struct.state, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3get5state(ptr noundef byval(%struct.state) align 8) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6solve1B5cxx11i(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %0, i32 noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.state, align 8
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  %8 = getelementptr inbounds i8, ptr %7, i64 4
  %9 = getelementptr inbounds i8, ptr %7, i64 44
  br label %10

10:                                               ; preds = %2, %.loopexit
  %.048 = phi i32 [ 0, %2 ], [ %.4, %.loopexit ]
  %.03147 = phi i32 [ 0, %2 ], [ %66, %.loopexit ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %.lhs.trunc = trunc nuw i32 %.03147 to i8
  %11 = udiv i8 %.lhs.trunc, 5
  %12 = zext nneg i8 %11 to i64
  %13 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (i8, ptr @cur, i64 4), i64 0, i64 %12
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %15 = load i8, ptr %14, align 4, !tbaa !9
  %16 = sext i8 %15 to i32
  %17 = add nsw i32 %16, -65
  store i32 %17, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %18 = urem i8 %.lhs.trunc, 5
  %19 = zext nneg i8 %18 to i64
  %20 = getelementptr inbounds [5 x %"struct.std::pair"], ptr getelementptr inbounds (i8, ptr @cur, i64 44), i64 0, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  %22 = load i8, ptr %21, align 4, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = add nsw i32 %23, -65
  store i32 %24, ptr %6, align 4, !tbaa !5
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %4, align 4, !tbaa !5
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %29 = load i32, ptr %28, align 4, !tbaa !5
  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.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %30 = icmp slt i32 %29, 25
  br i1 %30, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %10
  %31 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %8, i64 0, i64 %12
  %32 = getelementptr inbounds [5 x %"struct.std::pair"], ptr %9, i64 0, i64 %19
  %33 = getelementptr inbounds i8, ptr %31, i64 4
  %34 = getelementptr inbounds i8, ptr %32, i64 4
  br label %35

35:                                               ; preds = %.lr.ph, %64
  %.146 = phi i32 [ %.048, %.lr.ph ], [ %.3, %64 ]
  %.02945 = phi i32 [ %29, %.lr.ph ], [ %65, %64 ]
  %36 = load i32, ptr @cur, align 4, !tbaa !11
  %37 = shl nuw nsw i32 1, %.02945
  %38 = and i32 %36, %37
  %.not = icmp eq i32 %38, 0
  br i1 %.not, label %64, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 84, ptr nonnull %7) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(84) %7, ptr noundef nonnull align 4 dereferenceable(84) @cur, i64 84, i1 false), !tbaa.struct !13
  %40 = load i32, ptr %31, align 4, !tbaa !15
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %31, align 4, !tbaa !15
  %42 = load i32, ptr %32, align 4, !tbaa !15
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %32, align 4, !tbaa !15
  %44 = trunc i32 %.02945 to i8
  %45 = add i8 %44, 65
  store i8 %45, ptr %33, align 8, !tbaa !9
  store i8 %45, ptr %34, align 8, !tbaa !9
  %46 = load i32, ptr %7, align 8, !tbaa !11
  %47 = xor i32 %46, %37
  store i32 %47, ptr %7, align 8, !tbaa !11
  %48 = invoke noundef i32 @_Z3get5state(ptr noundef nonnull byval(%struct.state) align 8 %7)
          to label %49 unwind label %.loopexit38

49:                                               ; preds = %39
  %50 = add nsw i32 %48, %.146
  %.not34 = icmp slt i32 %50, %1
  br i1 %.not34, label %.thread, label %51

.thread:                                          ; preds = %49
  call void @llvm.lifetime.end.p0(i64 84, ptr nonnull %7) #5
  br label %64

51:                                               ; preds = %49
  %52 = invoke noundef i32 @_Z3get5state(ptr noundef nonnull byval(%struct.state) align 8 %7)
          to label %53 unwind label %.loopexit.split-lp

53:                                               ; preds = %51
  %54 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %0, i8 noundef signext %45)
          to label %56 unwind label %.loopexit.split-lp

.loopexit38:                                      ; preds = %39
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %55

.loopexit.split-lp:                               ; preds = %51, %53
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %55

55:                                               ; preds = %.loopexit.split-lp, %.loopexit38
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit38 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 84, ptr nonnull %7) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  resume { ptr, i32 } %lpad.phi

56:                                               ; preds = %53
  %57 = sub nsw i32 %50, %52
  %58 = load i32, ptr %13, align 4, !tbaa !15
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %13, align 4, !tbaa !15
  %60 = load i32, ptr %20, align 4, !tbaa !15
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %20, align 4, !tbaa !15
  store i8 %45, ptr %14, align 4, !tbaa !9
  store i8 %45, ptr %21, align 4, !tbaa !9
  %62 = load i32, ptr @cur, align 4, !tbaa !11
  %63 = xor i32 %62, %37
  store i32 %63, ptr @cur, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 84, ptr nonnull %7) #5
  br label %.loopexit

64:                                               ; preds = %.thread, %35
  %.3 = phi i32 [ %.146, %35 ], [ %50, %.thread ]
  %65 = add i32 %.02945, 1
  %exitcond.not = icmp eq i32 %65, 25
  br i1 %exitcond.not, label %.loopexit, label %35, !llvm.loop !16

.loopexit:                                        ; preds = %64, %10, %56
  %.4 = phi i32 [ %57, %56 ], [ %.048, %10 ], [ %.3, %64 ]
  %66 = add nuw nsw i32 %.03147, 1
  %exitcond54.not = icmp eq i32 %66, 25
  br i1 %exitcond54.not, label %67, label %10, !llvm.loop !18

67:                                               ; preds = %.loopexit
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #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, !7, i64 4}
!10 = !{!"_ZTSSt4pairIicE", !6, i64 0, !7, i64 4}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS5state", !6, i64 0, !7, i64 4, !7, i64 44}
!13 = !{i64 0, i64 4, !5, i64 4, i64 40, !14, i64 44, i64 40, !14}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !6, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass