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

; 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 void @clacgv_(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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.complex, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca { float, float }, align 4
  %13 = alloca { float, float }, align 4
  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 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.complex, ptr %14, i32 -1
  store ptr %15, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %59

19:                                               ; preds = %3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr %20, align 4, !tbaa !9
  store i32 %21, ptr %7, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %55, %19
  %23 = load i32, ptr %11, align 4, !tbaa !9
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = icmp sle i32 %23, %24
  br i1 %25, label %26, label %58

26:                                               ; preds = %22
  %27 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %27, ptr %8, align 4, !tbaa !9
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds %struct.complex, ptr %28, i64 %30
  %32 = call <2 x float> @Cf(ptr noundef %31)
  store <2 x float> %32, ptr %12, align 4
  %33 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 0
  %34 = load float, ptr %33, align 4
  %35 = getelementptr inbounds { float, float }, ptr %12, i32 0, i32 1
  %36 = load float, ptr %35, align 4
  %37 = fneg float %36
  %38 = call ptr @_pCf(ptr noundef %9)
  %39 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds { float, float }, ptr %38, i32 0, i32 1
  store float %34, ptr %39, align 4
  store float %37, ptr %40, align 4
  %41 = getelementptr inbounds %struct.complex, ptr %9, i32 0, i32 0
  %42 = load float, ptr %41, align 4, !tbaa !11
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = load i32, ptr %8, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %struct.complex, ptr %43, i64 %45
  %47 = getelementptr inbounds %struct.complex, ptr %46, i32 0, i32 0
  store float %42, ptr %47, align 4, !tbaa !11
  %48 = getelementptr inbounds %struct.complex, ptr %9, i32 0, i32 1
  %49 = load float, ptr %48, align 4, !tbaa !14
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %struct.complex, ptr %50, i64 %52
  %54 = getelementptr inbounds %struct.complex, ptr %53, i32 0, i32 1
  store float %49, ptr %54, align 4, !tbaa !14
  br label %55

55:                                               ; preds = %26
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %11, align 4, !tbaa !9
  br label %22, !llvm.loop !15

58:                                               ; preds = %22
  br label %115

59:                                               ; preds = %3
  store i32 1, ptr %10, align 4, !tbaa !9
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = icmp slt i32 %61, 0
  br i1 %62, label %63, label %71

63:                                               ; preds = %59
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = sub nsw i32 %65, 1
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = mul nsw i32 %66, %68
  %70 = sub nsw i32 1, %69
  store i32 %70, ptr %10, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %63, %59
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = load i32, ptr %72, align 4, !tbaa !9
  store i32 %73, ptr %7, align 4, !tbaa !9
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %74

74:                                               ; preds = %111, %71
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %78, label %114

78:                                               ; preds = %74
  %79 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %79, ptr %8, align 4, !tbaa !9
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds %struct.complex, ptr %80, i64 %82
  %84 = call <2 x float> @Cf(ptr noundef %83)
  store <2 x float> %84, ptr %13, align 4
  %85 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %86 = load float, ptr %85, align 4
  %87 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  %88 = load float, ptr %87, align 4
  %89 = fneg float %88
  %90 = call ptr @_pCf(ptr noundef %9)
  %91 = getelementptr inbounds { float, float }, ptr %90, i32 0, i32 0
  %92 = getelementptr inbounds { float, float }, ptr %90, i32 0, i32 1
  store float %86, ptr %91, align 4
  store float %89, ptr %92, align 4
  %93 = getelementptr inbounds %struct.complex, ptr %9, i32 0, i32 0
  %94 = load float, ptr %93, align 4, !tbaa !11
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %struct.complex, ptr %95, i64 %97
  %99 = getelementptr inbounds %struct.complex, ptr %98, i32 0, i32 0
  store float %94, ptr %99, align 4, !tbaa !11
  %100 = getelementptr inbounds %struct.complex, ptr %9, i32 0, i32 1
  %101 = load float, ptr %100, align 4, !tbaa !14
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.complex, ptr %102, i64 %104
  %106 = getelementptr inbounds %struct.complex, ptr %105, i32 0, i32 1
  store float %101, ptr %106, align 4, !tbaa !14
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = add nsw i32 %109, %108
  store i32 %110, ptr %10, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %78
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %11, align 4, !tbaa !9
  br label %74, !llvm.loop !17

114:                                              ; preds = %74
  br label %115

115:                                              ; preds = %114, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @Cf(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @_pCf(ptr noundef) #3

; 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"="64" "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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 void @clacgv_(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = alloca %struct.complex, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %1, i64 -8
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 1
  %8 = load i32, ptr %0, align 4, !tbaa !5
  %.not3237 = icmp slt i32 %8, 1
  br i1 %7, label %9, label %18

9:                                                ; preds = %3
  br i1 %.not3237, label %.loopexit, label %.lr.ph39

.lr.ph39:                                         ; preds = %9
  %10 = add nuw i32 %8, 1
  %wide.trip.count = zext i32 %10 to i64
  br label %11

11:                                               ; preds = %.lr.ph39, %11
  %indvars.iv = phi i64 [ 1, %.lr.ph39 ], [ %indvars.iv.next, %11 ]
  %12 = getelementptr inbounds %struct.complex, ptr %5, i64 %indvars.iv
  %13 = call <2 x float> @Cf(ptr noundef nonnull %12)
  %.sroa.01.0.vec.extract = extractelement <2 x float> %13, i64 0
  %.sroa.01.4.vec.extract = extractelement <2 x float> %13, i64 1
  %14 = fneg float %.sroa.01.4.vec.extract
  %15 = call ptr @_pCf(ptr noundef nonnull %4)
  %16 = getelementptr inbounds i8, ptr %15, i64 4
  store float %.sroa.01.0.vec.extract, ptr %15, align 4
  store float %14, ptr %16, align 4
  %17 = load <2 x float>, ptr %4, align 8, !tbaa !9
  store <2 x float> %17, ptr %12, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond42.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond42.not, label %.loopexit, label %11, !llvm.loop !11

18:                                               ; preds = %3
  br i1 %.not3237, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %18
  %19 = icmp slt i32 %6, 0
  %20 = add nsw i32 %8, -1
  %21 = mul nsw i32 %20, %6
  %22 = sub nsw i32 1, %21
  %.029 = select i1 %19, i32 %22, i32 1
  br label %23

23:                                               ; preds = %.lr.ph, %23
  %.136 = phi i32 [ 1, %.lr.ph ], [ %33, %23 ]
  %.13035 = phi i32 [ %.029, %.lr.ph ], [ %32, %23 ]
  %24 = sext i32 %.13035 to i64
  %25 = getelementptr inbounds %struct.complex, ptr %5, i64 %24
  %26 = call <2 x float> @Cf(ptr noundef nonnull %25)
  %.sroa.0.0.vec.extract = extractelement <2 x float> %26, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %26, i64 1
  %27 = fneg float %.sroa.0.4.vec.extract
  %28 = call ptr @_pCf(ptr noundef nonnull %4)
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  store float %.sroa.0.0.vec.extract, ptr %28, align 4
  store float %27, ptr %29, align 4
  %30 = load <2 x float>, ptr %4, align 8, !tbaa !9
  store <2 x float> %30, ptr %25, align 4, !tbaa !9
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, %.13035
  %33 = add nuw i32 %.136, 1
  %exitcond.not = icmp eq i32 %.136, %8
  br i1 %exitcond.not, label %.loopexit, label %23, !llvm.loop !13

.loopexit:                                        ; preds = %23, %11, %18, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @Cf(ptr noundef) local_unnamed_addr #2

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

; 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"="64" "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass