; LLVM IR from interpretml/interpret :: shared/libebm (BoosterCore)

; 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"

@g_traceLevel = external global i32, align 4
@.str = external hidden unnamed_addr constant [85 x i8], align 1
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage = external hidden constant [26 x i8], align 16
@__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE = external hidden unnamed_addr constant [129 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_0 = external hidden constant [68 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_1 = external hidden constant [47 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_2 = external hidden constant [46 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_3 = external hidden constant [25 x i8], align 16

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

declare void @InteralLogWithoutArguments(i32 noundef, ptr noundef) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #2

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE(i64 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #4 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %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 ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store i64 %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 3, ptr %10, align 4, !tbaa !11
  %25 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %26 = icmp sle i32 3, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage)
  br label %28

28:                                               ; preds = %27, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %29

29:                                               ; preds = %28
  %30 = load i64, ptr %6, align 8, !tbaa !5
  %31 = icmp ule i64 1, %30
  br i1 %31, label %34, label %32

32:                                               ; preds = %29
  call void @LogAssertFailure(i64 noundef 67, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef @.str.3)
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str, i32 noundef 67, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #8
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %29
  %35 = phi i1 [ true, %29 ], [ false, %33 ]
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = icmp ne ptr null, %36
  br i1 %37, label %40, label %38

38:                                               ; preds = %34
  call void @LogAssertFailure(i64 noundef 68, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef @.str.5)
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str, i32 noundef 68, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #8
  unreachable

39:                                               ; No predecessors!
  br label %40

40:                                               ; preds = %39, %34
  %41 = phi i1 [ true, %34 ], [ false, %39 ]
  %42 = load i64, ptr %8, align 8, !tbaa !5
  %43 = icmp ule i64 1, %42
  br i1 %43, label %46, label %44

44:                                               ; preds = %40
  call void @LogAssertFailure(i64 noundef 69, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef @.str.7)
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str, i32 noundef 69, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #8
  unreachable

45:                                               ; No predecessors!
  br label %46

46:                                               ; preds = %45, %40
  %47 = phi i1 [ true, %40 ], [ false, %45 ]
  %48 = load ptr, ptr %9, align 8, !tbaa !9
  %49 = icmp ne ptr null, %48
  br i1 %49, label %52, label %50

50:                                               ; preds = %46
  call void @LogAssertFailure(i64 noundef 70, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef @.str.9)
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str, i32 noundef 70, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #8
  unreachable

51:                                               ; No predecessors!
  br label %52

52:                                               ; preds = %51, %46
  %53 = phi i1 [ true, %46 ], [ false, %51 ]
  %54 = load ptr, ptr %9, align 8, !tbaa !9
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = icmp eq ptr null, %55
  br i1 %56, label %59, label %57

57:                                               ; preds = %52
  call void @LogAssertFailure(i64 noundef 71, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef @.str.11)
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str, i32 noundef 71, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #8
  unreachable

58:                                               ; No predecessors!
  br label %59

59:                                               ; preds = %58, %52
  %60 = phi i1 [ true, %52 ], [ false, %58 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %61 = load i64, ptr %6, align 8, !tbaa !5
  %62 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 8, i64 noundef %61) #7
  br i1 %62, label %63, label %71

63:                                               ; preds = %59
  br label %64

64:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 2, ptr %12, align 4, !tbaa !11
  %65 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %66 = icmp sle i32 2, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_0)
  br label %68

68:                                               ; preds = %67, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %170

71:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %72 = load i64, ptr %6, align 8, !tbaa !5
  %73 = mul i64 8, %72
  %74 = call noalias ptr @malloc(i64 noundef %73) #9
  store ptr %74, ptr %14, align 8, !tbaa !9
  %75 = load ptr, ptr %14, align 8, !tbaa !9
  %76 = icmp eq ptr null, %75
  %77 = xor i1 %76, true
  %78 = xor i1 %77, true
  %79 = zext i1 %78 to i64
  %80 = call i64 @llvm.expect.i64(i64 %79, i64 0)
  %81 = icmp ne i64 %80, 0
  br i1 %81, label %82, label %90

82:                                               ; preds = %71
  br label %83

83:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 2, ptr %15, align 4, !tbaa !11
  %84 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %85 = icmp sle i32 2, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %83
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_1)
  br label %87

87:                                               ; preds = %86, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %169

90:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %91 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %91, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %92 = load ptr, ptr %14, align 8, !tbaa !9
  %93 = load i64, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds ptr, ptr %92, i64 %93
  store ptr %94, ptr %17, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %99, %90
  %96 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr null, ptr %96, align 8, !tbaa !9
  %97 = load ptr, ptr %16, align 8, !tbaa !9
  %98 = getelementptr inbounds ptr, ptr %97, i32 1
  store ptr %98, ptr %16, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %95
  %100 = load ptr, ptr %17, align 8, !tbaa !9
  %101 = load ptr, ptr %16, align 8, !tbaa !9
  %102 = icmp ne ptr %100, %101
  br i1 %102, label %95, label %103, !llvm.loop !13

103:                                              ; preds = %99
  %104 = load ptr, ptr %14, align 8, !tbaa !9
  %105 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %104, ptr %105, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %106 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %106, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %107 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %107, ptr %19, align 8, !tbaa !9
  br label %108

108:                                              ; preds = %156, %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %109 = load ptr, ptr %19, align 8, !tbaa !9
  %110 = load ptr, ptr %109, align 8, !tbaa !9
  store ptr %110, ptr %20, align 8, !tbaa !9
  %111 = load ptr, ptr %20, align 8, !tbaa !9
  %112 = call noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountTensorBinsEv(ptr noundef nonnull align 8 dereferenceable(776) %111) #7
  %113 = icmp ne i64 0, %112
  br i1 %113, label %114, label %148

114:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %115 = load ptr, ptr %20, align 8, !tbaa !9
  %116 = call noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountDimensionsEv(ptr noundef nonnull align 8 dereferenceable(776) %115) #7
  %117 = load i64, ptr %8, align 8, !tbaa !5
  %118 = call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef %116, i64 noundef %117)
  store ptr %118, ptr %21, align 8, !tbaa !9
  %119 = load ptr, ptr %21, align 8, !tbaa !9
  %120 = icmp eq ptr null, %119
  %121 = xor i1 %120, true
  %122 = xor i1 %121, true
  %123 = zext i1 %122 to i64
  %124 = call i64 @llvm.expect.i64(i64 %123, i64 0)
  %125 = icmp ne i64 %124, 0
  br i1 %125, label %126, label %134

126:                                              ; preds = %114
  br label %127

127:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 2, ptr %22, align 4, !tbaa !11
  %128 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %129 = icmp sle i32 2, %128
  br i1 %129, label %130, label %131

130:                                              ; preds = %127
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_2)
  br label %131

131:                                              ; preds = %130, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %145

134:                                              ; preds = %114
  %135 = load ptr, ptr %21, align 8, !tbaa !9
  %136 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %135, ptr %136, align 8, !tbaa !9
  %137 = load ptr, ptr %21, align 8, !tbaa !9
  %138 = load ptr, ptr %20, align 8, !tbaa !9
  %139 = call noundef i32 @_ZN14NAMESPACE_MAIN6Tensor6ExpandEPKNS_4TermE(ptr noundef nonnull align 8 dereferenceable(72) %137, ptr noundef %138)
  store i32 %139, ptr %11, align 4, !tbaa !11
  %140 = load i32, ptr %11, align 4, !tbaa !11
  %141 = icmp ne i32 0, %140
  br i1 %141, label %142, label %144

142:                                              ; preds = %134
  %143 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %143, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %145

144:                                              ; preds = %134
  store i32 0, ptr %13, align 4
  br label %145

145:                                              ; preds = %144, %142, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  %146 = load i32, ptr %13, align 4
  switch i32 %146, label %153 [
    i32 0, label %147
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147, %108
  %149 = load ptr, ptr %19, align 8, !tbaa !9
  %150 = getelementptr inbounds ptr, ptr %149, i32 1
  store ptr %150, ptr %19, align 8, !tbaa !9
  %151 = load ptr, ptr %18, align 8, !tbaa !9
  %152 = getelementptr inbounds ptr, ptr %151, i32 1
  store ptr %152, ptr %18, align 8, !tbaa !9
  store i32 0, ptr %13, align 4
  br label %153

153:                                              ; preds = %148, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  %154 = load i32, ptr %13, align 4
  switch i32 %154, label %168 [
    i32 0, label %155
  ]

155:                                              ; preds = %153
  br label %156

156:                                              ; preds = %155
  %157 = load ptr, ptr %17, align 8, !tbaa !9
  %158 = load ptr, ptr %18, align 8, !tbaa !9
  %159 = icmp ne ptr %157, %158
  br i1 %159, label %108, label %160, !llvm.loop !15

160:                                              ; preds = %156
  br label %161

161:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 3, ptr %23, align 4, !tbaa !11
  %162 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %163 = icmp sle i32 3, %162
  br i1 %163, label %164, label %165

164:                                              ; preds = %161
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_3)
  br label %165

165:                                              ; preds = %164, %161
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  store i32 0, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %168

168:                                              ; preds = %167, %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %169

169:                                              ; preds = %168, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %170

170:                                              ; preds = %169, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %171 = load i32, ptr %5, align 4
  ret i32 %171
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef, i64 noundef) #5

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountTensorBinsEv(ptr noundef nonnull align 8 dereferenceable(776)) #5 align 2

declare noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef, i64 noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountDimensionsEv(ptr noundef nonnull align 8 dereferenceable(776)) #5 align 2

declare noundef i32 @_ZN14NAMESPACE_MAIN6Tensor6ExpandEPKNS_4TermE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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(none) }
attributes #3 = { noreturn 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 #4 = { 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 #5 = { 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 #6 = { nounwind allocsize(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 #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind allocsize(0) }

!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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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}


; 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"

@g_traceLevel = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [85 x i8], align 1
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage = external hidden constant [26 x i8], align 16
@__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE = external hidden unnamed_addr constant [129 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_0 = external hidden constant [68 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_1 = external hidden constant [47 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_2 = external hidden constant [46 x i8], align 16
@_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_3 = external hidden constant [25 x i8], align 16

declare void @InteralLogWithoutArguments(i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @LogAssertFailure(i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE(i64 noundef %0, ptr noundef readonly %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #2 align 2 {
  %5 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 2
  br i1 %6, label %7, label %8

7:                                                ; preds = %4
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage)
  br label %8

8:                                                ; preds = %7, %4
  %.not = icmp eq i64 %0, 0
  br i1 %.not, label %9, label %10

9:                                                ; preds = %8
  tail call void @LogAssertFailure(i64 noundef 67, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef nonnull @.str.3)
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str, i32 noundef 67, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #5
  unreachable

10:                                               ; preds = %8
  %.not52 = icmp eq ptr %1, null
  br i1 %.not52, label %11, label %12

11:                                               ; preds = %10
  tail call void @LogAssertFailure(i64 noundef 68, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef nonnull @.str.5)
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str, i32 noundef 68, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #5
  unreachable

12:                                               ; preds = %10
  %.not53 = icmp eq i64 %2, 0
  br i1 %.not53, label %13, label %14

13:                                               ; preds = %12
  tail call void @LogAssertFailure(i64 noundef 69, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef nonnull @.str.7)
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str, i32 noundef 69, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #5
  unreachable

14:                                               ; preds = %12
  %.not54 = icmp eq ptr %3, null
  br i1 %.not54, label %15, label %16

15:                                               ; preds = %14
  tail call void @LogAssertFailure(i64 noundef 70, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef nonnull @.str.9)
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str, i32 noundef 70, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #5
  unreachable

16:                                               ; preds = %14
  %17 = load ptr, ptr %3, align 8, !tbaa !9
  %18 = icmp eq ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  tail call void @LogAssertFailure(i64 noundef 71, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE, ptr noundef nonnull @.str.11)
  tail call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str, i32 noundef 71, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorE) #5
  unreachable

20:                                               ; preds = %16
  %21 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 8, i64 noundef %0) #6
  br i1 %21, label %22, label %26

22:                                               ; preds = %20
  %23 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 1
  br i1 %24, label %25, label %.thread62

25:                                               ; preds = %22
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_0)
  br label %.thread62

26:                                               ; preds = %20
  %27 = shl i64 %0, 3
  %calloc = tail call ptr @calloc(i64 1, i64 %27)
  %28 = icmp eq ptr %calloc, null
  br i1 %28, label %29, label %33, !prof !11

29:                                               ; preds = %26
  %30 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 1
  br i1 %31, label %32, label %.thread62

32:                                               ; preds = %29
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_1)
  br label %.thread62

33:                                               ; preds = %26
  %34 = getelementptr inbounds ptr, ptr %calloc, i64 %0
  store ptr %calloc, ptr %3, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %48, %33
  %.042 = phi ptr [ %1, %33 ], [ %49, %48 ]
  %.040 = phi ptr [ %calloc, %33 ], [ %50, %48 ]
  %36 = load ptr, ptr %.042, align 8, !tbaa !9
  %37 = tail call noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountTensorBinsEv(ptr noundef nonnull align 8 dereferenceable(776) %36) #6
  %.not56 = icmp eq i64 %37, 0
  br i1 %.not56, label %48, label %38

38:                                               ; preds = %35
  %39 = tail call noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountDimensionsEv(ptr noundef nonnull align 8 dereferenceable(776) %36) #6
  %40 = tail call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef %39, i64 noundef %2)
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %46, !prof !11

42:                                               ; preds = %38
  %43 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 1
  br i1 %44, label %45, label %.thread62

45:                                               ; preds = %42
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_2)
  br label %.thread62

46:                                               ; preds = %38
  store ptr %40, ptr %.040, align 8, !tbaa !9
  %47 = tail call noundef i32 @_ZN14NAMESPACE_MAIN6Tensor6ExpandEPKNS_4TermE(ptr noundef nonnull align 8 dereferenceable(72) %40, ptr noundef nonnull %36)
  %.not57 = icmp eq i32 %47, 0
  br i1 %.not57, label %48, label %.thread62

48:                                               ; preds = %46, %35
  %49 = getelementptr inbounds i8, ptr %.042, i64 8
  %50 = getelementptr inbounds i8, ptr %.040, i64 8
  %.not58 = icmp eq ptr %34, %50
  br i1 %.not58, label %51, label %35, !llvm.loop !12

51:                                               ; preds = %48
  %52 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, 2
  br i1 %53, label %54, label %.thread62

54:                                               ; preds = %51
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN11BoosterCore17InitializeTensorsEmPKPKNS_4TermEmPPPNS_6TensorEE13LOG__sMessage_3)
  br label %.thread62

.thread62:                                        ; preds = %46, %42, %45, %32, %29, %51, %54, %22, %25
  %.6 = phi i32 [ -1, %25 ], [ -1, %22 ], [ -1, %32 ], [ -1, %29 ], [ 0, %54 ], [ 0, %51 ], [ -1, %45 ], [ -1, %42 ], [ %47, %46 ]
  ret i32 %.6
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountTensorBinsEv(ptr noundef nonnull align 8 dereferenceable(776)) local_unnamed_addr #3 align 2

declare noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK14NAMESPACE_MAIN4Term18GetCountDimensionsEv(ptr noundef nonnull align 8 dereferenceable(776)) local_unnamed_addr #3 align 2

declare noundef i32 @_ZN14NAMESPACE_MAIN6Tensor6ExpandEPKNS_4TermE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #4

attributes #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 = { noreturn 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 #2 = { 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 #3 = { 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 #4 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #5 = { noreturn nounwind }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopIdiomRecognizePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass