; LLVM IR from interpretml/interpret :: shared/libebm/InteractionShell.ll (ZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_)

; 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::InteractionShell" = type { i64, ptr, ptr, i64, ptr, i64, i32, i32 }

@g_traceLevel = external global i32, align 4
@_ZZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage = external hidden constant [31 x i8], align 16
@_ZZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage_0 = external hidden constant [30 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_(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_MAIN16InteractionShell4FreeEPS0_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 %26

13:                                               ; preds = %10
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.NAMESPACE_MAIN::InteractionShell", ptr %14, i32 0, i32 2
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  call void @AlignedFree(ptr noundef %16)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.NAMESPACE_MAIN::InteractionShell", ptr %17, i32 0, i32 4
  %19 = load ptr, ptr %18, align 8, !tbaa !14
  call void @AlignedFree(ptr noundef %19)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.NAMESPACE_MAIN::InteractionShell", ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  call void @_ZN14NAMESPACE_MAIN15InteractionCore4FreeEPS0_(ptr noundef %22)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.NAMESPACE_MAIN::InteractionShell", ptr %23, i32 0, i32 0
  store i64 27913, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %25) #4
  br label %26

26:                                               ; preds = %13, %10
  br label %27

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

30:                                               ; preds = %27
  call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef @_ZZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage_0)
  br label %31

31:                                               ; preds = %30, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %32

32:                                               ; preds = %31
  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 @AlignedFree(ptr noundef) #2

declare void @_ZN14NAMESPACE_MAIN15InteractionCore4FreeEPS0_(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 16}
!12 = !{!"_ZTSN14NAMESPACE_MAIN16InteractionShellE", !13, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !10, i64 48, !10, i64 52}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 32}
!15 = !{!12, !6, i64 8}
!16 = !{!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_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage = external hidden constant [31 x i8], align 16
@_ZZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage_0 = external hidden constant [30 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_(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_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage)
  br label %5

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

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  tail call void @AlignedFree(ptr noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  tail call void @AlignedFree(ptr noundef %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  tail call void @_ZN14NAMESPACE_MAIN15InteractionCore4FreeEPS0_(ptr noundef %12)
  tail call void @free(ptr noundef nonnull %0) #3
  br label %13

13:                                               ; preds = %5, %6
  %14 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 2
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  tail call void @InteralLogWithoutArguments(i32 noundef 3, ptr noundef nonnull @_ZZN14NAMESPACE_MAIN16InteractionShell4FreeEPS0_E13LOG__sMessage_0)
  br label %17

17:                                               ; preds = %16, %13
  ret void
}

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

declare void @AlignedFree(ptr noundef) local_unnamed_addr #1

declare void @_ZN14NAMESPACE_MAIN15InteractionCore4FreeEPS0_(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 16}
!10 = !{!"_ZTSN14NAMESPACE_MAIN16InteractionShellE", !11, i64 0, !12, i64 8, !12, i64 16, !11, i64 24, !12, i64 32, !11, i64 40, !6, i64 48, !6, i64 52}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!10, !12, i64 32}
!14 = !{!10, !12, i64 8}


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