; LLVM IR from parallella/pal :: tests/dsp (check_p_xcorr_f32)

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

@in11_size = external dso_local global i32, align 4
@in11 = external dso_local global [80 x float], align 16
@in12_size = external dso_local global i32, align 4
@in12 = external dso_local global [51 x float], align 16
@in21_size = external dso_local global i32, align 4
@in21 = external dso_local global [47 x float], align 16
@in22_size = external dso_local global i32, align 4
@in22 = external dso_local global [47 x float], align 16
@CANARY = external dso_local global float, align 4
@test_out1 = external dso_local global [260 x float], align 16
@test_out2 = external dso_local global [186 x float], align 16

; 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: nounwind uwtable
define dso_local i32 @tc_against_gold_e(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 130, ptr %5, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %17, %2
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = icmp ult i64 %9, 260
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %20

12:                                               ; preds = %7
  %13 = load float, ptr @CANARY, align 4, !tbaa !11
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %15
  store float %13, ptr %16, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %12
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %5, align 4, !tbaa !9
  br label %7, !llvm.loop !13

20:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 93, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %31, %20
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = icmp ult i64 %23, 186
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %34

26:                                               ; preds = %21
  %27 = load float, ptr @CANARY, align 4, !tbaa !11
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %29
  store float %27, ptr %30, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !15

34:                                               ; preds = %25
  %35 = load i32, ptr @in11_size, align 4, !tbaa !9
  %36 = load i32, ptr @in12_size, align 4, !tbaa !9
  call void @p_xcorr_f32(ptr noundef @in11, ptr noundef @in12, ptr noundef @test_out1, i32 noundef %35, i32 noundef %36)
  %37 = load i32, ptr @in21_size, align 4, !tbaa !9
  %38 = load i32, ptr @in22_size, align 4, !tbaa !9
  call void @p_xcorr_f32(ptr noundef @in21, ptr noundef @in22, ptr noundef @test_out2, i32 noundef %37, i32 noundef %38)
  ret i32 0
}

declare void @p_xcorr_f32(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !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"

@in11_size = external dso_local local_unnamed_addr global i32, align 4
@in11 = external dso_local global [80 x float], align 16
@in12_size = external dso_local local_unnamed_addr global i32, align 4
@in12 = external dso_local global [51 x float], align 16
@in21_size = external dso_local local_unnamed_addr global i32, align 4
@in21 = external dso_local global [47 x float], align 16
@in22_size = external dso_local local_unnamed_addr global i32, align 4
@in22 = external dso_local global [47 x float], align 16
@CANARY = external dso_local local_unnamed_addr global float, align 4
@test_out1 = external dso_local global [260 x float], align 16
@test_out2 = external dso_local global [186 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @tc_against_gold_e(ptr nocapture noundef readnone %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
vector.ph:
  %2 = load float, ptr @CANARY, align 4, !tbaa !5
  %broadcast.splatinsert = insertelement <4 x float> poison, float %2, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 520), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 536), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 552), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 568), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 584), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 600), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 616), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 632), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 648), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 664), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 680), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 696), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 712), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 728), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 744), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 760), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 776), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 792), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 808), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 824), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 840), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 856), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 872), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 888), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 904), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 920), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 936), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 952), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 968), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 984), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 1000), align 8, !tbaa !5
  store <4 x float> %broadcast.splat, ptr getelementptr inbounds (i8, ptr @test_out1, i64 1016), align 8, !tbaa !5
  store float %2, ptr getelementptr inbounds (i8, ptr @test_out1, i64 1032), align 8, !tbaa !5
  store float %2, ptr getelementptr inbounds (i8, ptr @test_out1, i64 1036), align 4, !tbaa !5
  %3 = insertelement <4 x float> poison, float %2, i64 0
  %4 = shufflevector <4 x float> %3, <4 x float> poison, <4 x i32> zeroinitializer
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 372), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 388), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 404), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 420), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 436), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 452), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 468), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 484), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 500), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 516), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 532), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 548), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 564), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 580), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 596), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 612), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 628), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 644), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 660), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 676), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 692), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 708), align 4, !tbaa !5
  store <4 x float> %4, ptr getelementptr inbounds (i8, ptr @test_out2, i64 724), align 4, !tbaa !5
  store float %2, ptr getelementptr inbounds (i8, ptr @test_out2, i64 740), align 4, !tbaa !5
  %5 = load i32, ptr @in11_size, align 4, !tbaa !9
  %6 = load i32, ptr @in12_size, align 4, !tbaa !9
  tail call void @p_xcorr_f32(ptr noundef nonnull @in11, ptr noundef nonnull @in12, ptr noundef nonnull @test_out1, i32 noundef %5, i32 noundef %6) #2
  %7 = load i32, ptr @in21_size, align 4, !tbaa !9
  %8 = load i32, ptr @in22_size, align 4, !tbaa !9
  tail call void @p_xcorr_f32(ptr noundef nonnull @in21, ptr noundef nonnull @in22, ptr noundef nonnull @test_out2, i32 noundef %7, i32 noundef %8) #2
  ret i32 0
}

declare void @p_xcorr_f32(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #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 = { "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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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