; LLVM IR from ARM-software/Arm-2D :: Helper/Source/arm_2d_helper_pfb.ll_ (arm_2d_helper_dirty_region_transform_update_value1)

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

%struct.arm_2d_helper_dirty_region_transform_t = type { float, %union.anon.38, float, %struct.arm_2d_helper_dirty_region_item_t, %struct.anon.39 }
%union.anon.38 = type { float }
%struct.arm_2d_helper_dirty_region_item_t = type { %struct.anon.34, %struct.arm_2d_region_t }
%struct.anon.34 = type { ptr, ptr, %union.anon.35, %struct.arm_2d_region_t, i8, i8, i16 }
%union.anon.35 = type { [2 x %struct.arm_2d_region_t] }
%struct.arm_2d_region_t = type { %union.anon, %union.anon.0 }
%union.anon = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.0 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%struct.anon.39 = type { ptr, ptr, %struct.anon.40, %struct.anon.41, %struct.anon.42, i8 }
%struct.anon.40 = type { float, float }
%struct.anon.41 = type { float, float }
%struct.anon.42 = type { float, float }

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_helper_dirty_region_transform_update_value1 = external hidden unnamed_addr constant [121 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr 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

; Function Attrs: nounwind uwtable
define dso_local void @__arm_2d_helper_dirty_region_transform_update_value1(ptr noundef nonnull %0, float noundef %1, float noundef %2, float noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp ne ptr null, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %4
  br label %19

18:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 4963, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_helper_dirty_region_transform_update_value1) #3
  unreachable

19:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store float 0.000000e+00, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store ptr null, ptr %11, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %58, %19
  %21 = load ptr, ptr %11, align 8, !tbaa !5
  %22 = getelementptr inbounds i32, ptr %21, i32 1
  store ptr %22, ptr %11, align 8, !tbaa !5
  %23 = icmp eq ptr %21, null
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %59

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %26, i32 0, i32 4
  %28 = getelementptr inbounds %struct.anon.39, ptr %27, i32 0, i32 2
  %29 = getelementptr inbounds %struct.anon.40, ptr %28, i32 0, i32 0
  %30 = load float, ptr %29, align 8, !tbaa !13
  %31 = load float, ptr %6, align 4, !tbaa !9
  %32 = fsub float %30, %31
  store float %32, ptr %12, align 4, !tbaa !9
  %33 = load float, ptr %12, align 4, !tbaa !9
  %34 = fcmp ogt float %33, 0.000000e+00
  br i1 %34, label %35, label %37

35:                                               ; preds = %25
  %36 = load float, ptr %12, align 4, !tbaa !9
  br label %40

37:                                               ; preds = %25
  %38 = load float, ptr %12, align 4, !tbaa !9
  %39 = fneg float %38
  br label %40

40:                                               ; preds = %37, %35
  %41 = phi float [ %36, %35 ], [ %39, %37 ]
  store float %41, ptr %12, align 4, !tbaa !9
  %42 = load float, ptr %12, align 4, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %43, i32 0, i32 4
  %45 = getelementptr inbounds %struct.anon.39, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds %struct.anon.40, ptr %45, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !22
  %48 = fcmp oge float %42, %47
  br i1 %48, label %49, label %58

49:                                               ; preds = %40
  %50 = load float, ptr %6, align 4, !tbaa !9
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %51, i32 0, i32 4
  %53 = getelementptr inbounds %struct.anon.39, ptr %52, i32 0, i32 2
  %54 = getelementptr inbounds %struct.anon.40, ptr %53, i32 0, i32 0
  store float %50, ptr %54, align 8, !tbaa !13
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %55, i32 0, i32 4
  %57 = getelementptr inbounds %struct.anon.39, ptr %56, i32 0, i32 5
  store i8 1, ptr %57, align 8, !tbaa !23
  br label %58

58:                                               ; preds = %49, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %20, !llvm.loop !24

59:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store ptr null, ptr %14, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %131, %59
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds i32, ptr %61, i32 1
  store ptr %62, ptr %14, align 8, !tbaa !5
  %63 = icmp eq ptr %61, null
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %132

65:                                               ; preds = %60
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %66, i32 0, i32 4
  %68 = getelementptr inbounds %struct.anon.39, ptr %67, i32 0, i32 3
  %69 = getelementptr inbounds %struct.anon.41, ptr %68, i32 0, i32 0
  %70 = load float, ptr %69, align 8, !tbaa !26
  %71 = load float, ptr %7, align 4, !tbaa !9
  %72 = fsub float %70, %71
  store float %72, ptr %9, align 4, !tbaa !9
  %73 = load float, ptr %9, align 4, !tbaa !9
  %74 = fcmp ogt float %73, 0.000000e+00
  br i1 %74, label %75, label %77

75:                                               ; preds = %65
  %76 = load float, ptr %9, align 4, !tbaa !9
  br label %80

77:                                               ; preds = %65
  %78 = load float, ptr %9, align 4, !tbaa !9
  %79 = fneg float %78
  br label %80

80:                                               ; preds = %77, %75
  %81 = phi float [ %76, %75 ], [ %79, %77 ]
  store float %81, ptr %9, align 4, !tbaa !9
  %82 = load float, ptr %9, align 4, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %83, i32 0, i32 4
  %85 = getelementptr inbounds %struct.anon.39, ptr %84, i32 0, i32 3
  %86 = getelementptr inbounds %struct.anon.41, ptr %85, i32 0, i32 1
  %87 = load float, ptr %86, align 4, !tbaa !27
  %88 = fcmp oge float %82, %87
  br i1 %88, label %89, label %98

89:                                               ; preds = %80
  %90 = load float, ptr %7, align 4, !tbaa !9
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %91, i32 0, i32 4
  %93 = getelementptr inbounds %struct.anon.39, ptr %92, i32 0, i32 3
  %94 = getelementptr inbounds %struct.anon.41, ptr %93, i32 0, i32 0
  store float %90, ptr %94, align 8, !tbaa !26
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %95, i32 0, i32 4
  %97 = getelementptr inbounds %struct.anon.39, ptr %96, i32 0, i32 5
  store i8 1, ptr %97, align 8, !tbaa !23
  br label %98

98:                                               ; preds = %89, %80
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %99, i32 0, i32 4
  %101 = getelementptr inbounds %struct.anon.39, ptr %100, i32 0, i32 4
  %102 = getelementptr inbounds %struct.anon.42, ptr %101, i32 0, i32 0
  %103 = load float, ptr %102, align 8, !tbaa !28
  %104 = load float, ptr %8, align 4, !tbaa !9
  %105 = fsub float %103, %104
  store float %105, ptr %9, align 4, !tbaa !9
  %106 = load float, ptr %9, align 4, !tbaa !9
  %107 = fcmp ogt float %106, 0.000000e+00
  br i1 %107, label %108, label %110

108:                                              ; preds = %98
  %109 = load float, ptr %9, align 4, !tbaa !9
  br label %113

110:                                              ; preds = %98
  %111 = load float, ptr %9, align 4, !tbaa !9
  %112 = fneg float %111
  br label %113

113:                                              ; preds = %110, %108
  %114 = phi float [ %109, %108 ], [ %112, %110 ]
  store float %114, ptr %9, align 4, !tbaa !9
  %115 = load float, ptr %9, align 4, !tbaa !9
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %116, i32 0, i32 4
  %118 = getelementptr inbounds %struct.anon.39, ptr %117, i32 0, i32 4
  %119 = getelementptr inbounds %struct.anon.42, ptr %118, i32 0, i32 1
  %120 = load float, ptr %119, align 4, !tbaa !29
  %121 = fcmp oge float %115, %120
  br i1 %121, label %122, label %131

122:                                              ; preds = %113
  %123 = load float, ptr %8, align 4, !tbaa !9
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %124, i32 0, i32 4
  %126 = getelementptr inbounds %struct.anon.39, ptr %125, i32 0, i32 4
  %127 = getelementptr inbounds %struct.anon.42, ptr %126, i32 0, i32 0
  store float %123, ptr %127, align 8, !tbaa !28
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %128, i32 0, i32 4
  %130 = getelementptr inbounds %struct.anon.39, ptr %129, i32 0, i32 5
  store i8 1, ptr %130, align 8, !tbaa !23
  br label %131

131:                                              ; preds = %122, %113
  br label %60, !llvm.loop !30

132:                                              ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret void
}

attributes #0 = { noreturn nounwind "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 = { 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 = { noreturn nounwind }
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 = !{!"any pointer", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 88}
!14 = !{!"arm_2d_helper_dirty_region_transform_t", !10, i64 0, !7, i64 4, !10, i64 8, !15, i64 16, !19, i64 72}
!15 = !{!"arm_2d_helper_dirty_region_item_t", !16, i64 0, !17, i64 48}
!16 = !{!"", !6, i64 0, !6, i64 8, !7, i64 16, !17, i64 32, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 41, !18, i64 42}
!17 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !6, i64 0, !6, i64 8, !20, i64 16, !20, i64 24, !20, i64 32, !21, i64 40}
!20 = !{!"", !10, i64 0, !10, i64 4}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{!14, !10, i64 92}
!23 = !{!14, !21, i64 112}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!14, !10, i64 96}
!27 = !{!14, !10, i64 100}
!28 = !{!14, !10, i64 104}
!29 = !{!14, !10, i64 108}
!30 = distinct !{!30, !25}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @__arm_2d_helper_dirty_region_transform_update_value1(ptr nocapture noundef nonnull %0, float noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = getelementptr inbounds i8, ptr %0, i64 92
  %7 = load float, ptr %6, align 4, !tbaa !5
  %.promoted = load float, ptr %5, align 8, !tbaa !18
  %8 = getelementptr inbounds i8, ptr %0, i64 112
  %9 = fsub float %.promoted, %1
  %10 = fcmp ogt float %9, 0.000000e+00
  %11 = fneg float %9
  %12 = select i1 %10, float %9, float %11
  %13 = fcmp ult float %12, %7
  br i1 %13, label %.preheader, label %14

14:                                               ; preds = %4
  store float %1, ptr %5, align 8, !tbaa !18
  store i8 1, ptr %8, align 8, !tbaa !19
  br label %.preheader

.preheader:                                       ; preds = %14, %4
  %15 = getelementptr inbounds i8, ptr %0, i64 96
  %16 = getelementptr inbounds i8, ptr %0, i64 100
  %17 = load float, ptr %16, align 4, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %0, i64 104
  %19 = getelementptr inbounds i8, ptr %0, i64 108
  %20 = load float, ptr %19, align 4, !tbaa !21
  %.promoted34 = load float, ptr %15, align 8, !tbaa !22
  %.promoted35 = load float, ptr %18, align 8, !tbaa !23
  %21 = fsub float %.promoted34, %2
  %22 = fcmp ogt float %21, 0.000000e+00
  %23 = fneg float %21
  %24 = select i1 %22, float %21, float %23
  %25 = fcmp ult float %24, %17
  br i1 %25, label %27, label %26

26:                                               ; preds = %.preheader
  store float %2, ptr %15, align 8, !tbaa !22
  store i8 1, ptr %8, align 8, !tbaa !19
  br label %27

27:                                               ; preds = %26, %.preheader
  %28 = fsub float %.promoted35, %3
  %29 = fcmp ogt float %28, 0.000000e+00
  %30 = fneg float %28
  %31 = select i1 %29, float %28, float %30
  %32 = fcmp ult float %31, %20
  br i1 %32, label %34, label %33

33:                                               ; preds = %27
  store float %3, ptr %18, align 8, !tbaa !23
  store i8 1, ptr %8, align 8, !tbaa !19
  br label %34

34:                                               ; preds = %33, %27
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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" }

!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, !7, i64 92}
!6 = !{!"arm_2d_helper_dirty_region_transform_t", !7, i64 0, !8, i64 4, !7, i64 8, !10, i64 16, !15, i64 72}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"arm_2d_helper_dirty_region_item_t", !11, i64 0, !13, i64 48}
!11 = !{!"", !12, i64 0, !12, i64 8, !8, i64 16, !13, i64 32, !8, i64 40, !8, i64 40, !8, i64 40, !8, i64 40, !8, i64 41, !14, i64 42}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"arm_2d_region_t", !8, i64 0, !8, i64 4}
!14 = !{!"short", !8, i64 0}
!15 = !{!"", !12, i64 0, !12, i64 8, !16, i64 16, !16, i64 24, !16, i64 32, !17, i64 40}
!16 = !{!"", !7, i64 0, !7, i64 4}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!6, !7, i64 88}
!19 = !{!6, !17, i64 112}
!20 = !{!6, !7, i64 100}
!21 = !{!6, !7, i64 108}
!22 = !{!6, !7, i64 96}
!23 = !{!6, !7, i64 104}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass