; LLVM IR from kkumatani/distant_speech_recognition :: btk20_src/matrix/linpack_c.ll (Z5srotgPfS_S_S_)

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5srotgPfS_S_S_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = call noundef float @_Z6r4_absf(float noundef %14)
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = call noundef float @_Z6r4_absf(float noundef %17)
  %19 = fcmp olt float %15, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load float, ptr %21, align 4, !tbaa !9
  store float %22, ptr %10, align 4, !tbaa !9
  br label %26

23:                                               ; preds = %4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load float, ptr %24, align 4, !tbaa !9
  store float %25, ptr %10, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %23, %20
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = call noundef float @_Z6r4_absf(float noundef %28)
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = call noundef float @_Z6r4_absf(float noundef %31)
  %33 = fadd float %29, %32
  store float %33, ptr %11, align 4, !tbaa !9
  %34 = load float, ptr %11, align 4, !tbaa !9
  %35 = fpext float %34 to double
  %36 = fcmp oeq double %35, 0.000000e+00
  br i1 %36, label %37, label %40

37:                                               ; preds = %26
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  store float 1.000000e+00, ptr %38, align 4, !tbaa !9
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  store float 0.000000e+00, ptr %39, align 4, !tbaa !9
  store float 0.000000e+00, ptr %9, align 4, !tbaa !9
  br label %76

40:                                               ; preds = %26
  %41 = load float, ptr %11, align 4, !tbaa !9
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load float, ptr %42, align 4, !tbaa !9
  %44 = load float, ptr %11, align 4, !tbaa !9
  %45 = fdiv float %43, %44
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load float, ptr %46, align 4, !tbaa !9
  %48 = load float, ptr %11, align 4, !tbaa !9
  %49 = fdiv float %47, %48
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = load float, ptr %11, align 4, !tbaa !9
  %53 = fdiv float %51, %52
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = load float, ptr %11, align 4, !tbaa !9
  %57 = fdiv float %55, %56
  %58 = fmul float %53, %57
  %59 = call float @llvm.fmuladd.f32(float %45, float %49, float %58)
  %60 = call noundef float @_ZSt4sqrtf(float noundef %59)
  %61 = fmul float %41, %60
  store float %61, ptr %9, align 4, !tbaa !9
  %62 = load float, ptr %10, align 4, !tbaa !9
  %63 = call noundef float @_Z7r4_signf(float noundef %62)
  %64 = load float, ptr %9, align 4, !tbaa !9
  %65 = fmul float %63, %64
  store float %65, ptr %9, align 4, !tbaa !9
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load float, ptr %66, align 4, !tbaa !9
  %68 = load float, ptr %9, align 4, !tbaa !9
  %69 = fdiv float %67, %68
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  store float %69, ptr %70, align 4, !tbaa !9
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load float, ptr %71, align 4, !tbaa !9
  %73 = load float, ptr %9, align 4, !tbaa !9
  %74 = fdiv float %72, %73
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  store float %74, ptr %75, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %40, %37
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load float, ptr %77, align 4, !tbaa !9
  %79 = call noundef float @_Z6r4_absf(float noundef %78)
  %80 = fpext float %79 to double
  %81 = fcmp olt double 0.000000e+00, %80
  br i1 %81, label %82, label %95

82:                                               ; preds = %76
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load float, ptr %83, align 4, !tbaa !9
  %85 = call noundef float @_Z6r4_absf(float noundef %84)
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = load float, ptr %86, align 4, !tbaa !9
  %88 = fcmp ole float %85, %87
  br i1 %88, label %89, label %95

89:                                               ; preds = %82
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load float, ptr %90, align 4, !tbaa !9
  %92 = fpext float %91 to double
  %93 = fdiv double 1.000000e+00, %92
  %94 = fptrunc double %93 to float
  store float %94, ptr %12, align 4, !tbaa !9
  br label %98

95:                                               ; preds = %82, %76
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = load float, ptr %96, align 4, !tbaa !9
  store float %97, ptr %12, align 4, !tbaa !9
  br label %98

98:                                               ; preds = %95, %89
  %99 = load float, ptr %9, align 4, !tbaa !9
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  store float %99, ptr %100, align 4, !tbaa !9
  %101 = load float, ptr %12, align 4, !tbaa !9
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  store float %101, ptr %102, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void
}

declare noundef float @_Z6r4_absf(float noundef) #4

declare noundef float @_Z7r4_signf(float noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5srotgPfS_S_S_(ptr nocapture noundef %0, ptr nocapture noundef %1, ptr nocapture noundef %2, ptr nocapture noundef %3) local_unnamed_addr #2 {
  %5 = load float, ptr %1, align 4, !tbaa !5
  %6 = tail call noundef float @_Z6r4_absf(float noundef %5)
  %7 = load float, ptr %0, align 4, !tbaa !5
  %8 = tail call noundef float @_Z6r4_absf(float noundef %7)
  %9 = fcmp olt float %6, %8
  %. = select i1 %9, ptr %0, ptr %1
  %.036 = load float, ptr %., align 4, !tbaa !5
  %10 = load float, ptr %0, align 4, !tbaa !5
  %11 = tail call noundef float @_Z6r4_absf(float noundef %10)
  %12 = load float, ptr %1, align 4, !tbaa !5
  %13 = tail call noundef float @_Z6r4_absf(float noundef %12)
  %14 = fadd float %11, %13
  %15 = fcmp oeq float %14, 0.000000e+00
  br i1 %15, label %16, label %17

16:                                               ; preds = %4
  store float 1.000000e+00, ptr %2, align 4, !tbaa !5
  br label %32

17:                                               ; preds = %4
  %18 = load float, ptr %0, align 4, !tbaa !5
  %19 = fdiv float %18, %14
  %20 = load float, ptr %1, align 4, !tbaa !5
  %21 = fdiv float %20, %14
  %22 = fmul float %21, %21
  %23 = tail call float @llvm.fmuladd.f32(float %19, float %19, float %22)
  %24 = tail call noundef float @_ZSt4sqrtf(float noundef %23)
  %25 = fmul float %14, %24
  %26 = tail call noundef float @_Z7r4_signf(float noundef %.036)
  %27 = fmul float %26, %25
  %28 = load float, ptr %0, align 4, !tbaa !5
  %29 = fdiv float %28, %27
  store float %29, ptr %2, align 4, !tbaa !5
  %30 = load float, ptr %1, align 4, !tbaa !5
  %31 = fdiv float %30, %27
  br label %32

32:                                               ; preds = %17, %16
  %storemerge = phi float [ %31, %17 ], [ 0.000000e+00, %16 ]
  %.035 = phi float [ %27, %17 ], [ 0.000000e+00, %16 ]
  store float %storemerge, ptr %3, align 4, !tbaa !5
  %33 = load float, ptr %2, align 4, !tbaa !5
  %34 = tail call noundef float @_Z6r4_absf(float noundef %33)
  %35 = fcmp ogt float %34, 0.000000e+00
  br i1 %35, label %36, label %._crit_edge

._crit_edge:                                      ; preds = %32
  %.pre = load float, ptr %3, align 4, !tbaa !5
  br label %44

36:                                               ; preds = %32
  %37 = load float, ptr %2, align 4, !tbaa !5
  %38 = tail call noundef float @_Z6r4_absf(float noundef %37)
  %39 = load float, ptr %3, align 4, !tbaa !5
  %40 = fcmp ugt float %38, %39
  br i1 %40, label %44, label %41

41:                                               ; preds = %36
  %42 = load float, ptr %2, align 4, !tbaa !5
  %43 = fdiv float 1.000000e+00, %42
  br label %44

44:                                               ; preds = %36, %._crit_edge, %41
  %.0 = phi float [ %43, %41 ], [ %.pre, %._crit_edge ], [ %39, %36 ]
  store float %.035, ptr %0, align 4, !tbaa !5
  store float %.0, ptr %1, align 4, !tbaa !5
  ret void
}

declare noundef float @_Z6r4_absf(float noundef) local_unnamed_addr #3

declare noundef float @_Z7r4_signf(float noundef) local_unnamed_addr #3

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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = !{!6, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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