; LLVM IR from interpretml/interpret :: shared/libebm/unzoned (unzoned)

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

@.str = external hidden unnamed_addr constant [89 x i8], align 1
@__func__.AlignedAlloc = external hidden unnamed_addr constant [13 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.AlignedAlloc = external hidden unnamed_addr constant [33 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

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: mustprogress uwtable
define dso_local ptr @AlignedAlloc(i64 noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  %8 = load i64, ptr %3, align 8, !tbaa !5
  %9 = icmp ne i64 0, %8
  br i1 %9, label %12, label %10

10:                                               ; preds = %1
  call void @LogAssertFailure(i64 noundef 174, ptr noundef @.str, ptr noundef @__func__.AlignedAlloc, ptr noundef @.str.21)
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str, i32 noundef 174, ptr noundef @__PRETTY_FUNCTION__.AlignedAlloc) #5
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %1
  %13 = phi i1 [ true, %1 ], [ false, %11 ]
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = icmp ult i64 -72, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  store ptr null, ptr %2, align 8
  br label %38

17:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %18 = load i64, ptr %3, align 8, !tbaa !5
  %19 = add i64 71, %18
  store i64 %19, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %20 = load i64, ptr %4, align 8, !tbaa !5
  %21 = call noalias ptr @malloc(i64 noundef %20) #7
  store ptr %21, ptr %5, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = icmp eq ptr null, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %17
  store ptr null, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %37

25:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %26 = load ptr, ptr %5, align 8, !tbaa !9
  %27 = ptrtoint ptr %26 to i64
  store i64 %27, ptr %7, align 8, !tbaa !5
  %28 = load i64, ptr %7, align 8, !tbaa !5
  %29 = add i64 %28, 71
  %30 = and i64 %29, -64
  store i64 %30, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = load i64, ptr %7, align 8, !tbaa !5
  %33 = inttoptr i64 %32 to ptr
  %34 = getelementptr inbounds ptr, ptr %33, i64 -1
  store ptr %31, ptr %34, align 8, !tbaa !9
  %35 = load i64, ptr %7, align 8, !tbaa !5
  %36 = inttoptr i64 %35 to ptr
  store ptr %36, ptr %2, align 8
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %37

37:                                               ; preds = %25, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %38

38:                                               ; preds = %37, %16
  %39 = load ptr, ptr %2, align 8
  ret ptr %39
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"any pointer", !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 = external hidden unnamed_addr constant [89 x i8], align 1
@__func__.AlignedAlloc = external hidden unnamed_addr constant [13 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [15 x i8], align 1
@__PRETTY_FUNCTION__.AlignedAlloc = external hidden unnamed_addr constant [33 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @AlignedAlloc(i64 noundef %0) local_unnamed_addr #2 {
  %.not = icmp eq i64 %0, 0
  br i1 %.not, label %2, label %3

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

3:                                                ; preds = %1
  %4 = icmp ugt i64 %0, -72
  br i1 %4, label %15, label %5

5:                                                ; preds = %3
  %6 = add nuw i64 %0, 71
  %7 = tail call noalias ptr @malloc(i64 noundef %6) #5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %15, label %9

9:                                                ; preds = %5
  %10 = ptrtoint ptr %7 to i64
  %11 = add i64 %10, 71
  %12 = and i64 %11, -64
  %13 = inttoptr i64 %12 to ptr
  %14 = getelementptr inbounds i8, ptr %13, i64 -8
  store ptr %7, ptr %14, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %9, %5, %3
  %.1 = phi ptr [ null, %3 ], [ %13, %9 ], [ null, %5 ]
  ret ptr %.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 #3

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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