; LLVM IR from shupx/swarm_sync_sim :: src/px4_rotor_sim/src/mavros_px4_quadrotor_sim/px4_modules/mavlink/mavlink_msg_l_af386f7c (storageEi)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::array" = type { [8 x %struct.mavlink_info_s] }
%struct.mavlink_info_s = type { i8, %struct.__mavlink_message }
%struct.__mavlink_message = type <{ i16, i8, i8, i8, i8, i8, i8, i8, [3 x i8], [33 x i64], [2 x i8], [13 x i8] }>
%"struct.std::array.6" = type { [7 x %struct.mavlink_info_s] }

@_ZN3px420mavlink_stream_listsE = external dso_local global %"class.std::vector", align 8
@_ZN3px421mavlink_receive_listsE = external dso_local global %"class.std::vector.0", align 8

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3px432allocate_mavlink_message_storageEi(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::array", align 1
  %4 = alloca %"struct.std::array.6", align 1
  store i32 %0, ptr %2, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %31, %1
  %6 = call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px420mavlink_stream_listsE) #4
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = icmp ult i64 %6, %8
  br i1 %9, label %10, label %33

10:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 2336, ptr %3) #4
  call void @llvm.memset.p0.i64(ptr align 1 %3, i8 0, i64 2336, i1 false)
  %11 = getelementptr inbounds %"struct.std::array", ptr %3, i32 0, i32 0
  %12 = getelementptr inbounds %struct.mavlink_info_s, ptr %11, i64 8
  br label %13

13:                                               ; preds = %13, %10
  %14 = phi ptr [ %11, %10 ], [ %29, %13 ]
  %15 = getelementptr inbounds %struct.mavlink_info_s, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.mavlink_info_s, ptr %14, i32 0, i32 1
  %17 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 1
  %19 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 2
  %20 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 3
  %21 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 4
  %22 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 5
  %23 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 6
  %24 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 7
  %25 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 8
  %26 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 9
  %27 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 10
  %28 = getelementptr inbounds %struct.__mavlink_message, ptr %16, i32 0, i32 11
  %29 = getelementptr inbounds %struct.mavlink_info_s, ptr %14, i64 1
  %30 = icmp eq ptr %29, %12
  br i1 %30, label %31, label %13

31:                                               ; preds = %13
  %32 = call noundef nonnull align 1 dereferenceable(2336) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px420mavlink_stream_listsE, ptr noundef nonnull align 1 dereferenceable(2336) %3)
  call void @llvm.lifetime.end.p0(i64 2336, ptr %3) #4
  br label %5, !llvm.loop !9

33:                                               ; preds = %5
  br label %34

34:                                               ; preds = %60, %33
  %35 = call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px421mavlink_receive_listsE) #4
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %39, label %62

39:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 2044, ptr %4) #4
  call void @llvm.memset.p0.i64(ptr align 1 %4, i8 0, i64 2044, i1 false)
  %40 = getelementptr inbounds %"struct.std::array.6", ptr %4, i32 0, i32 0
  %41 = getelementptr inbounds %struct.mavlink_info_s, ptr %40, i64 7
  br label %42

42:                                               ; preds = %42, %39
  %43 = phi ptr [ %40, %39 ], [ %58, %42 ]
  %44 = getelementptr inbounds %struct.mavlink_info_s, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.mavlink_info_s, ptr %43, i32 0, i32 1
  %46 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 0
  %47 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 1
  %48 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 2
  %49 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 3
  %50 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 4
  %51 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 5
  %52 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 6
  %53 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 7
  %54 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 8
  %55 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 9
  %56 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 10
  %57 = getelementptr inbounds %struct.__mavlink_message, ptr %45, i32 0, i32 11
  %58 = getelementptr inbounds %struct.mavlink_info_s, ptr %43, i64 1
  %59 = icmp eq ptr %58, %41
  br i1 %59, label %60, label %42

60:                                               ; preds = %42
  %61 = call noundef nonnull align 1 dereferenceable(2044) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px421mavlink_receive_listsE, ptr noundef nonnull align 1 dereferenceable(2044) %4)
  call void @llvm.lifetime.end.p0(i64 2044, ptr %4) #4
  br label %34, !llvm.loop !11

62:                                               ; preds = %34
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(2336) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(2336)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(2044) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(2044)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress 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 #3 = { mustprogress 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 #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 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 8>, std::allocator<std::array<mavlink_info_s, 8>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::array<mavlink_info_s, 7>, std::allocator<std::array<mavlink_info_s, 7>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::array" = type { [8 x %struct.mavlink_info_s] }
%struct.mavlink_info_s = type { i8, %struct.__mavlink_message }
%struct.__mavlink_message = type <{ i16, i8, i8, i8, i8, i8, i8, i8, [3 x i8], [33 x i64], [2 x i8], [13 x i8] }>
%"struct.std::array.6" = type { [7 x %struct.mavlink_info_s] }

@_ZN3px420mavlink_stream_listsE = external dso_local global %"class.std::vector", align 8
@_ZN3px421mavlink_receive_listsE = external dso_local global %"class.std::vector.0", align 8

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3px432allocate_mavlink_message_storageEi(i32 noundef %0) local_unnamed_addr #2 {
  %2 = alloca %"struct.std::array", align 1
  %3 = alloca %"struct.std::array.6", align 1
  %4 = tail call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px420mavlink_stream_listsE) #4
  %5 = sext i32 %0 to i64
  %6 = icmp ult i64 %4, %5
  br i1 %6, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %1
  %7 = call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px421mavlink_receive_listsE) #4
  %8 = icmp ult i64 %7, %5
  br i1 %8, label %.lr.ph6, label %._crit_edge

.lr.ph:                                           ; preds = %1, %.lr.ph
  call void @llvm.lifetime.start.p0(i64 2336, ptr nonnull %2) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(2336) %2, i8 0, i64 2336, i1 false)
  %9 = call noundef nonnull align 1 dereferenceable(2336) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px420mavlink_stream_listsE, ptr noundef nonnull align 1 dereferenceable(2336) %2)
  call void @llvm.lifetime.end.p0(i64 2336, ptr nonnull %2) #4
  %10 = call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px420mavlink_stream_listsE) #4
  %11 = icmp ult i64 %10, %5
  br i1 %11, label %.lr.ph, label %.preheader, !llvm.loop !5

.lr.ph6:                                          ; preds = %.preheader, %.lr.ph6
  call void @llvm.lifetime.start.p0(i64 2044, ptr nonnull %3) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(2044) %3, i8 0, i64 2044, i1 false)
  %12 = call noundef nonnull align 1 dereferenceable(2044) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px421mavlink_receive_listsE, ptr noundef nonnull align 1 dereferenceable(2044) %3)
  call void @llvm.lifetime.end.p0(i64 2044, ptr nonnull %3) #4
  %13 = call noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZN3px421mavlink_receive_listsE) #4
  %14 = icmp ult i64 %13, %5
  br i1 %14, label %.lr.ph6, label %._crit_edge, !llvm.loop !7

._crit_edge:                                      ; preds = %.lr.ph6, %.preheader
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(2336) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm8EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(2336)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 1 dereferenceable(2044) ptr @_ZNSt6vectorISt5arrayI14mavlink_info_sLm7EESaIS2_EE12emplace_backIJS2_EEERS2_DpOT_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(2044)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress 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 #3 = { mustprogress 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass