; LLVM IR from ARM-software/Arm-2D :: examples/common/controls (spin_zoom_widget)

; 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.spin_zoom_widget_t = type { %struct.anon, %struct.anon.7 }
%struct.anon = type { %struct.spin_zoom_widget_cfg_t }
%struct.spin_zoom_widget_cfg_t = type { ptr, %struct.anon.0, ptr, %struct.anon.2, i32 }
%struct.anon.0 = type { ptr, ptr, %union.anon, %union.anon.1 }
%union.anon = type { %struct.arm_2d_point_float_t }
%struct.arm_2d_point_float_t = type { float, float }
%union.anon.1 = type { i16 }
%struct.anon.2 = type { %struct.anon.3, %struct.anon.4, %struct.anon.5 }
%struct.anon.3 = type { float, i32 }
%struct.anon.4 = type { float, i32 }
%struct.anon.5 = type { float, %union.anon.6, float }
%union.anon.6 = type { float }
%struct.anon.7 = type { %union.anon.8, %struct.arm_2d_helper_dirty_region_transform_t }
%union.anon.8 = type { %struct.arm_2d_op_trans_msk_opa_t }
%struct.arm_2d_op_trans_msk_opa_t = type { %struct.arm_2d_op_core_t, %struct.anon.30, %struct.anon.31, %union.anon.32, %struct.anon.34, %struct.anon.35, %struct.__arm_2d_transform_info_t, i8 }
%struct.arm_2d_op_core_t = type { [40 x i8], i64 }
%struct.anon.30 = type { ptr, ptr }
%struct.anon.31 = type { ptr }
%union.anon.32 = type { %struct.anon.33 }
%struct.anon.33 = type { i32 }
%struct.anon.34 = type { ptr, %struct.arm_2d_tile_t }
%struct.arm_2d_tile_t = type { %union.anon.14, %union.anon.25, %union.anon.28 }
%union.anon.14 = type { %struct.anon.15 }
%struct.anon.15 = type { i8, %union.arm_2d_color_info_t, %union.anon.18 }
%union.arm_2d_color_info_t = type { %struct.anon.16 }
%struct.anon.16 = type { i8 }
%union.anon.18 = type { i16 }
%union.anon.25 = type { %struct.arm_2d_region_t }
%struct.arm_2d_region_t = type { %union.anon.26, %union.anon.27 }
%union.anon.26 = type { %struct.arm_2d_location_t }
%struct.arm_2d_location_t = type { i16, i16 }
%union.anon.27 = type { %struct.arm_2d_size_t }
%struct.arm_2d_size_t = type { i16, i16 }
%union.anon.28 = type { ptr }
%struct.anon.35 = type { ptr, ptr }
%struct.__arm_2d_transform_info_t = type { float, float, float, %struct.arm_2d_point_float_t, %union.anon.29, [40 x i8] }
%union.anon.29 = type { i32 }
%struct.arm_2d_helper_dirty_region_transform_t = type { float, %union.anon.36, float, [4 x i8], %struct.arm_2d_helper_dirty_region_item_t, [48 x i8] }
%union.anon.36 = type { float }
%struct.arm_2d_helper_dirty_region_item_t = type { [48 x i8], %struct.arm_2d_region_t }
%struct.spin_zoom_widget_mode_t = type { ptr }

@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1
@__PRETTY_FUNCTION__.spin_zoom_widget_show_with_fp_pivot = external hidden unnamed_addr constant [150 x i8], align 1

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

declare ptr @arm_2d_get_default_frame_buffer() #1

; Function Attrs: nounwind uwtable
define dso_local void @spin_zoom_widget_show_with_fp_pivot(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i8 %4, ptr %10, align 1, !tbaa !9
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = ptrtoint ptr %11 to i64
  %13 = icmp eq i64 -1, %12
  br i1 %13, label %14, label %16

14:                                               ; preds = %5
  %15 = call ptr @arm_2d_get_default_frame_buffer()
  store ptr %15, ptr %7, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %14, %5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = icmp eq ptr null, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  br label %60

20:                                               ; preds = %16
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = icmp ne ptr null, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  br label %25

24:                                               ; preds = %20
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 273, ptr noundef @__PRETTY_FUNCTION__.spin_zoom_widget_show_with_fp_pivot) #3
  unreachable

25:                                               ; preds = %23
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.spin_zoom_widget_t, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.anon, ptr %27, i32 0, i32 0
  %29 = getelementptr inbounds %struct.spin_zoom_widget_cfg_t, ptr %28, i32 0, i32 2
  %30 = load ptr, ptr %29, align 8, !tbaa !10
  %31 = icmp ne ptr null, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %25
  br label %34

33:                                               ; preds = %25
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 274, ptr noundef @__PRETTY_FUNCTION__.spin_zoom_widget_show_with_fp_pivot) #3
  unreachable

34:                                               ; preds = %32
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.spin_zoom_widget_t, ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %struct.anon, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %struct.spin_zoom_widget_cfg_t, ptr %37, i32 0, i32 2
  %39 = load ptr, ptr %38, align 8, !tbaa !10
  %40 = getelementptr inbounds %struct.spin_zoom_widget_mode_t, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !24
  %42 = icmp eq ptr null, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %34
  br label %58

44:                                               ; preds = %34
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.spin_zoom_widget_t, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %struct.anon, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %struct.spin_zoom_widget_cfg_t, ptr %47, i32 0, i32 2
  %49 = load ptr, ptr %48, align 8, !tbaa !10
  %50 = getelementptr inbounds %struct.spin_zoom_widget_mode_t, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !24
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = load i8, ptr %10, align 1, !tbaa !9
  %57 = call i32 %51(ptr noundef %52, ptr noundef %53, ptr noundef %54, ptr noundef %55, i8 noundef zeroext %56)
  br label %58

58:                                               ; preds = %44, %43
  %59 = phi i32 [ 0, %43 ], [ %57, %44 ]
  br label %60

60:                                               ; preds = %58, %19
  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 = { "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 = { 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 }

!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, !6, i64 40}
!11 = !{!"spin_zoom_widget_t", !12, i64 0, !20, i64 80}
!12 = !{!"", !13, i64 0}
!13 = !{!"spin_zoom_widget_cfg_t", !6, i64 0, !14, i64 8, !6, i64 40, !15, i64 48, !18, i64 76}
!14 = !{!"", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 24}
!15 = !{!"", !16, i64 0, !16, i64 8, !19, i64 16}
!16 = !{!"", !17, i64 0, !18, i64 4}
!17 = !{!"float", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"", !17, i64 0, !7, i64 4, !17, i64 8}
!20 = !{!"", !7, i64 0, !21, i64 200}
!21 = !{!"arm_2d_helper_dirty_region_transform_t", !17, i64 0, !7, i64 4, !17, i64 8, !22, i64 16, !7, i64 72}
!22 = !{!"arm_2d_helper_dirty_region_item_t", !7, i64 0, !23, i64 48}
!23 = !{!"arm_2d_region_t", !7, i64 0, !7, i64 4}
!24 = !{!25, !6, i64 0}
!25 = !{!"spin_zoom_widget_mode_t", !6, i64 0}


; 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.1 = external hidden unnamed_addr constant [97 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [34 x i8], align 1
@__PRETTY_FUNCTION__.spin_zoom_widget_show_with_fp_pivot = external hidden unnamed_addr constant [150 x i8], align 1

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

declare ptr @arm_2d_get_default_frame_buffer() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @spin_zoom_widget_show_with_fp_pivot(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4) local_unnamed_addr #2 {
  %6 = icmp eq ptr %1, inttoptr (i64 -1 to ptr)
  br i1 %6, label %7, label %.thread

7:                                                ; preds = %5
  %8 = tail call ptr @arm_2d_get_default_frame_buffer() #3
  %9 = icmp eq ptr %8, null
  br i1 %9, label %18, label %.thread

.thread:                                          ; preds = %5, %7
  %.013 = phi ptr [ %8, %7 ], [ %1, %5 ]
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %13

12:                                               ; preds = %.thread
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 274, ptr noundef nonnull @__PRETTY_FUNCTION__.spin_zoom_widget_show_with_fp_pivot) #4
  unreachable

13:                                               ; preds = %.thread
  %14 = load ptr, ptr %11, align 8, !tbaa !22
  %15 = icmp eq ptr %14, null
  br i1 %15, label %18, label %16

16:                                               ; preds = %13
  %17 = tail call i32 %14(ptr noundef nonnull %0, ptr noundef nonnull %.013, ptr noundef %2, ptr noundef %3, i8 noundef zeroext %4) #3
  br label %18

18:                                               ; preds = %16, %13, %7
  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 = { "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 = { 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 = { nounwind }
attributes #4 = { 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, !9, i64 40}
!6 = !{!"spin_zoom_widget_t", !7, i64 0, !18, i64 80}
!7 = !{!"", !8, i64 0}
!8 = !{!"spin_zoom_widget_cfg_t", !9, i64 0, !12, i64 8, !9, i64 40, !13, i64 48, !16, i64 76}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"", !9, i64 0, !9, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!"", !14, i64 0, !14, i64 8, !17, i64 16}
!14 = !{!"", !15, i64 0, !16, i64 4}
!15 = !{!"float", !10, i64 0}
!16 = !{!"int", !10, i64 0}
!17 = !{!"", !15, i64 0, !10, i64 4, !15, i64 8}
!18 = !{!"", !10, i64 0, !19, i64 200}
!19 = !{!"arm_2d_helper_dirty_region_transform_t", !15, i64 0, !10, i64 4, !15, i64 8, !20, i64 16, !10, i64 72}
!20 = !{!"arm_2d_helper_dirty_region_item_t", !10, i64 0, !21, i64 48}
!21 = !{!"arm_2d_region_t", !10, i64 0, !10, i64 4}
!22 = !{!23, !9, i64 0}
!23 = !{!"spin_zoom_widget_mode_t", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass