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

@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [97 x i8], align 1
@__PRETTY_FUNCTION__.spin_zoom_widget_init = external hidden unnamed_addr constant [75 x i8], align 1

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

7:                                                ; preds = %2
  br label %9

8:                                                ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 125, ptr noundef @__PRETTY_FUNCTION__.spin_zoom_widget_init) #5
  unreachable

9:                                                ; preds = %7
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 400, i1 false)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.spin_zoom_widget_t, ptr %11, i32 0, i32 0
  %13 = getelementptr inbounds %struct.anon, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %14, i64 80, i1 false), !tbaa.struct !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.spin_zoom_widget_t, ptr %15, i32 0, i32 1
  %17 = getelementptr inbounds %struct.anon.7, ptr %16, i32 0, i32 0
  %18 = call ptr @arm_2d_op_init(ptr noundef %17, i64 noundef 200)
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; 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) #3

declare ptr @arm_2d_op_init(ptr noundef, i64 noundef) #4

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 nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 #5 = { 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 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !10, i64 32, i64 2, !10, i64 40, i64 8, !5, i64 48, i64 4, !11, i64 52, i64 4, !13, i64 56, i64 4, !11, i64 60, i64 4, !13, i64 64, i64 4, !11, i64 68, i64 4, !10, i64 72, i64 4, !11, i64 76, i64 4, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, 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"

; Function Attrs: nounwind uwtable
define dso_local void @spin_zoom_widget_init(ptr noundef nonnull %0, ptr nocapture noundef nonnull readonly %1) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(400) %0, i8 0, i64 400, i1 false)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef nonnull align 8 dereferenceable(80) %1, i64 80, i1 false), !tbaa.struct !5
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  %4 = tail call ptr @arm_2d_op_init(ptr noundef nonnull %3, i64 noundef 200) #4
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

declare ptr @arm_2d_op_init(ptr noundef, i64 noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { 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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6, i64 16, i64 8, !6, i64 24, i64 8, !10, i64 32, i64 2, !10, i64 40, i64 8, !6, i64 48, i64 4, !11, i64 52, i64 4, !13, i64 56, i64 4, !11, i64 60, i64 4, !13, i64 64, i64 4, !11, i64 68, i64 4, !10, i64 72, i64 4, !11, i64 76, i64 4, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !8, i64 0}


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