; LLVM IR from rweather/lightweight-crypto :: src/genavr/algorithm_wage.ll (ZN9WageState3regEi)

; 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.Reg = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.WageState = type { ptr, [37 x %class.Reg], [3 x %class.Reg], %class.Reg, [37 x i8], [37 x i32], i32 }

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9WageState3regEi(ptr dead_on_unwind noalias writable sret(%class.Reg) align 8 %0, ptr noundef nonnull align 8 dereferenceable(1184) %1, i32 noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %class.Reg, align 8
  %8 = alloca ptr, align 8
  %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 i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %class.Reg, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %17 = load ptr, ptr %5, align 8
  %18 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [37 x %class.Reg], ptr %18, i64 0, i64 %20
  %22 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21)
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %36

24:                                               ; preds = %3
  %25 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 6
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %25, align 4, !tbaa !11
  %28 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [37 x i32], ptr %28, i64 0, i64 %30
  store i32 %26, ptr %31, align 4, !tbaa !9
  %32 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [37 x %class.Reg], ptr %32, i64 0, i64 %34
  call void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %35)
  br label %186

36:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %37 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  call void @_ZN4Code19allocateOptionalRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8 %7, ptr noundef nonnull align 8 dereferenceable(200) %38, i32 noundef 1)
  %39 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [37 x %class.Reg], ptr %39, i64 0, i64 %41
  %43 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3RegaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %44 unwind label %56

44:                                               ; preds = %36
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  %45 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [37 x %class.Reg], ptr %45, i64 0, i64 %47
  %49 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %48)
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %162

51:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 2147483647, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 -1, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %91, %51
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = icmp slt i32 %53, 37
  br i1 %54, label %60, label %55

55:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %94

56:                                               ; preds = %36
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %8, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %9, align 4
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  br label %187

60:                                               ; preds = %52
  %61 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %62 = load i32, ptr %12, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [37 x %class.Reg], ptr %61, i64 0, i64 %63
  %65 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %64)
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %90

67:                                               ; preds = %60
  %68 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 4
  %69 = load i32, ptr %12, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [37 x i8], ptr %68, i64 0, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !19
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %90, label %74

74:                                               ; preds = %67
  %75 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [37 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = load i32, ptr %10, align 4, !tbaa !9
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %89

82:                                               ; preds = %74
  %83 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %84 = load i32, ptr %12, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [37 x i32], ptr %83, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !9
  store i32 %87, ptr %10, align 4, !tbaa !9
  %88 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %88, ptr %11, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %82, %74
  br label %90

90:                                               ; preds = %89, %67, %60
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %12, align 4, !tbaa !9
  br label %52, !llvm.loop !20

94:                                               ; preds = %55
  %95 = load i32, ptr %11, align 4, !tbaa !9
  %96 = icmp eq i32 %95, -1
  br i1 %96, label %97, label %147

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 2147483647, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %133, %97
  %99 = load i32, ptr %15, align 4, !tbaa !9
  %100 = icmp slt i32 %99, 37
  br i1 %100, label %102, label %101

101:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %136

102:                                              ; preds = %98
  %103 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [37 x %class.Reg], ptr %103, i64 0, i64 %105
  %107 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %106)
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %132

109:                                              ; preds = %102
  %110 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 4
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [37 x i8], ptr %110, i64 0, i64 %112
  %114 = load i8, ptr %113, align 1, !tbaa !19
  %115 = icmp ne i8 %114, 0
  br i1 %115, label %116, label %132

116:                                              ; preds = %109
  %117 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %118 = load i32, ptr %15, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [37 x i32], ptr %117, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !9
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %124, label %131

124:                                              ; preds = %116
  %125 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %126 = load i32, ptr %15, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [37 x i32], ptr %125, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !9
  store i32 %129, ptr %13, align 4, !tbaa !9
  %130 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %130, ptr %14, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %124, %116
  br label %132

132:                                              ; preds = %131, %109, %102
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %15, align 4, !tbaa !9
  br label %98, !llvm.loop !22

136:                                              ; preds = %101
  %137 = load i32, ptr %14, align 4, !tbaa !9
  %138 = icmp eq i32 %137, -1
  br i1 %138, label %139, label %146

139:                                              ; preds = %136
  %140 = call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %140, ptr noundef @.str)
          to label %141 unwind label %142

141:                                              ; preds = %139
  call void @__cxa_throw(ptr %140, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #6
  unreachable

142:                                              ; preds = %139
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %8, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %9, align 4
  call void @__cxa_free_exception(ptr %140) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %161

146:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %147

147:                                              ; preds = %146, %94
  %148 = load i32, ptr %11, align 4, !tbaa !9
  call void @_ZN9WageState5spillEi(ptr noundef nonnull align 8 dereferenceable(1184) %17, i32 noundef %148)
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #5
  %149 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !18
  call void @_ZN4Code11allocateRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8 %16, ptr noundef nonnull align 8 dereferenceable(200) %150, i32 noundef 1)
  %151 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %152 = load i32, ptr %6, align 4, !tbaa !9
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [37 x %class.Reg], ptr %151, i64 0, i64 %153
  %155 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3RegaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %154, ptr noundef nonnull align 8 dereferenceable(24) %16)
          to label %156 unwind label %157

156:                                              ; preds = %147
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #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 %162

157:                                              ; preds = %147
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %8, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %9, align 4
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #5
  br label %161

161:                                              ; preds = %157, %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %187

162:                                              ; preds = %156, %44
  %163 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 0
  %164 = load ptr, ptr %163, align 8, !tbaa !18
  %165 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %166 = load i32, ptr %6, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [37 x %class.Reg], ptr %165, i64 0, i64 %167
  %169 = load i32, ptr %6, align 4, !tbaa !9
  %170 = trunc i32 %169 to i8
  call void @_ZN4Code7ldlocalERK3Regh(ptr noundef nonnull align 8 dereferenceable(200) %164, ptr noundef nonnull align 8 dereferenceable(24) %168, i8 noundef zeroext %170)
  %171 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 6
  %172 = load i32, ptr %171, align 4, !tbaa !11
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %171, align 4, !tbaa !11
  %174 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 5
  %175 = load i32, ptr %6, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [37 x i32], ptr %174, i64 0, i64 %176
  store i32 %172, ptr %177, align 4, !tbaa !9
  %178 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 4
  %179 = load i32, ptr %6, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [37 x i8], ptr %178, i64 0, i64 %180
  store i8 0, ptr %181, align 1, !tbaa !19
  %182 = getelementptr inbounds %struct.WageState, ptr %17, i32 0, i32 1
  %183 = load i32, ptr %6, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [37 x %class.Reg], ptr %182, i64 0, i64 %184
  call void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %185)
  br label %186

186:                                              ; preds = %162, %24
  ret void

187:                                              ; preds = %161, %56
  %188 = load ptr, ptr %8, align 8
  %189 = load i32, ptr %9, align 4
  %190 = insertvalue { ptr, i32 } poison, ptr %188, 0
  %191 = insertvalue { ptr, i32 } %190, i32 %189, 1
  resume { ptr, i32 } %191
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

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

declare void @_ZN4Code19allocateOptionalRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) #3

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9WageState5spillEi(ptr noundef nonnull align 8 dereferenceable(1184), i32 noundef) #0 align 2

declare void @_ZN4Code11allocateRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Code7ldlocalERK3Regh(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef nonnull align 8 dereferenceable(24), i8 noundef zeroext) #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" }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nounwind "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 }
attributes #6 = { noreturn }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1180}
!12 = !{!"_ZTS9WageState", !6, i64 0, !7, i64 8, !7, i64 896, !13, i64 968, !7, i64 992, !7, i64 1032, !10, i64 1180}
!13 = !{!"_ZTS3Reg", !14, i64 0}
!14 = !{!"_ZTSSt6vectorIhSaIhEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!12, !6, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


; 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.Reg = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9WageState3regEi(ptr dead_on_unwind noalias writable sret(%class.Reg) align 8 %0, ptr noundef nonnull align 8 dereferenceable(1184) %1, i32 noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.Reg, align 8
  %5 = alloca %class.Reg, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = sext i32 %2 to i64
  %8 = getelementptr inbounds [37 x %class.Reg], ptr %6, i64 0, i64 %7
  %9 = tail call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %16, label %10

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %1, i64 1180
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr %11, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 1032
  %15 = getelementptr inbounds [37 x i32], ptr %14, i64 0, i64 %7
  store i32 %12, ptr %15, align 4, !tbaa !16
  tail call void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %8)
  br label %74

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  %17 = load ptr, ptr %1, align 8, !tbaa !17
  call void @_ZN4Code19allocateOptionalRegEj(ptr dead_on_unwind nonnull writable sret(%class.Reg) align 8 %4, ptr noundef nonnull align 8 dereferenceable(200) %17, i32 noundef 1)
  %18 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3RegaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %19 unwind label %26

19:                                               ; preds = %16
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  %20 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %.preheader55, label %64

.preheader55:                                     ; preds = %19
  %22 = getelementptr inbounds i8, ptr %1, i64 992
  %23 = getelementptr inbounds i8, ptr %1, i64 1032
  br label %28

24:                                               ; preds = %39
  %25 = icmp eq i32 %.137, -1
  br i1 %25, label %.preheader, label %58

26:                                               ; preds = %16
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  br label %75

28:                                               ; preds = %.preheader55, %39
  %indvars.iv = phi i64 [ 0, %.preheader55 ], [ %indvars.iv.next, %39 ]
  %.03657 = phi i32 [ -1, %.preheader55 ], [ %.137, %39 ]
  %.03856 = phi i32 [ 2147483647, %.preheader55 ], [ %.139, %39 ]
  %29 = getelementptr inbounds [37 x %class.Reg], ptr %6, i64 0, i64 %indvars.iv
  %30 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %.not50 = icmp eq i32 %30, 0
  br i1 %.not50, label %39, label %31

31:                                               ; preds = %28
  %32 = getelementptr inbounds [37 x i8], ptr %22, i64 0, i64 %indvars.iv
  %33 = load i8, ptr %32, align 1, !tbaa !18
  %.not51 = icmp eq i8 %33, 0
  br i1 %.not51, label %34, label %39

34:                                               ; preds = %31
  %35 = getelementptr inbounds [37 x i32], ptr %23, i64 0, i64 %indvars.iv
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = icmp slt i32 %36, %.03856
  %spec.select = call i32 @llvm.smin.i32(i32 %36, i32 %.03856)
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  %spec.select52 = select i1 %37, i32 %38, i32 %.03657
  br label %39

39:                                               ; preds = %34, %28, %31
  %.139 = phi i32 [ %.03856, %31 ], [ %.03856, %28 ], [ %spec.select, %34 ]
  %.137 = phi i32 [ %.03657, %31 ], [ %.03657, %28 ], [ %spec.select52, %34 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 37
  br i1 %exitcond.not, label %24, label %28, !llvm.loop !19

40:                                               ; preds = %52
  %41 = icmp eq i32 %.1, -1
  br i1 %41, label %53, label %58

.preheader:                                       ; preds = %24, %52
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %52 ], [ 0, %24 ]
  %.03260 = phi i32 [ %.1, %52 ], [ -1, %24 ]
  %.03359 = phi i32 [ %.134, %52 ], [ 2147483647, %24 ]
  %42 = getelementptr inbounds [37 x %class.Reg], ptr %6, i64 0, i64 %indvars.iv63
  %43 = call noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %42)
  %.not48 = icmp eq i32 %43, 0
  br i1 %.not48, label %52, label %44

44:                                               ; preds = %.preheader
  %45 = getelementptr inbounds [37 x i8], ptr %22, i64 0, i64 %indvars.iv63
  %46 = load i8, ptr %45, align 1, !tbaa !18
  %.not49 = icmp eq i8 %46, 0
  br i1 %.not49, label %52, label %47

47:                                               ; preds = %44
  %48 = getelementptr inbounds [37 x i32], ptr %23, i64 0, i64 %indvars.iv63
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = icmp slt i32 %49, %.03359
  %spec.select53 = call i32 @llvm.smin.i32(i32 %49, i32 %.03359)
  %51 = trunc nuw nsw i64 %indvars.iv63 to i32
  %spec.select54 = select i1 %50, i32 %51, i32 %.03260
  br label %52

52:                                               ; preds = %47, %.preheader, %44
  %.134 = phi i32 [ %.03359, %44 ], [ %.03359, %.preheader ], [ %spec.select53, %47 ]
  %.1 = phi i32 [ %.03260, %44 ], [ %.03260, %.preheader ], [ %spec.select54, %47 ]
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next64, 37
  br i1 %exitcond66.not, label %40, label %.preheader, !llvm.loop !21

53:                                               ; preds = %40
  %54 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull @.str)
          to label %55 unwind label %56

55:                                               ; preds = %53
  call void @__cxa_throw(ptr nonnull %54, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

56:                                               ; preds = %53
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %54) #6
  br label %75

58:                                               ; preds = %40, %24
  call void @_ZN9WageState5spillEi(ptr noundef nonnull align 8 dereferenceable(1184) %1, i32 noundef %.137)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  %59 = load ptr, ptr %1, align 8, !tbaa !17
  call void @_ZN4Code11allocateRegEj(ptr dead_on_unwind nonnull writable sret(%class.Reg) align 8 %5, ptr noundef nonnull align 8 dereferenceable(200) %59, i32 noundef 1)
  %60 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3RegaSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %61 unwind label %62

61:                                               ; preds = %58
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %64

62:                                               ; preds = %58
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %75

64:                                               ; preds = %61, %19
  %65 = load ptr, ptr %1, align 8, !tbaa !17
  %66 = trunc i32 %2 to i8
  call void @_ZN4Code7ldlocalERK3Regh(ptr noundef nonnull align 8 dereferenceable(200) %65, ptr noundef nonnull align 8 dereferenceable(24) %8, i8 noundef zeroext %66)
  %67 = getelementptr inbounds i8, ptr %1, i64 1180
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %67, align 4, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %1, i64 1032
  %71 = getelementptr inbounds [37 x i32], ptr %70, i64 0, i64 %7
  store i32 %68, ptr %71, align 4, !tbaa !16
  %72 = getelementptr inbounds i8, ptr %1, i64 992
  %73 = getelementptr inbounds [37 x i8], ptr %72, i64 0, i64 %7
  store i8 0, ptr %73, align 1, !tbaa !18
  call void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %8)
  br label %74

74:                                               ; preds = %64, %10
  ret void

75:                                               ; preds = %56, %62, %26
  %.pn.pn = phi { ptr, i32 } [ %27, %26 ], [ %57, %56 ], [ %63, %62 ]
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3Reg4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3RegC2ERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

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

declare void @_ZN4Code19allocateOptionalRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) local_unnamed_addr #3

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3RegD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9WageState5spillEi(ptr noundef nonnull align 8 dereferenceable(1184), i32 noundef) local_unnamed_addr #0 align 2

declare void @_ZN4Code11allocateRegEj(ptr dead_on_unwind writable sret(%class.Reg) align 8, ptr noundef nonnull align 8 dereferenceable(200), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Code7ldlocalERK3Regh(ptr noundef nonnull align 8 dereferenceable(200), ptr noundef nonnull align 8 dereferenceable(24), i8 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nounwind "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn }

!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, !15, i64 1180}
!6 = !{!"_ZTS9WageState", !7, i64 0, !8, i64 8, !8, i64 896, !10, i64 968, !8, i64 992, !8, i64 1032, !15, i64 1180}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS3Reg", !11, i64 0}
!11 = !{!"_ZTSSt6vectorIhSaIhEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!"int", !8, i64 0}
!16 = !{!15, !15, i64 0}
!17 = !{!6, !7, i64 0}
!18 = !{!8, !8, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


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