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

%union.libxsmm_malloc_function = type { ptr }
%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_ninit = external global i32, align 4
@.str.22 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_xset_default_allocator = external hidden unnamed_addr constant [113 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [44 x i8], align 1
@libxsmm_default_allocator_context = external global ptr, align 8
@libxsmm_default_malloc_fn = external global %union.libxsmm_malloc_function, align 8
@libxsmm_default_free_fn = external global %union.libxsmm_free_function, align 8
@libxsmm_xset_default_allocator.error_once = external hidden global i32, align 4
@.str.24 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

19:                                               ; preds = %4
  %20 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !9
  %21 = icmp ugt i32 2, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  call void @libxsmm_init()
  br label %23

23:                                               ; preds = %22, %19
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = ptrtoint ptr %24 to i64
  %26 = and i64 %25, 3
  %27 = icmp eq i64 0, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %23
  br label %30

29:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 1377, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #9
  unreachable

30:                                               ; preds = %28
  br label %31

31:                                               ; preds = %63, %30
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = atomicrmw or ptr %32, i32 1 seq_cst, align 4
  %34 = icmp eq i32 0, %33
  %35 = xor i1 %34, true
  br i1 %35, label %36, label %64

36:                                               ; preds = %31
  br label %37

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %56, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %44, %38
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %47

43:                                               ; preds = %39
  call void @llvm.x86.sse2.pause()
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %11, align 4, !tbaa !9
  br label %39, !llvm.loop !11

47:                                               ; preds = %39
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = icmp slt i32 %48, 4096
  br i1 %49, label %50, label %53

50:                                               ; preds = %47
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = mul nsw i32 %51, 2
  store i32 %52, ptr %10, align 4, !tbaa !9
  br label %55

53:                                               ; preds = %47
  store i32 4096, ptr %10, align 4, !tbaa !9
  %54 = call i32 @sched_yield() #6
  br label %55

55:                                               ; preds = %53, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load volatile i32, ptr %57, align 4, !tbaa !9
  %59 = and i32 %58, 1
  %60 = icmp ne i32 0, %59
  br i1 %60, label %38, label %61, !llvm.loop !13

61:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  br label %31, !llvm.loop !14

64:                                               ; preds = %31
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = load volatile i32, ptr %65, align 4, !tbaa !9
  %67 = icmp ne i32 0, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  br label %70

69:                                               ; preds = %64
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 1377, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #9
  unreachable

70:                                               ; preds = %68
  br label %71

71:                                               ; preds = %70, %4
  %72 = load ptr, ptr %5, align 8, !tbaa !15
  %73 = icmp ne ptr null, %72
  br i1 %73, label %74, label %79

74:                                               ; preds = %71
  %75 = load ptr, ptr %6, align 8, !tbaa !15
  %76 = icmp ne ptr null, %75
  br i1 %76, label %77, label %79

77:                                               ; preds = %74
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %78, ptr @libxsmm_default_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_malloc_fn, ptr align 8 %5, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_free_fn, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !16
  br label %107

79:                                               ; preds = %74, %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr null, ptr %14, align 8, !tbaa !5
  store ptr @malloc, ptr %12, align 8, !tbaa !15
  store ptr @free, ptr %13, align 8, !tbaa !15
  %80 = load ptr, ptr %5, align 8, !tbaa !15
  %81 = icmp eq ptr null, %80
  br i1 %81, label %82, label %87

82:                                               ; preds = %79
  %83 = load ptr, ptr %6, align 8, !tbaa !15
  %84 = icmp eq ptr null, %83
  br i1 %84, label %85, label %87

85:                                               ; preds = %82
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %86, ptr @libxsmm_default_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_malloc_fn, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_free_fn, ptr align 8 %13, i64 8, i1 false), !tbaa.struct !16
  br label %106

87:                                               ; preds = %82, %79
  %88 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %89 = icmp ne i32 0, %88
  br i1 %89, label %90, label %97

90:                                               ; preds = %87
  %91 = atomicrmw add ptr @libxsmm_xset_default_allocator.error_once, i32 1 seq_cst, align 4
  %92 = add i32 %91, 1
  %93 = icmp eq i32 1, %92
  br i1 %93, label %94, label %97

94:                                               ; preds = %90
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str.24) #6
  br label %97

97:                                               ; preds = %94, %90, %87
  %98 = load ptr, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !15
  %99 = icmp eq ptr null, %98
  br i1 %99, label %103, label %100

