; LLVM IR from parallella/pal :: tests/dsp (check_p_fir_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"

@ref1 = external dso_local global [32 x float], align 16
@nx1 = external dso_local global i32, align 4
@ref2 = external dso_local global [100 x float], align 16
@nx2 = external dso_local global i32, align 4
@r1 = external dso_local global [32 x float], align 16
@r2 = external dso_local global [100 x float], align 16
@.str = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.tc_against_gold_v = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare1(float noundef, float noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare2(float noundef, float noundef) #0

; 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
  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 %8

8:                                                ; preds = %43, %2
  %9 = load i64, ptr %6, align 8, !tbaa !9
  %10 = load i32, ptr @nx1, align 4, !tbaa !11
  %11 = sext i32 %10 to i64
  %12 = icmp ult i64 %9, %11
  br i1 %12, label %13, label %46

13:                                               ; preds = %8
  br label %14

14:                                               ; preds = %13
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = getelementptr inbounds [32 x float], ptr @r1, i64 0, i64 %15
  %17 = load float, ptr %16, align 4, !tbaa !13
  %18 = load i64, ptr %6, align 8, !tbaa !9
  %19 = getelementptr inbounds [32 x float], ptr @ref1, i64 0, i64 %18
  %20 = load float, ptr %19, align 4, !tbaa !13
  %21 = call zeroext i1 @compare1(float noundef %17, float noundef %20)
  br i1 %21, label %40, label %22

22:                                               ; preds = %14
  %23 = load i64, ptr %6, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = getelementptr inbounds [32 x float], ptr @ref1, i64 0, i64 %24
  %26 = load float, ptr %25, align 4, !tbaa !13
  %27 = fpext float %26 to double
  %28 = load i64, ptr %6, align 8, !tbaa !9
  %29 = getelementptr inbounds [32 x float], ptr @r1, i64 0, i64 %28
  %30 = load float, ptr %29, align 4, !tbaa !13
  %31 = fpext float %30 to double
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = getelementptr inbounds [32 x float], ptr @r1, i64 0, i64 %32
  %34 = load float, ptr %33, align 4, !tbaa !13
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds [32 x float], ptr @ref1, i64 0, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !13
  %38 = fdiv float %34, %37
  %39 = fpext float %38 to double
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 44, ptr noundef @.str.1, ptr noundef @.str.2, i64 noundef %23, double noundef %27, double noundef %31, double noundef %39)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %86

40:                                               ; preds = %14
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  br label %43

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

46:                                               ; preds = %8
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %82, %46
  %48 = load i64, ptr %6, align 8, !tbaa !9
  %49 = load i32, ptr @nx2, align 4, !tbaa !11
  %50 = sext i32 %49 to i64
  %51 = icmp ult i64 %48, %50
  br i1 %51, label %52, label %85

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %52
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds [100 x float], ptr @r2, i64 0, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !13
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = getelementptr inbounds [100 x float], ptr @ref2, i64 0, i64 %57
  %59 = load float, ptr %58, align 4, !tbaa !13
  %60 = call zeroext i1 @compare2(float noundef %56, float noundef %59)
  br i1 %60, label %79, label %61

61:                                               ; preds = %53
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = load i64, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds [100 x float], ptr @ref2, i64 0, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !13
  %66 = fpext float %65 to double
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = getelementptr inbounds [100 x float], ptr @r2, i64 0, i64 %67
  %69 = load float, ptr %68, align 4, !tbaa !13
  %70 = fpext float %69 to double
  %71 = load i64, ptr %6, align 8, !tbaa !9
  %72 = getelementptr inbounds [100 x float], ptr @r2, i64 0, i64 %71
  %73 = load float, ptr %72, align 4, !tbaa !13
  %74 = load i64, ptr %6, align 8, !tbaa !9
  %75 = getelementptr inbounds [100 x float], ptr @ref2, i64 0, i64 %74
  %76 = load float, ptr %75, align 4, !tbaa !13
  %77 = fdiv float %73, %76
  %78 = fpext float %77 to double
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 50, ptr noundef @.str.3, ptr noundef @.str.4, i64 noundef %62, double noundef %66, double noundef %70, double noundef %78)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %86

79:                                               ; preds = %53
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr %6, align 8, !tbaa !9
  %84 = add i64 %83, 1
  store i64 %84, ptr %6, align 8, !tbaa !9
  br label %47, !llvm.loop !17

85:                                               ; preds = %47
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %86

86:                                               ; preds = %85, %61, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %87 = load i32, ptr %3, align 4
  ret i32 %87
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@ref1 = external dso_local local_unnamed_addr global [32 x float], align 16
@nx1 = external dso_local local_unnamed_addr global i32, align 4
@ref2 = external dso_local local_unnamed_addr global [100 x float], align 16
@nx2 = external dso_local local_unnamed_addr global i32, align 4
@r1 = external dso_local local_unnamed_addr global [32 x float], align 16
@r2 = external dso_local local_unnamed_addr global [100 x float], align 16
@.str = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.tc_against_gold_v = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [75 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare1(float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare2(float noundef, float noundef) local_unnamed_addr #0

; 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 {
  %3 = load i32, ptr @nx1, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %19, %2
  %4 = load i32, ptr @nx2, align 4, !tbaa !5
  %.not30 = icmp eq i32 %4, 0
  br i1 %.not30, label %.loopexit, label %.lr.ph29

.lr.ph:                                           ; preds = %2, %19
  %.026 = phi i64 [ %20, %19 ], [ 0, %2 ]
  %5 = getelementptr inbounds [32 x float], ptr @r1, i64 0, i64 %.026
  %6 = load float, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds [32 x float], ptr @ref1, i64 0, i64 %.026
  %8 = load float, ptr %7, align 4, !tbaa !9
  %9 = tail call zeroext i1 @compare1(float noundef %6, float noundef %8)
  br i1 %9, label %19, label %10

10:                                               ; preds = %.lr.ph
  %11 = getelementptr inbounds [32 x float], ptr @r1, i64 0, i64 %.026
  %12 = getelementptr inbounds [32 x float], ptr @ref1, i64 0, i64 %.026
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = fpext float %13 to double
  %15 = load float, ptr %11, align 4, !tbaa !9
  %16 = fpext float %15 to double
  %17 = fdiv float %15, %13
  %18 = fpext float %17 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 44, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i64 noundef %.026, double noundef %14, double noundef %16, double noundef %18) #2
  br label %.loopexit

19:                                               ; preds = %.lr.ph
  %20 = add nuw i64 %.026, 1
  %21 = load i32, ptr @nx1, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp ult i64 %20, %22
  br i1 %23, label %.lr.ph, label %.preheader, !llvm.loop !11

.lr.ph29:                                         ; preds = %.preheader, %38
  %.128 = phi i64 [ %39, %38 ], [ 0, %.preheader ]
  %24 = getelementptr inbounds [100 x float], ptr @r2, i64 0, i64 %.128
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = getelementptr inbounds [100 x float], ptr @ref2, i64 0, i64 %.128
  %27 = load float, ptr %26, align 4, !tbaa !9
  %28 = tail call zeroext i1 @compare2(float noundef %25, float noundef %27)
  br i1 %28, label %38, label %29

29:                                               ; preds = %.lr.ph29
  %30 = getelementptr inbounds [100 x float], ptr @r2, i64 0, i64 %.128
  %31 = getelementptr inbounds [100 x float], ptr @ref2, i64 0, i64 %.128
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = fpext float %32 to double
  %34 = load float, ptr %30, align 4, !tbaa !9
  %35 = fpext float %34 to double
  %36 = fdiv float %34, %32
  %37 = fpext float %36 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 50, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i64 noundef %.128, double noundef %33, double noundef %35, double noundef %37) #2
  br label %.loopexit

38:                                               ; preds = %.lr.ph29
  %39 = add nuw i64 %.128, 1
  %40 = load i32, ptr @nx2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp ult i64 %39, %41
  br i1 %42, label %.lr.ph29, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %38, %.preheader, %29, %10
  %.019 = phi i32 [ 1, %10 ], [ 1, %29 ], [ 0, %.preheader ], [ 0, %38 ]
  ret i32 %.019
}

declare void @__ut_assert_msg(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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