; LLVM IR from 66Lau/webots-short :: controllers/Lau_Bot (math_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.PidTypeDef = type { i8, float, float, float, float, float, float, float, float, float, float, float, [3 x float], [3 x float] }

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

13:                                               ; preds = %5
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %13, %5
  br label %68

17:                                               ; preds = %13
  %18 = load i8, ptr %7, align 1, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.PidTypeDef, ptr %19, i32 0, i32 0
  store i8 %18, ptr %20, align 4, !tbaa !12
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = getelementptr inbounds float, ptr %21, i64 0
  %23 = load float, ptr %22, align 4, !tbaa !10
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.PidTypeDef, ptr %24, i32 0, i32 1
  store float %23, ptr %25, align 4, !tbaa !14
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds float, ptr %26, i64 1
  %28 = load float, ptr %27, align 4, !tbaa !10
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.PidTypeDef, ptr %29, i32 0, i32 2
  store float %28, ptr %30, align 4, !tbaa !15
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 2
  %33 = load float, ptr %32, align 4, !tbaa !10
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.PidTypeDef, ptr %34, i32 0, i32 3
  store float %33, ptr %35, align 4, !tbaa !16
  %36 = load float, ptr %9, align 4, !tbaa !10
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.PidTypeDef, ptr %37, i32 0, i32 4
  store float %36, ptr %38, align 4, !tbaa !17
  %39 = load float, ptr %10, align 4, !tbaa !10
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.PidTypeDef, ptr %40, i32 0, i32 5
  store float %39, ptr %41, align 4, !tbaa !18
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.PidTypeDef, ptr %42, i32 0, i32 12
  %44 = getelementptr inbounds [3 x float], ptr %43, i64 0, i64 2
  store float 0.000000e+00, ptr %44, align 4, !tbaa !10
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.PidTypeDef, ptr %45, i32 0, i32 12
  %47 = getelementptr inbounds [3 x float], ptr %46, i64 0, i64 1
  store float 0.000000e+00, ptr %47, align 4, !tbaa !10
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.PidTypeDef, ptr %48, i32 0, i32 12
  %50 = getelementptr inbounds [3 x float], ptr %49, i64 0, i64 0
  store float 0.000000e+00, ptr %50, align 4, !tbaa !10
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.PidTypeDef, ptr %51, i32 0, i32 8
  store float 0.000000e+00, ptr %52, align 4, !tbaa !19
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.PidTypeDef, ptr %53, i32 0, i32 11
  store float 0.000000e+00, ptr %54, align 4, !tbaa !20
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.PidTypeDef, ptr %55, i32 0, i32 10
  store float 0.000000e+00, ptr %56, align 4, !tbaa !21
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.PidTypeDef, ptr %57, i32 0, i32 9
  store float 0.000000e+00, ptr %58, align 4, !tbaa !22
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.PidTypeDef, ptr %59, i32 0, i32 13
  %61 = getelementptr inbounds [3 x float], ptr %60, i64 0, i64 2
  store float 0.000000e+00, ptr %61, align 4, !tbaa !10
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.PidTypeDef, ptr %62, i32 0, i32 13
  %64 = getelementptr inbounds [3 x float], ptr %63, i64 0, i64 1
  store float 0.000000e+00, ptr %64, align 4, !tbaa !10
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.PidTypeDef, ptr %65, i32 0, i32 13
  %67 = getelementptr inbounds [3 x float], ptr %66, i64 0, i64 0
  store float 0.000000e+00, ptr %67, align 4, !tbaa !10
  br label %68

68:                                               ; preds = %17, %16
  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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"", !7, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !7, i64 48, !7, i64 60}
!14 = !{!13, !11, i64 4}
!15 = !{!13, !11, i64 8}
!16 = !{!13, !11, i64 12}
!17 = !{!13, !11, i64 16}
!18 = !{!13, !11, i64 20}
!19 = !{!13, !11, i64 32}
!20 = !{!13, !11, i64 44}
!21 = !{!13, !11, i64 40}
!22 = !{!13, !11, i64 36}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @PID_Init(ptr noundef writeonly %0, i8 noundef zeroext %1, ptr noundef readonly %2, float noundef %3, float noundef %4) local_unnamed_addr #0 {
  %6 = icmp eq ptr %0, null
  %7 = icmp eq ptr %2, null
  %or.cond = or i1 %6, %7
  br i1 %or.cond, label %20, label %8

8:                                                ; preds = %5
  store i8 %1, ptr %0, align 4, !tbaa !5
  %9 = load float, ptr %2, align 4, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  store float %9, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  %12 = load float, ptr %11, align 4, !tbaa !10
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  store float %12, ptr %13, align 4, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %2, i64 8
  %15 = load float, ptr %14, align 4, !tbaa !10
  %16 = getelementptr inbounds i8, ptr %0, i64 12
  store float %15, ptr %16, align 4, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store float %3, ptr %17, align 4, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  store float %4, ptr %18, align 4, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(40) %19, i8 0, i64 40, i1 false)
  br label %20

20:                                               ; preds = %5, %8
  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: readwrite) 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 = !{!"", !7, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36, !9, i64 40, !9, i64 44, !7, i64 48, !7, i64 60}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"float", !7, i64 0}
!10 = !{!9, !9, i64 0}
!11 = !{!6, !9, i64 4}
!12 = !{!6, !9, i64 8}
!13 = !{!6, !9, i64 12}
!14 = !{!6, !9, i64 16}
!15 = !{!6, !9, i64 20}


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