; LLVM IR from ARM-software/Arm-2D :: Library/Source/arm_2d.ll_ (arm_2d_sub_task_depose)

; 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_op_core_t = type { %struct.anon, i64 }
%struct.anon = type { ptr, ptr, %struct.anon.0, i8, %union.arm_2d_op_status_t, %struct.arm_2d_op_evt_t }
%struct.anon.0 = type { i8 }
%union.arm_2d_op_status_t = type { %struct.anon.1 }
%struct.anon.1 = type { i16 }
%struct.arm_2d_op_evt_t = type { ptr, ptr }
%struct.anon.2 = type { %union.arm_2d_color_info_t, %union.anon, i8, i8, %union.anon.6, %union.anon.10 }
%union.arm_2d_color_info_t = type { %struct.anon.3 }
%struct.anon.3 = type { i8 }
%union.anon = type { %struct.anon.5 }
%struct.anon.5 = type { i8 }
%union.anon.6 = type { %struct.anon.7 }
%struct.anon.7 = type { i8, i8 }
%union.anon.10 = type { [2 x ptr] }
%struct.arm_2d_op_msk_t = type { %struct.arm_2d_op_core_t, %struct.anon.14, %struct.anon.15 }
%struct.anon.14 = type { ptr, ptr }
%struct.anon.15 = type { ptr }
%struct.arm_2d_op_src_t = type { %struct.arm_2d_op_core_t, %struct.anon.16, %struct.anon.17, i32 }
%struct.anon.16 = type { ptr, ptr }
%struct.anon.17 = type { ptr }
%struct.arm_2d_op_src_msk_t = type { %struct.arm_2d_op_core_t, %struct.anon.18, %struct.anon.19, i32, %struct.anon.20 }
%struct.anon.18 = type { ptr, ptr }
%struct.anon.19 = type { ptr }
%struct.anon.20 = type { ptr, ptr }
%struct.arm_2d_op_src_orig_t = type { %struct.arm_2d_op_core_t, %struct.anon.21, %struct.anon.22, i32, %struct.anon.23 }
%struct.anon.21 = type { ptr, ptr }
%struct.anon.22 = type { ptr }
%struct.anon.23 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.24, %union.anon.33, %union.anon.36 }
%union.anon.24 = type { %struct.anon.25 }
%struct.anon.25 = type { i8, %union.arm_2d_color_info_t, %union.anon.26 }
%union.anon.26 = type { i16 }
%union.anon.33 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.34, %union.anon.35 }
%union.anon.34 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.35 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.36 = type { ptr }
%struct.arm_2d_op_src_orig_msk_t = type { %struct.arm_2d_op_core_t, %struct.anon.37, %struct.anon.38, i32, %struct.anon.39, %struct.anon.40 }
%struct.anon.37 = type { ptr, ptr }
%struct.anon.38 = type { ptr }
%struct.anon.39 = type { ptr, %struct.arm_2d_tile_t }
%struct.anon.40 = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_sub_task_depose = external hidden unnamed_addr constant [50 x i8], align 1

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

10:                                               ; preds = %1
  br label %12

11:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 280, ptr noundef @__PRETTY_FUNCTION__.__arm_2d_sub_task_depose) #3
  unreachable

12:                                               ; preds = %10
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.arm_2d_op_core_t, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.anon, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.anon.2, ptr %16, i32 0, i32 1
  %18 = load i8, ptr %17, align 1, !tbaa !15
  %19 = zext i8 %18 to i32
  %20 = and i32 %19, 31
  switch i32 %20, label %67 [
    i32 10, label %21
    i32 3, label %27
    i32 7, label %33
    i32 11, label %33
    i32 15, label %33
    i32 19, label %47
    i32 23, label %53
    i32 27, label %53
    i32 31, label %53
  ]

21:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %22, ptr %3, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.arm_2d_op_msk_t, ptr %23, i32 0, i32 2
  %25 = getelementptr inbounds %struct.anon.15, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  call void @__depose_virtual_resource(ptr noundef %26)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %67

27:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %28, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.arm_2d_op_src_t, ptr %29, i32 0, i32 2
  %31 = getelementptr inbounds %struct.anon.17, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  call void @__depose_virtual_resource(ptr noundef %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %67

33:                                               ; preds = %12, %12, %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %34, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.arm_2d_op_src_msk_t, ptr %35, i32 0, i32 2
  %37 = getelementptr inbounds %struct.anon.19, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !23
  call void @__depose_virtual_resource(ptr noundef %38)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.arm_2d_op_src_msk_t, ptr %39, i32 0, i32 4
  %41 = getelementptr inbounds %struct.anon.20, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !25
  call void @__depose_virtual_resource(ptr noundef %42)
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.arm_2d_op_src_msk_t, ptr %43, i32 0, i32 4
  %45 = getelementptr inbounds %struct.anon.20, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !26
  call void @__depose_virtual_resource(ptr noundef %46)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %67

47:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %48, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.arm_2d_op_src_orig_t, ptr %49, i32 0, i32 4
  %51 = getelementptr inbounds %struct.anon.23, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !27
  call void @__depose_virtual_resource(ptr noundef %52)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %67

53:                                               ; preds = %12, %12, %12
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.arm_2d_op_src_orig_msk_t, ptr %55, i32 0, i32 4
  %57 = getelementptr inbounds %struct.anon.39, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !31
  call void @__depose_virtual_resource(ptr noundef %58)
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.arm_2d_op_src_orig_msk_t, ptr %59, i32 0, i32 5
  %61 = getelementptr inbounds %struct.anon.40, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !33
  call void @__depose_virtual_resource(ptr noundef %62)
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.arm_2d_op_src_orig_msk_t, ptr %63, i32 0, i32 5
  %65 = getelementptr inbounds %struct.anon.40, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !34
  call void @__depose_virtual_resource(ptr noundef %66)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %67

67:                                               ; preds = %53, %47, %33, %27, %21, %12
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
declare hidden void @__depose_virtual_resource(ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 8}
!10 = !{!"arm_2d_op_core_t", !11, i64 0, !14, i64 40}
!11 = !{!"", !6, i64 0, !6, i64 8, !12, i64 16, !7, i64 17, !7, i64 18, !13, i64 24}
!12 = !{!"", !7, i64 0}
!13 = !{!"arm_2d_op_evt_t", !6, i64 0, !6, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !6, i64 64}
!17 = !{!"arm_2d_op_msk_t", !10, i64 0, !18, i64 48, !19, i64 64}
!18 = !{!"", !6, i64 0, !6, i64 8}
!19 = !{!"", !6, i64 0}
!20 = !{!21, !6, i64 64}
!21 = !{!"arm_2d_op_src_t", !10, i64 0, !18, i64 48, !19, i64 64, !22, i64 72}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !6, i64 64}
!24 = !{!"arm_2d_op_src_msk_t", !10, i64 0, !18, i64 48, !19, i64 64, !22, i64 72, !18, i64 80}
!25 = !{!24, !6, i64 80}
!26 = !{!24, !6, i64 88}
!27 = !{!28, !6, i64 80}
!28 = !{!"arm_2d_op_src_orig_t", !10, i64 0, !18, i64 48, !19, i64 64, !22, i64 72, !29, i64 80}
!29 = !{!"", !6, i64 0, !30, i64 8}
!30 = !{!"arm_2d_tile_t", !7, i64 0, !7, i64 4, !7, i64 16}
!31 = !{!32, !6, i64 80}
!32 = !{!"arm_2d_op_src_orig_msk_t", !10, i64 0, !18, i64 48, !19, i64 64, !22, i64 72, !29, i64 80, !18, i64 112}
!33 = !{!32, !6, i64 112}
!34 = !{!32, !6, i64 120}


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

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.__arm_2d_sub_task_depose = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__arm_2d_sub_task_depose(ptr noundef readonly %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %3

2:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 280, ptr noundef nonnull @__PRETTY_FUNCTION__.__arm_2d_sub_task_depose) #2
  unreachable

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 1
  %7 = load i8, ptr %6, align 1, !tbaa !14
  %8 = and i8 %7, 31
  switch i8 %8, label %22 [
    i8 10, label %.sink.split
    i8 3, label %.sink.split
    i8 7, label %9
    i8 11, label %9
    i8 15, label %9
    i8 19, label %14
    i8 23, label %15
    i8 27, label %15
    i8 31, label %15
  ]

9:                                                ; preds = %3, %3, %3
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  tail call void @__depose_virtual_resource(ptr noundef %11)
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  %13 = load ptr, ptr %12, align 8, !tbaa !20
  tail call void @__depose_virtual_resource(ptr noundef %13)
  br label %.sink.split

14:                                               ; preds = %3
  br label %.sink.split

15:                                               ; preds = %3, %3, %3
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  %17 = load ptr, ptr %16, align 8, !tbaa !21
  tail call void @__depose_virtual_resource(ptr noundef %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 112
  %19 = load ptr, ptr %18, align 8, !tbaa !25
  tail call void @__depose_virtual_resource(ptr noundef %19)
  br label %.sink.split

.sink.split:                                      ; preds = %3, %3, %9, %14, %15
  %.sink = phi i64 [ 120, %15 ], [ 80, %14 ], [ 88, %9 ], [ 64, %3 ], [ 64, %3 ]
  %20 = getelementptr inbounds i8, ptr %0, i64 %.sink
  %21 = load ptr, ptr %20, align 8, !tbaa !26
  tail call void @__depose_virtual_resource(ptr noundef %21)
  br label %22

22:                                               ; preds = %.sink.split, %3
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @__depose_virtual_resource(ptr noundef) local_unnamed_addr #0

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 = { 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 #2 = { noreturn 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, !8, i64 8}
!6 = !{!"arm_2d_op_core_t", !7, i64 0, !13, i64 40}
!7 = !{!"", !8, i64 0, !8, i64 8, !11, i64 16, !9, i64 17, !9, i64 18, !12, i64 24}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"", !9, i64 0}
!12 = !{!"arm_2d_op_evt_t", !8, i64 0, !8, i64 8}
!13 = !{!"long", !9, i64 0}
!14 = !{!9, !9, i64 0}
!15 = !{!16, !8, i64 64}
!16 = !{!"arm_2d_op_src_msk_t", !6, i64 0, !17, i64 48, !18, i64 64, !19, i64 72, !17, i64 80}
!17 = !{!"", !8, i64 0, !8, i64 8}
!18 = !{!"", !8, i64 0}
!19 = !{!"int", !9, i64 0}
!20 = !{!16, !8, i64 80}
!21 = !{!22, !8, i64 80}
!22 = !{!"arm_2d_op_src_orig_msk_t", !6, i64 0, !17, i64 48, !18, i64 64, !19, i64 72, !23, i64 80, !17, i64 112}
!23 = !{!"", !8, i64 0, !24, i64 8}
!24 = !{!"arm_2d_tile_t", !9, i64 0, !9, i64 4, !9, i64 16}
!25 = !{!22, !8, i64 112}
!26 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass