; 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
@_ZZ11FillFeatureE13LOG__sMessage = external hidden constant [37 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_0 = external hidden constant [75 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_1 = external hidden constant [53 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_2 = external hidden constant [73 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_MAINL13AppendFeatureEliiilPKlmPh(i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) #3

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

28:                                               ; preds = %8
  br label %29

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

32:                                               ; preds = %29
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ11FillFeatureE13LOG__sMessage)
  br label %33

33:                                               ; preds = %32, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %34

34:                                               ; preds = %33
  store i32 -3, ptr %9, align 4
  br label %85

35:                                               ; preds = %8
  %36 = load i64, ptr %16, align 8, !tbaa !5
  %37 = call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %36) #4
  br i1 %37, label %38, label %45

38:                                               ; preds = %35
  br label %39

39:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 1, ptr %19, align 4, !tbaa !9
  %40 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %41 = icmp sle i32 1, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ11FillFeatureE13LOG__sMessage_0)
  br label %43

43:                                               ; preds = %42, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %44

44:                                               ; preds = %43
  store i32 -3, ptr %9, align 4
  br label %85

45:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %46 = load i64, ptr %16, align 8, !tbaa !5
  store i64 %46, ptr %20, align 8, !tbaa !5
  %47 = load i64, ptr %20, align 8, !tbaa !5
  %48 = icmp ult i64 %47, 8
  br i1 %48, label %49, label %57

49:                                               ; preds = %45
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 1, ptr %21, align 4, !tbaa !9
  %51 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %52 = icmp sle i32 1, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ11FillFeatureE13LOG__sMessage_1)
  br label %54

54:                                               ; preds = %53, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  store i32 -3, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %84

57:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %58 = load ptr, ptr %17, align 8, !tbaa !11
  store ptr %58, ptr %23, align 8, !tbaa !11
  %59 = load ptr, ptr %23, align 8, !tbaa !11
  %60 = getelementptr inbounds %"struct.NAMESPACE_MAIN::HeaderDataSetShared", ptr %59, i32 0, i32 0
  %61 = load i64, ptr %60, align 8, !tbaa !13
  %62 = icmp ne i64 18139, %61
  br i1 %62, label %63, label %71

63:                                               ; preds = %57
  br label %64

64:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 1, ptr %24, align 4, !tbaa !9
  %65 = load i32, ptr @g_traceLevel, align 4, !tbaa !9
  %66 = icmp sle i32 1, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %64
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ11FillFeatureE13LOG__sMessage_2)
  br label %68

68:                                               ; preds = %67, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  store i32 -3, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %83

71:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %72 = load i64, ptr %10, align 8, !tbaa !5
  %73 = load i32, ptr %11, align 4, !tbaa !9
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = load i32, ptr %13, align 4, !tbaa !9
  %76 = load i64, ptr %14, align 8, !tbaa !5
  %77 = load ptr, ptr %15, align 8, !tbaa !11
  %78 = load i64, ptr %20, align 8, !tbaa !5
  %79 = load ptr, ptr %17, align 8, !tbaa !11
  %80 = call noundef i64 @_ZN14NAMESPACE_MAINL13AppendFeatureEliiilPKlmPh(i64 noundef %72, i32 noundef %73, i32 noundef %74, i32 noundef %75, i64 noundef %76, ptr noundef %77, i64 noundef %78, ptr noundef %79)
  store i64 %80, ptr %25, align 8, !tbaa !5
  %81 = load i64, ptr %25, align 8, !tbaa !5
  %82 = trunc i64 %81 to i32
  store i32 %82, ptr %9, align 4
  store i32 1, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  br label %83

83:                                               ; preds = %71, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  br label %84

84:                                               ; preds = %83, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %85

85:                                               ; preds = %84, %44, %34
  %86 = load i32, ptr %9, align 4
  ret i32 %86
}

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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !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
@_ZZ11FillFeatureE13LOG__sMessage = external hidden constant [37 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_0 = external hidden constant [75 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_1 = external hidden constant [53 x i8], align 16
@_ZZ11FillFeatureE13LOG__sMessage_2 = external hidden constant [73 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_MAINL13AppendFeatureEliiilPKlmPh(i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

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

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

13:                                               ; preds = %10
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ11FillFeatureE13LOG__sMessage)
  br label %35

14:                                               ; preds = %8
  %15 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %6) #3
  br i1 %15, label %16, label %20

16:                                               ; preds = %14
  %17 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %19, label %35

19:                                               ; preds = %16
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ11FillFeatureE13LOG__sMessage_0)
  br label %35

20:                                               ; preds = %14
  %21 = icmp ult i64 %6, 8
  br i1 %21, label %22, label %26

22:                                               ; preds = %20
  %23 = load i32, ptr @g_traceLevel, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %25, label %35

25:                                               ; preds = %22
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ11FillFeatureE13LOG__sMessage_1)
  br label %35

26:                                               ; preds = %20
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %.not = icmp eq i64 %27, 18139
  br i1 %.not, label %32, label %28

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

31:                                               ; preds = %28
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ11FillFeatureE13LOG__sMessage_2)
  br label %35

32:                                               ; preds = %26
  %33 = tail call noundef i64 @_ZN14NAMESPACE_MAINL13AppendFeatureEliiilPKlmPh(i64 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i64 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef nonnull %7)
  %34 = trunc i64 %33 to i32
  br label %35

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