100:                                              ; preds = %97
  %101 = load ptr, ptr @libxsmm_default_free_fn, align 8, !tbaa !15
  %102 = icmp eq ptr null, %101
  br i1 %102, label %103, label %105

103:                                              ; preds = %100, %97
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %104, ptr @libxsmm_default_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_malloc_fn, ptr align 8 %12, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_default_free_fn, ptr align 8 %13, i64 8, i1 false), !tbaa.struct !16
  br label %105

105:                                              ; preds = %103, %100
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %105, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %107

107:                                              ; preds = %106, %77
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = icmp ne ptr null, %108
  br i1 %109, label %110, label %118

110:                                              ; preds = %107
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = load volatile i32, ptr %111, align 4, !tbaa !9
  %113 = icmp ne i32 0, %112
  br i1 %113, label %114, label %115

114:                                              ; preds = %110
  br label %116

115:                                              ; preds = %110
  call void @__assert_fail(ptr noundef @.str.25, ptr noundef @.str.1, i32 noundef 1418, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #9
  unreachable

116:                                              ; preds = %114
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  store atomic i32 0, ptr %117 release, align 4
  br label %118

118:                                              ; preds = %116, %107
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = icmp eq i32 0, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %118
  br label %123

122:                                              ; preds = %118
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.1, i32 noundef 1420, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #9
  unreachable

123:                                              ; preds = %121
  %124 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret i32 %124
}

declare void @libxsmm_init() #5

; Function Attrs: nounwind
declare void @llvm.x86.sse2.pause() #6

; Function Attrs: nounwind
declare i32 @sched_yield() #2

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

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

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

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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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 #9 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!7, !7, i64 0}
!16 = !{i64 0, i64 8, !15}


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

%union.libxsmm_malloc_function = type { ptr }
%union.libxsmm_free_function = type { ptr }

@.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_ninit = external local_unnamed_addr global i32, align 4
@.str.22 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__.libxsmm_xset_default_allocator = external hidden unnamed_addr constant [113 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [44 x i8], align 1
@libxsmm_default_allocator_context = external local_unnamed_addr global ptr, align 8
@libxsmm_default_malloc_fn = external local_unnamed_addr global %union.libxsmm_malloc_function, align 8
@libxsmm_default_free_fn = external local_unnamed_addr global %union.libxsmm_free_function, align 8
@libxsmm_xset_default_allocator.error_once = external hidden global i32, align 4
@.str.24 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

5:                                                ; preds = %4
  %6 = load i32, ptr @libxsmm_ninit, align 4, !tbaa !5
  %7 = icmp ult i32 %6, 2
  br i1 %7, label %8, label %9

8:                                                ; preds = %5
  tail call void @libxsmm_init() #4
  br label %9

9:                                                ; preds = %8, %5
  %10 = ptrtoint ptr %0 to i64
  %11 = and i64 %10, 3
  %12 = icmp eq i64 %11, 0
  br i1 %12, label %.preheader41, label %14

.preheader41:                                     ; preds = %9
  %13 = atomicrmw or ptr %0, i32 1 seq_cst, align 4
  %.not3643 = icmp eq i32 %13, 0
  br i1 %.not3643, label %._crit_edge44, label %.preheader

14:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.1, i32 noundef 1377, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #8
  unreachable

.preheader:                                       ; preds = %.preheader41, %.preheader.backedge
  %.030 = phi i32 [ %.030.be, %.preheader.backedge ], [ 1, %.preheader41 ]
  %15 = icmp sgt i32 %.030, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge.thread

.lr.ph.preheader:                                 ; preds = %.preheader
  %xtraiter = and i32 %.030, 7
  %16 = icmp ult i32 %.030, 8
  br i1 %16, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %.030, 2147483640
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.7, %.lr.ph ]
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  tail call void @llvm.x86.sse2.pause()
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.unr-lcssa:                            ; preds = %.lr.ph, %.lr.ph.preheader
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa, %.lr.ph.epil
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.unr-lcssa ]
  tail call void @llvm.x86.sse2.pause()
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.unr-lcssa
  %17 = icmp slt i32 %.030, 4096
  br i1 %17, label %._crit_edge.thread, label %19

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %18 = shl i32 %.030, 1
  br label %21

19:                                               ; preds = %._crit_edge
  %20 = tail call i32 @sched_yield() #4
  br label %21

21:                                               ; preds = %19, %._crit_edge.thread
  %.131 = phi i32 [ %18, %._crit_edge.thread ], [ 4096, %19 ]
  %22 = load volatile i32, ptr %0, align 4, !tbaa !5
  %23 = and i32 %22, 1
  %.not40 = icmp eq i32 %23, 0
  br i1 %.not40, label %24, label %.preheader.backedge

.preheader.backedge:                              ; preds = %21, %24
  %.030.be = phi i32 [ %.131, %21 ], [ 1, %24 ]
  br label %.preheader, !llvm.loop !13

24:                                               ; preds = %21
  %25 = atomicrmw or ptr %0, i32 1 seq_cst, align 4
  %.not36 = icmp eq i32 %25, 0
  br i1 %.not36, label %._crit_edge44, label %.preheader.backedge

._crit_edge44:                                    ; preds = %24, %.preheader41
  %26 = load volatile i32, ptr %0, align 4, !tbaa !5
  %.not37 = icmp eq i32 %26, 0
  br i1 %.not37, label %27, label %28

27:                                               ; preds = %._crit_edge44
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 1377, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #8
  unreachable

28:                                               ; preds = %._crit_edge44, %4
  %29 = icmp ne ptr %2, null
  %30 = icmp ne ptr %3, null
  %or.cond = select i1 %29, i1 %30, i1 false
  br i1 %or.cond, label %.sink.split, label %31

31:                                               ; preds = %28
  %32 = icmp eq ptr %2, null
  %33 = icmp eq ptr %3, null
  %or.cond3 = select i1 %32, i1 %33, i1 false
  br i1 %or.cond3, label %.sink.split, label %34

34:                                               ; preds = %31
  %35 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !5
  %.not38 = icmp eq i32 %35, 0
  br i1 %.not38, label %42, label %36

36:                                               ; preds = %34
  %37 = atomicrmw add ptr @libxsmm_xset_default_allocator.error_once, i32 1 seq_cst, align 4
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %42

39:                                               ; preds = %36
  %40 = load ptr, ptr @stderr, align 8, !tbaa !14
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.24) #9
  br label %42

42:                                               ; preds = %39, %36, %34
  %43 = load ptr, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !16
  %44 = icmp eq ptr %43, null
  %45 = load ptr, ptr @libxsmm_default_free_fn, align 8
  %46 = icmp eq ptr %45, null
  %or.cond5 = select i1 %44, i1 true, i1 %46
  br i1 %or.cond5, label %.sink.split, label %47

.sink.split:                                      ; preds = %42, %31, %28
  %.sink = phi ptr [ %1, %28 ], [ null, %31 ], [ null, %42 ]
  %malloc.sink = phi ptr [ %2, %28 ], [ @malloc, %31 ], [ @malloc, %42 ]
  %free.sink = phi ptr [ %3, %28 ], [ @free, %31 ], [ @free, %42 ]
  %.1.ph = phi i1 [ true, %28 ], [ true, %31 ], [ false, %42 ]
  store ptr %.sink, ptr @libxsmm_default_allocator_context, align 8, !tbaa !14
  store ptr %malloc.sink, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !16
  store ptr %free.sink, ptr @libxsmm_default_free_fn, align 8, !tbaa !16
  br label %47

47:                                               ; preds = %.sink.split, %42
  %.1 = phi i1 [ false, %42 ], [ %.1.ph, %.sink.split ]
  br i1 %.not, label %52, label %48

48:                                               ; preds = %47
  %49 = load volatile i32, ptr %0, align 4, !tbaa !5
  %.not39 = icmp eq i32 %49, 0
  br i1 %.not39, label %50, label %51

50:                                               ; preds = %48
  tail call void @__assert_fail(ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.1, i32 noundef 1418, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #8
  unreachable

51:                                               ; preds = %48
  store atomic i32 0, ptr %0 release, align 4
  br label %52

52:                                               ; preds = %51, %47
  br i1 %.1, label %54, label %53

53:                                               ; preds = %52
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.1, i32 noundef 1420, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_default_allocator) #8
  unreachable

54:                                               ; preds = %52
  ret i32 0
}

declare void @libxsmm_init() local_unnamed_addr #3

; Function Attrs: nounwind
declare void @llvm.x86.sse2.pause() #4

; Function Attrs: nounwind
declare i32 @sched_yield() local_unnamed_addr #5

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

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

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 = { 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 #2 = { 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 = { "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 }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass