; 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
@_ZZ20FillRegressionTargetE13LOG__sMessage = external hidden constant [46 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_0 = external hidden constant [84 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_1 = external hidden constant [62 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_2 = external hidden constant [82 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 @FillRegressionTarget(i64 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !9
  %18 = load ptr, ptr %9, align 8, !tbaa !9
  %19 = icmp eq ptr null, %18
  br i1 %19, label %20, label %27

20:                                               ; preds = %4
  br label %21

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

24:                                               ; preds = %21
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ20FillRegressionTargetE13LOG__sMessage)
  br label %25

25:                                               ; preds = %24, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %26

26:                                               ; preds = %25
  store i32 -3, ptr %5, align 4
  br label %73

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

30:                                               ; preds = %27
  br label %31

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

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

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

36:                                               ; preds = %35
  store i32 -3, ptr %5, align 4
  br label %73

37:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %38 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %38, ptr %12, align 8, !tbaa !5
  %39 = load i64, ptr %12, align 8, !tbaa !5
  %40 = icmp ult i64 %39, 8
  br i1 %40, label %41, label %49

41:                                               ; preds = %37
  br label %42

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

45:                                               ; preds = %42
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ20FillRegressionTargetE13LOG__sMessage_1)
  br label %46

46:                                               ; preds = %45, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  store i32 -3, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %72

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

55:                                               ; preds = %49
  br label %56

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

59:                                               ; preds = %56
  call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef @_ZZ20FillRegressionTargetE13LOG__sMessage_2)
  br label %60

60:                                               ; preds = %59, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  store i32 -3, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %71

63:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %64 = load i64, ptr %6, align 8, !tbaa !5
  %65 = load ptr, ptr %7, align 8, !tbaa !9
  %66 = load i64, ptr %12, align 8, !tbaa !5
  %67 = load ptr, ptr %9, align 8, !tbaa !9
  %68 = call noundef i64 @_ZN14NAMESPACE_MAINL12AppendTargetEbllPKvmPh(i1 noundef zeroext false, i64 noundef 0, i64 noundef %64, ptr noundef %65, i64 noundef %66, ptr noundef %67)
  store i64 %68, ptr %17, align 8, !tbaa !5
  %69 = load i64, ptr %17, align 8, !tbaa !5
  %70 = trunc i64 %69 to i32
  store i32 %70, ptr %5, align 4
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  br label %71

71:                                               ; preds = %63, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %72

72:                                               ; preds = %71, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %73

73:                                               ; preds = %72, %36, %26
  %74 = load i32, ptr %5, align 4
  ret i32 %74
}

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
@_ZZ20FillRegressionTargetE13LOG__sMessage = external hidden constant [46 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_0 = external hidden constant [84 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_1 = external hidden constant [62 x i8], align 16
@_ZZ20FillRegressionTargetE13LOG__sMessage_2 = external hidden constant [82 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 @FillRegressionTarget(i64 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = icmp eq ptr %3, null
  br i1 %5, label %6, label %10

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

9:                                                ; preds = %6
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ20FillRegressionTargetE13LOG__sMessage)
  br label %31

10:                                               ; preds = %4
  %11 = tail call noundef zeroext i1 @_ZN14NAMESPACE_MAINL14IsConvertErrorImlEENSt9enable_ifIXaaaantsr3std9is_signedIT_EE5valuesr3std9is_signedIT0_EE5valueleclsr3std14numeric_limitsIS3_EE3maxEclsr3std14numeric_limitsIS2_EE3maxEEbE4typeES3_(i64 noundef %2) #3
  br i1 %11, label %12, label %16

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

15:                                               ; preds = %12
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ20FillRegressionTargetE13LOG__sMessage_0)
  br label %31

16:                                               ; preds = %10
  %17 = icmp ult i64 %2, 8
  br i1 %17, label %18, label %22

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

21:                                               ; preds = %18
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ20FillRegressionTargetE13LOG__sMessage_1)
  br label %31

22:                                               ; preds = %16
  %23 = load i64, ptr %3, align 8, !tbaa !9
  %.not = icmp eq i64 %23, 18139
  br i1 %.not, label %28, label %24

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

27:                                               ; preds = %24
  tail call void @InteralLogWithoutArguments(i32 noundef 1, ptr noundef nonnull @_ZZ20FillRegressionTargetE13LOG__sMessage_2)
  br label %31

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

31:                                               ; preds = %21, %18, %24, %27, %28, %12, %15, %6, %9
  %.2 = phi i32 [ -3, %9 ], [ -3, %6 ], [ -3, %15 ], [ -3, %12 ], [ -3, %21 ], [ -3, %18 ], [ %30, %28 ], [ -3, %27 ], [ -3, %24 ]
  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