; LLVM IR from BoysTownOrg/chapro :: db (cha_db1)

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

@cha_db1.c1 = external hidden global float, align 4
@cha_db1.c2 = external hidden global float, align 4
@cha_db1.c3 = external hidden global float, align 4
@cha_db1.c4 = external hidden global float, align 4
@cha_db1.c5 = external hidden global float, align 4
@cha_db1.c6 = external hidden global float, align 4
@cha_db1.c7 = external hidden global float, align 4

; Function Attrs: nounwind uwtable
define dso_local float @cha_db1(float noundef %0) #0 {
  %2 = alloca float, align 4
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %8 = load float, ptr %3, align 4, !tbaa !5
  %9 = load float, ptr @cha_db1.c1, align 4, !tbaa !5
  %10 = fcmp olt float %8, %9
  br i1 %10, label %11, label %13

11:                                               ; preds = %1
  %12 = load float, ptr @cha_db1.c2, align 4, !tbaa !5
  store float %12, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %40

13:                                               ; preds = %1
  %14 = load float, ptr %3, align 4, !tbaa !5
  %15 = load float, ptr @cha_db1.c3, align 4, !tbaa !5
  %16 = fcmp ogt float %14, %15
  br i1 %16, label %17, label %19

17:                                               ; preds = %13
  %18 = load float, ptr @cha_db1.c4, align 4, !tbaa !5
  store float %18, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %40

19:                                               ; preds = %13
  %20 = load float, ptr %3, align 4, !tbaa !5
  %21 = call float @frexpf(float noundef %20, ptr noundef %6) #5
  store float %21, ptr %4, align 4, !tbaa !5
  %22 = load float, ptr %4, align 4, !tbaa !5
  %23 = load float, ptr @cha_db1.c5, align 4, !tbaa !5
  %24 = fcmp olt float %22, %23
  br i1 %24, label %25, label %30

25:                                               ; preds = %19
  %26 = load float, ptr %4, align 4, !tbaa !5
  %27 = fmul float %26, 2.000000e+00
  store float %27, ptr %4, align 4, !tbaa !5
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = add nsw i32 %28, -1
  store i32 %29, ptr %6, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %25, %19
  %31 = load float, ptr %4, align 4, !tbaa !5
  %32 = call float @log_lu(float noundef %31)
  store float %32, ptr %5, align 4, !tbaa !5
  %33 = load float, ptr @cha_db1.c6, align 4, !tbaa !5
  %34 = load float, ptr %5, align 4, !tbaa !5
  %35 = load float, ptr @cha_db1.c7, align 4, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = sitofp i32 %36 to float
  %38 = call float @llvm.fmuladd.f32(float %35, float %37, float %34)
  %39 = fmul float %33, %38
  store float %39, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %40

40:                                               ; preds = %30, %17, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %41 = load float, ptr %2, align 4
  ret float %41
}

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

; Function Attrs: nounwind
declare float @frexpf(float noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @log_lu(float noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; 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 "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 = { inlinehint 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !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"

@cha_db1.c1 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c2 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c3 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c4 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c5 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c6 = external hidden local_unnamed_addr global float, align 4
@cha_db1.c7 = external hidden local_unnamed_addr global float, align 4

; Function Attrs: nounwind uwtable
define dso_local float @cha_db1(float noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %3 = load float, ptr @cha_db1.c1, align 4, !tbaa !5
  %4 = fcmp ogt float %3, %0
  br i1 %4, label %5, label %7

5:                                                ; preds = %1
  %6 = load float, ptr @cha_db1.c2, align 4, !tbaa !5
  br label %25

7:                                                ; preds = %1
  %8 = load float, ptr @cha_db1.c3, align 4, !tbaa !5
  %9 = fcmp olt float %8, %0
  br i1 %9, label %10, label %12

10:                                               ; preds = %7
  %11 = load float, ptr @cha_db1.c4, align 4, !tbaa !5
  br label %25

12:                                               ; preds = %7
  %13 = call float @frexpf(float noundef %0, ptr noundef nonnull %2) #5
  %14 = load float, ptr @cha_db1.c5, align 4, !tbaa !5
  %15 = fcmp olt float %13, %14
  %.pre = load i32, ptr %2, align 4, !tbaa !9
  %16 = fmul float %13, 2.000000e+00
  %17 = sext i1 %15 to i32
  %18 = add nsw i32 %.pre, %17
  %.08 = select i1 %15, float %16, float %13
  %19 = tail call float @log_lu(float noundef %.08)
  %20 = load float, ptr @cha_db1.c6, align 4, !tbaa !5
  %21 = load float, ptr @cha_db1.c7, align 4, !tbaa !5
  %22 = sitofp i32 %18 to float
  %23 = tail call float @llvm.fmuladd.f32(float %21, float %22, float %19)
  %24 = fmul float %20, %23
  br label %25

25:                                               ; preds = %12, %10, %5
  %.0 = phi float [ %6, %5 ], [ %11, %10 ], [ %24, %12 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret float %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: write)
declare float @frexpf(float noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @log_lu(float noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: write) "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 = { inlinehint 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


; Effective O3 passes: DSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass