; LLVM IR from interpretml/interpret :: shared/libebm/BoosterShell.ll (ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE)

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

@g_traceLevel = external global i32, align 4
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage = external hidden constant [29 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_0 = external hidden constant [43 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_1 = external hidden constant [28 x i8], align 16

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 3, ptr %4, align 4, !tbaa !9
  %10 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %11 = icmp sle i32 3, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage)
  br label %13

13:                                               ; preds = %12, %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %14

14:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %15 = call noalias ptr @malloc(i64 noundef 112) #7
  store ptr %15, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp eq ptr null, %16
  %18 = xor i1 %17, true
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 0)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %31

23:                                               ; preds = %14
  br label %24

24:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !9
  %25 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %26 = icmp sle i32 1, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_0)
  br label %28

28:                                               ; preds = %27, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  store ptr null, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %42

31:                                               ; preds = %14
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  call void @_ZN14NAMESPACE_MAIN12BoosterShell19InitializeUnfailingEPNS_11BoosterCoreE(ptr noundef nonnull align 8 dereferenceable(112) %32, ptr noundef %33)
  br label %34

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

37:                                               ; preds = %34
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_1)
  br label %38

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

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %41, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %42

42:                                               ; preds = %40, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %43 = load ptr, ptr %2, align 8
  ret ptr %43
}

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN12BoosterShell19InitializeUnfailingEPNS_11BoosterCoreE(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef) #5 align 2

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 = { 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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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"

@g_traceLevel = external local_unnamed_addr global i32, align 4
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage = external hidden constant [29 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_0 = external hidden constant [43 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_1 = external hidden constant [28 x i8], align 16

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef %0) local_unnamed_addr #1 align 2 {
  %2 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 2
  br i1 %3, label %4, label %5

4:                                                ; preds = %1
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage)
  br label %5

5:                                                ; preds = %4, %1
  %6 = tail call noalias dereferenceable_or_null(112) ptr @malloc(i64 noundef 112) #4
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %12, !prof !9

8:                                                ; preds = %5
  %9 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %16

11:                                               ; preds = %8
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_0)
  br label %16

12:                                               ; preds = %5
  tail call void @_ZN14NAMESPACE_MAIN12BoosterShell19InitializeUnfailingEPNS_11BoosterCoreE(ptr noundef nonnull align 8 dereferenceable(112) %6, ptr noundef %0)
  %13 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 2
  br i1 %14, label %15, label %16

15:                                               ; preds = %12
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreEE13LOG__sMessage_1)
  br label %16

16:                                               ; preds = %12, %15, %8, %11
  ret ptr %6
}

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN12BoosterShell19InitializeUnfailingEPNS_11BoosterCoreE(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef) local_unnamed_addr #3 align 2

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 = { 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 #2 = { 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 #3 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(0) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"branch_weights", !"expected", i32 1, i32 2000}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass