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

; 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_on_frame_start = external hidden unnamed_addr constant [99 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
declare dso_local zeroext i1 @arm_2d_helper_dirty_region_item_suspend_update(ptr noundef nonnull, i1 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local void @arm_2d_helper_dirty_region_transform_on_frame_start(ptr noundef nonnull %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = icmp ne ptr null, %5
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  br label %9

8:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 4877, ptr noundef @__PRETTY_FUNCTION__.arm_2d_helper_dirty_region_transform_on_frame_start) #3
  unreachable

9:                                                ; preds = %7
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %10, i32 0, i32 3
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %12, i32 0, i32 4
  %14 = getelementptr inbounds %struct.anon.39, ptr %13, i32 0, i32 5
  %15 = load i8, ptr %14, align 8, !tbaa !9, !range !19, !noundef !20
  %16 = trunc i8 %15 to i1
  %17 = xor i1 %16, true
  %18 = call zeroext i1 @arm_2d_helper_dirty_region_item_suspend_update(ptr noundef %11, i1 noundef zeroext %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %19

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

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %56

24:                                               ; preds = %19
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %25, i32 0, i32 4
  %27 = getelementptr inbounds %struct.anon.39, ptr %26, i32 0, i32 5
  %28 = load i8, ptr %27, align 8, !tbaa !9, !range !19, !noundef !20
  %29 = trunc i8 %28 to i1
  br i1 %29, label %30, label %55

30:                                               ; preds = %24
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %31, i32 0, i32 4
  %33 = getelementptr inbounds %struct.anon.39, ptr %32, i32 0, i32 5
  store i8 0, ptr %33, align 8, !tbaa !9
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %34, i32 0, i32 4
  %36 = getelementptr inbounds %struct.anon.39, ptr %35, i32 0, i32 2
  %37 = getelementptr inbounds %struct.anon.40, ptr %36, i32 0, i32 0
  %38 = load float, ptr %37, align 8, !tbaa !23
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %39, i32 0, i32 0
  store float %38, ptr %40, align 8, !tbaa !24
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %41, i32 0, i32 4
  %43 = getelementptr inbounds %struct.anon.39, ptr %42, i32 0, i32 3
  %44 = getelementptr inbounds %struct.anon.41, ptr %43, i32 0, i32 0
  %45 = load float, ptr %44, align 8, !tbaa !25
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %46, i32 0, i32 1
  store float %45, ptr %47, align 4, !tbaa !26
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %48, i32 0, i32 4
  %50 = getelementptr inbounds %struct.anon.39, ptr %49, i32 0, i32 4
  %51 = getelementptr inbounds %struct.anon.42, ptr %50, i32 0, i32 0
  %52 = load float, ptr %51, align 8, !tbaa !27
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.arm_2d_helper_dirty_region_transform_t, ptr %53, i32 0, i32 2
  store float %52, ptr %54, align 8, !tbaa !28
  br label %55

55:                                               ; preds = %30, %24
  br label %19, !llvm.loop !29

56:                                               ; preds = %23
  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, !18, i64 112}
!10 = !{!"arm_2d_helper_dirty_region_transform_t", !11, i64 0, !7, i64 4, !11, i64 8, !12, i64 16, !16, i64 72}
!11 = !{!"float", !7, i64 0}
!12 = !{!"arm_2d_helper_dirty_region_item_t", !13, i64 0, !14, i64 48}
!13 = !{!"", !6, i64 0, !6, i64 8, !7, i64 16, !14, i64 32, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 40, !7, i64 41, !15, i64 42}
!14 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!15 = !{!"short", !7, i64 0}
!16 = !{!"", !6, i64 0, !6, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !18, i64 40}
!17 = !{!"", !11, i64 0, !11, i64 4}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!10, !11, i64 88}
!24 = !{!10, !11, i64 0}
!25 = !{!10, !11, i64 96}
!26 = !{!7, !7, i64 0}
!27 = !{!10, !11, i64 104}
!28 = !{!10, !11, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
declare dso_local zeroext i1 @arm_2d_helper_dirty_region_item_suspend_update(ptr noundef nonnull, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @arm_2d_helper_dirty_region_transform_on_frame_start(ptr noundef nonnull %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = getelementptr inbounds i8, ptr %0, i64 112
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !18, !noundef !19
  %5 = trunc nuw i8 %4 to i1
  %6 = xor i1 %5, true
  %7 = tail call zeroext i1 @arm_2d_helper_dirty_region_item_suspend_update(ptr noundef %2, i1 noundef zeroext %6)
  %.promoted = load i8, ptr %3, align 8, !tbaa !5
  %8 = trunc nuw i8 %.promoted to i1
  br i1 %8, label %9, label %18

9:                                                ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = getelementptr inbounds i8, ptr %0, i64 104
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  %13 = getelementptr inbounds i8, ptr %0, i64 96
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  store i8 0, ptr %3, align 8, !tbaa !5
  %15 = load float, ptr %14, align 8, !tbaa !20
  store float %15, ptr %0, align 8, !tbaa !21
  %16 = load float, ptr %13, align 8, !tbaa !22
  store float %16, ptr %12, align 4, !tbaa !23
  %17 = load float, ptr %11, align 8, !tbaa !24
  store float %17, ptr %10, align 8, !tbaa !25
  br label %18

18:                                               ; preds = %9, %1
  ret void
}

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

!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, !17, i64 112}
!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 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!6, !7, i64 88}
!21 = !{!6, !7, i64 0}
!22 = !{!6, !7, i64 96}
!23 = !{!8, !8, i64 0}
!24 = !{!6, !7, i64 104}
!25 = !{!6, !7, i64 8}


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