; LLVM IR from kkumatani/distant_speech_recognition :: btk20_src/matrix/blas1_c.ll (Z5cdotuiPSt7complexIfEiS1_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 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: mustprogress uwtable
define dso_local <2 x float> @_Z5cdotuiPSt7complexIfEiS1_i(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #4 {
  %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
  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)
  %20 = load i32, ptr %7, align 4, !tbaa !5
  %21 = icmp sle i32 %20, 0
  br i1 %21, label %22, label %23

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

23:                                               ; preds = %5
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %51

26:                                               ; preds = %23
  %27 = load i32, ptr %11, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %29, label %51

29:                                               ; preds = %26
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %47, %29
  %31 = load i32, ptr %12, align 4, !tbaa !5
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %34, label %50

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %35 = load ptr, ptr %8, align 8, !tbaa !9
  %36 = load i32, ptr %12, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %"class.std::complex", ptr %35, i64 %37
  %39 = load ptr, ptr %10, align 8, !tbaa !9
  %40 = load i32, ptr %12, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds %"class.std::complex", ptr %39, i64 %41
  %43 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %38, ptr noundef nonnull align 4 dereferenceable(8) %42)
  %44 = getelementptr inbounds %"class.std::complex", ptr %17, i32 0, i32 0
  store <2 x float> %43, ptr %44, align 4
  %45 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %17)
  %46 = getelementptr inbounds %"class.std::complex", ptr %16, i32 0, i32 0
  store <2 x float> %45, ptr %46, 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 %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %47

47:                                               ; preds = %34
  %48 = load i32, ptr %12, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %12, align 4, !tbaa !5
  br label %30, !llvm.loop !13

50:                                               ; preds = %30
  br label %99

51:                                               ; preds = %26, %23
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = icmp sle i32 0, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %61

55:                                               ; preds = %51
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = sub nsw i32 0, %56
  %58 = add nsw i32 %57, 1
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = mul nsw i32 %58, %59
  store i32 %60, ptr %13, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %55, %54
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = icmp sle i32 0, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %61
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %71

65:                                               ; preds = %61
  %66 = load i32, ptr %7, align 4, !tbaa !5
  %67 = sub nsw i32 0, %66
  %68 = add nsw i32 %67, 1
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = mul nsw i32 %68, %69
  store i32 %70, ptr %14, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %65, %64
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %95, %71
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %76, label %98

76:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = load i32, ptr %13, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds %"class.std::complex", ptr %77, i64 %79
  %81 = load ptr, ptr %10, align 8, !tbaa !9
  %82 = load i32, ptr %14, 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> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %80, ptr noundef nonnull align 4 dereferenceable(8) %84)
  %86 = getelementptr inbounds %"class.std::complex", ptr %19, i32 0, i32 0
  store <2 x float> %85, ptr %86, align 4
  %87 = call <2 x float> @_ZStplIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %19)
  %88 = getelementptr inbounds %"class.std::complex", ptr %18, i32 0, i32 0
  store <2 x float> %87, ptr %88, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  %89 = load i32, ptr %13, align 4, !tbaa !5
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = add nsw i32 %89, %90
  store i32 %91, ptr %13, align 4, !tbaa !5
  %92 = load i32, ptr %14, align 4, !tbaa !5
  %93 = load i32, ptr %11, align 4, !tbaa !5
  %94 = add nsw i32 %92, %93
  store i32 %94, ptr %14, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %76
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !5
  br label %72, !llvm.loop !15

98:                                               ; preds = %72
  br label %99

99:                                               ; preds = %98, %50
  store i32 1, ptr %15, align 4
  br label %100

100:                                              ; preds = %99, %22
  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
  %101 = getelementptr inbounds %"class.std::complex", ptr %6, i32 0, i32 0
  %102 = load <2 x float>, ptr %101, align 4
  ret <2 x float> %102
}

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 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 = { 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 #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 nounwind uwtable
declare dso_local void @_ZNSt7complexIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_Z5cdotuiPSt7complexIfEiS1_i(i32 noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #3 {
  %6 = alloca %"class.std::complex", align 8
  %7 = alloca %"class.std::complex", align 8
  %8 = 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)
  %9 = icmp slt i32 %0, 1
  br i1 %9, label %.loopexit, label %10

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

.lr.ph41.preheader:                               ; preds = %10
  %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
  %13 = getelementptr inbounds %"class.std::complex", ptr %1, i64 %indvars.iv48
  %14 = getelementptr inbounds %"class.std::complex", ptr %3, i64 %indvars.iv48
  %15 = call <2 x float> @_ZStmlIfESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(8) %14)
  store <2 x float> %15, ptr %7, align 8
  %16 = 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> %16, ptr %6, align 8, !tbaa !5
  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 = %10
  %.inv35 = icmp slt i32 %4, 0
  %17 = sub nsw i32 1, %0
  %18 = mul nsw i32 %17, %4
  %.030 = select i1 %.inv35, i32 %18, i32 0
  %.inv = icmp slt i32 %2, 0
  %19 = mul nsw i32 %17, %2
  %.028 = select i1 %.inv, i32 %19, i32 0
  %20 = sext i32 %.028 to i64
  %21 = sext i32 %2 to i64
  %22 = sext i32 %.030 to i64
  %23 = sext i32 %4 to i64
  br label %.lr.ph

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

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

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 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 #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 = { 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