; LLVM IR from OpenMathLib/OpenBLAS :: lapack-netlib/SRC (dlarmm)

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

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local double @dlarmm_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %10 = call double @dlamch_(ptr noundef @.str)
  %11 = call double @dlamch_(ptr noundef @.str.1)
  %12 = fdiv double %10, %11
  store double %12, ptr %9, align 8, !tbaa !9
  %13 = load double, ptr %9, align 8, !tbaa !9
  %14 = fdiv double 1.000000e+00, %13
  %15 = fdiv double %14, 4.000000e+00
  store double %15, ptr %8, align 8, !tbaa !9
  store double 1.000000e+00, ptr %7, align 8, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = fcmp ole double %17, 1.000000e+00
  br i1 %18, label %19, label %32

19:                                               ; preds = %3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fmul double %21, %23
  %25 = load double, ptr %8, align 8, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load double, ptr %26, align 8, !tbaa !9
  %28 = fsub double %25, %27
  %29 = fcmp ogt double %24, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %19
  store double 5.000000e-01, ptr %7, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %30, %19
  br label %48

32:                                               ; preds = %3
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = load double, ptr %8, align 8, !tbaa !9
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = fsub double %35, %37
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = fdiv double %38, %40
  %42 = fcmp ogt double %34, %41
  br i1 %42, label %43, label %47

43:                                               ; preds = %32
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = fdiv double 5.000000e-01, %45
  store double %46, ptr %7, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %43, %32
  br label %48

48:                                               ; preds = %47, %31
  %49 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret double %49
}

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

declare double @dlamch_(ptr noundef) #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 = { "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 = !{!"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"

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local double @dlarmm_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = tail call double @dlamch_(ptr noundef nonnull @.str) #2
  %5 = tail call double @dlamch_(ptr noundef nonnull @.str.1) #2
  %6 = fdiv double %4, %5
  %7 = fdiv double 1.000000e+00, %6
  %8 = fmul double %7, 2.500000e-01
  %9 = load double, ptr %1, align 8, !tbaa !5
  %10 = fcmp ugt double %9, 1.000000e+00
  %11 = load double, ptr %0, align 8, !tbaa !5
  br i1 %10, label %18, label %12

12:                                               ; preds = %3
  %13 = fmul double %9, %11
  %14 = load double, ptr %2, align 8, !tbaa !5
  %15 = fsub double %8, %14
  %16 = fcmp ogt double %13, %15
  br i1 %16, label %17, label %25

17:                                               ; preds = %12
  br label %25

18:                                               ; preds = %3
  %19 = load double, ptr %2, align 8, !tbaa !5
  %20 = fsub double %8, %19
  %21 = fdiv double %20, %9
  %22 = fcmp ogt double %11, %21
  br i1 %22, label %23, label %25

23:                                               ; preds = %18
  %24 = fdiv double 5.000000e-01, %9
  br label %25

25:                                               ; preds = %18, %23, %12, %17
  %.0 = phi double [ 5.000000e-01, %17 ], [ 1.000000e+00, %12 ], [ %24, %23 ], [ 1.000000e+00, %18 ]
  ret double %.0
}

declare double @dlamch_(ptr noundef) local_unnamed_addr #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 = { "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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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