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

@expected = external dso_local global [9 x float], align 16
@test_out = external dso_local global [10 x float], align 16
@.str = external hidden unnamed_addr constant [81 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 [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare(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 = %41, %2
  %9 = load i64, ptr %6, align 8, !tbaa !9
  %10 = icmp ult i64 %9, 9
  br i1 %10, label %11, label %44

11:                                               ; preds = %8
  br label %12

12:                                               ; preds = %11
  %13 = load i64, ptr %6, align 8, !tbaa !9
  %14 = getelementptr inbounds [10 x float], ptr @test_out, i64 0, i64 %13
  %15 = load float, ptr %14, align 4, !tbaa !11
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = getelementptr inbounds [9 x float], ptr @expected, i64 0, i64 %16
  %18 = load float, ptr %17, align 4, !tbaa !11
  %19 = call zeroext i1 @compare(float noundef %15, float noundef %18)
  br i1 %19, label %38, label %20

20:                                               ; preds = %12
  %21 = load i64, ptr %6, align 8, !tbaa !9
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = getelementptr inbounds [9 x float], ptr @expected, i64 0, i64 %22
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = fpext float %24 to double
  %26 = load i64, ptr %6, align 8, !tbaa !9
  %27 = getelementptr inbounds [10 x float], ptr @test_out, i64 0, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !11
  %29 = fpext float %28 to double
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = getelementptr inbounds [9 x float], ptr @expected, i64 0, i64 %30
  %32 = load float, ptr %31, align 4, !tbaa !11
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = getelementptr inbounds [10 x float], ptr @test_out, i64 0, i64 %33
  %35 = load float, ptr %34, align 4, !tbaa !11
  %36 = fsub float %32, %35
  %37 = fpext float %36 to double
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 56, ptr noundef @.str.1, ptr noundef @.str.2, i64 noundef %21, double noundef %25, double noundef %29, double noundef %37)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %52

38:                                               ; preds = %12
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  br label %41

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

44:                                               ; preds = %8
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr getelementptr inbounds ([10 x float], ptr @test_out, i64 0, i64 9), align 4, !tbaa !15
  %47 = icmp eq i32 %46, 1347463765
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  call void (ptr, ptr, i32, ptr, ptr, ...) @__ut_assert_msg(ptr noundef @.str, ptr noundef @__func__.tc_against_gold_v, i32 noundef 60, ptr noundef @.str.3, ptr noundef @.str.4)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %52

49:                                               ; preds = %45
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %52

52:                                               ; preds = %51, %48, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %53 = load i32, ptr %3, align 4
  ret i32 %53
}

; 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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}


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

@expected = external dso_local local_unnamed_addr global [9 x float], align 16
@test_out = external dso_local local_unnamed_addr global [10 x float], align 16
@.str = external hidden unnamed_addr constant [81 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 [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @compare(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 float, ptr @test_out, align 16, !tbaa !5
  %4 = load float, ptr @expected, align 16, !tbaa !5
  %5 = tail call zeroext i1 @compare(float noundef %3, float noundef %4)
  br i1 %5, label %15, label %6

6:                                                ; preds = %43, %39, %35, %31, %27, %23, %19, %15, %2
  %.014.lcssa = phi i64 [ 0, %2 ], [ 1, %15 ], [ 2, %19 ], [ 3, %23 ], [ 4, %27 ], [ 5, %31 ], [ 6, %35 ], [ 7, %39 ], [ 8, %43 ]
  %7 = getelementptr inbounds [10 x float], ptr @test_out, i64 0, i64 %.014.lcssa
  %8 = getelementptr inbounds [9 x float], ptr @expected, i64 0, i64 %.014.lcssa
  %9 = load float, ptr %8, align 4, !tbaa !5
  %10 = fpext float %9 to double
  %11 = load float, ptr %7, align 4, !tbaa !5
  %12 = fpext float %11 to double
  %13 = fsub float %9, %11
  %14 = fpext float %13 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 56, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i64 noundef %.014.lcssa, double noundef %10, double noundef %12, double noundef %14) #2
  br label %51

15:                                               ; preds = %2
  %16 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 4), align 4, !tbaa !5
  %17 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 4), align 4, !tbaa !5
  %18 = tail call zeroext i1 @compare(float noundef %16, float noundef %17)
  br i1 %18, label %19, label %6

19:                                               ; preds = %15
  %20 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 8), align 8, !tbaa !5
  %21 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 8), align 8, !tbaa !5
  %22 = tail call zeroext i1 @compare(float noundef %20, float noundef %21)
  br i1 %22, label %23, label %6

23:                                               ; preds = %19
  %24 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 12), align 4, !tbaa !5
  %25 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 12), align 4, !tbaa !5
  %26 = tail call zeroext i1 @compare(float noundef %24, float noundef %25)
  br i1 %26, label %27, label %6

27:                                               ; preds = %23
  %28 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 16), align 16, !tbaa !5
  %29 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 16), align 16, !tbaa !5
  %30 = tail call zeroext i1 @compare(float noundef %28, float noundef %29)
  br i1 %30, label %31, label %6

31:                                               ; preds = %27
  %32 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 20), align 4, !tbaa !5
  %33 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 20), align 4, !tbaa !5
  %34 = tail call zeroext i1 @compare(float noundef %32, float noundef %33)
  br i1 %34, label %35, label %6

35:                                               ; preds = %31
  %36 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 24), align 8, !tbaa !5
  %37 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 24), align 8, !tbaa !5
  %38 = tail call zeroext i1 @compare(float noundef %36, float noundef %37)
  br i1 %38, label %39, label %6

39:                                               ; preds = %35
  %40 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 28), align 4, !tbaa !5
  %41 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 28), align 4, !tbaa !5
  %42 = tail call zeroext i1 @compare(float noundef %40, float noundef %41)
  br i1 %42, label %43, label %6

43:                                               ; preds = %39
  %44 = load float, ptr getelementptr inbounds (i8, ptr @test_out, i64 32), align 16, !tbaa !5
  %45 = load float, ptr getelementptr inbounds (i8, ptr @expected, i64 32), align 16, !tbaa !5
  %46 = tail call zeroext i1 @compare(float noundef %44, float noundef %45)
  br i1 %46, label %47, label %6

47:                                               ; preds = %43
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @test_out, i64 36), align 4, !tbaa !9
  %49 = icmp eq i32 %48, 1347463765
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  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 60, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4) #2
  br label %51

51:                                               ; preds = %47, %50, %6
  %.010 = phi i32 [ 1, %6 ], [ 1, %50 ], [ 0, %47 ]
  ret i32 %.010
}

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 = !{!"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,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass