; LLVM IR from niuyishuai/PDCABB :: LAPACK_BLAS/LAPACK (dladiv)

; 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 i32 @dladiv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %15 = load ptr, ptr %10, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fcmp oge double %16, 0.000000e+00
  br i1 %17, label %18, label %21

18:                                               ; preds = %6
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = load double, ptr %19, align 8, !tbaa !9
  br label %25

21:                                               ; preds = %6
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fneg double %23
  br label %25

25:                                               ; preds = %21, %18
  %26 = phi double [ %20, %18 ], [ %24, %21 ]
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fcmp oge double %28, 0.000000e+00
  br i1 %29, label %30, label %33

30:                                               ; preds = %25
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = load double, ptr %31, align 8, !tbaa !9
  br label %37

33:                                               ; preds = %25
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = fneg double %35
  br label %37

37:                                               ; preds = %33, %30
  %38 = phi double [ %32, %30 ], [ %36, %33 ]
  %39 = fcmp olt double %26, %38
  br i1 %39, label %40, label %71

40:                                               ; preds = %37
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fdiv double %42, %44
  store double %45, ptr %13, align 8, !tbaa !9
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load double, ptr %48, align 8, !tbaa !9
  %50 = load double, ptr %13, align 8, !tbaa !9
  %51 = call double @llvm.fmuladd.f64(double %49, double %50, double %47)
  store double %51, ptr %14, align 8, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = load double, ptr %52, align 8, !tbaa !9
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = load double, ptr %13, align 8, !tbaa !9
  %57 = call double @llvm.fmuladd.f64(double %55, double %56, double %53)
  %58 = load double, ptr %14, align 8, !tbaa !9
  %59 = fdiv double %57, %58
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  store double %59, ptr %60, align 8, !tbaa !9
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load double, ptr %61, align 8, !tbaa !9
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = load double, ptr %13, align 8, !tbaa !9
  %66 = fneg double %64
  %67 = call double @llvm.fmuladd.f64(double %66, double %65, double %62)
  %68 = load double, ptr %14, align 8, !tbaa !9
  %69 = fdiv double %67, %68
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  store double %69, ptr %70, align 8, !tbaa !9
  br label %102

71:                                               ; preds = %37
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = load double, ptr %72, align 8, !tbaa !9
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = load double, ptr %74, align 8, !tbaa !9
  %76 = fdiv double %73, %75
  store double %76, ptr %13, align 8, !tbaa !9
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = load double, ptr %77, align 8, !tbaa !9
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = load double, ptr %13, align 8, !tbaa !9
  %82 = call double @llvm.fmuladd.f64(double %80, double %81, double %78)
  store double %82, ptr %14, align 8, !tbaa !9
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = load double, ptr %13, align 8, !tbaa !9
  %88 = call double @llvm.fmuladd.f64(double %86, double %87, double %84)
  %89 = load double, ptr %14, align 8, !tbaa !9
  %90 = fdiv double %88, %89
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  store double %90, ptr %91, align 8, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = fneg double %93
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = load double, ptr %95, align 8, !tbaa !9
  %97 = load double, ptr %13, align 8, !tbaa !9
  %98 = call double @llvm.fmuladd.f64(double %96, double %97, double %94)
  %99 = load double, ptr %14, align 8, !tbaa !9
  %100 = fdiv double %98, %99
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  store double %100, ptr %101, align 8, !tbaa !9
  br label %102

102:                                              ; preds = %71, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  ret i32 0
}

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef i32 @dladiv_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #0 {
  %7 = load double, ptr %3, align 8, !tbaa !5
  %8 = fcmp ult double %7, 0.000000e+00
  %9 = fneg double %7
  %10 = select i1 %8, double %9, double %7
  %11 = load double, ptr %2, align 8, !tbaa !5
  %12 = fcmp ult double %11, 0.000000e+00
  %13 = fneg double %11
  %14 = select i1 %12, double %13, double %11
  %15 = fcmp olt double %10, %14
  br i1 %15, label %16, label %28

16:                                               ; preds = %6
  %17 = fdiv double %7, %11
  %18 = tail call double @llvm.fmuladd.f64(double %7, double %17, double %11)
  %19 = load double, ptr %0, align 8, !tbaa !5
  %20 = load double, ptr %1, align 8, !tbaa !5
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %17, double %19)
  %22 = fdiv double %21, %18
  store double %22, ptr %4, align 8, !tbaa !5
  %23 = load double, ptr %1, align 8, !tbaa !5
  %24 = load double, ptr %0, align 8, !tbaa !5
  %25 = fneg double %24
  %26 = tail call double @llvm.fmuladd.f64(double %25, double %17, double %23)
  %27 = fdiv double %26, %18
  br label %40

28:                                               ; preds = %6
  %29 = fdiv double %11, %7
  %30 = tail call double @llvm.fmuladd.f64(double %11, double %29, double %7)
  %31 = load double, ptr %1, align 8, !tbaa !5
  %32 = load double, ptr %0, align 8, !tbaa !5
  %33 = tail call double @llvm.fmuladd.f64(double %32, double %29, double %31)
  %34 = fdiv double %33, %30
  store double %34, ptr %4, align 8, !tbaa !5
  %35 = load double, ptr %0, align 8, !tbaa !5
  %36 = fneg double %35
  %37 = load double, ptr %1, align 8, !tbaa !5
  %38 = tail call double @llvm.fmuladd.f64(double %37, double %29, double %36)
  %39 = fdiv double %38, %30
  br label %40

40:                                               ; preds = %28, %16
  %storemerge = phi double [ %39, %28 ], [ %27, %16 ]
  store double %storemerge, ptr %5, align 8, !tbaa !5
  ret i32 0
}

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass