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

@out1 = external dso_local global [130 x float], align 16
@out2 = external dso_local global [93 x float], align 16
@test_out1 = external dso_local global [260 x float], align 16
@test_out2 = external dso_local global [186 x float], align 16
@.str = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.tc_against_gold_v = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @check_data(float noundef, float noundef, float noundef) #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

declare void @__ut_assert_msg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @tc_against_gold_v(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %44, %2
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = icmp ult i64 %10, 130
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  store i32 2, ptr %7, align 4
  br label %47

13:                                               ; preds = %9
  br label %14

14:                                               ; preds = %13
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %15
  %17 = load float, ptr %16, align 4, !tbaa !11
  %18 = load i64, ptr %6, align 8, !tbaa !9
  %19 = getelementptr inbounds [130 x float], ptr @out1, i64 0, i64 %18
  %20 = load float, ptr %19, align 4, !tbaa !11
  %21 = call i32 @check_data(float noundef %17, float noundef %20, float noundef 0x3EE4F8B580000000)
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %41, label %23

23:                                               ; preds = %14
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = load i64, ptr %6, align 8, !tbaa !9
  %26 = getelementptr inbounds [130 x float], ptr @out1, i64 0, i64 %25
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = fpext float %27 to double
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %29
  %31 = load float, ptr %30, align 4, !tbaa !11
  %32 = fpext float %31 to double
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %33
  %35 = load float, ptr %34, align 4, !tbaa !11
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = getelementptr inbounds [130 x float], ptr @out1, i64 0, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !11
  %39 = fdiv float %35, %38
  %40 = fpext float %39 to double
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 104, ptr noundef @.str.5, ptr noundef @.str.6, i64 noundef %24, double noundef %28, double noundef %32, double noundef %40)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %47

41:                                               ; preds = %14
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = add i64 %45, 1
  store i64 %46, ptr %6, align 8, !tbaa !9
  br label %9, !llvm.loop !13

47:                                               ; preds = %23, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %48 = load i32, ptr %7, align 4
  switch i32 %48, label %93 [
    i32 2, label %49
    i32 1, label %91
  ]

49:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %50

50:                                               ; preds = %85, %49
  %51 = load i64, ptr %8, align 8, !tbaa !9
  %52 = icmp ult i64 %51, 93
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  store i32 7, ptr %7, align 4
  br label %88

54:                                               ; preds = %50
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !11
  %59 = load i64, ptr %8, align 8, !tbaa !9
  %60 = getelementptr inbounds [93 x float], ptr @out2, i64 0, i64 %59
  %61 = load float, ptr %60, align 4, !tbaa !11
  %62 = call i32 @check_data(float noundef %58, float noundef %61, float noundef 0x3EE4F8B580000000)
  %63 = icmp eq i32 %62, 1
  br i1 %63, label %82, label %64

64:                                               ; preds = %55
  %65 = load i64, ptr %8, align 8, !tbaa !9
  %66 = load i64, ptr %8, align 8, !tbaa !9
  %67 = getelementptr inbounds [93 x float], ptr @out2, i64 0, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !11
  %69 = fpext float %68 to double
  %70 = load i64, ptr %8, align 8, !tbaa !9
  %71 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %70
  %72 = load float, ptr %71, align 4, !tbaa !11
  %73 = fpext float %72 to double
  %74 = load i64, ptr %8, align 8, !tbaa !9
  %75 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %74
  %76 = load float, ptr %75, align 4, !tbaa !11
  %77 = load i64, ptr %8, align 8, !tbaa !9
  %78 = getelementptr inbounds [93 x float], ptr @out2, i64 0, i64 %77
  %79 = load float, ptr %78, align 4, !tbaa !11
  %80 = fdiv float %76, %79
  %81 = fpext float %80 to double
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 110, ptr noundef @.str.7, ptr noundef @.str.8, i64 noundef %65, double noundef %69, double noundef %73, double noundef %81)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %88

82:                                               ; preds = %55
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load i64, ptr %8, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %8, align 8, !tbaa !9
  br label %50, !llvm.loop !15

88:                                               ; preds = %64, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %89 = load i32, ptr %7, align 4
  switch i32 %89, label %93 [
    i32 7, label %90
    i32 1, label %91
  ]

90:                                               ; preds = %88
  store i32 0, ptr %3, align 4
  br label %91

91:                                               ; preds = %90, %88, %47
  %92 = load i32, ptr %3, align 4
  ret i32 %92

93:                                               ; preds = %88, %47
  unreachable
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !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"

@out1 = external dso_local local_unnamed_addr global [130 x float], align 16
@out2 = external dso_local local_unnamed_addr global [93 x float], align 16
@test_out1 = external dso_local local_unnamed_addr global [260 x float], align 16
@test_out2 = external dso_local local_unnamed_addr global [186 x float], align 16
@.str = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.tc_against_gold_v = external hidden unnamed_addr constant [18 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [76 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @check_data(float noundef, float noundef, float noundef) local_unnamed_addr #0

declare void @__ut_assert_msg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @tc_against_gold_v(ptr nocapture noundef readnone %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  br label %3

3:                                                ; preds = %2, %18
  %.02238 = phi i64 [ 0, %2 ], [ %19, %18 ]
  %4 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %.02238
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds [130 x float], ptr @out1, i64 0, i64 %.02238
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = tail call i32 @check_data(float noundef %5, float noundef %7, float noundef 0x3EE4F8B580000000)
  %9 = icmp eq i32 %8, 1
  br i1 %9, label %18, label %.thread

.thread:                                          ; preds = %3
  %10 = getelementptr inbounds [260 x float], ptr @test_out1, i64 0, i64 %.02238
  %11 = getelementptr inbounds [130 x float], ptr @out1, i64 0, i64 %.02238
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fpext float %12 to double
  %14 = load float, ptr %10, align 4, !tbaa !5
  %15 = fpext float %14 to double
  %16 = fdiv float %14, %12
  %17 = fpext float %16 to double
  tail call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef nonnull @.str, ptr noundef nonnull @__func__.tc_against_gold_v, i32 noundef 104, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.6, i64 noundef %.02238, double noundef %13, double noundef %15, double noundef %17) #2
  br label %42

18:                                               ; preds = %3
  %19 = add nuw nsw i64 %.02238, 1
  %exitcond.not = icmp eq i64 %19, 130
  br i1 %exitcond.not, label %.preheader.preheader, label %3, !llvm.loop !9

.preheader.preheader:                             ; preds = %18
  %20 = load float, ptr @test_out2, align 16, !tbaa !5
  %21 = load float, ptr @out2, align 16, !tbaa !5
  %22 = tail call i32 @check_data(float noundef %20, float noundef %21, float noundef 0x3EE4F8B580000000)
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %.lr.ph, label %.preheader._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %24 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %39
  %25 = load float, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds [93 x float], ptr @out2, i64 0, i64 %39
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = tail call i32 @check_data(float noundef %25, float noundef %27, float noundef 0x3EE4F8B580000000)
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %.lr.ph, label %.preheader._crit_edge.loopexit, !llvm.loop !11

.preheader._crit_edge.loopexit:                   ; preds = %.preheader
  %30 = icmp ult i64 %.04066, 92
  br label %.preheader._crit_edge

.preheader._crit_edge:                            ; preds = %.preheader._crit_edge.loopexit, %.preheader.preheader
  %.lcssa = phi i1 [ true, %.preheader.preheader ], [ %30, %.preheader._crit_edge.loopexit ]
  %.040.lcssa = phi i64 [ 0, %.preheader.preheader ], [ %39, %.preheader._crit_edge.loopexit ]
  %31 = getelementptr inbounds [186 x float], ptr @test_out2, i64 0, i64 %.040.lcssa
  %32 = getelementptr inbounds [93 x float], ptr @out2, i64 0, i64 %.040.lcssa
  %33 = load float, ptr %32, align 4, !tbaa !5
  %34 = fpext float %33 to double
  %35 = load float, ptr %31, align 4, !tbaa !5
  %36 = fpext float %35 to double
  %37 = fdiv float %35, %33
  %38 = fpext float %37 to double
  tail call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef nonnull @.str, ptr noundef nonnull @__func__.tc_against_gold_v, i32 noundef 110, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8, i64 noundef %.040.lcssa, double noundef %34, double noundef %36, double noundef %38) #2
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader.preheader, %.preheader
  %.04066 = phi i64 [ %39, %.preheader ], [ 0, %.preheader.preheader ]
  %39 = add nuw nsw i64 %.04066, 1
  %exitcond45.not = icmp eq i64 %39, 93
  br i1 %exitcond45.not, label %.loopexit.loopexit, label %.preheader, !llvm.loop !11

.loopexit.loopexit:                               ; preds = %.lr.ph
  %40 = icmp ult i64 %.04066, 92
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.preheader._crit_edge
  %41 = phi i1 [ %.lcssa, %.preheader._crit_edge ], [ %40, %.loopexit.loopexit ]
  %spec.select = zext i1 %41 to i32
  br label %42

42:                                               ; preds = %.thread, %.loopexit
  %.2 = phi i32 [ %spec.select, %.loopexit ], [ 1, %.thread ]
  ret i32 %.2
}

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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass