; LLVM IR from giusenso/Ball-Balancing-PID-System :: ball_tracker (ball_physic)

; 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.Ball = type { i32, [8 x i16], [8 x i16], [8 x i16], [8 x i16], i16, i16 }

; Function Attrs: nounwind uwtable
define dso_local void @createBall(ptr dead_on_unwind noalias writable sret(%struct.Ball) align 4 %0, i16 noundef zeroext %1, i16 noundef zeroext %2) #0 {
  %4 = alloca i16, align 2
  %5 = alloca i16, align 2
  store i16 %1, ptr %4, align 2, !tbaa !5
  store i16 %2, ptr %5, align 2, !tbaa !5
  %6 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 0
  store i32 0, ptr %6, align 4, !tbaa !9
  %7 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 1
  %8 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %8, ptr %7, align 2, !tbaa !5
  %9 = getelementptr inbounds i16, ptr %7, i64 1
  %10 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %10, ptr %9, align 2, !tbaa !5
  %11 = getelementptr inbounds i16, ptr %7, i64 2
  %12 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %12, ptr %11, align 2, !tbaa !5
  %13 = getelementptr inbounds i16, ptr %7, i64 3
  %14 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %14, ptr %13, align 2, !tbaa !5
  %15 = getelementptr inbounds i16, ptr %7, i64 4
  %16 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %16, ptr %15, align 2, !tbaa !5
  %17 = getelementptr inbounds i16, ptr %7, i64 5
  %18 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %18, ptr %17, align 2, !tbaa !5
  %19 = getelementptr inbounds i16, ptr %7, i64 6
  %20 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %20, ptr %19, align 2, !tbaa !5
  %21 = getelementptr inbounds i16, ptr %7, i64 7
  %22 = load i16, ptr %4, align 2, !tbaa !5
  store i16 %22, ptr %21, align 2, !tbaa !5
  %23 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 2
  %24 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %24, ptr %23, align 2, !tbaa !5
  %25 = getelementptr inbounds i16, ptr %23, i64 1
  %26 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %26, ptr %25, align 2, !tbaa !5
  %27 = getelementptr inbounds i16, ptr %23, i64 2
  %28 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %28, ptr %27, align 2, !tbaa !5
  %29 = getelementptr inbounds i16, ptr %23, i64 3
  %30 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %30, ptr %29, align 2, !tbaa !5
  %31 = getelementptr inbounds i16, ptr %23, i64 4
  %32 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %32, ptr %31, align 2, !tbaa !5
  %33 = getelementptr inbounds i16, ptr %23, i64 5
  %34 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %34, ptr %33, align 2, !tbaa !5
  %35 = getelementptr inbounds i16, ptr %23, i64 6
  %36 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %36, ptr %35, align 2, !tbaa !5
  %37 = getelementptr inbounds i16, ptr %23, i64 7
  %38 = load i16, ptr %5, align 2, !tbaa !5
  store i16 %38, ptr %37, align 2, !tbaa !5
  %39 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 3
  store i16 0, ptr %39, align 2, !tbaa !5
  %40 = getelementptr inbounds i16, ptr %39, i64 1
  store i16 0, ptr %40, align 2, !tbaa !5
  %41 = getelementptr inbounds i16, ptr %39, i64 2
  store i16 0, ptr %41, align 2, !tbaa !5
  %42 = getelementptr inbounds i16, ptr %39, i64 3
  store i16 0, ptr %42, align 2, !tbaa !5
  %43 = getelementptr inbounds i16, ptr %39, i64 4
  store i16 0, ptr %43, align 2, !tbaa !5
  %44 = getelementptr inbounds i16, ptr %39, i64 5
  store i16 0, ptr %44, align 2, !tbaa !5
  %45 = getelementptr inbounds i16, ptr %39, i64 6
  store i16 0, ptr %45, align 2, !tbaa !5
  %46 = getelementptr inbounds i16, ptr %39, i64 7
  store i16 0, ptr %46, align 2, !tbaa !5
  %47 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 4
  store i16 0, ptr %47, align 2, !tbaa !5
  %48 = getelementptr inbounds i16, ptr %47, i64 1
  store i16 0, ptr %48, align 2, !tbaa !5
  %49 = getelementptr inbounds i16, ptr %47, i64 2
  store i16 0, ptr %49, align 2, !tbaa !5
  %50 = getelementptr inbounds i16, ptr %47, i64 3
  store i16 0, ptr %50, align 2, !tbaa !5
  %51 = getelementptr inbounds i16, ptr %47, i64 4
  store i16 0, ptr %51, align 2, !tbaa !5
  %52 = getelementptr inbounds i16, ptr %47, i64 5
  store i16 0, ptr %52, align 2, !tbaa !5
  %53 = getelementptr inbounds i16, ptr %47, i64 6
  store i16 0, ptr %53, align 2, !tbaa !5
  %54 = getelementptr inbounds i16, ptr %47, i64 7
  store i16 0, ptr %54, align 2, !tbaa !5
  %55 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 5
  store i16 0, ptr %55, align 4, !tbaa !12
  %56 = getelementptr inbounds %struct.Ball, ptr %0, i32 0, i32 6
  store i16 0, ptr %56, align 2, !tbaa !13
  ret void
}

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, !6, i64 0}
!6 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"Ball", !11, i64 0, !7, i64 4, !7, i64 20, !7, i64 36, !7, i64 52, !6, i64 68, !6, i64 70}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 68}
!13 = !{!10, !6, i64 70}


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

%struct.Ball = type { i32, [8 x i16], [8 x i16], [8 x i16], [8 x i16], i16, i16 }

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @createBall(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.Ball) align 4 %0, i16 noundef zeroext %1, i16 noundef zeroext %2) local_unnamed_addr #0 {
  store i32 0, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = insertelement <8 x i16> poison, i16 %1, i64 0
  %6 = shufflevector <8 x i16> %5, <8 x i16> poison, <8 x i32> zeroinitializer
  store <8 x i16> %6, ptr %4, align 4, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  %8 = insertelement <8 x i16> poison, i16 %2, i64 0
  %9 = shufflevector <8 x i16> %8, <8 x i16> poison, <8 x i32> zeroinitializer
  store <8 x i16> %9, ptr %7, align 4, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(36) %10, i8 0, i64 36, i1 false)
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !7, i64 0}
!6 = !{!"Ball", !7, i64 0, !8, i64 4, !8, i64 20, !8, i64 36, !8, i64 52, !10, i64 68, !10, i64 70}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass