; LLVM IR from generalized-intelligence/GAAS :: deprecated/algorithms/sfm/OpenSfM/opensfm/src/third_party/akaze/lib (fed)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind
declare double @sqrt(double 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z21fed_is_prime_internali(i32 noundef %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = icmp sle i32 %7, 1
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i1 false, ptr %2, align 1
  br label %61

10:                                               ; preds = %1
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 2
  br i1 %12, label %22, label %13

13:                                               ; preds = %10
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 3
  br i1 %15, label %22, label %16

16:                                               ; preds = %13
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp eq i32 %17, 5
  br i1 %18, label %22, label %19

19:                                               ; preds = %16
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 7
  br i1 %21, label %22, label %23

22:                                               ; preds = %19, %16, %13, %10
  store i1 true, ptr %2, align 1
  br label %61

23:                                               ; preds = %19
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = srem i32 %24, 2
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %39, label %27

27:                                               ; preds = %23
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = srem i32 %28, 3
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %39, label %31

31:                                               ; preds = %27
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = srem i32 %32, 5
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %39, label %35

35:                                               ; preds = %31
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = srem i32 %36, 7
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %35, %31, %27, %23
  store i1 false, ptr %2, align 1
  br label %61

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sitofp i32 %41 to double
  %43 = fadd double %42, 1.000000e+00
  %44 = call double @sqrt(double noundef %43) #3
  %45 = fptosi double %44 to i32
  store i32 %45, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 11, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %56, %40
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %50, label %59

50:                                               ; preds = %46
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = srem i32 %51, %52
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %50
  store i1 false, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %60

56:                                               ; preds = %50
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = add nsw i32 %57, 2
  store i32 %58, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !9

59:                                               ; preds = %46
  store i1 true, ptr %2, align 1
  store i32 1, ptr %6, align 4
  br label %60

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

61:                                               ; preds = %60, %39, %22, %9
  %62 = load i1, ptr %2, align 1
  ret i1 %62
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "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 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 = { 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 = 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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef zeroext i1 @_Z21fed_is_prime_internali(i32 noundef %0) local_unnamed_addr #0 {
  %2 = icmp slt i32 %0, 2
  br i1 %2, label %.loopexit, label %3

3:                                                ; preds = %1
  %4 = and i32 %0, 2147483646
  %or.cond = icmp eq i32 %4, 2
  %5 = and i32 %0, 2147483645
  %6 = icmp eq i32 %5, 5
  %or.cond5 = or i1 %or.cond, %6
  br i1 %or.cond5, label %.loopexit, label %7

7:                                                ; preds = %3
  %8 = and i32 %0, 1
  %9 = icmp eq i32 %8, 0
  %10 = urem i32 %0, 3
  %11 = icmp eq i32 %10, 0
  %or.cond23 = or i1 %9, %11
  %12 = urem i32 %0, 5
  %13 = icmp eq i32 %12, 0
  %or.cond25 = or i1 %13, %or.cond23
  %14 = urem i32 %0, 7
  %15 = icmp eq i32 %14, 0
  %or.cond27 = or i1 %15, %or.cond25
  br i1 %or.cond27, label %.loopexit, label %16

16:                                               ; preds = %7
  %17 = add nuw i32 %0, 1
  %18 = uitofp i32 %17 to double
  %sqrt = tail call double @llvm.sqrt.f64(double %18)
  %19 = fptosi double %sqrt to i32
  %.not28 = icmp slt i32 %19, 11
  br i1 %.not28, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %16, %.lr.ph
  %.029 = phi i32 [ %21, %.lr.ph ], [ 11, %16 ]
  %20 = urem i32 %0, %.029
  %.not32 = icmp ne i32 %20, 0
  %21 = add nuw nsw i32 %.029, 2
  %.not = icmp sle i32 %21, %19
  %or.cond33.not = select i1 %.not32, i1 %.not, i1 false
  br i1 %or.cond33.not, label %.lr.ph, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %.lr.ph, %16, %7, %3, %1
  %.1 = phi i1 [ false, %1 ], [ true, %3 ], [ false, %7 ], [ true, %16 ], [ %.not32, %.lr.ph ]
  ret i1 %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #1

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" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass