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

; 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
@__func__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@g_traceLevel = external global i32, align 4
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage = external hidden constant [67 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_0 = external hidden constant [36 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_1 = external hidden constant [42 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_2 = external hidden constant [36 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef %0, i64 noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  %18 = load i64, ptr %4, align 8, !tbaa !5
  %19 = icmp ule i64 %18, 30
  br i1 %19, label %22, label %20

20:                                               ; preds = %2
  call void @LogAssertFailure(i64 noundef 26, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm, ptr noundef @.str.1)
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str, i32 noundef 26, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm) #9
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %2
  %23 = phi i1 [ true, %2 ], [ false, %21 ]
  %24 = load i64, ptr %5, align 8, !tbaa !5
  %25 = icmp ule i64 1, %24
  br i1 %25, label %28, label %26

26:                                               ; preds = %22
  call void @LogAssertFailure(i64 noundef 27, ptr noundef @.str, ptr noundef @__func__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm, ptr noundef @.str.3)
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str, i32 noundef 27, ptr noundef @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm) #9
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %22
  %29 = phi i1 [ true, %22 ], [ false, %27 ]
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 2, i64 noundef %30) #10
  br i1 %31, label %32, label %39

32:                                               ; preds = %28
  br label %33

33:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  store i32 2, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %35 = icmp sle i32 2, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage)
  br label %37

37:                                               ; preds = %36, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  br label %38

38:                                               ; preds = %37
  store ptr null, ptr %3, align 8
  br label %166

39:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  %40 = load i64, ptr %5, align 8, !tbaa !5
  %41 = mul i64 16, %40
  store i64 %41, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  %42 = load i64, ptr %4, align 8, !tbaa !5
  %43 = mul i64 24, %42
  %44 = add i64 48, %43
  store i64 %44, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  %45 = load i64, ptr %8, align 8, !tbaa !5
  %46 = call noalias ptr @malloc(i64 noundef %45) #11
  store ptr %46, ptr %9, align 8, !tbaa !11
  %47 = load ptr, ptr %9, align 8, !tbaa !11
  %48 = icmp eq ptr null, %47
  %49 = xor i1 %48, true
  %50 = xor i1 %49, true
  %51 = zext i1 %50 to i64
  %52 = call i64 @llvm.expect.i64(i64 %51, i64 0)
  %53 = icmp ne i64 %52, 0
  br i1 %53, label %54, label %62

54:                                               ; preds = %39
  br label %55

55:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  store i32 2, ptr %10, align 4, !tbaa !9
  %56 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %57 = icmp sle i32 2, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_0)
  br label %59

59:                                               ; preds = %58, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %165

62:                                               ; preds = %39
  %63 = load i64, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %9, align 8, !tbaa !11
  %65 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %64, i32 0, i32 1
  store i64 %63, ptr %65, align 8, !tbaa !13
  %66 = load i64, ptr %4, align 8, !tbaa !5
  %67 = load ptr, ptr %9, align 8, !tbaa !11
  %68 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %67, i32 0, i32 2
  store i64 %66, ptr %68, align 8, !tbaa !16
  %69 = load i64, ptr %4, align 8, !tbaa !5
  %70 = load ptr, ptr %9, align 8, !tbaa !11
  %71 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %70, i32 0, i32 3
  store i64 %69, ptr %71, align 8, !tbaa !17
  %72 = load i64, ptr %7, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !11
  %74 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %73, i32 0, i32 0
  store i64 %72, ptr %74, align 8, !tbaa !18
  %75 = load ptr, ptr %9, align 8, !tbaa !11
  %76 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %75, i32 0, i32 5
  store i8 0, ptr %76, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  %77 = load i64, ptr %7, align 8, !tbaa !5
  %78 = call ptr @AlignedAlloc(i64 noundef %77)
  store ptr %78, ptr %12, align 8, !tbaa !11
  %79 = load ptr, ptr %12, align 8, !tbaa !11
  %80 = icmp eq ptr null, %79
  %81 = xor i1 %80, true
  %82 = xor i1 %81, true
  %83 = zext i1 %82 to i64
  %84 = call i64 @llvm.expect.i64(i64 %83, i64 0)
  %85 = icmp ne i64 %84, 0
  br i1 %85, label %86, label %95

86:                                               ; preds = %62
  br label %87

87:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #10
  store i32 2, ptr %13, align 4, !tbaa !9
  %88 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %89 = icmp sle i32 2, %88
  br i1 %89, label %90, label %91

90:                                               ; preds = %87
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_1)
  br label %91

91:                                               ; preds = %90, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #10
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  %94 = load ptr, ptr %9, align 8, !tbaa !11
  call void @free(ptr noundef %94) #10
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %164

95:                                               ; preds = %62
  %96 = load ptr, ptr %12, align 8, !tbaa !11
  %97 = load ptr, ptr %9, align 8, !tbaa !11
  %98 = getelementptr inbounds %"class.NAMESPACE_MAIN::Tensor", ptr %97, i32 0, i32 4
  store ptr %96, ptr %98, align 8, !tbaa !20
  %99 = load ptr, ptr %12, align 8, !tbaa !11
  %100 = load i64, ptr %5, align 8, !tbaa !5
  %101 = mul i64 8, %100
  call void @llvm.memset.p0.i64(ptr align 8 %99, i8 0, i64 %101, i1 false)
  %102 = load i64, ptr %4, align 8, !tbaa !5
  %103 = icmp ne i64 0, %102
  br i1 %103, label %104, label %162

104:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  %105 = load ptr, ptr %9, align 8, !tbaa !11
  %106 = call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %105)
  store ptr %106, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #10
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %118, %104
  %108 = load ptr, ptr %14, align 8, !tbaa !11
  %109 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %108, i32 0, i32 0
  store i64 1, ptr %109, align 8, !tbaa !21
  %110 = load ptr, ptr %14, align 8, !tbaa !11
  %111 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %110, i32 0, i32 2
  store i64 2, ptr %111, align 8, !tbaa !23
  %112 = load ptr, ptr %14, align 8, !tbaa !11
  %113 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %112, i32 0, i32 1
  store ptr null, ptr %113, align 8, !tbaa !24
  %114 = load ptr, ptr %14, align 8, !tbaa !11
  %115 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %114, i32 1
  store ptr %115, ptr %14, align 8, !tbaa !11
  %116 = load i64, ptr %15, align 8, !tbaa !5
  %117 = add i64 %116, 1
  store i64 %117, ptr %15, align 8, !tbaa !5
  br label %118

118:                                              ; preds = %107
  %119 = load i64, ptr %15, align 8, !tbaa !5
  %120 = load i64, ptr %4, align 8, !tbaa !5
  %121 = icmp ult i64 %119, %120
  br i1 %121, label %107, label %122, !llvm.loop !25

122:                                              ; preds = %118
  %123 = load ptr, ptr %9, align 8, !tbaa !11
  %124 = call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %123)
  store ptr %124, ptr %14, align 8, !tbaa !11
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %125

125:                                              ; preds = %154, %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #10
  %126 = call noalias ptr @malloc(i64 noundef 8) #11
  store ptr %126, ptr %16, align 8, !tbaa !11
  %127 = load ptr, ptr %16, align 8, !tbaa !11
  %128 = icmp eq ptr null, %127
  %129 = xor i1 %128, true
  %130 = xor i1 %129, true
  %131 = zext i1 %130 to i64
  %132 = call i64 @llvm.expect.i64(i64 %131, i64 0)
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %143

134:                                              ; preds = %125
  br label %135

135:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  store i32 2, ptr %17, align 4, !tbaa !9
  %136 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %137 = icmp sle i32 2, %136
  br i1 %137, label %138, label %139

138:                                              ; preds = %135
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_2)
  br label %139

139:                                              ; preds = %138, %135
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  %142 = load ptr, ptr %9, align 8, !tbaa !11
  call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef %142)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %151

143:                                              ; preds = %125
  %144 = load ptr, ptr %16, align 8, !tbaa !11
  %145 = load ptr, ptr %14, align 8, !tbaa !11
  %146 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %145, i32 0, i32 1
  store ptr %144, ptr %146, align 8, !tbaa !24
  %147 = load ptr, ptr %14, align 8, !tbaa !11
  %148 = getelementptr inbounds %"struct.NAMESPACE_MAIN::Tensor::DimensionInfo", ptr %147, i32 1
  store ptr %148, ptr %14, align 8, !tbaa !11
  %149 = load i64, ptr %15, align 8, !tbaa !5
  %150 = add i64 %149, 1
  store i64 %150, ptr %15, align 8, !tbaa !5
  store i32 0, ptr %11, align 4
  br label %151

151:                                              ; preds = %143, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #10
  %152 = load i32, ptr %11, align 4
  switch i32 %152, label %159 [
    i32 0, label %153
  ]

153:                                              ; preds = %151
  br label %154

154:                                              ; preds = %153
  %155 = load i64, ptr %15, align 8, !tbaa !5
  %156 = load i64, ptr %4, align 8, !tbaa !5
  %157 = icmp ult i64 %155, %156
  br i1 %157, label %125, label %158, !llvm.loop !27

158:                                              ; preds = %154
  store i32 0, ptr %11, align 4
  br label %159

159:                                              ; preds = %158, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  %160 = load i32, ptr %11, align 4
  switch i32 %160, label %164 [
    i32 0, label %161
  ]

161:                                              ; preds = %159
  br label %162

162:                                              ; preds = %161, %95
  %163 = load ptr, ptr %9, align 8, !tbaa !11
  store ptr %163, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %164

164:                                              ; preds = %162, %159, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  br label %165

165:                                              ; preds = %164, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  br label %166

166:                                              ; preds = %165, %38
  %167 = load ptr, ptr %3, align 8
  ret ptr %167
}

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) #2

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

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

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) #4

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

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

declare ptr @AlignedAlloc(i64 noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #7

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef) #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #7 = { 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 #8 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind }
attributes #11 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"_ZTSN14NAMESPACE_MAIN6TensorE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !15, i64 40, !7, i64 48}
!15 = !{!"bool", !7, i64 0}
!16 = !{!14, !6, i64 16}
!17 = !{!14, !6, i64 24}
!18 = !{!14, !6, i64 0}
!19 = !{!14, !15, i64 40}
!20 = !{!14, !12, i64 32}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTSN14NAMESPACE_MAIN6Tensor13DimensionInfoE", !6, i64 0, !12, i64 8, !6, i64 16}
!23 = !{!22, !6, i64 16}
!24 = !{!22, !12, i64 8}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


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

@.str = external hidden unnamed_addr constant [80 x i8], align 1
@__func__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@g_traceLevel = external local_unnamed_addr global i32, align 4
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage = external hidden constant [67 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_0 = external hidden constant [36 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_1 = external hidden constant [42 x i8], align 16
@_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_2 = external hidden constant [36 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14NAMESPACE_MAIN6Tensor8AllocateEmm(i64 noundef %0, i64 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = icmp ult i64 %0, 31
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @LogAssertFailure(i64 noundef 26, ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm, ptr noundef nonnull @.str.1)
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, i32 noundef 26, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN14NAMESPACE_MAIN6Tensor8AllocateEmm) #7
  unreachable

5:                                                ; preds = %2
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %6, label %7

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

7:                                                ; preds = %5
  %8 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL15IsMultiplyErrorImEEbT_S1_(i64 noundef 2, i64 noundef %1) #8
  br i1 %8, label %9, label %13

9:                                                ; preds = %7
  %10 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 1
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %9
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage)
  br label %.critedge

13:                                               ; preds = %7
  %14 = mul nuw nsw i64 %0, 24
  %15 = add nuw nsw i64 %14, 48
  %16 = tail call noalias ptr @malloc(i64 noundef %15) #9
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %22, !prof !9

18:                                               ; preds = %13
  %19 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %21, label %.critedge

21:                                               ; preds = %18
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_0)
  br label %.critedge

22:                                               ; preds = %13
  %23 = shl i64 %1, 4
  %24 = getelementptr inbounds i8, ptr %16, i64 8
  store i64 %1, ptr %24, align 8, !tbaa !10
  %25 = getelementptr inbounds i8, ptr %16, i64 16
  store i64 %0, ptr %25, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %16, i64 24
  store i64 %0, ptr %26, align 8, !tbaa !16
  store i64 %23, ptr %16, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %16, i64 40
  store i8 0, ptr %27, align 8, !tbaa !18
  %28 = tail call ptr @AlignedAlloc(i64 noundef %23)
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %35, !prof !9

30:                                               ; preds = %22
  %31 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 1
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_1)
  br label %34

34:                                               ; preds = %33, %30
  tail call void @free(ptr noundef nonnull %16) #8
  br label %.critedge

35:                                               ; preds = %22
  %36 = getelementptr inbounds i8, ptr %16, i64 32
  store ptr %28, ptr %36, align 8, !tbaa !19
  %37 = shl i64 %1, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %28, i8 0, i64 %37, i1 false)
  %.not58 = icmp eq i64 %0, 0
  br i1 %.not58, label %.critedge, label %38

38:                                               ; preds = %35
  %39 = tail call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %16)
  %xtraiter = and i64 %0, 3
  %40 = icmp ult i64 %0, 4
  br i1 %40, label %.unr-lcssa, label %.new

.new:                                             ; preds = %38
  %unroll_iter = and i64 %0, 28
  br label %41

41:                                               ; preds = %41, %.new
  %.050 = phi ptr [ %39, %.new ], [ %53, %41 ]
  %niter = phi i64 [ 0, %.new ], [ %niter.next.3, %41 ]
  store i64 1, ptr %.050, align 8, !tbaa !20
  %42 = getelementptr inbounds i8, ptr %.050, i64 16
  store i64 2, ptr %42, align 8, !tbaa !22
  %43 = getelementptr inbounds i8, ptr %.050, i64 8
  store ptr null, ptr %43, align 8, !tbaa !23
  %44 = getelementptr inbounds i8, ptr %.050, i64 24
  store i64 1, ptr %44, align 8, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %.050, i64 40
  store i64 2, ptr %45, align 8, !tbaa !22
  %46 = getelementptr inbounds i8, ptr %.050, i64 32
  store ptr null, ptr %46, align 8, !tbaa !23
  %47 = getelementptr inbounds i8, ptr %.050, i64 48
  store i64 1, ptr %47, align 8, !tbaa !20
  %48 = getelementptr inbounds i8, ptr %.050, i64 64
  store i64 2, ptr %48, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %.050, i64 56
  store ptr null, ptr %49, align 8, !tbaa !23
  %50 = getelementptr inbounds i8, ptr %.050, i64 72
  store i64 1, ptr %50, align 8, !tbaa !20
  %51 = getelementptr inbounds i8, ptr %.050, i64 88
  store i64 2, ptr %51, align 8, !tbaa !22
  %52 = getelementptr inbounds i8, ptr %.050, i64 80
  store ptr null, ptr %52, align 8, !tbaa !23
  %53 = getelementptr inbounds i8, ptr %.050, i64 96
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.unr-lcssa, label %41, !llvm.loop !24

.unr-lcssa:                                       ; preds = %41, %38
  %.050.unr = phi ptr [ %39, %38 ], [ %53, %41 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %.050.epil = phi ptr [ %56, %.epil.preheader ], [ %.050.unr, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.unr-lcssa ]
  store i64 1, ptr %.050.epil, align 8, !tbaa !20
  %54 = getelementptr inbounds i8, ptr %.050.epil, i64 16
  store i64 2, ptr %54, align 8, !tbaa !22
  %55 = getelementptr inbounds i8, ptr %.050.epil, i64 8
  store ptr null, ptr %55, align 8, !tbaa !23
  %56 = getelementptr inbounds i8, ptr %.050.epil, i64 24
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.epil.preheader, !llvm.loop !26

.epilog-lcssa:                                    ; preds = %.epil.preheader, %.unr-lcssa
  %57 = tail call noundef ptr @_ZN14NAMESPACE_MAIN6Tensor13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(72) %16)
  br label %58

58:                                               ; preds = %64, %.epilog-lcssa
  %.151 = phi ptr [ %57, %.epilog-lcssa ], [ %66, %64 ]
  %.148 = phi i64 [ 0, %.epilog-lcssa ], [ %67, %64 ]
  %59 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #9
  %.not59.not = icmp eq ptr %59, null
  br i1 %.not59.not, label %60, label %64, !prof !9

60:                                               ; preds = %58
  %61 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %62 = icmp sgt i32 %61, 1
  br i1 %62, label %63, label %.thread

63:                                               ; preds = %60
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN6Tensor8AllocateEmmE13LOG__sMessage_2)
  br label %.thread

.thread:                                          ; preds = %60, %63
  tail call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef nonnull %16)
  br label %.critedge

64:                                               ; preds = %58
  %65 = getelementptr inbounds i8, ptr %.151, i64 8
  store ptr %59, ptr %65, align 8, !tbaa !23
  %66 = getelementptr inbounds i8, ptr %.151, i64 24
  %67 = add nuw i64 %.148, 1
  %exitcond62.not = icmp eq i64 %67, %0
  br i1 %exitcond62.not, label %.critedge, label %58, !llvm.loop !28

.critedge:                                        ; preds = %64, %35, %.thread, %21, %18, %34, %9, %12
  %.4 = phi ptr [ null, %12 ], [ null, %9 ], [ null, %21 ], [ null, %18 ], [ null, %34 ], [ null, %.thread ], [ %16, %35 ], [ %16, %64 ]
  ret ptr %.4
}

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

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

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

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

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

declare ptr @AlignedAlloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef) local_unnamed_addr #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 = { mustprogress nounwind willreturn allockind("free") 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!10 = !{!11, !12, i64 8}
!11 = !{!"_ZTSN14NAMESPACE_MAIN6TensorE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !14, i64 40, !7, i64 48}
!12 = !{!"long", !7, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!11, !12, i64 16}
!16 = !{!11, !12, i64 24}
!17 = !{!11, !12, i64 0}
!18 = !{!11, !14, i64 40}
!19 = !{!11, !13, i64 32}
!20 = !{!21, !12, i64 0}
!21 = !{!"_ZTSN14NAMESPACE_MAIN6Tensor13DimensionInfoE", !12, i64 0, !13, i64 8, !12, i64 16}
!22 = !{!21, !12, i64 16}
!23 = !{!21, !13, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.unroll.disable"}
!28 = distinct !{!28, !25}


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