; LLVM IR from kkumatani/distant_speech_recognition :: btk20_src/matrix/blas1_c.ll (Z5caxpyiSt7complexIfEPS0_iS1_i)

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

%"class.std::complex" = type { { float, float } }

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_Z5cabs1St7complexIfE(<2 x float>) #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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5caxpyiSt7complexIfEPS0_iS1_i(i32 noundef %0, <2 x float> %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) #0 {
  %7 = alloca %"class.std::complex", align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::complex", align 4
  %18 = alloca %"class.std::complex", align 4
  %19 = alloca %"class.std::complex", align 4
  %20 = alloca %"class.std::complex", align 4
  %21 = alloca %"class.std::complex", align 4
  %22 = getelementptr inbounds %"class.std::complex", ptr %7, i32 0, i32 0
  store <2 x float> %1, ptr %22, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = icmp sle i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %6
  store i32 1, ptr %16, align 4
  br label %118

26:                                               ; preds = %6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !11
  %27 = getelementptr inbounds %"class.std::complex", ptr %17, i32 0, i32 0
  %28 = load <2 x float>, ptr %27, align 4
  %29 = call noundef float @_Z5cabs1St7complexIfE(<2 x float> %28)
  %30 = fpext float %29 to double
  %31 = fcmp oeq double %30, 0.000000e+00
  br i1 %31, label %32, label %33

32:                                               ; preds = %26
  store i32 1, ptr %16, align 4
  br label %118

33:                                               ; preds = %26
  %34 = load i32, ptr %10, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 1
  br i1 %35, label %39, label %36

36:                                               ; preds = %33
  %37 = load i32, ptr %12, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 1
  br i1 %38, label %39, label %91

39:                                               ; preds = %36, %33
  %40 = load i32, ptr %10, align 4, !tbaa !5
  %41 = icmp sle i32 0, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %49

43:                                               ; preds = %39
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = sub nsw i32 0, %44
  %46 = add nsw i32 %45, 1
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = mul nsw i32 %46, %47
  store i32 %48, ptr %14, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %43, %42
  %50 = load i32, ptr %12, align 4, !tbaa !5
  %51 = icmp sle i32 0, %50
  br i1 %51, label %52, label %53

52:                                               ; preds = %49
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %59

53:                                               ; preds = %49
  %54 = load i32, ptr %8, align 4, !tbaa !5
  %55 = sub nsw i32 0, %54
  %56 = add nsw i32 %55, 1
  %57 = load i32, ptr %12, align 4, !tbaa !5
  %58 = mul nsw i32 %56, %57
  store i32 %58, ptr %15, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %53, %52
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %87, %59
  %61 = load i32, ptr %13, align 4, !tbaa !5
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %90

64:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %65 = load ptr, ptr %11, align 8, !tbaa !9
  %66 = load i32, ptr %15, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %"class.std::complex", ptr %65, i64 %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %69 = load ptr, ptr %9, align 8, !tbaa !9
  %70 = load i32, ptr %14, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds %"class.std::complex", ptr %69, i64 %71
  %73 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %72)
  %74 = getelementptr inbounds %"class.std::complex", ptr %19, i32 0, i32 0
  store <2 x float> %73, ptr %74, align 4
  %75 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %68, ptr noundef nonnull align 4 dereferenceable(8) %19)
  %76 = getelementptr inbounds %"class.std::complex", ptr %18, i32 0, i32 0
  store <2 x float> %75, ptr %76, align 4
  %77 = load ptr, ptr %11, align 8, !tbaa !9
  %78 = load i32, ptr %15, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %"class.std::complex", ptr %77, i64 %79
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %80, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %81 = load i32, ptr %14, align 4, !tbaa !5
  %82 = load i32, ptr %10, align 4, !tbaa !5
  %83 = add nsw i32 %81, %82
  store i32 %83, ptr %14, align 4, !tbaa !5
  %84 = load i32, ptr %15, align 4, !tbaa !5
  %85 = load i32, ptr %12, align 4, !tbaa !5
  %86 = add nsw i32 %84, %85
  store i32 %86, ptr %15, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %64
  %88 = load i32, ptr %13, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %13, align 4, !tbaa !5
  br label %60, !llvm.loop !13

90:                                               ; preds = %60
  br label %117

91:                                               ; preds = %36
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %113, %91
  %93 = load i32, ptr %13, align 4, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %96, label %116

96:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %97 = load ptr, ptr %11, align 8, !tbaa !9
  %98 = load i32, ptr %13, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds %"class.std::complex", ptr %97, i64 %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %101 = load ptr, ptr %9, align 8, !tbaa !9
  %102 = load i32, ptr %13, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %"class.std::complex", ptr %101, i64 %103
  %105 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %104)
  %106 = getelementptr inbounds %"class.std::complex", ptr %21, i32 0, i32 0
  store <2 x float> %105, ptr %106, align 4
  %107 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %100, ptr noundef nonnull align 4 dereferenceable(8) %21)
  %108 = getelementptr inbounds %"class.std::complex", ptr %20, i32 0, i32 0
  store <2 x float> %107, ptr %108, align 4
  %109 = load ptr, ptr %11, align 8, !tbaa !9
  %110 = load i32, ptr %13, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds %"class.std::complex", ptr %109, i64 %111
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %112, ptr align 4 %20, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %113

113:                                              ; preds = %96
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %13, align 4, !tbaa !5
  br label %92, !llvm.loop !15

116:                                              ; preds = %92
  br label %117

117:                                              ; preds = %116, %90
  store i32 1, ptr %16, align 4
  br label %118

118:                                              ; preds = %117, %32, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #3

attributes #0 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i64 0, i64 8, !12}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

%"class.std::complex" = type { { float, float } }

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_Z5cabs1St7complexIfE(<2 x float>) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5caxpyiSt7complexIfEPS0_iS1_i(i32 noundef %0, <2 x float> %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = alloca %"class.std::complex", align 8
  %8 = alloca %"class.std::complex", align 8
  %9 = alloca %"class.std::complex", align 8
  store <2 x float> %1, ptr %7, align 8
  %10 = icmp slt i32 %0, 1
  br i1 %10, label %.loopexit, label %11

11:                                               ; preds = %6
  %12 = tail call noundef float @_Z5cabs1St7complexIfE(<2 x float> %1)
  %13 = fcmp oeq float %12, 0.000000e+00
  br i1 %13, label %.loopexit, label %14

14:                                               ; preds = %11
  %15 = icmp ne i32 %3, 1
  %16 = icmp ne i32 %5, 1
  %or.cond = or i1 %15, %16
  br i1 %or.cond, label %.lr.ph46.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %14
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %.lr.ph

.lr.ph46.preheader:                               ; preds = %14
  %.inv40 = icmp slt i32 %5, 0
  %17 = sub nsw i32 1, %0
  %18 = mul nsw i32 %17, %5
  %.035 = select i1 %.inv40, i32 %18, i32 0
  %.inv = icmp slt i32 %3, 0
  %19 = mul nsw i32 %17, %3
  %.033 = select i1 %.inv, i32 %19, i32 0
  %20 = sext i32 %.033 to i64
  %21 = sext i32 %3 to i64
  %22 = sext i32 %.035 to i64
  %23 = sext i32 %5 to i64
  br label %.lr.ph46

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %indvars.iv51 = phi i64 [ %22, %.lr.ph46.preheader ], [ %indvars.iv.next52, %.lr.ph46 ]
  %indvars.iv49 = phi i64 [ %20, %.lr.ph46.preheader ], [ %indvars.iv.next50, %.lr.ph46 ]
  %.045 = phi i32 [ 0, %.lr.ph46.preheader ], [ %28, %.lr.ph46 ]
  %24 = getelementptr inbounds %"class.std::complex", ptr %4, i64 %indvars.iv51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %25 = getelementptr inbounds %"class.std::complex", ptr %2, i64 %indvars.iv49
  %26 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %25)
  store <2 x float> %26, ptr %8, align 8
  %27 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %24, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %27, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  %indvars.iv.next50 = add nsw i64 %indvars.iv49, %21
  %indvars.iv.next52 = add nsw i64 %indvars.iv51, %23
  %28 = add nuw nsw i32 %.045, 1
  %exitcond56.not = icmp eq i32 %28, %0
  br i1 %exitcond56.not, label %.loopexit, label %.lr.ph46, !llvm.loop !8

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %29 = getelementptr inbounds %"class.std::complex", ptr %4, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %30 = getelementptr inbounds %"class.std::complex", ptr %2, i64 %indvars.iv
  %31 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %30)
  store <2 x float> %31, ptr %9, align 8
  %32 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %32, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !10

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph46, %11, %6
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

attributes #0 = { mustprogress 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 mustprogress 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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}


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