; LLVM IR from IlyaGrebnov/libsais :: src (libsais16x64)

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

; Function Attrs: nounwind uwtable
define dso_local i64 @libsais16x64_lcp(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %21, label %12

12:                                               ; preds = %4
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %21, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %21, label %18

18:                                               ; preds = %15
  %19 = load i64, ptr %9, align 8, !tbaa !9
  %20 = icmp slt i64 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %18, %15, %12, %4
  store i64 -1, ptr %5, align 8
  br label %44

22:                                               ; preds = %18
  %23 = load i64, ptr %9, align 8, !tbaa !9
  %24 = icmp sle i64 %23, 1
  br i1 %24, label %25, label %38

25:                                               ; preds = %22
  %26 = load i64, ptr %9, align 8, !tbaa !9
  %27 = icmp eq i64 %26, 1
  br i1 %27, label %28, label %37

28:                                               ; preds = %25
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds i64, ptr %30, i64 0
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds i64, ptr %29, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds i64, ptr %35, i64 0
  store i64 %34, ptr %36, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %28, %25
  store i64 0, ptr %5, align 8
  br label %44

38:                                               ; preds = %22
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = load i64, ptr %9, align 8, !tbaa !9
  call void @libsais16x64_compute_lcp_omp(ptr noundef %40, ptr noundef %41, ptr noundef %42, i64 noundef %43, i64 noundef 1)
  store i64 0, ptr %5, align 8
  br label %44

44:                                               ; preds = %39, %37, %21
  %45 = load i64, ptr %5, align 8
  ret i64 %45
}

; Function Attrs: nounwind uwtable
declare hidden void @libsais16x64_compute_lcp_omp(ptr noalias noundef, ptr noalias noundef, ptr noalias noundef, i64 noundef, i64 noundef) #0

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !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"

; Function Attrs: nounwind uwtable
define dso_local range(i64 -1, 1) i64 @libsais16x64_lcp(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %1, null
  %or.cond = or i1 %5, %6
  %7 = icmp eq ptr %2, null
  %or.cond3 = or i1 %or.cond, %7
  %8 = icmp slt i64 %3, 0
  %or.cond5 = or i1 %or.cond3, %8
  br i1 %or.cond5, label %18, label %9

9:                                                ; preds = %4
  %10 = icmp ult i64 %3, 2
  br i1 %10, label %11, label %17

11:                                               ; preds = %9
  %12 = icmp eq i64 %3, 1
  br i1 %12, label %13, label %18

13:                                               ; preds = %11
  %14 = load i64, ptr %1, align 8, !tbaa !5
  %15 = getelementptr inbounds i64, ptr %0, i64 %14
  %16 = load i64, ptr %15, align 8, !tbaa !5
  store i64 %16, ptr %2, align 8, !tbaa !5
  br label %18

17:                                               ; preds = %9
  tail call void @libsais16x64_compute_lcp_omp(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef %3, i64 noundef 1)
  br label %18

18:                                               ; preds = %11, %13, %4, %17
  %.0 = phi i64 [ 0, %17 ], [ -1, %4 ], [ 0, %13 ], [ 0, %11 ]
  ret i64 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @libsais16x64_compute_lcp_omp(ptr noalias noundef, ptr noalias noundef, ptr noalias noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

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

!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/C++ TBAA"}


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