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

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

%struct.complex = type { float, float }

; Function Attrs: nounwind uwtable
define dso_local i32 @claev2_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %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 ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca %struct.complex, align 4
  %19 = alloca %struct.complex, align 4
  %20 = alloca float, align 4
  %21 = alloca %struct.complex, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = call double @c_abs(ptr noundef %22)
  %24 = fcmp oeq double %23, 0.000000e+00
  br i1 %24, label %25, label %28

25:                                               ; preds = %7
  %26 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 0
  store float 1.000000e+00, ptr %26, align 4, !tbaa !9
  %27 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 1
  store float 0.000000e+00, ptr %27, align 4, !tbaa !12
  br label %49

28:                                               ; preds = %7
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  call void @r_cnjg(ptr noundef %19, ptr noundef %29)
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = call double @c_abs(ptr noundef %30)
  %32 = fptrunc double %31 to float
  store float %32, ptr %15, align 4, !tbaa !13
  %33 = getelementptr inbounds %struct.complex, ptr %19, i32 0, i32 0
  %34 = load float, ptr %33, align 4, !tbaa !9
  %35 = load float, ptr %15, align 4, !tbaa !13
  %36 = fdiv float %34, %35
  %37 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 0
  store float %36, ptr %37, align 4, !tbaa !9
  %38 = getelementptr inbounds %struct.complex, ptr %19, i32 0, i32 1
  %39 = load float, ptr %38, align 4, !tbaa !12
  %40 = load float, ptr %15, align 4, !tbaa !13
  %41 = fdiv float %39, %40
  %42 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 1
  store float %41, ptr %42, align 4, !tbaa !12
  %43 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !9
  %45 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 0
  store float %44, ptr %45, align 4, !tbaa !9
  %46 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !12
  %48 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 1
  store float %47, ptr %48, align 4, !tbaa !12
  br label %49

49:                                               ; preds = %28, %25
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.complex, ptr %50, i32 0, i32 0
  %52 = load float, ptr %51, align 4, !tbaa !9
  store float %52, ptr %15, align 4, !tbaa !13
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = call double @c_abs(ptr noundef %53)
  %55 = fptrunc double %54 to float
  store float %55, ptr %16, align 4, !tbaa !13
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.complex, ptr %56, i32 0, i32 0
  %58 = load float, ptr %57, align 4, !tbaa !9
  store float %58, ptr %17, align 4, !tbaa !13
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = call i32 @slaev2_(ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %59, ptr noundef %60, ptr noundef %61, ptr noundef %20)
  %63 = load float, ptr %20, align 4, !tbaa !13
  %64 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 0
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = fmul float %63, %65
  %67 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 0
  store float %66, ptr %67, align 4, !tbaa !9
  %68 = load float, ptr %20, align 4, !tbaa !13
  %69 = getelementptr inbounds %struct.complex, ptr %21, i32 0, i32 1
  %70 = load float, ptr %69, align 4, !tbaa !12
  %71 = fmul float %68, %70
  %72 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 1
  store float %71, ptr %72, align 4, !tbaa !12
  %73 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 0
  %74 = load float, ptr %73, align 4, !tbaa !9
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.complex, ptr %75, i32 0, i32 0
  store float %74, ptr %76, align 4, !tbaa !9
  %77 = getelementptr inbounds %struct.complex, ptr %18, i32 0, i32 1
  %78 = load float, ptr %77, align 4, !tbaa !12
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.complex, ptr %79, i32 0, i32 1
  store float %78, ptr %80, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #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

declare double @c_abs(ptr noundef) #2

declare void @r_cnjg(ptr noundef, ptr noundef) #2

declare i32 @slaev2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, 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, !11, i64 0}
!10 = !{!"", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!11, !11, 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"

%struct.complex = type { float, float }

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @claev2_(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #0 {
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca %struct.complex, align 8
  %12 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #3
  %13 = tail call double @c_abs(ptr noundef %1) #3
  %14 = fcmp oeq double %13, 0.000000e+00
  br i1 %14, label %22, label %15

15:                                               ; preds = %7
  call void @r_cnjg(ptr noundef nonnull %11, ptr noundef %1) #3
  %16 = call double @c_abs(ptr noundef %1) #3
  %17 = fptrunc double %16 to float
  %18 = load <2 x float>, ptr %11, align 8, !tbaa !5
  %19 = insertelement <2 x float> poison, float %17, i64 0
  %20 = shufflevector <2 x float> %19, <2 x float> poison, <2 x i32> zeroinitializer
  %21 = fdiv <2 x float> %18, %20
  br label %22

22:                                               ; preds = %7, %15
  %23 = phi <2 x float> [ %21, %15 ], [ <float 1.000000e+00, float 0.000000e+00>, %7 ]
  %24 = load float, ptr %0, align 4, !tbaa !9
  store float %24, ptr %8, align 4, !tbaa !5
  %25 = call double @c_abs(ptr noundef %1) #3
  %26 = fptrunc double %25 to float
  store float %26, ptr %9, align 4, !tbaa !5
  %27 = load float, ptr %2, align 4, !tbaa !9
  store float %27, ptr %10, align 4, !tbaa !5
  %28 = call i32 @slaev2_(ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef nonnull %12) #3
  %29 = load float, ptr %12, align 4, !tbaa !5
  %30 = insertelement <2 x float> poison, float %29, i64 0
  %31 = shufflevector <2 x float> %30, <2 x float> poison, <2 x i32> zeroinitializer
  %32 = fmul <2 x float> %23, %31
  store <2 x float> %32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #3
  ret i32 0
}

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

declare double @c_abs(ptr noundef) local_unnamed_addr #2

declare void @r_cnjg(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @slaev2_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; 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 = { "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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 4}


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