; LLVM IR from huawei-noah/bolt :: compute/tensor/src/cpu/x86/int8/avx512 (quantize)

; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<DataFormat, DataFormat, std::_Identity<DataFormat>, std::less<DataFormat>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<DataFormat, DataFormat, std::_Identity<DataFormat>, std::less<DataFormat>>::_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 }
%"class.std::initializer_list" = type { ptr, i64 }
%"struct.std::less" = type { i8 }
%"class.std::allocator.0" = type { i8 }

@constinit = external hidden constant [5 x 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) #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: 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 noundef i32 @_Z22quantizeBiasOffsetCI32PKf10TensorDescPaS1_S0_Pi(ptr noundef %0, ptr noundef byval(%struct.TensorDesc) align 8 %1, ptr noundef %2, ptr noundef byval(%struct.TensorDesc) align 8 %3, ptr noundef %4, ptr noundef %5) #3 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.TensorDesc, align 8
  %14 = alloca %"class.std::set", align 8
  %15 = alloca %"class.std::initializer_list", align 8
  %16 = alloca [5 x i32], align 4
  %17 = alloca %"struct.std::less", align 1
  %18 = alloca %"class.std::allocator.0", align 1
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  store ptr %5, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %1, i64 92, i1 false), !tbaa.struct !9
  %25 = call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8 %13)
  store i32 %25, ptr %12, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 48, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 20, ptr %16) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 @constinit, i64 20, i1 false), !tbaa.struct !17
  %26 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 0
  store ptr %16, ptr %26, align 8, !tbaa !18
  %27 = getelementptr inbounds %"class.std::initializer_list", ptr %15, i32 0, i32 1
  store i64 5, ptr %27, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #6
  call void @_ZNSaI10DataFormatEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  %28 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8
  %30 = getelementptr inbounds { ptr, i64 }, ptr %15, i32 0, i32 1
  %31 = load i64, ptr %30, align 8
  invoke void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EEC2ESt16initializer_listIS0_ERKS2_RKS3_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr %29, i64 %31, ptr noundef nonnull align 1 dereferenceable(1) %17, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %32 unwind label %40

32:                                               ; preds = %6
  call void @_ZNSt15__new_allocatorI10DataFormatED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %16) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %33, ptr %21, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %44

36:                                               ; preds = %32
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %44

39:                                               ; preds = %36
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %172

40:                                               ; preds = %6
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %19, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %20, align 4
  call void @_ZNSt15__new_allocatorI10DataFormatED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %16) #6
  br label %175

44:                                               ; preds = %36, %32
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %12, align 4, !tbaa !14
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %94

50:                                               ; preds = %47, %44
  %51 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 3
  %52 = getelementptr inbounds [20 x i32], ptr %51, i64 0, i64 0
  %53 = load i32, ptr %52, align 4, !tbaa !14
  %54 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 3
  %55 = getelementptr inbounds [20 x i32], ptr %54, i64 0, i64 1
  %56 = load i32, ptr %55, align 4, !tbaa !14
  %57 = icmp ugt i32 %53, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %50
  %59 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 3
  %60 = getelementptr inbounds [20 x i32], ptr %59, i64 0, i64 0
  %61 = load i32, ptr %60, align 4, !tbaa !14
  br label %66

62:                                               ; preds = %50
  %63 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 3
  %64 = getelementptr inbounds [20 x i32], ptr %63, i64 0, i64 1
  %65 = load i32, ptr %64, align 4, !tbaa !14
  br label %66

66:                                               ; preds = %62, %58
  %67 = phi i32 [ %61, %58 ], [ %65, %62 ]
  store i32 %67, ptr %12, align 4, !tbaa !14
  %68 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 1
  %69 = invoke noundef i64 @_ZNKSt3setI10DataFormatSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 4 dereferenceable(4) %68)
          to label %70 unwind label %80

70:                                               ; preds = %66
  %71 = icmp ne i64 %69, 0
  br i1 %71, label %72, label %84

72:                                               ; preds = %70
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load i32, ptr %12, align 4, !tbaa !14
  %75 = invoke noundef i32 @_Z7bytesOf8DataType(i32 noundef 3)
          to label %76 unwind label %80

76:                                               ; preds = %72
  %77 = mul i32 %74, %75
  %78 = zext i32 %77 to i64
  invoke void @_Z10UNI_MEMSETPvim(ptr noundef %73, i32 noundef 0, i64 noundef %78)
          to label %79 unwind label %80

79:                                               ; preds = %76
  br label %93

80:                                               ; preds = %97, %89, %84, %76, %72, %66
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %19, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %20, align 4
  br label %174

84:                                               ; preds = %70
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load ptr, ptr %21, align 8, !tbaa !5
  %87 = load i32, ptr %12, align 4, !tbaa !14
  %88 = invoke noundef i32 @_Z7bytesOf8DataType(i32 noundef 3)
          to label %89 unwind label %80

89:                                               ; preds = %84
  %90 = mul i32 %87, %88
  %91 = zext i32 %90 to i64
  invoke void @_Z10UNI_MEMCPYPvPKvm(ptr noundef %85, ptr noundef %86, i64 noundef %91)
          to label %92 unwind label %80

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92, %79
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %172

94:                                               ; preds = %47
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = icmp eq ptr %95, null
  br i1 %96, label %102, label %97

97:                                               ; preds = %94
  %98 = getelementptr inbounds %struct.TensorDesc, ptr %3, i32 0, i32 1
  %99 = invoke noundef i64 @_ZNKSt3setI10DataFormatSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %14, ptr noundef nonnull align 4 dereferenceable(4) %98)
          to label %100 unwind label %80

100:                                              ; preds = %97
  %101 = icmp ne i64 %99, 0
  br i1 %101, label %102, label %133

102:                                              ; preds = %100, %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 0, ptr %23, align 4, !tbaa !14
  br label %103

103:                                              ; preds = %125, %102
  %104 = load i32, ptr %23, align 4, !tbaa !14
  %105 = load i32, ptr %12, align 4, !tbaa !14
  %106 = icmp ult i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 2, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %132

108:                                              ; preds = %103
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = load i32, ptr %23, align 4, !tbaa !14
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds float, ptr %109, i64 %111
  %113 = load float, ptr %112, align 4, !tbaa !22
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = getelementptr inbounds float, ptr %114, i64 0
  %116 = load float, ptr %115, align 4, !tbaa !22
  %117 = fmul float %113, %116
  %118 = invoke noundef float @_ZSt5roundf(float noundef %117)
          to label %119 unwind label %128

119:                                              ; preds = %108
  %120 = fptosi float %118 to i32
  %121 = load ptr, ptr %11, align 8, !tbaa !5
  %122 = load i32, ptr %23, align 4, !tbaa !14
  %123 = zext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  store i32 %120, ptr %124, align 4, !tbaa !14
  br label %125

125:                                              ; preds = %119
  %126 = load i32, ptr %23, align 4, !tbaa !14
  %127 = add i32 %126, 1
  store i32 %127, ptr %23, align 4, !tbaa !14
  br label %103, !llvm.loop !24

128:                                              ; preds = %108
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %19, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %174

132:                                              ; preds = %107
  br label %171

133:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !14
  br label %134

134:                                              ; preds = %163, %133
  %135 = load i32, ptr %24, align 4, !tbaa !14
  %136 = load i32, ptr %12, align 4, !tbaa !14
  %137 = icmp ult i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 5, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %170

139:                                              ; preds = %134
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = load i32, ptr %24, align 4, !tbaa !14
  %142 = zext i32 %141 to i64
  %143 = getelementptr inbounds float, ptr %140, i64 %142
  %144 = load float, ptr %143, align 4, !tbaa !22
  %145 = load ptr, ptr %10, align 8, !tbaa !5
  %146 = getelementptr inbounds float, ptr %145, i64 0
  %147 = load float, ptr %146, align 4, !tbaa !22
  %148 = fmul float %144, %147
  %149 = invoke noundef float @_ZSt5roundf(float noundef %148)
          to label %150 unwind label %166

150:                                              ; preds = %139
  %151 = load ptr, ptr %21, align 8, !tbaa !5
  %152 = load i32, ptr %24, align 4, !tbaa !14
  %153 = zext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %151, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !14
  %156 = sitofp i32 %155 to float
  %157 = fadd float %149, %156
  %158 = fptosi float %157 to i32
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = load i32, ptr %24, align 4, !tbaa !14
  %161 = zext i32 %160 to i64
  %162 = getelementptr inbounds i32, ptr %159, i64 %161
  store i32 %158, ptr %162, align 4, !tbaa !14
  br label %163

163:                                              ; preds = %150
  %164 = load i32, ptr %24, align 4, !tbaa !14
  %165 = add i32 %164, 1
  store i32 %165, ptr %24, align 4, !tbaa !14
  br label %134, !llvm.loop !26

166:                                              ; preds = %139
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %19, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %174

170:                                              ; preds = %138
  br label %171

171:                                              ; preds = %170, %132
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %172

172:                                              ; preds = %171, %93, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %173 = load i32, ptr %7, align 4
  ret i32 %173

174:                                              ; preds = %166, %128, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %14) #6
  br label %175

175:                                              ; preds = %174, %40
  call void @llvm.lifetime.end.p0(i64 48, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %176

176:                                              ; preds = %175
  %177 = load ptr, ptr %19, align 8
  %178 = load i32, ptr %20, align 4
  %179 = insertvalue { ptr, i32 } poison, ptr %177, 0
  %180 = insertvalue { ptr, i32 } %179, i32 %178, 1
  resume { ptr, i32 } %180
}

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z10UNI_MEMSETPvim(ptr noundef, i32 noundef, i64 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z7bytesOf8DataType(i32 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = { inlinehint 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 #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i64 0, i64 4, !10, i64 4, i64 4, !12, i64 8, i64 4, !14, i64 12, i64 80, !16}
!10 = !{!11, !11, i64 0}
!11 = !{!"_ZTS8DataType", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTS10DataFormat", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{i64 0, i64 20, !16}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSSt16initializer_listI10DataFormatE", !6, i64 0, !20, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = !{!19, !20, i64 8}
!22 = !{!23, !23, i64 0}
!23 = !{!"float", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}


; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<DataFormat, DataFormat, std::_Identity<DataFormat>, std::less<DataFormat>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<DataFormat, DataFormat, std::_Identity<DataFormat>, std::less<DataFormat>>::_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 }
%"struct.std::less" = type { i8 }
%"class.std::allocator.0" = type { i8 }

@constinit = external hidden local_unnamed_addr constant [5 x i32], align 4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #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 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 noundef i32 @_Z22quantizeBiasOffsetCI32PKf10TensorDescPaS1_S0_Pi(ptr noundef readonly %0, ptr nocapture noundef readonly byval(%struct.TensorDesc) align 8 %1, ptr noundef %2, ptr noundef byval(%struct.TensorDesc) align 8 %3, ptr nocapture noundef readonly %4, ptr noundef %5) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.std::set", align 8
  %8 = alloca [5 x i32], align 4
  %9 = alloca %"struct.std::less", align 1
  %10 = alloca %"class.std::allocator.0", align 1
  %11 = tail call noundef i32 @_Z17tensorNumElements10TensorDesc(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %1)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %8) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %8, ptr noundef nonnull align 4 dereferenceable(20) @constinit, i64 20, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #7
  call void @_ZNSaI10DataFormatEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  invoke void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EEC2ESt16initializer_listIS0_ERKS2_RKS3_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr nonnull %8, i64 5, ptr noundef nonnull align 1 dereferenceable(1) %9, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %12 unwind label %15

12:                                               ; preds = %6
  call void @_ZNSt15__new_allocatorI10DataFormatED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %8) #7
  %13 = icmp eq ptr %0, null
  %14 = icmp eq ptr %2, null
  %or.cond = and i1 %13, %14
  br i1 %or.cond, label %.loopexit, label %17

15:                                               ; preds = %6
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorI10DataFormatED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %8) #7
  br label %63

17:                                               ; preds = %12
  %18 = icmp eq i32 %11, 0
  %or.cond3 = or i1 %13, %18
  br i1 %or.cond3, label %19, label %40

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %3, i64 12
  %21 = load i32, ptr %20, align 4
  %22 = getelementptr inbounds i8, ptr %3, i64 16
  %23 = load i32, ptr %22, align 8
  %24 = call i32 @llvm.umax.i32(i32 %21, i32 %23)
  %25 = getelementptr inbounds i8, ptr %3, i64 4
  %26 = invoke noundef i64 @_ZNKSt3setI10DataFormatSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %25)
          to label %27 unwind label %33

27:                                               ; preds = %19
  %.not41 = icmp eq i64 %26, 0
  br i1 %.not41, label %35, label %28

28:                                               ; preds = %27
  %29 = invoke noundef i32 @_Z7bytesOf8DataType(i32 noundef 3)
          to label %30 unwind label %33

30:                                               ; preds = %28
  %31 = mul i32 %29, %24
  %32 = zext i32 %31 to i64
  call void @_Z10UNI_MEMSETPvim(ptr noundef %5, i32 noundef 0, i64 noundef %32)
  br label %.loopexit

33:                                               ; preds = %41, %37, %35, %28, %19
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  br label %63

35:                                               ; preds = %27
  %36 = invoke noundef i32 @_Z7bytesOf8DataType(i32 noundef 3)
          to label %37 unwind label %33

37:                                               ; preds = %35
  %38 = mul i32 %36, %24
  %39 = zext i32 %38 to i64
  invoke void @_Z10UNI_MEMCPYPvPKvm(ptr noundef %5, ptr noundef %2, i64 noundef %39)
          to label %.loopexit unwind label %33

40:                                               ; preds = %17
  br i1 %14, label %.lr.ph46.preheader, label %41

41:                                               ; preds = %40
  %42 = getelementptr inbounds i8, ptr %3, i64 4
  %43 = invoke noundef i64 @_ZNKSt3setI10DataFormatSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 4 dereferenceable(4) %42)
          to label %44 unwind label %33

44:                                               ; preds = %41
  %.not = icmp eq i64 %43, 0
  br i1 %.not, label %.lr.ph.preheader, label %.lr.ph46.preheader

.lr.ph.preheader:                                 ; preds = %44
  %wide.trip.count = zext i32 %11 to i64
  br label %.lr.ph

.lr.ph46.preheader:                               ; preds = %40, %44
  %wide.trip.count54 = zext i32 %11 to i64
  br label %.lr.ph46

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %indvars.iv51 = phi i64 [ 0, %.lr.ph46.preheader ], [ %indvars.iv.next52, %.lr.ph46 ]
  %45 = getelementptr inbounds float, ptr %0, i64 %indvars.iv51
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load float, ptr %4, align 4, !tbaa !9
  %48 = fmul float %46, %47
  %49 = call noundef float @_ZSt5roundf(float noundef %48)
  %50 = fptosi float %49 to i32
  %51 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv51
  store i32 %50, ptr %51, align 4, !tbaa !11
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count54
  br i1 %exitcond55.not, label %.loopexit, label %.lr.ph46, !llvm.loop !13

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %52 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  %53 = load float, ptr %52, align 4, !tbaa !9
  %54 = load float, ptr %4, align 4, !tbaa !9
  %55 = fmul float %53, %54
  %56 = call noundef float @_ZSt5roundf(float noundef %55)
  %57 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = sitofp i32 %58 to float
  %60 = fadd float %56, %59
  %61 = fptosi float %60 to i32
  %62 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  store i32 %61, ptr %62, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph46, %30, %37, %12
  call void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #7
  ret i32 0

63:                                               ; preds = %33, %15
  %.pn = phi { ptr, i32 } [ %34, %33 ], [ %16, %15 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #7
  resume { ptr, i32 } %.pn
}

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3setI10DataFormatSt4lessIS0_ESaIS0_EE5countERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z10UNI_MEMSETPvim(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z7bytesOf8DataType(i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setI10DataFormatSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = { inlinehint 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{i64 0, i64 20, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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