; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (alglibinternal)

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

@.str.27 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [28 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl11splitlengthEllPlS0_PNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %8, align 8, !tbaa !9
  store i64 0, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %9, align 8, !tbaa !9
  store i64 0, ptr %12, align 8, !tbaa !5
  %13 = load i64, ptr %7, align 8, !tbaa !5
  %14 = icmp sge i64 %13, 2
  %15 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef @.str.27, ptr noundef %15)
  %16 = load i64, ptr %6, align 8, !tbaa !5
  %17 = icmp sge i64 %16, 2
  %18 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %17, ptr noundef @.str.28, ptr noundef %18)
  %19 = load i64, ptr %6, align 8, !tbaa !5
  %20 = sdiv i64 %19, 2
  %21 = load ptr, ptr %8, align 8, !tbaa !9
  store i64 %20, ptr %21, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !9
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = load i64, ptr %7, align 8, !tbaa !5
  %25 = icmp sgt i64 %23, %24
  br i1 %25, label %26, label %41

26:                                               ; preds = %5
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = load i64, ptr %7, align 8, !tbaa !5
  %30 = srem i64 %28, %29
  %31 = icmp ne i64 %30, 0
  br i1 %31, label %32, label %41

32:                                               ; preds = %26
  %33 = load ptr, ptr %8, align 8, !tbaa !9
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = load i64, ptr %7, align 8, !tbaa !5
  %38 = srem i64 %36, %37
  %39 = sub nsw i64 %34, %38
  %40 = load ptr, ptr %8, align 8, !tbaa !9
  store i64 %39, ptr %40, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %32, %26, %5
  %42 = load i64, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = sub nsw i64 %42, %44
  %46 = load ptr, ptr %9, align 8, !tbaa !9
  store i64 %45, ptr %46, align 8, !tbaa !5
  %47 = load ptr, ptr %8, align 8, !tbaa !9
  %48 = load i64, ptr %47, align 8, !tbaa !5
  %49 = icmp sge i64 %48, 1
  %50 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %49, ptr noundef @.str.29, ptr noundef %50)
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = icmp sge i64 %52, 1
  %54 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %53, ptr noundef @.str.29, ptr noundef %54)
  ret void
}

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

!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}


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

@.str.27 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [28 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl11splitlengthEllPlS0_PNS_8ae_stateE(i64 noundef %0, i64 noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  store i64 0, ptr %2, align 8, !tbaa !5
  store i64 0, ptr %3, align 8, !tbaa !5
  %6 = icmp sgt i64 %1, 1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.27, ptr noundef %4)
  %7 = icmp sgt i64 %0, 1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %7, ptr noundef nonnull @.str.28, ptr noundef %4)
  %8 = sdiv i64 %0, 2
  store i64 %8, ptr %2, align 8, !tbaa !5
  %9 = icmp sgt i64 %8, %1
  br i1 %9, label %10, label %14

10:                                               ; preds = %5
  %11 = srem i64 %8, %1
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %14, label %12

12:                                               ; preds = %10
  %13 = sub nsw i64 %8, %11
  store i64 %13, ptr %2, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %12, %10, %5
  %15 = phi i64 [ %13, %12 ], [ %8, %10 ], [ %8, %5 ]
  %16 = sub nsw i64 %0, %15
  store i64 %16, ptr %3, align 8, !tbaa !5
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = icmp sgt i64 %17, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %18, ptr noundef nonnull @.str.29, ptr noundef %4)
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %20 = icmp sgt i64 %19, 0
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %20, ptr noundef nonnull @.str.29, ptr noundef %4)
  ret void
}

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

!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"}


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