; LLVM IR from kkumatani/distant_speech_recognition :: btk20_src/matrix/blas1_c.ll (Z5cdotciPSt7complexIfEiS1_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: 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: 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) #1

; 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)) #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)) #2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_Z5cdotciPSt7complexIfEiS1_i(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #3 {
  %6 = alloca %"class.std::complex", align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::complex", 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
  store i32 %0, ptr %7, align 4, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @_ZNSt7complexIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %6, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = icmp sle i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %5
  store i32 1, ptr %15, align 4
  br label %106

25:                                               ; preds = %5
  %26 = load i32, ptr %9, align 4, !tbaa !5
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %55

28:                                               ; preds = %25
  %29 = load i32, ptr %11, align 4, !tbaa !5
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %55

31:                                               ; preds = %28
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %51, %31
  %33 = load i32, ptr %12, align 4, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %36, label %54

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %37 = load ptr, ptr %8, align 8, !tbaa !9
  %38 = load i32, ptr %12, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds %"class.std::complex", ptr %37, i64 %39
  %41 = call <2 x float> @_ZSt4conjIfESt7complexIT_ERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %40)
  %42 = getelementptr inbounds %"class.std::complex", ptr %18, i32 0, i32 0
  store <2 x float> %41, ptr %42, align 4
  %43 = load ptr, ptr %10, align 8, !tbaa !9
  %44 = load i32, ptr %12, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds %"class.std::complex", ptr %43, i64 %45
  %47 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(8) %46)
  %48 = getelementptr inbounds %"class.std::complex", ptr %17, i32 0, i32 0
  store <2 x float> %47, ptr %48, align 4
  %49 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %50 = getelementptr inbounds %"class.std::complex", ptr %16, i32 0, i32 0
  store <2 x float> %49, ptr %50, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %16, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %51

51:                                               ; preds = %36
  %52 = load i32, ptr %12, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %12, align 4, !tbaa !5
  br label %32, !llvm.loop !13

54:                                               ; preds = %32
  br label %105

55:                                               ; preds = %28, %25
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = icmp sle i32 0, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %65

59:                                               ; preds = %55
  %60 = load i32, ptr %7, align 4, !tbaa !5
  %61 = sub nsw i32 0, %60
  %62 = add nsw i32 %61, 1
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = mul nsw i32 %62, %63
  store i32 %64, ptr %13, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %59, %58
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = icmp sle i32 0, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %75

69:                                               ; preds = %65
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = sub nsw i32 0, %70
  %72 = add nsw i32 %71, 1
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = mul nsw i32 %72, %73
  store i32 %74, ptr %14, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %69, %68
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %101, %75
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %104

80:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %81 = load ptr, ptr %8, align 8, !tbaa !9
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds %"class.std::complex", ptr %81, i64 %83
  %85 = call <2 x float> @_ZSt4conjIfESt7complexIT_ERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %84)
  %86 = getelementptr inbounds %"class.std::complex", ptr %21, i32 0, i32 0
  store <2 x float> %85, ptr %86, align 4
  %87 = load ptr, ptr %10, align 8, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds %"class.std::complex", ptr %87, i64 %89
  %91 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %21, ptr noundef nonnull align 4 dereferenceable(8) %90)
  %92 = getelementptr inbounds %"class.std::complex", ptr %20, i32 0, i32 0
  store <2 x float> %91, ptr %92, align 4
  %93 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %20)
  %94 = getelementptr inbounds %"class.std::complex", ptr %19, i32 0, i32 0
  store <2 x float> %93, ptr %94, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %95 = load i32, ptr %13, align 4, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = add nsw i32 %95, %96
  store i32 %97, ptr %13, align 4, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !5
  %99 = load i32, ptr %11, align 4, !tbaa !5
  %100 = add nsw i32 %98, %99
  store i32 %100, ptr %14, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %80
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %12, align 4, !tbaa !5
  br label %76, !llvm.loop !15

104:                                              ; preds = %76
  br label %105

105:                                              ; preds = %104, %54
  store i32 1, ptr %15, align 4
  br label %106

106:                                              ; preds = %105, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %107 = getelementptr inbounds %"class.std::complex", ptr %6, i32 0, i32 0
  %108 = load <2 x float>, ptr %107, align 4
  ret <2 x float> %108
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #4 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { 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 = { 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 #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 = !{!"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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; 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 #1

; 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 #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_Z5cdotciPSt7complexIfEiS1_i(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = alloca %"class.std::complex", align 8
  %7 = alloca %"class.std::complex", align 8
  %8 = alloca %"class.std::complex", align 8
  %9 = alloca %"class.std::complex", align 8
  %10 = alloca %"class.std::complex", align 8
  call void @_ZNSt7complexIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %6, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %11 = icmp slt i32 %0, 1
  br i1 %11, label %.loopexit, label %12

12:                                               ; preds = %5
  %13 = icmp eq i32 %2, 1
  %14 = icmp eq i32 %4, 1
  %or.cond = and i1 %13, %14
  br i1 %or.cond, label %.lr.ph41.preheader, label %.lr.ph.preheader

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

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %.lr.ph41
  %indvars.iv48 = phi i64 [ 0, %.lr.ph41.preheader ], [ %indvars.iv.next49, %.lr.ph41 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %15 = getelementptr inbounds %"class.std::complex", ptr %1, i64 %indvars.iv48
  %16 = call <2 x float> @_ZSt4conjIfESt7complexIT_ERKS2_(ptr noundef nonnull align 4 dereferenceable(8) %15)
  store <2 x float> %16, ptr %8, align 8
  %17 = getelementptr inbounds %"class.std::complex", ptr %3, i64 %indvars.iv48
  %18 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %8, ptr noundef nonnull align 4 dereferenceable(8) %17)
  store <2 x float> %18, ptr %7, align 8
  %19 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
  store <2 x float> %19, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond51.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
  br i1 %exitcond51.not, label %.loopexit, label %.lr.ph41, !llvm.loop !8

.lr.ph.preheader:                                 ; preds = %12
  %.inv35 = icmp slt i32 %4, 0
  %20 = sub nsw i32 1, %0
  %21 = mul nsw i32 %20, %4
  %.030 = select i1 %.inv35, i32 %21, i32 0
  %.inv = icmp slt i32 %2, 0
  %22 = mul nsw i32 %20, %2
  %.028 = select i1 %.inv, i32 %22, i32 0
  %23 = sext i32 %.028 to i64
  %24 = sext i32 %2 to i64
  %25 = sext i32 %.030 to i64
  %26 = sext i32 %4 to i64
  br label %.lr.ph

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

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph41, %5
  %33 = load <2 x float>, ptr %6, align 8
  ret <2 x float> %33
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #3 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { 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 #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 = !{!"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