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

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

%"struct.NAMESPACE_MAIN::HeaderDataSetShared" = type { i64, i64, i64, i64, i64, [1 x i64] }

@g_traceLevel = external global i32, align 4
@_ZZ24FillClassificationTargetE13LOG__sMessage = external hidden constant [50 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_0 = external hidden constant [88 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_1 = external hidden constant [66 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_2 = external hidden constant [86 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN14NAMESPACE_MAINL12AppendTargetEbllPKvmPh(i1 noundef zeroext, i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local i32 @FillClassificationTarget(i64 noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4) #3 {
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i64, align 8
  store i64 %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !9
  %20 = load ptr, ptr %11, align 8, !tbaa !9
  %21 = icmp eq ptr null, %20
  br i1 %21, label %22, label %29

22:                                               ; preds = %5
  br label %23

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

26:                                               ; preds = %23
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ24FillClassificationTargetE13LOG__sMessage)
  br label %27

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

28:                                               ; preds = %27
  store i32 -3, ptr %6, align 4
  br label %76

29:                                               ; preds = %5
  %30 = load i64, ptr %10, align 8, !tbaa !5
  %31 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %30) #4
  br i1 %31, label %32, label %39

32:                                               ; preds = %29
  br label %33

33:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !11
  %34 = load i32, ptr @g_traceLevel, align 4, !tbaa !11
  %35 = icmp sle i32 1, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ24FillClassificationTargetE13LOG__sMessage_0)
  br label %37

37:                                               ; preds = %36, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %38

38:                                               ; preds = %37
  store i32 -3, ptr %6, align 4
  br label %76

39:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %40 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %40, ptr %14, align 8, !tbaa !5
  %41 = load i64, ptr %14, align 8, !tbaa !5
  %42 = icmp ult i64 %41, 8
  br i1 %42, label %43, label %51

43:                                               ; preds = %39
  br label %44

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

47:                                               ; preds = %44
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ24FillClassificationTargetE13LOG__sMessage_1)
  br label %48

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

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %75

51:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %52 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %52, ptr %17, align 8, !tbaa !9
  %53 = load ptr, ptr %17, align 8, !tbaa !9
  %54 = getelementptr inbounds %"struct.NAMESPACE_MAIN::HeaderDataSetShared", ptr %53, i32 0, i32 0
  %55 = load i64, ptr %54, align 8, !tbaa !13
  %56 = icmp ne i64 18139, %55
  br i1 %56, label %57, label %65

57:                                               ; preds = %51
  br label %58

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

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

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

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %16, align 4
  br label %74

65:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %66 = load i64, ptr %7, align 8, !tbaa !5
  %67 = load i64, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !9
  %69 = load i64, ptr %14, align 8, !tbaa !5
  %70 = load ptr, ptr %11, align 8, !tbaa !9
  %71 = call noundef i64 @_ZN14NAMESPACE_MAINL12AppendTargetEbllPKvmPh(i1 noundef zeroext true, i64 noundef %66, i64 noundef %67, ptr noundef %68, i64 noundef %69, ptr noundef %70)
  store i64 %71, ptr %19, align 8, !tbaa !5
  %72 = load i64, ptr %19, align 8, !tbaa !5
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %6, align 4
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %74

74:                                               ; preds = %65, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %75

75:                                               ; preds = %74, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %76

76:                                               ; preds = %75, %38, %28
  %77 = load i32, ptr %6, align 4
  ret i32 %77
}

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 = { 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 #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 }

!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}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN14NAMESPACE_MAIN19HeaderDataSetSharedE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40}


; 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
@_ZZ24FillClassificationTargetE13LOG__sMessage = external hidden constant [50 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_0 = external hidden constant [88 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_1 = external hidden constant [66 x i8], align 16
@_ZZ24FillClassificationTargetE13LOG__sMessage_2 = external hidden constant [86 x i8], align 16

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i64 @_ZN14NAMESPACE_MAINL12AppendTargetEbllPKvmPh(i1 noundef zeroext, i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @FillClassificationTarget(i64 noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = icmp eq ptr %4, null
  br i1 %6, label %7, label %11

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

10:                                               ; preds = %7
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ24FillClassificationTargetE13LOG__sMessage)
  br label %32

11:                                               ; preds = %5
  %12 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %3) #3
  br i1 %12, label %13, label %17

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

16:                                               ; preds = %13
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ24FillClassificationTargetE13LOG__sMessage_0)
  br label %32

17:                                               ; preds = %11
  %18 = icmp ult i64 %3, 8
  br i1 %18, label %19, label %23

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

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

23:                                               ; preds = %17
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %.not = icmp eq i64 %24, 18139
  br i1 %.not, label %29, label %25

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

28:                                               ; preds = %25
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ24FillClassificationTargetE13LOG__sMessage_2)
  br label %32

29:                                               ; preds = %23
  %30 = tail call noundef i64 @_ZN14NAMESPACE_MAINL12AppendTargetEbllPKvmPh(i1 noundef zeroext true, i64 noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef nonnull %4)
  %31 = trunc i64 %30 to i32
  br label %32

32:                                               ; preds = %22, %19, %25, %28, %29, %13, %16, %7, %10
  %.2 = phi i32 [ -3, %10 ], [ -3, %7 ], [ -3, %16 ], [ -3, %13 ], [ -3, %22 ], [ -3, %19 ], [ %31, %29 ], [ -3, %28 ], [ -3, %25 ]
  ret i32 %.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 = { 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 #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 }

!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, !11, i64 0}
!10 = !{!"_ZTSN14NAMESPACE_MAIN19HeaderDataSetSharedE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40}
!11 = !{!"long", !7, i64 0}


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