; 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
@.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
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 x i8], align 1
@libxsmm_xset_scratch_allocator.error_once = external hidden global i32, align 4
@__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator = external hidden unnamed_addr constant [113 x i8], align 1
@libxsmm_scratch_allocator_context = external global ptr, align 8
@libxsmm_scratch_malloc_fn = external global %union.libxsmm_malloc_function, align 8
@libxsmm_scratch_free_fn = external global %union.libxsmm_free_function, align 8
@.str.28 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [58 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
declare dso_local i32 @libxsmm_xset_default_allocator(ptr noundef, ptr noundef, ptr, ptr) #4

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 uwtable
define dso_local i32 @libxsmm_xset_scratch_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 = getelementptr inbounds %union.libxsmm_malloc_function, ptr %5, i32 0, i32 0
  store ptr %2, ptr %14, align 8
  %15 = getelementptr inbounds %union.libxsmm_free_function, ptr %6, i32 0, i32 0
  store ptr %3, ptr %15, 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
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = icmp ne ptr null, %16
  br i1 %17, label %18, label %70

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

21:                                               ; preds = %18
  call void @libxsmm_init()
  br label %22

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

27:                                               ; preds = %22
  br label %29

28:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 1460, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #8
  unreachable

29:                                               ; preds = %27
  br label %30

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

35:                                               ; preds = %30
  br label %36

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

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

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

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

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

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

49:                                               ; preds = %46
  %50 = load i32, ptr %10, align 4, !tbaa !9
  %51 = mul nsw i32 %50, 2
  store i32 %51, ptr %10, align 4, !tbaa !9
  br label %54

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

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

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

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

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  br label %30, !llvm.loop !14

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

67:                                               ; preds = %63
  br label %69

68:                                               ; preds = %63
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 1460, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #8
  unreachable

69:                                               ; preds = %67
  br label %70

70:                                               ; preds = %69, %4
  %71 = load ptr, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !15
  %72 = icmp eq ptr null, %71
  br i1 %72, label %76, label %73

73:                                               ; preds = %70
  %74 = load ptr, ptr @libxsmm_default_free_fn, align 8, !tbaa !15
  %75 = icmp eq ptr null, %74
  br i1 %75, label %76, label %82

76:                                               ; preds = %73, %70
  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)
  %77 = getelementptr inbounds %union.libxsmm_malloc_function, ptr %12, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8
  %79 = getelementptr inbounds %union.libxsmm_free_function, ptr %13, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8
  %81 = call i32 @libxsmm_xset_default_allocator(ptr noundef null, ptr noundef null, ptr %78, ptr %80)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %82

82:                                               ; preds = %76, %73
  %83 = load ptr, ptr %5, align 8, !tbaa !15
  %84 = icmp eq ptr null, %83
  br i1 %84, label %85, label %90

85:                                               ; preds = %82
  %86 = load ptr, ptr %6, align 8, !tbaa !15
  %87 = icmp eq ptr null, %86
  br i1 %87, label %88, label %90

88:                                               ; preds = %85
  %89 = load ptr, ptr @libxsmm_default_allocator_context, align 8, !tbaa !5
  store ptr %89, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_malloc_fn, ptr align 8 @libxsmm_default_malloc_fn, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_free_fn, ptr align 8 @libxsmm_default_free_fn, i64 8, i1 false), !tbaa.struct !16
  br label %128

90:                                               ; preds = %85, %82
  %91 = load ptr, ptr %5, align 8, !tbaa !15
  %92 = icmp ne ptr null, %91
  br i1 %92, label %93, label %111

93:                                               ; preds = %90
  %94 = load ptr, ptr %6, align 8, !tbaa !15
  %95 = icmp eq ptr null, %94
  br i1 %95, label %96, label %109

96:                                               ; preds = %93
  %97 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %98 = icmp sle i32 2, %97
  br i1 %98, label %102, label %99

99:                                               ; preds = %96
  %100 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %101 = icmp sgt i32 0, %100
  br i1 %101, label %102, label %109

102:                                              ; preds = %99, %96
  %103 = atomicrmw add ptr @libxsmm_xset_scratch_allocator.error_once, i32 1 seq_cst, align 4
  %104 = add i32 %103, 1
  %105 = icmp eq i32 1, %104
  br i1 %105, label %106, label %109

106:                                              ; preds = %102
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef @.str.28) #6
  br label %109

109:                                              ; preds = %106, %102, %99, %93
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %110, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_malloc_fn, ptr align 8 %5, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_free_fn, ptr align 8 %6, i64 8, i1 false), !tbaa.struct !16
  br label %127

111:                                              ; preds = %90
  %112 = load i32, ptr @libxsmm_verbosity, align 4, !tbaa !9
  %113 = icmp ne i32 0, %112
  br i1 %113, label %114, label %121

114:                                              ; preds = %111
  %115 = atomicrmw add ptr @libxsmm_xset_scratch_allocator.error_once, i32 1 seq_cst, align 4
  %116 = add i32 %115, 1
  %117 = icmp eq i32 1, %116
  br i1 %117, label %118, label %121

118:                                              ; preds = %114
  %119 = load ptr, ptr @stderr, align 8, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef @.str.29) #6
  br label %121

121:                                              ; preds = %118, %114, %111
  %122 = load ptr, ptr @libxsmm_scratch_malloc_fn, align 8, !tbaa !15
  %123 = icmp eq ptr null, %122
  br i1 %123, label %124, label %126

124:                                              ; preds = %121
  %125 = load ptr, ptr @libxsmm_default_allocator_context, align 8, !tbaa !5
  store ptr %125, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_malloc_fn, ptr align 8 @libxsmm_default_malloc_fn, i64 8, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @libxsmm_scratch_free_fn, ptr align 8 @libxsmm_default_free_fn, i64 8, i1 false), !tbaa.struct !16
  br label %126

126:                                              ; preds = %124, %121
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %126, %109
  br label %128

128:                                              ; preds = %127, %88
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = icmp ne ptr null, %129
  br i1 %130, label %131, label %139

131:                                              ; preds = %128
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = load volatile i32, ptr %132, align 4, !tbaa !9
  %134 = icmp ne i32 0, %133
  br i1 %134, label %135, label %136

135:                                              ; preds = %131
  br label %137

136:                                              ; preds = %131
  call void @__assert_fail(ptr noundef @.str.25, ptr noundef @.str.1, i32 noundef 1499, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #8
  unreachable

137:                                              ; preds = %135
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  store atomic i32 0, ptr %138 release, align 4
  br label %139

139:                                              ; preds = %137, %128
  %140 = load i32, ptr %9, align 4, !tbaa !9
  %141 = icmp eq i32 0, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %139
  br label %144

143:                                              ; preds = %139
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.1, i32 noundef 1501, ptr noundef @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #8
  unreachable

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

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 = { 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
@.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
@.str.25 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [12 x i8], align 1
@libxsmm_xset_scratch_allocator.error_once = external hidden global i32, align 4
@__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator = external hidden unnamed_addr constant [113 x i8], align 1
@libxsmm_scratch_allocator_context = external local_unnamed_addr global ptr, align 8
@libxsmm_scratch_malloc_fn = external local_unnamed_addr global %union.libxsmm_malloc_function, align 8
@libxsmm_scratch_free_fn = external local_unnamed_addr global %union.libxsmm_free_function, align 8
@.str.28 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [58 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
declare dso_local i32 @libxsmm_xset_default_allocator(ptr noundef, ptr noundef, ptr, ptr) local_unnamed_addr #2

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: nounwind uwtable
define dso_local noundef i32 @libxsmm_xset_scratch_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 %.preheader37, label %14

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

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

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

.lr.ph.preheader:                                 ; preds = %.preheader
  %xtraiter = and i32 %.025, 7
  %16 = icmp ult i32 %.025, 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 %.025, 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 %.025, 4096
  br i1 %17, label %._crit_edge.thread, label %19

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

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

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

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

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

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

27:                                               ; preds = %._crit_edge40
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 1460, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #6
  unreachable

28:                                               ; preds = %._crit_edge40, %4
  %29 = load ptr, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !14
  %30 = icmp eq ptr %29, null
  %31 = load ptr, ptr @libxsmm_default_free_fn, align 8
  %32 = icmp eq ptr %31, null
  %or.cond = select i1 %30, i1 true, i1 %32
  br i1 %or.cond, label %33, label %35

33:                                               ; preds = %28
  %34 = tail call i32 @libxsmm_xset_default_allocator(ptr noundef null, ptr noundef null, ptr null, ptr null)
  br label %35

35:                                               ; preds = %28, %33
  %36 = icmp eq ptr %2, null
  %37 = icmp eq ptr %3, null
  %or.cond3 = select i1 %36, i1 %37, i1 false
  br i1 %or.cond3, label %38, label %42

38:                                               ; preds = %35
  %39 = load ptr, ptr @libxsmm_default_allocator_context, align 8, !tbaa !15
  store ptr %39, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !15
  %40 = load i64, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !14
  store i64 %40, ptr @libxsmm_scratch_malloc_fn, align 8, !tbaa !14
  %41 = load i64, ptr @libxsmm_default_free_fn, align 8, !tbaa !14
  store i64 %41, ptr @libxsmm_scratch_free_fn, align 8, !tbaa !14
  br label %66

42:                                               ; preds = %35
  %43 = load i32, ptr @libxsmm_verbosity, align 4
  br i1 %36, label %52, label %44

44:                                               ; preds = %42
  %or.cond5 = icmp ugt i32 %43, 1
  %or.cond36 = select i1 %37, i1 %or.cond5, i1 false
  br i1 %or.cond36, label %45, label %51

45:                                               ; preds = %44
  %46 = atomicrmw add ptr @libxsmm_xset_scratch_allocator.error_once, i32 1 seq_cst, align 4
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %51

48:                                               ; preds = %45
  %49 = load ptr, ptr @stderr, align 8, !tbaa !15
  %50 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.28) #7
  br label %51

51:                                               ; preds = %48, %45, %44
  store ptr %1, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !15
  store ptr %2, ptr @libxsmm_scratch_malloc_fn, align 8, !tbaa !14
  store ptr %3, ptr @libxsmm_scratch_free_fn, align 8, !tbaa !14
  br label %66

52:                                               ; preds = %42
  %.not33 = icmp eq i32 %43, 0
  br i1 %.not33, label %59, label %53

53:                                               ; preds = %52
  %54 = atomicrmw add ptr @libxsmm_xset_scratch_allocator.error_once, i32 1 seq_cst, align 4
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %59

56:                                               ; preds = %53
  %57 = load ptr, ptr @stderr, align 8, !tbaa !15
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.29) #7
  br label %59

59:                                               ; preds = %56, %53, %52
  %60 = load ptr, ptr @libxsmm_scratch_malloc_fn, align 8, !tbaa !14
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %66

62:                                               ; preds = %59
  %63 = load ptr, ptr @libxsmm_default_allocator_context, align 8, !tbaa !15
  store ptr %63, ptr @libxsmm_scratch_allocator_context, align 8, !tbaa !15
  %64 = load i64, ptr @libxsmm_default_malloc_fn, align 8, !tbaa !14
  store i64 %64, ptr @libxsmm_scratch_malloc_fn, align 8, !tbaa !14
  %65 = load i64, ptr @libxsmm_default_free_fn, align 8, !tbaa !14
  store i64 %65, ptr @libxsmm_scratch_free_fn, align 8, !tbaa !14
  br label %66

66:                                               ; preds = %59, %62, %51, %38
  %67 = phi i1 [ true, %38 ], [ true, %51 ], [ false, %62 ], [ false, %59 ]
  br i1 %.not, label %72, label %68

68:                                               ; preds = %66
  %69 = load volatile i32, ptr %0, align 4, !tbaa !5
  %.not34 = icmp eq i32 %69, 0
  br i1 %.not34, label %70, label %71

70:                                               ; preds = %68
  tail call void @__assert_fail(ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.1, i32 noundef 1499, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #6
  unreachable

71:                                               ; preds = %68
  store atomic i32 0, ptr %0 release, align 4
  br label %72

72:                                               ; preds = %71, %66
  br i1 %67, label %74, label %73

73:                                               ; preds = %72
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.1, i32 noundef 1501, ptr noundef nonnull @__PRETTY_FUNCTION__.libxsmm_xset_scratch_allocator) #6
  unreachable

74:                                               ; preds = %72
  ret i32 0
}

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 = { noreturn nounwind }
attributes #7 = { 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 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}


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