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

; 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
@_ZZ17CreateBoosterViewE13LOG__sMessage = external hidden constant [69 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_0 = external hidden constant [54 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_1 = external hidden constant [50 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_2 = external hidden constant [25 x i8], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_(ptr noundef) #0 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14NAMESPACE_MAIN12BoosterShell15FillAllocationsEv(ptr noundef nonnull align 8 dereferenceable(112)) #0 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell14GetBoosterCoreEv(ptr noundef nonnull align 8 dereferenceable(112)) #4 align 2

declare void @InteralLogWithArguments(i32 noundef, ptr noundef, ...) #2

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @CreateBoosterView(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 3, ptr %6, align 4, !tbaa !9
  %16 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %17 = icmp sle i32 3, %16
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef 3, ptr noundef @_ZZ17CreateBoosterViewE13LOG__sMessage, ptr noundef %19, ptr noundef %20)
  br label %21

21:                                               ; preds = %18, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %22

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = icmp eq ptr null, %23
  %25 = xor i1 %24, true
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i64
  %28 = call i64 @llvm.expect.i64(i64 %27, i64 0)
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %38

30:                                               ; preds = %22
  br label %31

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 2, ptr %8, align 4, !tbaa !9
  %32 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %33 = icmp sle i32 2, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZ17CreateBoosterViewE13LOG__sMessage_0)
  br label %35

35:                                               ; preds = %34, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  store i32 -3, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %87

38:                                               ; preds = %22
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr null, ptr %39, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell25GetBoosterShellFromHandleEP14_BoosterHandle(ptr noundef %40)
  store ptr %41, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = icmp eq ptr null, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  store i32 -3, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %86

45:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell14GetBoosterCoreEv(ptr noundef nonnull align 8 dereferenceable(112) %46)
  store ptr %47, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef %48)
  store ptr %49, ptr %12, align 8, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = icmp eq ptr null, %50
  %52 = xor i1 %51, true
  %53 = xor i1 %52, true
  %54 = zext i1 %53 to i64
  %55 = call i64 @llvm.expect.i64(i64 %54, i64 0)
  %56 = icmp ne i64 %55, 0
  br i1 %56, label %57, label %65

57:                                               ; preds = %45
  br label %58

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 2, ptr %13, align 4, !tbaa !9
  %59 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %60 = icmp sle i32 2, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %58
  call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef @_ZZ17CreateBoosterViewE13LOG__sMessage_1)
  br label %62

62:                                               ; preds = %61, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %85

65:                                               ; preds = %45
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN14NAMESPACE_MAIN11BoosterCore17AddReferenceCountEv(ptr noundef nonnull align 8 dereferenceable(520) %66)
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = call noundef i32 @_ZN14NAMESPACE_MAIN12BoosterShell15FillAllocationsEv(ptr noundef nonnull align 8 dereferenceable(112) %67)
  store i32 %68, ptr %7, align 4, !tbaa !9
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = icmp ne i32 0, %69
  br i1 %70, label %71, label %74

71:                                               ; preds = %65
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_(ptr noundef %72)
  %73 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %73, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %85

74:                                               ; preds = %65
  br label %75

75:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 3, ptr %14, align 4, !tbaa !9
  %76 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %77 = icmp sle i32 3, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %75
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZ17CreateBoosterViewE13LOG__sMessage_2)
  br label %79

79:                                               ; preds = %78, %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell9GetHandleEv(ptr noundef nonnull align 8 dereferenceable(112) %82)
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %83, ptr %84, align 8, !tbaa !5
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %85

85:                                               ; preds = %81, %71, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %86

86:                                               ; preds = %85, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %87

87:                                               ; preds = %86, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  %88 = load i32, ptr %3, align 4
  ret i32 %88
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell25GetBoosterShellFromHandleEP14_BoosterHandle(ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN11BoosterCore17AddReferenceCountEv(ptr noundef nonnull align 8 dereferenceable(520)) #6 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nosync nounwind willreturn memory(none) }
attributes #4 = { alwaysinline 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 #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 = { inlinehint 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 #7 = { 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++ 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
@_ZZ17CreateBoosterViewE13LOG__sMessage = external hidden constant [69 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_0 = external hidden constant [54 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_1 = external hidden constant [50 x i8], align 16
@_ZZ17CreateBoosterViewE13LOG__sMessage_2 = external hidden constant [25 x i8], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_(ptr noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN14NAMESPACE_MAIN12BoosterShell15FillAllocationsEv(ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell14GetBoosterCoreEv(ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #2 align 2

declare void @InteralLogWithArguments(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

5:                                                ; preds = %2
  tail call void (i32, ptr, ...) @InteralLogWithArguments(i32 noundef 3, ptr noundef nonnull @_ZZ17CreateBoosterViewE13LOG__sMessage, ptr noundef %0, ptr noundef %1)
  br label %6

6:                                                ; preds = %5, %2
  %7 = icmp eq ptr %1, null
  br i1 %7, label %8, label %12, !prof !9

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

11:                                               ; preds = %8
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZ17CreateBoosterViewE13LOG__sMessage_0)
  br label %32

12:                                               ; preds = %6
  store ptr null, ptr %1, align 8, !tbaa !10
  %13 = tail call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell25GetBoosterShellFromHandleEP14_BoosterHandle(ptr noundef %0)
  %14 = icmp eq ptr %13, null
  br i1 %14, label %32, label %15

15:                                               ; preds = %12
  %16 = tail call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell14GetBoosterCoreEv(ptr noundef nonnull align 8 dereferenceable(112) %13)
  %17 = tail call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell6CreateEPNS_11BoosterCoreE(ptr noundef %16)
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %23, !prof !9

19:                                               ; preds = %15
  %20 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 1
  br i1 %21, label %22, label %32

22:                                               ; preds = %19
  tail call void @InteralLogWithoutArguments(i32 noundef 2, ptr noundef nonnull @_ZZ17CreateBoosterViewE13LOG__sMessage_1)
  br label %32

23:                                               ; preds = %15
  tail call void @_ZN14NAMESPACE_MAIN11BoosterCore17AddReferenceCountEv(ptr noundef nonnull align 8 dereferenceable(520) %16)
  %24 = tail call noundef i32 @_ZN14NAMESPACE_MAIN12BoosterShell15FillAllocationsEv(ptr noundef nonnull align 8 dereferenceable(112) %17)
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %26, label %25

25:                                               ; preds = %23
  tail call void @_ZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_(ptr noundef nonnull %17)
  br label %32

26:                                               ; preds = %23
  %27 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %28 = icmp sgt i32 %27, 2
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZ17CreateBoosterViewE13LOG__sMessage_2)
  br label %30

30:                                               ; preds = %29, %26
  %31 = tail call noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell9GetHandleEv(ptr noundef nonnull align 8 dereferenceable(112) %17)
  store ptr %31, ptr %1, align 8, !tbaa !10
  br label %32

32:                                               ; preds = %12, %19, %22, %30, %25, %8, %11
  %.2 = phi i32 [ -3, %11 ], [ -3, %8 ], [ -3, %12 ], [ %24, %25 ], [ 0, %30 ], [ -1, %22 ], [ -1, %19 ]
  ret i32 %.2
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN14NAMESPACE_MAIN12BoosterShell25GetBoosterShellFromHandleEP14_BoosterHandle(ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN14NAMESPACE_MAIN11BoosterCore17AddReferenceCountEv(ptr noundef nonnull align 8 dereferenceable(520)) local_unnamed_addr #4 align 2

attributes #0 = { 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 #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 = { alwaysinline 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 = { 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 = { inlinehint 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" }

!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}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}


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