; 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_pfb_t = type { %struct.anon, %struct.anon.30 }
%struct.anon = type { %struct.arm_2d_helper_pfb_cfg_t, %struct.anon.4 }
%struct.arm_2d_helper_pfb_cfg_t = type { %struct.arm_2d_region_t, %struct.anon.1, %struct.anon.2, %struct.arm_2d_helper_pfb_dependency_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.1 = type <{ ptr, %struct.arm_2d_size_t, i64, [4 x i8] }>
%struct.anon.2 = type { ptr, i8 }
%struct.arm_2d_helper_pfb_dependency_t = type { %struct.arm_2d_helper_render_evt_t, %struct.arm_2d_helper_draw_evt_t, %struct.arm_2d_evt_t, %struct.arm_2d_evt_t, %struct.anon.3, %struct.arm_2d_helper_before_flushing_evt_t }
%struct.arm_2d_helper_render_evt_t = type { ptr, ptr }
%struct.arm_2d_helper_draw_evt_t = type { ptr, ptr }
%struct.arm_2d_evt_t = type { ptr, ptr }
%struct.anon.3 = type { %struct.arm_2d_helper_draw_evt_t, ptr }
%struct.arm_2d_helper_before_flushing_evt_t = type { ptr, ptr }
%struct.anon.4 = type { %struct.arm_2d_location_t, %struct.arm_2d_region_t, ptr, %struct.anon.5, %struct.arm_2d_tile_t, %struct.arm_2d_size_t, i32, i8, i8, i16, %struct.anon.21, %union.arm_2d_colour_t, i64, ptr, ptr, ptr, %struct.anon.29, ptr }
%struct.anon.5 = type { ptr, ptr, ptr, ptr, %struct.arm_2d_region_list_item_t }
%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.anon.7 = type { i8, i8, i16 }
%struct.arm_2d_tile_t = type { %union.anon.8, %union.anon.19, %union.anon.20 }
%union.anon.8 = type { %struct.anon.9 }
%struct.anon.9 = type { i8, %union.arm_2d_color_info_t, %union.anon.12 }
%union.arm_2d_color_info_t = type { %struct.anon.10 }
%struct.anon.10 = type { i8 }
%union.anon.12 = type { i16 }
%union.anon.19 = type { %struct.arm_2d_region_t }
%union.anon.20 = type { ptr }
%struct.anon.21 = type { i32 }
%union.arm_2d_colour_t = type { i32 }
%struct.anon.29 = type { ptr, ptr }
%struct.anon.30 = type { i64, i32, i32 }

@.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_pfb_update_dependency = external hidden unnamed_addr constant [126 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [21 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

11:                                               ; preds = %3
  br label %13

12:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 2695, ptr noundef @__PRETTY_FUNCTION__.arm_2d_helper_pfb_update_dependency) #4
  unreachable

13:                                               ; preds = %11
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = icmp ne ptr null, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  br label %18

17:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 2696, ptr noundef @__PRETTY_FUNCTION__.arm_2d_helper_pfb_update_dependency) #4
  unreachable

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

19:                                               ; preds = %89, %18
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds i32, ptr %20, i32 1
  store ptr %21, ptr %8, 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 %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %90

24:                                               ; preds = %19
  %25 = load i8, ptr %5, align 1, !tbaa !9
  %26 = zext i8 %25 to i32
  %27 = and i32 %26, 1
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %37

29:                                               ; preds = %24
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.arm_2d_helper_pfb_t, ptr %30, i32 0, i32 0
  %32 = getelementptr inbounds %struct.anon, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.arm_2d_helper_pfb_cfg_t, ptr %32, i32 0, i32 3
  %34 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %35, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 8 %36, i64 16, i1 false), !tbaa.struct !12
  br label %37

37:                                               ; preds = %29, %24
  %38 = load i8, ptr %5, align 1, !tbaa !9
  %39 = zext i8 %38 to i32
  %40 = and i32 %39, 2
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %50

42:                                               ; preds = %37
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arm_2d_helper_pfb_t, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.anon, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.arm_2d_helper_pfb_cfg_t, ptr %45, i32 0, i32 3
  %47 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %48, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %47, ptr align 8 %49, i64 16, i1 false), !tbaa.struct !12
  br label %50

50:                                               ; preds = %42, %37
  %51 = load i8, ptr %5, align 1, !tbaa !9
  %52 = zext i8 %51 to i32
  %53 = and i32 %52, 4
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %63

55:                                               ; preds = %50
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.arm_2d_helper_pfb_t, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.anon, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %struct.arm_2d_helper_pfb_cfg_t, ptr %58, i32 0, i32 3
  %60 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %61, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %60, ptr align 8 %62, i64 16, i1 false), !tbaa.struct !12
  br label %63

63:                                               ; preds = %55, %50
  %64 = load i8, ptr %5, align 1, !tbaa !9
  %65 = zext i8 %64 to i32
  %66 = and i32 %65, 16
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %76

68:                                               ; preds = %63
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.arm_2d_helper_pfb_t, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds %struct.anon, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.arm_2d_helper_pfb_cfg_t, ptr %71, i32 0, i32 3
  %73 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %72, i32 0, i32 3
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %74, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 8 %75, i64 16, i1 false), !tbaa.struct !12
  br label %76

76:                                               ; preds = %68, %63
  %77 = load i8, ptr %5, align 1, !tbaa !9
  %78 = zext i8 %77 to i32
  %79 = and i32 %78, 32
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %89

81:                                               ; preds = %76
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.arm_2d_helper_pfb_t, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.anon, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.arm_2d_helper_pfb_cfg_t, ptr %84, i32 0, i32 3
  %86 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %85, i32 0, i32 4
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.arm_2d_helper_pfb_dependency_t, ptr %87, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %86, ptr align 8 %88, i64 24, i1 false), !tbaa.struct !13
  br label %89

89:                                               ; preds = %81, %76
  br label %19, !llvm.loop !14

90:                                               ; preds = %23
  ret i32 0
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!13 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5}
!14 = distinct !{!14, !15}
!15 = !{!"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: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef i32 @arm_2d_helper_pfb_update_dependency(ptr nocapture noundef nonnull writeonly %0, i8 noundef zeroext %1, ptr nocapture noundef nonnull readonly %2) local_unnamed_addr #1 {
  %4 = zext i8 %1 to i32
  %5 = and i32 %4, 1
  %.not = icmp eq i32 %5, 0
  %6 = and i32 %4, 2
  %.not17 = icmp eq i32 %6, 0
  %7 = and i32 %4, 4
  %.not18 = icmp eq i32 %7, 0
  %8 = and i32 %4, 16
  %.not19 = icmp eq i32 %8, 0
  %9 = and i32 %4, 32
  %.not20 = icmp eq i32 %9, 0
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = getelementptr inbounds i8, ptr %2, i64 16
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  %13 = getelementptr inbounds i8, ptr %2, i64 32
  %14 = getelementptr inbounds i8, ptr %0, i64 96
  %15 = getelementptr inbounds i8, ptr %2, i64 48
  %16 = getelementptr inbounds i8, ptr %0, i64 112
  %17 = getelementptr inbounds i8, ptr %2, i64 64
  br i1 %.not, label %.split.us, label %.split

.split.us:                                        ; preds = %3
  br i1 %.not17, label %19, label %18

18:                                               ; preds = %.split.us
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11, i64 16, i1 false), !tbaa.struct !5
  br label %19

19:                                               ; preds = %18, %.split.us
  br i1 %.not18, label %21, label %20

20:                                               ; preds = %19
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %13, i64 16, i1 false), !tbaa.struct !5
  br label %21

21:                                               ; preds = %20, %19
  br i1 %.not19, label %23, label %22

22:                                               ; preds = %21
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %15, i64 16, i1 false), !tbaa.struct !5
  br label %23

23:                                               ; preds = %22, %21
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split:                                           ; preds = %3
  %24 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 16, i1 false)
  br i1 %.not17, label %.split.split.us, label %.split.split

.split.split.us:                                  ; preds = %.split
  br i1 %.not18, label %26, label %25

25:                                               ; preds = %.split.split.us
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %13, i64 16, i1 false), !tbaa.struct !5
  br label %26

26:                                               ; preds = %25, %.split.split.us
  br i1 %.not19, label %28, label %27

27:                                               ; preds = %26
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %15, i64 16, i1 false), !tbaa.struct !5
  br label %28

28:                                               ; preds = %27, %26
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split.split:                                     ; preds = %.split
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %11, i64 16, i1 false)
  br i1 %.not18, label %.split.split.split.us, label %.split.split.split

.split.split.split.us:                            ; preds = %.split.split
  br i1 %.not19, label %.split.split.split.us.split.us, label %.split.split.split.us.split

.split.split.split.us.split.us:                   ; preds = %.split.split.split.us
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split.split.split.us.split:                      ; preds = %.split.split.split.us
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %15, i64 16, i1 false), !tbaa.struct !5
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split.split.split:                               ; preds = %.split.split
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %13, i64 16, i1 false)
  br i1 %.not19, label %.split.split.split.split.us, label %.split.split.split.split

.split.split.split.split.us:                      ; preds = %.split.split.split
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split.split.split.split:                         ; preds = %.split.split.split
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %15, i64 16, i1 false)
  br i1 %.not20, label %.split22, label %.split22.sink.split

.split22.sink.split:                              ; preds = %.split.split.split.split.us, %.split.split.split.us.split, %.split.split.split.us.split.us, %28, %23, %.split.split.split.split
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %17, i64 24, i1 false)
  br label %.split22

.split22:                                         ; preds = %.split22.sink.split, %.split.split.split.split, %.split.split.split.split.us, %.split.split.split.us.split.us, %.split.split.split.us.split, %28, %23
  ret i32 0
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass