; 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_transform_t = type { %union.anon.44, float, float, %struct.anon.45 }
%union.anon.44 = type { %struct.arm_2d_helper_dirty_region_t }
%struct.arm_2d_helper_dirty_region_t = type { %struct.anon.33, %struct.arm_2d_helper_dirty_region_item_t }
%struct.anon.33 = type <{ %struct.arm_2d_region_list_item_t, ptr, ptr, i8, i32, [3 x i8] }>
%struct.arm_2d_region_list_item_t = type { ptr, %struct.anon.6, %struct.arm_2d_region_t, %struct.anon.7 }
%struct.anon.6 = type { ptr }
%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.7 = type { i8, i8, i16 }
%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.anon.45 = type { ptr, %struct.anon.46, %struct.anon.47, i8 }
%struct.anon.46 = type { float, float }
%struct.anon.47 = 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_transform_on_frame_begin = external hidden unnamed_addr constant [73 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 void @arm_2d_helper_dirty_region_on_frame_start(ptr noundef nonnull) #2

; Function Attrs: nounwind uwtable
define dso_local void @arm_2d_helper_transform_on_frame_begin(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 5075, ptr noundef @__PRETTY_FUNCTION__.arm_2d_helper_transform_on_frame_begin) #3
  unreachable

9:                                                ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %41, %9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds i32, ptr %11, i32 1
  store ptr %12, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %11, null
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %16, i32 0, i32 3
  %18 = getelementptr inbounds %struct.anon.45, ptr %17, i32 0, i32 3
  %19 = load i8, ptr %18, align 8, !tbaa !11, !range !17, !noundef !18
  %20 = trunc i8 %19 to i1
  br i1 %20, label %21, label %41

21:                                               ; preds = %15
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %22, i32 0, i32 3
  %24 = getelementptr inbounds %struct.anon.45, ptr %23, i32 0, i32 3
  store i8 0, ptr %24, align 8, !tbaa !11
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %25, i32 0, i32 3
  %27 = getelementptr inbounds %struct.anon.45, ptr %26, i32 0, i32 1
  %28 = getelementptr inbounds %struct.anon.46, ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 8, !tbaa !19
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %30, i32 0, i32 1
  store float %29, ptr %31, align 8, !tbaa !20
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %32, i32 0, i32 3
  %34 = getelementptr inbounds %struct.anon.45, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds %struct.anon.47, ptr %34, i32 0, i32 0
  %36 = load float, ptr %35, align 8, !tbaa !21
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %37, i32 0, i32 2
  store float %36, ptr %38, align 4, !tbaa !22
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.arm_2d_helper_transform_t, ptr %39, i32 0, i32 0
  call void @arm_2d_helper_dirty_region_on_frame_start(ptr noundef %40)
  br label %41

41:                                               ; preds = %21, %15
  br label %10, !llvm.loop !23

42:                                               ; preds = %14
  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 = !{!"int", !7, i64 0}
!11 = !{!12, !16, i64 144}
!12 = !{!"", !7, i64 0, !13, i64 112, !13, i64 116, !14, i64 120}
!13 = !{!"float", !7, i64 0}
!14 = !{!"", !6, i64 0, !15, i64 8, !15, i64 16, !16, i64 24}
!15 = !{!"", !13, i64 0, !13, i64 4}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!12, !13, i64 128}
!20 = !{!12, !13, i64 112}
!21 = !{!12, !13, i64 136}
!22 = !{!12, !13, i64 116}
!23 = distinct !{!23, !24}
!24 = !{!"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 void @arm_2d_helper_dirty_region_on_frame_start(ptr noundef nonnull) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @arm_2d_helper_transform_on_frame_begin(ptr noundef nonnull %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 144
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !14, !noundef !15
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %.split10.loopexit, label %.split10

.split10:                                         ; preds = %1, %.split10.loopexit
  ret void

.split10.loopexit:                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 116
  %6 = getelementptr inbounds i8, ptr %0, i64 136
  %7 = getelementptr inbounds i8, ptr %0, i64 112
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  store i8 0, ptr %2, align 8, !tbaa !5
  %9 = load float, ptr %8, align 8, !tbaa !16
  store float %9, ptr %7, align 8, !tbaa !17
  %10 = load float, ptr %6, align 8, !tbaa !18
  store float %10, ptr %5, align 4, !tbaa !19
  tail call void @arm_2d_helper_dirty_region_on_frame_start(ptr noundef %0)
  br label %.split10
}

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, !13, i64 144}
!6 = !{!"", !7, i64 0, !9, i64 112, !9, i64 116, !10, i64 120}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 8, !12, i64 16, !13, i64 24}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"", !9, i64 0, !9, i64 4}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!6, !9, i64 128}
!17 = !{!6, !9, i64 112}
!18 = !{!6, !9, i64 136}
!19 = !{!6, !9, i64 116}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass