; LLVM IR from interpretml/interpret :: shared/libebm/Tensor.ll (ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm)

; 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.NAMESPACE_MAIN::Tensor" = type { i64, i64, i64, i64, ptr, i8, [1 x %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo"] }
%"struct.NAMESPACE_MAIN::Tensor::DimensionInfo" = type { i64, ptr, i64 }

@.str = external hidden unnamed_addr constant [80 x i8], align 1
@g_traceLevel = external global i32, align 4
@__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage = external hidden constant [57 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_0 = external hidden constant [35 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_1 = external hidden constant [77 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_2 = external hidden constant [45 x i8], align 16

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1, i64 noundef %2) #5 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  %18 = load ptr, ptr %5, align 8
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %18, i32 0, i32 3
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = icmp ult i64 %19, %21
  br i1 %22, label %25, label %23

23:                                               ; preds = %3
  call void @LogAssertFailure(i64 noundef 122, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef @.str.5)
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str, i32 noundef 122, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #7
  unreachable

24:                                               ; No predecessors!
  br label %25

25:                                               ; preds = %24, %3
  %26 = phi i1 [ true, %3 ], [ false, %24 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %27 = call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %18)
  %28 = load i64, ptr %6, align 8, !tbaa !9
  %29 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %27, i64 %28
  store ptr %29, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %18, i32 0, i32 5
  %31 = load i8, ptr %30, align 8, !tbaa !14, !range !15, !noundef !16
  %32 = trunc i8 %31 to i1
  br i1 %32, label %33, label %41

33:                                               ; preds = %25
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %35, i32 0, i32 0
  %37 = load i64, ptr %36, align 8, !tbaa !17
  %38 = icmp ule i64 %34, %37
  br i1 %38, label %41, label %39

39:                                               ; preds = %33
  call void @LogAssertFailure(i64 noundef 126, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef @.str.7)
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str, i32 noundef 126, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #7
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %33, %25
  %42 = phi i1 [ true, %33 ], [ true, %25 ], [ false, %40 ]
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %43, i32 0, i32 2
  %45 = load i64, ptr %44, align 8, !tbaa !19
  %46 = load i64, ptr %7, align 8, !tbaa !9
  %47 = icmp ult i64 %45, %46
  %48 = xor i1 %47, true
  %49 = xor i1 %48, true
  %50 = zext i1 %49 to i64
  %51 = call i64 @llvm.expect.i64(i64 %50, i64 0)
  %52 = icmp ne i64 %51, 0
  br i1 %52, label %53, label %134

53:                                               ; preds = %41
  %54 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %18, i32 0, i32 5
  %55 = load i8, ptr %54, align 8, !tbaa !14, !range !15, !noundef !16
  %56 = trunc i8 %55 to i1
  br i1 %56, label %57, label %59

57:                                               ; preds = %53
  call void @LogAssertFailure(i64 noundef 128, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef @.str.9)
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str, i32 noundef 128, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #7
  unreachable

58:                                               ; No predecessors!
  br label %59

59:                                               ; preds = %58, %53
  %60 = phi i1 [ true, %53 ], [ false, %58 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %61 = load i64, ptr %7, align 8, !tbaa !9
  %62 = sub i64 %61, 1
  store i64 %62, ptr %9, align 8, !tbaa !9
  %63 = load i64, ptr %9, align 8, !tbaa !9
  %64 = load i64, ptr %9, align 8, !tbaa !9
  %65 = lshr i64 %64, 1
  %66 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL10IsAddErrorImEEbT_S1_(i64 noundef %63, i64 noundef %65) #8
  br i1 %66, label %67, label %75

67:                                               ; preds = %59
  br label %68

68:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 2, ptr %10, align 4, !tbaa !20
  %69 = load i32, ptr @g_traceLevel, align 4, !tbaa !20
  %70 = icmp sle i32 2, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage)
  br label %72

72:                                               ; preds = %71, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %131

75:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %76 = load i64, ptr %9, align 8, !tbaa !9
  %77 = load i64, ptr %9, align 8, !tbaa !9
  %78 = lshr i64 %77, 1
  %79 = add i64 %76, %78
  store i64 %79, ptr %12, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 3, ptr %13, align 4, !tbaa !20
  %81 = load i32, ptr @g_traceLevel, align 4, !tbaa !20
  %82 = icmp sle i32 3, %81
  br i1 %82, label %83, label %85

83:                                               ; preds = %80
  %84 = load i64, ptr %12, align 8, !tbaa !9
  call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_0, i64 noundef %84)
  br label %85

85:                                               ; preds = %83, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  %88 = load i64, ptr %12, align 8, !tbaa !9
  %89 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 8, i64 noundef %88) #8
  br i1 %89, label %90, label %98

90:                                               ; preds = %87
  br label %91

91:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 2, ptr %14, align 4, !tbaa !20
  %92 = load i32, ptr @g_traceLevel, align 4, !tbaa !20
  %93 = icmp sle i32 2, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %91
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_1)
  br label %95

95:                                               ; preds = %94, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %130

98:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %99 = load i64, ptr %12, align 8, !tbaa !9
  %100 = mul i64 8, %99
  store i64 %100, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !22
  %104 = load i64, ptr %15, align 8, !tbaa !9
  %105 = call ptr @realloc(ptr noundef %103, i64 noundef %104) #9
  store ptr %105, ptr %16, align 8, !tbaa !5
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = icmp eq ptr null, %106
  %108 = xor i1 %107, true
  %109 = xor i1 %108, true
  %110 = zext i1 %109 to i64
  %111 = call i64 @llvm.expect.i64(i64 %110, i64 0)
  %112 = icmp ne i64 %111, 0
  br i1 %112, label %113, label %121

113:                                              ; preds = %98
  br label %114

114:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 2, ptr %17, align 4, !tbaa !20
  %115 = load i32, ptr @g_traceLevel, align 4, !tbaa !20
  %116 = icmp sle i32 2, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %114
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_2)
  br label %118

118:                                              ; preds = %117, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %129

121:                                              ; preds = %98
  %122 = load ptr, ptr %16, align 8, !tbaa !5
  %123 = load ptr, ptr %8, align 8, !tbaa !5
  %124 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %123, i32 0, i32 1
  store ptr %122, ptr %124, align 8, !tbaa !22
  %125 = load i64, ptr %12, align 8, !tbaa !9
  %126 = add i64 %125, 1
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %127, i32 0, i32 2
  store i64 %126, ptr %128, align 8, !tbaa !19
  store i32 0, ptr %11, align 4
  br label %129

129:                                              ; preds = %121, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %130

130:                                              ; preds = %129, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %131

131:                                              ; preds = %130, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  %132 = load i32, ptr %11, align 4
  switch i32 %132, label %138 [
    i32 0, label %133
  ]

133:                                              ; preds = %131
  br label %134

134:                                              ; preds = %133, %41
  %135 = load i64, ptr %7, align 8, !tbaa !9
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %136, i32 0, i32 0
  store i64 %135, ptr %137, align 8, !tbaa !17
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %138

138:                                              ; preds = %134, %131
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %139 = load i32, ptr %4, align 4
  ret i32 %139
}

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

declare void @InteralLogWithArguments(i32 noundef, ptr noundef, ...) #0

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

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

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTSN14NAMESPACE_MAIN6TensorE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !13, i64 40, !7, i64 48}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !13, i64 40}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTSN14NAMESPACE_MAIN6Tensor13DimensionInfoE", !10, i64 0, !6, i64 8, !10, i64 16}
!19 = !{!18, !10, i64 16}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!18, !6, i64 8}


; 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.NAMESPACE_MAIN::Tensor::DimensionInfo" = type { i64, ptr, i64 }

@.str = external hidden unnamed_addr constant [80 x i8], align 1
@g_traceLevel = external local_unnamed_addr global i32, align 4
@__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [30 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage = external hidden constant [57 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_0 = external hidden constant [35 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_1 = external hidden constant [77 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_2 = external hidden constant [45 x i8], align 16

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: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 1) i32 @_ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm(ptr noundef nonnull align 8 dereferenceable(72) %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #3 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = icmp ugt i64 %5, %1
  br i1 %6, label %8, label %7

7:                                                ; preds = %3
  tail call void @LogAssertFailure(i64 noundef 122, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef nonnull @.str.5)
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str, i32 noundef 122, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #5
  unreachable

8:                                                ; preds = %3
  %9 = tail call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %0)
  %10 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %9, i64 %1
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load i8, ptr %11, align 8, !tbaa !12, !range !13, !noundef !14
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %14, label %.thread

14:                                               ; preds = %8
  %15 = load i64, ptr %10, align 8, !tbaa !15
  %.not = icmp ult i64 %15, %2
  br i1 %.not, label %16, label %17

16:                                               ; preds = %14
  tail call void @LogAssertFailure(i64 noundef 126, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef nonnull @.str.7)
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str, i32 noundef 126, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #5
  unreachable

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %10, i64 16
  %19 = load i64, ptr %18, align 8, !tbaa !17
  %20 = icmp ult i64 %19, %2
  br i1 %20, label %24, label %55, !prof !18

.thread:                                          ; preds = %8
  %21 = getelementptr inbounds i8, ptr %10, i64 16
  %22 = load i64, ptr %21, align 8, !tbaa !17
  %23 = icmp ult i64 %22, %2
  br i1 %23, label %25, label %55, !prof !18

24:                                               ; preds = %17
  tail call void @LogAssertFailure(i64 noundef 128, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm, ptr noundef nonnull @.str.9)
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str, i32 noundef 128, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmm) #5
  unreachable

25:                                               ; preds = %.thread
  %26 = add i64 %2, -1
  %27 = lshr i64 %26, 1
  %28 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL10IsAddErrorImEEbT_S1_(i64 noundef %26, i64 noundef %27) #6
  br i1 %28, label %29, label %33

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

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

33:                                               ; preds = %25
  %34 = add i64 %27, %26
  %35 = load i32, ptr @g_traceLevel, align 4, !tbaa !19
  %36 = icmp sgt i32 %35, 2
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  tail call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_0, i64 noundef %34)
  br label %38

38:                                               ; preds = %37, %33
  %39 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 8, i64 noundef %34) #6
  br i1 %39, label %40, label %44

40:                                               ; preds = %38
  %41 = load i32, ptr @g_traceLevel, align 4, !tbaa !19
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %43, label %.critedge

43:                                               ; preds = %40
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_1)
  br label %.critedge

44:                                               ; preds = %38
  %45 = shl i64 %34, 3
  %46 = getelementptr inbounds i8, ptr %10, i64 8
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  %48 = tail call ptr @realloc(ptr noundef %47, i64 noundef %45) #7
  %.not32 = icmp eq ptr %48, null
  br i1 %.not32, label %49, label %53, !prof !18

49:                                               ; preds = %44
  %50 = load i32, ptr @g_traceLevel, align 4, !tbaa !19
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %52, label %.critedge

52:                                               ; preds = %49
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor14SetCountSlicesEmmE13LOG__sMessage_2)
  br label %.critedge

53:                                               ; preds = %44
  store ptr %48, ptr %46, align 8, !tbaa !21
  %54 = add i64 %27, %2
  store i64 %54, ptr %21, align 8, !tbaa !17
  br label %55

55:                                               ; preds = %53, %.thread, %17
  store i64 %2, ptr %10, align 8, !tbaa !15
  br label %.critedge

.critedge:                                        ; preds = %52, %49, %32, %29, %43, %40, %55
  %.3 = phi i32 [ 0, %55 ], [ -1, %40 ], [ -1, %43 ], [ -1, %29 ], [ -1, %32 ], [ -1, %49 ], [ -1, %52 ]
  ret i32 %.3
}

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture 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 = { 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 #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 willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { noreturn nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(1) }

!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, !7, i64 24}
!6 = !{!"_ZTSN14NAMESPACE_MAIN6TensorE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !8, i64 48}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!6, !11, i64 40}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !7, i64 0}
!16 = !{!"_ZTSN14NAMESPACE_MAIN6Tensor13DimensionInfoE", !7, i64 0, !10, i64 8, !7, i64 16}
!17 = !{!16, !7, i64 16}
!18 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !8, i64 0}
!21 = !{!16, !10, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass