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

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

; Function Attrs: nounwind uwtable
define dso_local void @createPID(ptr dead_on_unwind noalias writable sret(%struct.PID_t) align 4 %0, float noundef %1, float noundef %2, float noundef %3, i16 noundef zeroext %4, i32 noundef %5, i16 noundef zeroext %6, i16 noundef zeroext %7) #0 {
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca i16, align 2
  %13 = alloca i32, align 4
  %14 = alloca i16, align 2
  %15 = alloca i16, align 2
  store float %1, ptr %9, align 4, !tbaa !5
  store float %2, ptr %10, align 4, !tbaa !5
  store float %3, ptr %11, align 4, !tbaa !5
  store i16 %4, ptr %12, align 2, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !11
  store i16 %6, ptr %14, align 2, !tbaa !9
  store i16 %7, ptr %15, align 2, !tbaa !9
  %16 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 0
  %17 = load float, ptr %9, align 4, !tbaa !5
  store float %17, ptr %16, align 4, !tbaa !13
  %18 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 1
  %19 = load float, ptr %10, align 4, !tbaa !5
  store float %19, ptr %18, align 4, !tbaa !15
  %20 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 2
  %21 = load float, ptr %11, align 4, !tbaa !5
  store float %21, ptr %20, align 4, !tbaa !16
  %22 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 3
  %23 = load i16, ptr %12, align 2, !tbaa !9
  store i16 %23, ptr %22, align 4, !tbaa !17
  %24 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 4
  store i16 0, ptr %24, align 2, !tbaa !9
  %25 = getelementptr inbounds i16, ptr %24, i64 1
  store i16 0, ptr %25, align 2, !tbaa !9
  %26 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 5
  store float 0x3F847AE140000000, ptr %26, align 4, !tbaa !18
  %27 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 6
  store i16 0, ptr %27, align 2, !tbaa !9
  %28 = getelementptr inbounds i16, ptr %27, i64 1
  store i16 0, ptr %28, align 2, !tbaa !9
  %29 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 7
  store float 0.000000e+00, ptr %29, align 4, !tbaa !19
  %30 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 8
  store float 0.000000e+00, ptr %30, align 4, !tbaa !20
  %31 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 9
  store float 0.000000e+00, ptr %31, align 4, !tbaa !21
  %32 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 10
  store i16 0, ptr %32, align 4, !tbaa !22
  %33 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 11
  %34 = load i16, ptr %14, align 2, !tbaa !9
  store i16 %34, ptr %33, align 2, !tbaa !23
  %35 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 12
  %36 = load i16, ptr %15, align 2, !tbaa !9
  store i16 %36, ptr %35, align 4, !tbaa !24
  %37 = getelementptr inbounds %struct.PID_t, ptr %0, i32 0, i32 13
  %38 = load i32, ptr %13, align 4, !tbaa !11
  store i32 %38, ptr %37, align 4, !tbaa !25
  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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"PID_t", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 12, !7, i64 14, !6, i64 20, !7, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !10, i64 40, !10, i64 42, !10, i64 44, !12, i64 48}
!15 = !{!14, !6, i64 4}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !10, i64 12}
!18 = !{!14, !6, i64 20}
!19 = !{!14, !6, i64 28}
!20 = !{!14, !6, i64 32}
!21 = !{!14, !6, i64 36}
!22 = !{!14, !10, i64 40}
!23 = !{!14, !10, i64 42}
!24 = !{!14, !10, i64 44}
!25 = !{!14, !12, i64 48}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @createPID(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.PID_t) align 4 %0, float noundef %1, float noundef %2, float noundef %3, i16 noundef zeroext %4, i32 noundef %5, i16 noundef zeroext %6, i16 noundef zeroext %7) local_unnamed_addr #0 {
  store float %1, ptr %0, align 4, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  store float %2, ptr %9, align 4, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  store float %3, ptr %10, align 4, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %0, i64 12
  store i16 %4, ptr %11, align 4, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 14
  store i16 0, ptr %12, align 2, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  store i16 0, ptr %13, align 4, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %0, i64 20
  store float 0x3F847AE140000000, ptr %14, align 4, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = getelementptr inbounds i8, ptr %0, i64 42
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(18) %15, i8 0, i64 18, i1 false)
  store i16 %6, ptr %16, align 2, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 44
  store i16 %7, ptr %17, align 4, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %5, ptr %18, align 4, !tbaa !19
  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 = !{!"PID_t", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !8, i64 14, !7, i64 20, !8, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !10, i64 40, !10, i64 42, !10, i64 44, !11, i64 48}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 12}
!15 = !{!10, !10, i64 0}
!16 = !{!6, !7, i64 20}
!17 = !{!6, !10, i64 42}
!18 = !{!6, !10, i64 44}
!19 = !{!6, !11, i64 48}


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