; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/stats/stats.ll (Z5gammaf)

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_Z5gammaf(float noundef %0) #3 {
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store float %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store float 0.000000e+00, ptr %3, align 4, !tbaa !5
  %7 = load float, ptr %2, align 4, !tbaa !5
  %8 = fmul float 2.000000e+00, %7
  %9 = call noundef float @_ZSt4rintf(float noundef %8)
  %10 = fdiv float %9, 2.000000e+00
  store float %10, ptr %2, align 4, !tbaa !5
  %11 = load float, ptr %2, align 4, !tbaa !5
  %12 = call noundef float @_ZSt4rintf(float noundef %11)
  %13 = load float, ptr %2, align 4, !tbaa !5
  %14 = fcmp oeq float %12, %13
  br i1 %14, label %15, label %31

15:                                               ; preds = %1
  store float 1.000000e+00, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %27, %15
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = load float, ptr %2, align 4, !tbaa !5
  %19 = fptosi float %18 to i32
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %30

22:                                               ; preds = %16
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = sitofp i32 %23 to float
  %25 = load float, ptr %3, align 4, !tbaa !5
  %26 = fmul float %25, %24
  store float %26, ptr %3, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %4, align 4, !tbaa !9
  br label %16, !llvm.loop !11

30:                                               ; preds = %21
  br label %63

31:                                               ; preds = %1
  %32 = load float, ptr %2, align 4, !tbaa !5
  %33 = call noundef float @_ZSt4rintf(float noundef %32)
  %34 = load float, ptr %2, align 4, !tbaa !5
  %35 = fcmp une float %33, %34
  br i1 %35, label %36, label %62

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %37 = load float, ptr %2, align 4, !tbaa !5
  %38 = call noundef float @_ZSt5floorf(float noundef %37)
  %39 = fptosi float %38 to i32
  store i32 %39, ptr %5, align 4, !tbaa !9
  store float 5.000000e-01, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %53, %36
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %56

45:                                               ; preds = %40
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = sitofp i32 %46 to double
  %48 = fadd double %47, 5.000000e-01
  %49 = load float, ptr %3, align 4, !tbaa !5
  %50 = fpext float %49 to double
  %51 = fmul double %50, %48
  %52 = fptrunc double %51 to float
  store float %52, ptr %3, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %45
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %6, align 4, !tbaa !9
  br label %40, !llvm.loop !13

56:                                               ; preds = %44
  %57 = call double @sqrt(double noundef 0x400921FB54442D18) #5
  %58 = load float, ptr %3, align 4, !tbaa !5
  %59 = fpext float %58 to double
  %60 = fmul double %59, %57
  %61 = fptrunc double %60 to float
  store float %61, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %62

62:                                               ; preds = %56, %31
  br label %63

63:                                               ; preds = %62, %30
  %64 = load float, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret float %64
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4rintf(float noundef) #4

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 = { 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 = { 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 #5 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_Z5gammaf(float noundef %0) local_unnamed_addr #1 {
  %2 = fmul float %0, 2.000000e+00
  %3 = tail call noundef float @_ZSt4rintf(float noundef %2)
  %4 = fmul float %3, 5.000000e-01
  %5 = tail call noundef float @_ZSt4rintf(float noundef %4)
  %6 = fcmp oeq float %5, %4
  br i1 %6, label %.preheader, label %36

.preheader:                                       ; preds = %1
  %7 = fptosi float %4 to i32
  %8 = icmp sgt i32 %7, 1
  br i1 %8, label %.lr.ph25.preheader, label %.loopexit

.lr.ph25.preheader:                               ; preds = %.preheader
  %9 = add nsw i32 %7, -1
  %10 = add nsw i32 %7, -2
  %xtraiter33 = and i32 %9, 7
  %11 = icmp ult i32 %10, 7
  br i1 %11, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph25.preheader.new

.lr.ph25.preheader.new:                           ; preds = %.lr.ph25.preheader
  %unroll_iter37 = and i32 %9, -8
  br label %.lr.ph25

.lr.ph25:                                         ; preds = %.lr.ph25, %.lr.ph25.preheader.new
  %.01724 = phi i32 [ 1, %.lr.ph25.preheader.new ], [ %35, %.lr.ph25 ]
  %.01823 = phi float [ 1.000000e+00, %.lr.ph25.preheader.new ], [ %34, %.lr.ph25 ]
  %niter38 = phi i32 [ 0, %.lr.ph25.preheader.new ], [ %niter38.next.7, %.lr.ph25 ]
  %12 = uitofp nneg i32 %.01724 to float
  %13 = fmul float %.01823, %12
  %14 = add nuw nsw i32 %.01724, 1
  %15 = uitofp nneg i32 %14 to float
  %16 = fmul float %13, %15
  %17 = add nuw nsw i32 %.01724, 2
  %18 = uitofp nneg i32 %17 to float
  %19 = fmul float %16, %18
  %20 = add nuw nsw i32 %.01724, 3
  %21 = uitofp nneg i32 %20 to float
  %22 = fmul float %19, %21
  %23 = add nuw nsw i32 %.01724, 4
  %24 = uitofp nneg i32 %23 to float
  %25 = fmul float %22, %24
  %26 = add nuw nsw i32 %.01724, 5
  %27 = uitofp nneg i32 %26 to float
  %28 = fmul float %25, %27
  %29 = add nuw nsw i32 %.01724, 6
  %30 = uitofp nneg i32 %29 to float
  %31 = fmul float %28, %30
  %32 = add nuw nsw i32 %.01724, 7
  %33 = uitofp nneg i32 %32 to float
  %34 = fmul float %31, %33
  %35 = add nuw nsw i32 %.01724, 8
  %niter38.next.7 = add i32 %niter38, 8
  %niter38.ncmp.7 = icmp eq i32 %niter38.next.7, %unroll_iter37
  br i1 %niter38.ncmp.7, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph25, !llvm.loop !5

36:                                               ; preds = %1
  %37 = tail call noundef float @_ZSt4rintf(float noundef %4)
  %38 = fcmp une float %37, %4
  br i1 %38, label %39, label %.loopexit

39:                                               ; preds = %36
  %40 = tail call noundef float @_ZSt5floorf(float noundef %4)
  %41 = fptosi float %40 to i32
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %39
  %43 = add nsw i32 %41, -1
  %44 = add nsw i32 %41, -2
  %xtraiter = and i32 %43, 3
  %45 = icmp ult i32 %44, 3
  br i1 %45, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %43, -4
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa31.ph = phi float [ poison, %.lr.ph.preheader ], [ %77, %.lr.ph ]
  %.022.unr = phi i32 [ 1, %.lr.ph.preheader ], [ %78, %.lr.ph ]
  %.121.unr = phi float [ 5.000000e-01, %.lr.ph.preheader ], [ %77, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.022.epil = phi i32 [ %51, %.lr.ph.epil ], [ %.022.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.121.epil = phi float [ %50, %.lr.ph.epil ], [ %.121.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %46 = uitofp nneg i32 %.022.epil to double
  %47 = fadd double %46, 5.000000e-01
  %48 = fpext float %.121.epil to double
  %49 = fmul double %47, %48
  %50 = fptrunc double %49 to float
  %51 = add nuw nsw i32 %.022.epil, 1
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.loopexit, label %.lr.ph.epil, !llvm.loop !7

._crit_edge.loopexit:                             ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa
  %.lcssa31 = phi float [ %.lcssa31.ph, %._crit_edge.loopexit.unr-lcssa ], [ %50, %.lr.ph.epil ]
  %52 = fpext float %.lcssa31 to double
  %53 = fmul double %52, 0x3FFC5BF891B4EF6A
  %54 = fptrunc double %53 to float
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.022 = phi i32 [ 1, %.lr.ph.preheader.new ], [ %78, %.lr.ph ]
  %.121 = phi float [ 5.000000e-01, %.lr.ph.preheader.new ], [ %77, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %55 = uitofp nneg i32 %.022 to double
  %56 = fadd double %55, 5.000000e-01
  %57 = fpext float %.121 to double
  %58 = fmul double %56, %57
  %59 = fptrunc double %58 to float
  %60 = add nuw nsw i32 %.022, 1
  %61 = uitofp nneg i32 %60 to double
  %62 = fadd double %61, 5.000000e-01
  %63 = fpext float %59 to double
  %64 = fmul double %62, %63
  %65 = fptrunc double %64 to float
  %66 = add nuw nsw i32 %.022, 2
  %67 = uitofp nneg i32 %66 to double
  %68 = fadd double %67, 5.000000e-01
  %69 = fpext float %65 to double
  %70 = fmul double %68, %69
  %71 = fptrunc double %70 to float
  %72 = add nuw nsw i32 %.022, 3
  %73 = uitofp nneg i32 %72 to double
  %74 = fadd double %73, 5.000000e-01
  %75 = fpext float %71 to double
  %76 = fmul double %74, %75
  %77 = fptrunc double %76 to float
  %78 = add nuw nsw i32 %.022, 4
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph25, %.lr.ph25.preheader
  %.lcssa.ph = phi float [ poison, %.lr.ph25.preheader ], [ %34, %.lr.ph25 ]
  %.01724.unr = phi i32 [ 1, %.lr.ph25.preheader ], [ %35, %.lr.ph25 ]
  %.01823.unr = phi float [ 1.000000e+00, %.lr.ph25.preheader ], [ %34, %.lr.ph25 ]
  %lcmp.mod35.not = icmp eq i32 %xtraiter33, 0
  br i1 %lcmp.mod35.not, label %.loopexit, label %.lr.ph25.epil

.lr.ph25.epil:                                    ; preds = %.loopexit.loopexit.unr-lcssa, %.lr.ph25.epil
  %.01724.epil = phi i32 [ %81, %.lr.ph25.epil ], [ %.01724.unr, %.loopexit.loopexit.unr-lcssa ]
  %.01823.epil = phi float [ %80, %.lr.ph25.epil ], [ %.01823.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter34 = phi i32 [ %epil.iter34.next, %.lr.ph25.epil ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %79 = uitofp nneg i32 %.01724.epil to float
  %80 = fmul float %.01823.epil, %79
  %81 = add nuw nsw i32 %.01724.epil, 1
  %epil.iter34.next = add i32 %epil.iter34, 1
  %epil.iter34.cmp.not = icmp eq i32 %epil.iter34.next, %xtraiter33
  br i1 %epil.iter34.cmp.not, label %.loopexit, label %.lr.ph25.epil, !llvm.loop !10

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.lr.ph25.epil, %39, %._crit_edge.loopexit, %.preheader, %36
  %.2 = phi float [ 0.000000e+00, %36 ], [ 1.000000e+00, %.preheader ], [ 0x3FEC5BF8A0000000, %39 ], [ %54, %._crit_edge.loopexit ], [ %.lcssa.ph, %.loopexit.loopexit.unr-lcssa ], [ %80, %.lr.ph25.epil ]
  ret float %.2
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4rintf(float noundef) local_unnamed_addr #1

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

!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"}
!7 = distinct !{!7, !8}
!8 = !{!"llvm.loop.unroll.disable"}
!9 = distinct !{!9, !6}
!10 = distinct !{!10, !8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass