; LLVM IR from libxsmm/libxsmm :: src (libxsmm_malloc)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.internal_malloc_info_type = type { %union.libxsmm_free_function, ptr, ptr, ptr, i64, i32 }
%union.libxsmm_free_function = type { ptr }

@.str.1 = external hidden unnamed_addr constant [70 x i8], align 1
@libxsmm_verbosity = external global i32, align 4
@stderr = external global ptr, align 8
@libxsmm_malloc_attrib.error_once = external hidden global i32, align 4
@.str.68 = external hidden unnamed_addr constant [69 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_malloc_attrib = external hidden unnamed_addr constant [70 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @internal_malloc_info(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare i32 @munmap(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @libxsmm_malloc_xattrib(ptr noundef, i32 noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @libxsmm_malloc_attrib(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp ne ptr null, %17
  br i1 %18, label %19, label %23

19:                                               ; preds = %4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = call ptr @internal_malloc_info(ptr noundef %21, i32 noundef 0)
  br label %24

23:                                               ; preds = %4
  br label %24

24:                                               ; preds = %23, %19
  %25 = phi ptr [ %22, %19 ], [ null, %23 ]
  store ptr %25, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = icmp ne ptr null, %26
  br i1 %27, label %28, label %179

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %29, i32 0, i32 4
  %31 = load i64, ptr %30, align 8, !tbaa !11
  store i64 %31, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = icmp eq ptr null, %32
  br i1 %33, label %34, label %36

34:                                               ; preds = %28
  %35 = load i64, ptr %11, align 8, !tbaa !14
  br label %50

36:                                               ; preds = %28
  %37 = load i64, ptr %11, align 8, !tbaa !14
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = load i64, ptr %38, align 8, !tbaa !14
  %40 = load i64, ptr %11, align 8, !tbaa !14
  %41 = icmp ult i64 %39, %40
  br i1 %41, label %42, label %45

42:                                               ; preds = %36
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i64, ptr %43, align 8, !tbaa !14
  br label %47

45:                                               ; preds = %36
  %46 = load i64, ptr %11, align 8, !tbaa !14
  br label %47

47:                                               ; preds = %45, %42
  %48 = phi i64 [ %44, %42 ], [ %46, %45 ]
  %49 = sub i64 %37, %48
  br label %50

50:                                               ; preds = %47, %34
  %51 = phi i64 [ %35, %34 ], [ %49, %47 ]
  store i64 %51, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  store ptr %54, ptr %13, align 8, !tbaa !5
  %55 = load ptr, ptr %13, align 8, !tbaa !5
  %56 = icmp ne ptr null, %55
  br i1 %56, label %57, label %60

57:                                               ; preds = %50
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = icmp ne ptr inttoptr (i64 -1 to ptr), %58
  br i1 %59, label %63, label %60

60:                                               ; preds = %57, %50
  %61 = load i64, ptr %12, align 8, !tbaa !14
  %62 = icmp eq i64 0, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %60, %57
  br label %65

64:                                               ; preds = %60
  call void @__assert_fail(ptr noundef @.str.68, ptr noundef @.str.1, i32 noundef 2265, ptr noundef @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

65:                                               ; preds = %63
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %66, i32 0, i32 5
  %68 = load i32, ptr %67, align 8, !tbaa !16
  %69 = and i32 %68, -449
  %70 = load i32, ptr %6, align 4, !tbaa !9
  %71 = or i32 %70, %69
  store i32 %71, ptr %6, align 4, !tbaa !9
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = and i32 128, %72
  %74 = icmp eq i32 0, %73
  br i1 %74, label %79, label %75

75:                                               ; preds = %65
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = and i32 256, %76
  %78 = icmp ne i32 0, %77
  br i1 %78, label %79, label %178

79:                                               ; preds = %75, %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = ptrtoint ptr %81 to i64
  %84 = ptrtoint ptr %82 to i64
  %85 = sub i64 %83, %84
  store i64 %85, ptr %14, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %86 = load i64, ptr %12, align 8, !tbaa !14
  %87 = load i64, ptr %14, align 8, !tbaa !14
  %88 = add i64 %86, %87
  store i64 %88, ptr %15, align 8, !tbaa !14
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = and i32 256, %89
  %91 = icmp eq i32 0, %90
  br i1 %91, label %92, label %97

92:                                               ; preds = %79
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = load i64, ptr %15, align 8, !tbaa !14
  %96 = call i32 @libxsmm_malloc_xattrib(ptr noundef %93, i32 noundef %94, i64 noundef %95)
  store i32 %96, ptr %10, align 4, !tbaa !9
  br label %177

97:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %98, i32 0, i32 2
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = icmp ne ptr null, %100
  br i1 %101, label %102, label %108

102:                                              ; preds = %97
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  %106 = load i64, ptr %14, align 8, !tbaa !14
  %107 = getelementptr inbounds i8, ptr %105, i64 %106
  br label %111

108:                                              ; preds = %97
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load ptr, ptr %109, align 8, !tbaa !5
  br label %111

111:                                              ; preds = %108, %102
  %112 = phi ptr [ %107, %102 ], [ %110, %108 ]
  store ptr %112, ptr %16, align 8, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !9
  %114 = and i32 256, %113
  %115 = icmp ne i32 0, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %111
  br label %118

117:                                              ; preds = %111
  call void @__assert_fail(ptr noundef @.str.69, ptr noundef @.str.1, i32 noundef 2277, ptr noundef @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

118:                                              ; preds = %116
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = icmp ne ptr null, %119
  br i1 %120, label %121, label %139

121:                                              ; preds = %118
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = load i8, ptr %122, align 1, !tbaa !18
  %124 = sext i8 %123 to i32
  %125 = icmp ne i32 0, %124
  br i1 %125, label %126, label %139

126:                                              ; preds = %121
  %127 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %128 = icmp sgt i32 0, %127
  br i1 %128, label %129, label %138

129:                                              ; preds = %126
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = load ptr, ptr %16, align 8, !tbaa !5
  %132 = load i64, ptr %12, align 8, !tbaa !14
  %133 = call i32 @libxsmm_dump(ptr noundef @.str.70, ptr noundef %130, ptr noundef %131, i64 noundef %132, i32 noundef 1, i32 noundef 0)
  %134 = icmp eq i32 0, %133
  br i1 %134, label %135, label %136

135:                                              ; preds = %129
  br label %137

136:                                              ; preds = %129
  call void @__assert_fail(ptr noundef @.str.71, ptr noundef @.str.1, i32 noundef 2282, ptr noundef @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

137:                                              ; preds = %135
  br label %138

138:                                              ; preds = %137, %126
  br label %139

139:                                              ; preds = %138, %121, %118
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %140, i32 0, i32 2
  %142 = load ptr, ptr %141, align 8, !tbaa !17
  %143 = icmp ne ptr null, %142
  br i1 %143, label %144, label %171

144:                                              ; preds = %139
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %145, i32 0, i32 1
  %147 = load ptr, ptr %146, align 8, !tbaa !15
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %148, i32 0, i32 2
  %150 = load ptr, ptr %149, align 8, !tbaa !17
  %151 = icmp ne ptr %147, %150
  br i1 %151, label %152, label %171

152:                                              ; preds = %144
  %153 = load i32, ptr %6, align 4, !tbaa !9
  %154 = and i32 32, %153
  %155 = icmp ne i32 0, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %152
  br label %158

157:                                              ; preds = %152
  call void @__assert_fail(ptr noundef @.str.72, ptr noundef @.str.1, i32 noundef 2308, ptr noundef @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

158:                                              ; preds = %156
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %159, ptr %160, align 8, !tbaa !5
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %161, i32 0, i32 2
  %163 = load ptr, ptr %162, align 8, !tbaa !17
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %164, i32 0, i32 1
  store ptr %163, ptr %165, align 8, !tbaa !15
  %166 = load ptr, ptr %9, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.internal_malloc_info_type, ptr %166, i32 0, i32 2
  store ptr null, ptr %167, align 8, !tbaa !17
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = load i64, ptr %15, align 8, !tbaa !14
  %170 = call i32 @munmap(ptr noundef %168, i64 noundef %169) #6
  br label %176

171:                                              ; preds = %144, %139
  %172 = load ptr, ptr %13, align 8, !tbaa !5
  %173 = load i32, ptr %6, align 4, !tbaa !9
  %174 = load i64, ptr %15, align 8, !tbaa !14
  %175 = call i32 @libxsmm_malloc_xattrib(ptr noundef %172, i32 noundef %173, i64 noundef %174)
  store i32 %175, ptr %10, align 4, !tbaa !9
  br label %176

176:                                              ; preds = %171, %158
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %177

177:                                              ; preds = %176, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %178

178:                                              ; preds = %177, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %219

179:                                              ; preds = %24
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  %181 = icmp eq ptr null, %180
  br i1 %181, label %186, label %182

182:                                              ; preds = %179
  %183 = load ptr, ptr %5, align 8, !tbaa !5
  %184 = load ptr, ptr %183, align 8, !tbaa !5
  %185 = icmp eq ptr null, %184
  br i1 %185, label %186, label %197

186:                                              ; preds = %182, %179
  %187 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %188 = icmp ne i32 0, %187
  br i1 %188, label %189, label %196

189:                                              ; preds = %186
  %190 = atomicrmw add ptr @libxsmm_malloc_attrib.error_once, i32 1 seq_cst, align 4
  %191 = add i32 %190, 1
  %192 = icmp eq i32 1, %191
  br i1 %192, label %193, label %196

193:                                              ; preds = %189
  %194 = load ptr, ptr @stderr, align 8, !tbaa !5
  %195 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %194, ptr noundef @.str.73) #6
  br label %196

196:                                              ; preds = %193, %189, %186
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %218

197:                                              ; preds = %182
  %198 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %199 = icmp sle i32 2, %198
  br i1 %199, label %203, label %200

200:                                              ; preds = %197
  %201 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %202 = icmp sgt i32 0, %201
  br i1 %202, label %203, label %217

203:                                              ; preds = %200, %197
  %204 = atomicrmw add ptr @libxsmm_malloc_attrib.error_once, i32 1 seq_cst, align 4
  %205 = add i32 %204, 1
  %206 = icmp eq i32 1, %205
  br i1 %206, label %207, label %217

207:                                              ; preds = %203
  %208 = load ptr, ptr @stderr, align 8, !tbaa !5
  %209 = load i32, ptr %6, align 4, !tbaa !9
  %210 = and i32 256, %209
  %211 = icmp ne i32 0, %210
  %212 = zext i1 %211 to i64
  %213 = select i1 %211, ptr @.str.75, ptr @.str.76
  %214 = load ptr, ptr %5, align 8, !tbaa !5
  %215 = load ptr, ptr %214, align 8, !tbaa !5
  %216 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %208, ptr noundef @.str.74, ptr noundef %213, ptr noundef %215) #6
  br label %217

217:                                              ; preds = %207, %203, %200
  br label %218

218:                                              ; preds = %217, %196
  br label %219

219:                                              ; preds = %218, %178
  %220 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  ret i32 %220
}

declare i32 @libxsmm_dump(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "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 }
attributes #7 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 32}
!12 = !{!"internal_malloc_info_type", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !10, i64 40}
!13 = !{!"long", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !10, i64 40}
!17 = !{!12, !6, i64 16}
!18 = !{!7, !7, i64 0}


; 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.1 = external hidden unnamed_addr constant [70 x i8], align 1
@libxsmm_verbosity = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@libxsmm_malloc_attrib.error_once = external hidden global i32, align 4
@.str.68 = external hidden unnamed_addr constant [69 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_malloc_attrib = external hidden unnamed_addr constant [70 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [80 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @internal_malloc_info(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @munmap(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @libxsmm_malloc_xattrib(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local i32 @libxsmm_malloc_attrib(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef readonly %3) local_unnamed_addr #4 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.thread82, label %5

5:                                                ; preds = %4
  %6 = load ptr, ptr %0, align 8, !tbaa !5
  %7 = tail call ptr @internal_malloc_info(ptr noundef %6, i32 noundef 0)
  %.not71 = icmp eq ptr %7, null
  br i1 %.not71, label %63, label %8

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %7, i64 32
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = icmp eq ptr %3, null
  br i1 %11, label %15, label %12

12:                                               ; preds = %8
  %13 = load i64, ptr %3, align 8, !tbaa !13
  %14 = tail call i64 @llvm.usub.sat.i64(i64 %10, i64 %13)
  br label %15

15:                                               ; preds = %8, %12
  %16 = phi i64 [ %14, %12 ], [ %10, %8 ]
  %17 = getelementptr inbounds i8, ptr %7, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = icmp ne ptr %18, null
  %20 = icmp ne ptr %18, inttoptr (i64 -1 to ptr)
  %or.cond = and i1 %19, %20
  %21 = icmp eq i64 %16, 0
  %or.cond3 = select i1 %or.cond, i1 true, i1 %21
  br i1 %or.cond3, label %23, label %22

22:                                               ; preds = %15
  tail call void @__assert_fail(ptr noundef nonnull @.str.68, ptr noundef nonnull @.str.1, i32 noundef 2265, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

23:                                               ; preds = %15
  %24 = getelementptr inbounds i8, ptr %7, i64 40
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %26 = and i32 %25, -449
  %27 = or i32 %26, %1
  %28 = and i32 %1, 384
  %or.cond80 = icmp eq i32 %28, 128
  br i1 %or.cond80, label %84, label %29

29:                                               ; preds = %23
  %30 = and i32 %1, 256
  %.not74 = icmp eq i32 %30, 0
  %31 = load ptr, ptr %0, align 8, !tbaa !5
  %32 = ptrtoint ptr %31 to i64
  %33 = ptrtoint ptr %18 to i64
  %34 = sub i64 %32, %33
  %35 = add i64 %34, %16
  br i1 %.not74, label %36, label %38

36:                                               ; preds = %29
  %37 = tail call i32 @libxsmm_malloc_xattrib(ptr noundef %18, i32 noundef %27, i64 noundef %35)
  br label %84

38:                                               ; preds = %29
  %39 = getelementptr inbounds i8, ptr %7, i64 16
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  %.not75 = icmp eq ptr %40, null
  %41 = getelementptr inbounds i8, ptr %40, i64 %34
  %42 = select i1 %.not75, ptr %31, ptr %41
  %.not76 = icmp eq ptr %2, null
  br i1 %.not76, label %thread-pre-split, label %43

43:                                               ; preds = %38
  %44 = load i8, ptr %2, align 1, !tbaa !17
  %45 = icmp ne i8 %44, 0
  %46 = load i32, ptr @libxsmm_verbosity, align 4
  %47 = icmp slt i32 %46, 0
  %or.cond7 = select i1 %45, i1 %47, i1 false
  br i1 %or.cond7, label %48, label %thread-pre-split

48:                                               ; preds = %43
  %49 = tail call i32 @libxsmm_dump(ptr noundef nonnull @.str.70, ptr noundef nonnull %2, ptr noundef %42, i64 noundef %16, i32 noundef 1, i32 noundef 0) #8
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %.thread-pre-split_crit_edge, label %51

.thread-pre-split_crit_edge:                      ; preds = %48
  %.pr.pre = load ptr, ptr %39, align 8, !tbaa !16
  br label %thread-pre-split

51:                                               ; preds = %48
  tail call void @__assert_fail(ptr noundef nonnull @.str.71, ptr noundef nonnull @.str.1, i32 noundef 2282, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

thread-pre-split:                                 ; preds = %43, %.thread-pre-split_crit_edge, %38
  %52 = phi ptr [ %40, %38 ], [ %.pr.pre, %.thread-pre-split_crit_edge ], [ %40, %43 ]
  %.not77 = icmp eq ptr %52, null
  br i1 %.not77, label %61, label %53

53:                                               ; preds = %thread-pre-split
  %54 = load ptr, ptr %17, align 8, !tbaa !14
  %.not78 = icmp eq ptr %54, %52
  br i1 %.not78, label %61, label %55

55:                                               ; preds = %53
  %56 = and i32 %27, 32
  %.not79 = icmp eq i32 %56, 0
  br i1 %.not79, label %57, label %58

57:                                               ; preds = %55
  tail call void @__assert_fail(ptr noundef nonnull @.str.72, ptr noundef nonnull @.str.1, i32 noundef 2308, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_malloc_attrib) #7
  unreachable

58:                                               ; preds = %55
  store ptr %42, ptr %0, align 8, !tbaa !5
  %59 = load ptr, ptr %39, align 8, !tbaa !16
  store ptr %59, ptr %17, align 8, !tbaa !14
  store ptr null, ptr %39, align 8, !tbaa !16
  %60 = tail call i32 @munmap(ptr noundef %18, i64 noundef %35) #8
  br label %84

61:                                               ; preds = %53, %thread-pre-split
  %62 = tail call i32 @libxsmm_malloc_xattrib(ptr noundef %18, i32 noundef %27, i64 noundef %35)
  br label %84

63:                                               ; preds = %5
  %64 = load ptr, ptr %0, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %.thread82, label %73

.thread82:                                        ; preds = %4, %63
  %66 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !18
  %.not73 = icmp eq i32 %66, 0
  br i1 %.not73, label %84, label %67

67:                                               ; preds = %.thread82
  %68 = atomicrmw add ptr @libxsmm_malloc_attrib.error_once, i32 1 seq_cst, align 4
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %84

70:                                               ; preds = %67
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.73) #9
  br label %84

73:                                               ; preds = %63
  %74 = load i32, ptr @libxsmm_verbosity, align 4
  %or.cond5 = icmp ugt i32 %74, 1
  br i1 %or.cond5, label %75, label %84

75:                                               ; preds = %73
  %76 = atomicrmw add ptr @libxsmm_malloc_attrib.error_once, i32 1 seq_cst, align 4
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %84

78:                                               ; preds = %75
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = and i32 %1, 256
  %.not72 = icmp eq i32 %80, 0
  %81 = select i1 %.not72, ptr @.str.76, ptr @.str.75
  %82 = load ptr, ptr %0, align 8, !tbaa !5
  %83 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.74, ptr noundef nonnull %81, ptr noundef %82) #9
  br label %84

84:                                               ; preds = %.thread82, %67, %70, %23, %58, %61, %36, %73, %78, %75
  %.3 = phi i32 [ 0, %78 ], [ 0, %75 ], [ 0, %73 ], [ 0, %23 ], [ %37, %36 ], [ 0, %58 ], [ %62, %61 ], [ 1, %70 ], [ 1, %67 ], [ 1, %.thread82 ]
  ret i32 %.3
}

declare i32 @libxsmm_dump(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

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

attributes #0 = { 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 #1 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree 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 = { 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind }
attributes #9 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 32}
!10 = !{!"internal_malloc_info_type", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !12, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 8}
!15 = !{!10, !12, i64 40}
!16 = !{!10, !6, i64 16}
!17 = !{!7, !7, i64 0}
!18 = !{!12, !12, i64 0}


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