; LLVM IR from cyberbotics/webots_ros2 :: webots_ros2_driver/webots/src/controller/c (joystick)

; 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.WbJoystick = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, double, double, double, i32, i8, i8, i8, i8, i8 }

@joystick = external hidden global %struct.WbJoystick, align 8

; Function Attrs: nounwind uwtable
define dso_local void @wb_joystick_init() #0 {
  store i32 0, ptr @joystick, align 8, !tbaa !5
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 1), align 4, !tbaa !12
  store i32 -1, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 2), align 8, !tbaa !13
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 3), align 4, !tbaa !14
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 4), align 8, !tbaa !15
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 5), align 4, !tbaa !16
  store ptr null, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 6), align 8, !tbaa !17
  store ptr null, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 7), align 8, !tbaa !18
  store ptr null, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 8), align 8, !tbaa !19
  store ptr null, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 9), align 8, !tbaa !20
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 10), align 8, !tbaa !21
  store double 0.000000e+00, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 11), align 8, !tbaa !22
  store double 0.000000e+00, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 12), align 8, !tbaa !23
  store double 0.000000e+00, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 13), align 8, !tbaa !24
  store i32 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 14), align 8, !tbaa !25
  store i8 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 15), align 4, !tbaa !26
  store i8 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 16), align 1, !tbaa !27
  store i8 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 17), align 2, !tbaa !28
  store i8 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 18), align 1, !tbaa !29
  store i8 0, ptr getelementptr inbounds (%struct.WbJoystick, ptr @joystick, i32 0, i32 19), align 8, !tbaa !30
  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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !7, i64 88, !8, i64 92, !8, i64 93, !8, i64 94, !8, i64 95, !8, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 20}
!17 = !{!6, !10, i64 24}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !7, i64 56}
!22 = !{!6, !11, i64 64}
!23 = !{!6, !11, i64 72}
!24 = !{!6, !11, i64 80}
!25 = !{!6, !7, i64 88}
!26 = !{!6, !8, i64 92}
!27 = !{!6, !8, i64 93}
!28 = !{!6, !8, i64 94}
!29 = !{!6, !8, i64 95}
!30 = !{!6, !8, i64 96}


; 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.WbJoystick = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, i32, double, double, double, i32, i8, i8, i8, i8, i8 }

@joystick = external hidden local_unnamed_addr global %struct.WbJoystick, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @wb_joystick_init() local_unnamed_addr #0 {
  store i32 0, ptr @joystick, align 8, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @joystick, i64 4), align 4, !tbaa !12
  store i32 -1, ptr getelementptr inbounds (i8, ptr @joystick, i64 8), align 8, !tbaa !13
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(48) getelementptr inbounds (i8, ptr @joystick, i64 12), i8 0, i64 48, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(33) getelementptr inbounds (i8, ptr @joystick, i64 64), i8 0, i64 33, 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(write, argmem: none, inaccessiblemem: none) 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, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !7, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !7, i64 88, !8, i64 92, !8, i64 93, !8, i64 94, !8, i64 95, !8, i64 96}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}


; Effective O3 passes: GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,TailCallElimPass