; LLVM IR from fmela/libdict :: src (hashtable_common)

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

@kPrimes = external hidden constant [30 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @dict_prime_geq(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %23, %1
  %7 = load i32, ptr %4, align 4, !tbaa !5
  %8 = icmp ult i32 %7, 30
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  store i32 2, ptr %5, align 4
  br label %26

10:                                               ; preds = %6
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds [30 x i32], ptr @kPrimes, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp uge i32 %14, %15
  br i1 %16, label %17, label %22

17:                                               ; preds = %10
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds [30 x i32], ptr @kPrimes, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  store i32 %21, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %26

22:                                               ; preds = %10
  br label %23

23:                                               ; preds = %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = add i32 %24, 1
  store i32 %25, ptr %4, align 4, !tbaa !5
  br label %6, !llvm.loop !9

26:                                               ; preds = %17, %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  %27 = load i32, ptr %5, align 4
  switch i32 %27, label %32 [
    i32 2, label %28
    i32 1, label %30
  ]

28:                                               ; preds = %26
  %29 = load i32, ptr getelementptr inbounds ([30 x i32], ptr @kPrimes, i64 0, i64 29), align 4, !tbaa !5
  store i32 %29, ptr %2, align 4
  br label %30

30:                                               ; preds = %28, %26
  %31 = load i32, ptr %2, align 4
  ret i32 %31

32:                                               ; preds = %26
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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

@kPrimes = external hidden local_unnamed_addr constant [30 x i32], align 16

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i32 @dict_prime_geq(i32 noundef %0) local_unnamed_addr #0 {
  %2 = load i32, ptr @kPrimes, align 16, !tbaa !5
  %.not = icmp ult i32 %2, %0
  br i1 %.not, label %3, label %.thread

3:                                                ; preds = %1
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 4), align 4, !tbaa !5
  %.not.1 = icmp ult i32 %4, %0
  br i1 %.not.1, label %5, label %.thread

5:                                                ; preds = %3
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 8), align 8, !tbaa !5
  %.not.2 = icmp ult i32 %6, %0
  br i1 %.not.2, label %7, label %.thread

7:                                                ; preds = %5
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 12), align 4, !tbaa !5
  %.not.3 = icmp ult i32 %8, %0
  br i1 %.not.3, label %9, label %.thread

9:                                                ; preds = %7
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 16), align 16, !tbaa !5
  %.not.4 = icmp ult i32 %10, %0
  br i1 %.not.4, label %11, label %.thread

11:                                               ; preds = %9
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 20), align 4, !tbaa !5
  %.not.5 = icmp ult i32 %12, %0
  br i1 %.not.5, label %13, label %.thread

13:                                               ; preds = %11
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 24), align 8, !tbaa !5
  %.not.6 = icmp ult i32 %14, %0
  br i1 %.not.6, label %15, label %.thread

15:                                               ; preds = %13
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 28), align 4, !tbaa !5
  %.not.7 = icmp ult i32 %16, %0
  br i1 %.not.7, label %17, label %.thread

17:                                               ; preds = %15
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 32), align 16, !tbaa !5
  %.not.8 = icmp ult i32 %18, %0
  br i1 %.not.8, label %19, label %.thread

19:                                               ; preds = %17
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 36), align 4, !tbaa !5
  %.not.9 = icmp ult i32 %20, %0
  br i1 %.not.9, label %21, label %.thread

21:                                               ; preds = %19
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 40), align 8, !tbaa !5
  %.not.10 = icmp ult i32 %22, %0
  br i1 %.not.10, label %23, label %.thread

23:                                               ; preds = %21
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 44), align 4, !tbaa !5
  %.not.11 = icmp ult i32 %24, %0
  br i1 %.not.11, label %25, label %.thread

25:                                               ; preds = %23
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 48), align 16, !tbaa !5
  %.not.12 = icmp ult i32 %26, %0
  br i1 %.not.12, label %27, label %.thread

27:                                               ; preds = %25
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 52), align 4, !tbaa !5
  %.not.13 = icmp ult i32 %28, %0
  br i1 %.not.13, label %29, label %.thread

29:                                               ; preds = %27
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 56), align 8, !tbaa !5
  %.not.14 = icmp ult i32 %30, %0
  br i1 %.not.14, label %31, label %.thread

31:                                               ; preds = %29
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 60), align 4, !tbaa !5
  %.not.15 = icmp ult i32 %32, %0
  br i1 %.not.15, label %33, label %.thread

33:                                               ; preds = %31
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 64), align 16, !tbaa !5
  %.not.16 = icmp ult i32 %34, %0
  br i1 %.not.16, label %35, label %.thread

35:                                               ; preds = %33
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 68), align 4, !tbaa !5
  %.not.17 = icmp ult i32 %36, %0
  br i1 %.not.17, label %37, label %.thread

37:                                               ; preds = %35
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 72), align 8, !tbaa !5
  %.not.18 = icmp ult i32 %38, %0
  br i1 %.not.18, label %39, label %.thread

39:                                               ; preds = %37
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 76), align 4, !tbaa !5
  %.not.19 = icmp ult i32 %40, %0
  br i1 %.not.19, label %41, label %.thread

41:                                               ; preds = %39
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 80), align 16, !tbaa !5
  %.not.20 = icmp ult i32 %42, %0
  br i1 %.not.20, label %43, label %.thread

43:                                               ; preds = %41
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 84), align 4, !tbaa !5
  %.not.21 = icmp ult i32 %44, %0
  br i1 %.not.21, label %45, label %.thread

45:                                               ; preds = %43
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 88), align 8, !tbaa !5
  %.not.22 = icmp ult i32 %46, %0
  br i1 %.not.22, label %47, label %.thread

47:                                               ; preds = %45
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 92), align 4, !tbaa !5
  %.not.23 = icmp ult i32 %48, %0
  br i1 %.not.23, label %49, label %.thread

49:                                               ; preds = %47
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 96), align 16, !tbaa !5
  %.not.24 = icmp ult i32 %50, %0
  br i1 %.not.24, label %51, label %.thread

51:                                               ; preds = %49
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 100), align 4, !tbaa !5
  %.not.25 = icmp ult i32 %52, %0
  br i1 %.not.25, label %53, label %.thread

53:                                               ; preds = %51
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 104), align 8, !tbaa !5
  %.not.26 = icmp ult i32 %54, %0
  br i1 %.not.26, label %55, label %.thread

55:                                               ; preds = %53
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 108), align 4, !tbaa !5
  %.not.27 = icmp ult i32 %56, %0
  br i1 %.not.27, label %57, label %.thread

57:                                               ; preds = %55
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 112), align 16, !tbaa !5
  %.not.28 = icmp ult i32 %58, %0
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @kPrimes, i64 116), align 4
  %spec.select = select i1 %.not.28, i32 %59, i32 %58
  br label %.thread

.thread:                                          ; preds = %57, %55, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
  %60 = phi i32 [ %56, %55 ], [ %54, %53 ], [ %52, %51 ], [ %50, %49 ], [ %48, %47 ], [ %46, %45 ], [ %44, %43 ], [ %42, %41 ], [ %40, %39 ], [ %38, %37 ], [ %36, %35 ], [ %34, %33 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ], [ %2, %1 ], [ %spec.select, %57 ]
  ret i32 %60
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass