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

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

%"class.NAMESPACE_MAIN::BoosterShell" = type { i64, ptr, i64, ptr, ptr, ptr, ptr, ptr, i64, ptr, i64, ptr, ptr, ptr }

@g_traceLevel = external global i32, align 4
@_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage = external hidden constant [27 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage_0 = external hidden constant [26 x i8], align 16

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

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

8:                                                ; preds = %5
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage)
  br label %9

9:                                                ; preds = %8, %5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %10

10:                                               ; preds = %9
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = icmp ne ptr null, %11
  br i1 %12, label %13, label %44

13:                                               ; preds = %10
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %14, i32 0, i32 3
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef %16)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !14
  call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef %19)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %20, i32 0, i32 5
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  call void @AlignedFree(ptr noundef %22)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %23, i32 0, i32 6
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  call void @AlignedFree(ptr noundef %25)
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %26, i32 0, i32 7
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  call void @AlignedFree(ptr noundef %28)
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %29, i32 0, i32 12
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  call void @AlignedFree(ptr noundef %31)
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %32, i32 0, i32 11
  %34 = load ptr, ptr %33, align 8, !tbaa !19
  call void @AlignedFree(ptr noundef %34)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %35, i32 0, i32 9
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  call void @AlignedFree(ptr noundef %37)
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  call void @_ZN14NAMESPACE_MAIN11BoosterCore4FreeEPS0_(ptr noundef %40)
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %"class.NAMESPACE_MAIN::BoosterShell", ptr %41, i32 0, i32 0
  store i64 25073, ptr %42, align 8, !tbaa !22
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %43) #4
  br label %44

44:                                               ; preds = %13, %10
  br label %45

45:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 3, ptr %4, align 4, !tbaa !9
  %46 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %47 = icmp sle i32 3, %46
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage_0)
  br label %49

49:                                               ; preds = %48, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %50

50:                                               ; preds = %49
  ret void
}

; 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

declare void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef) #2

declare void @AlignedFree(ptr noundef) #2

declare void @_ZN14NAMESPACE_MAIN11BoosterCore4FreeEPS0_(ptr noundef) #2

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

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 = { 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 #4 = { 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}
!11 = !{!12, !6, i64 24}
!12 = !{!"_ZTSN14NAMESPACE_MAIN12BoosterShellE", !13, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64, !6, i64 72, !13, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = !{!12, !6, i64 40}
!16 = !{!12, !6, i64 48}
!17 = !{!12, !6, i64 56}
!18 = !{!12, !6, i64 96}
!19 = !{!12, !6, i64 88}
!20 = !{!12, !6, i64 72}
!21 = !{!12, !6, i64 8}
!22 = !{!12, !13, 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_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage = external hidden constant [27 x i8], align 16
@_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage_0 = external hidden constant [26 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_(ptr noundef %0) local_unnamed_addr #0 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_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage)
  br label %5

5:                                                ; preds = %4, %1
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %25, label %6

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  tail call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  tail call void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  tail call void @AlignedFree(ptr noundef %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  tail call void @AlignedFree(ptr noundef %14)
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  tail call void @AlignedFree(ptr noundef %16)
  %17 = getelementptr inbounds i8, ptr %0, i64 96
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  tail call void @AlignedFree(ptr noundef %18)
  %19 = getelementptr inbounds i8, ptr %0, i64 88
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  tail call void @AlignedFree(ptr noundef %20)
  %21 = getelementptr inbounds i8, ptr %0, i64 72
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  tail call void @AlignedFree(ptr noundef %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @_ZN14NAMESPACE_MAIN11BoosterCore4FreeEPS0_(ptr noundef %24)
  tail call void @free(ptr noundef nonnull %0) #3
  br label %25

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

28:                                               ; preds = %25
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN12BoosterShell4FreeEPS0_E13LOG__sMessage_0)
  br label %29

29:                                               ; preds = %28, %25
  ret void
}

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

declare void @_ZN14NAMESPACE_MAIN6Tensor4FreeEPS0_(ptr noundef) local_unnamed_addr #1

declare void @AlignedFree(ptr noundef) local_unnamed_addr #1

declare void @_ZN14NAMESPACE_MAIN11BoosterCore4FreeEPS0_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #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 = { 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 #3 = { 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++ TBAA"}
!9 = !{!10, !12, i64 24}
!10 = !{!"_ZTSN14NAMESPACE_MAIN12BoosterShellE", !11, i64 0, !12, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !11, i64 64, !12, i64 72, !11, i64 80, !12, i64 88, !12, i64 96, !12, i64 104}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !12, i64 32}
!14 = !{!10, !12, i64 40}
!15 = !{!10, !12, i64 48}
!16 = !{!10, !12, i64 56}
!17 = !{!10, !12, i64 96}
!18 = !{!10, !12, i64 88}
!19 = !{!10, !12, i64 72}
!20 = !{!10, !12, i64 8}


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