; LLVM IR from Sonryle/JoePhys :: testbed/src/Scenes.ll (ZN5Scene18AddAttractionForceE4vec2ff)

; 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.Palette = type { [16 x %struct.colour] }
%struct.colour = type { float, float, float, float }
%struct.Renderer = type { ptr, ptr }
%struct.vec2 = type { float, float }
%"class.__gnu_cxx::__normal_iterator.16" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%struct.Scene = type <{ ptr, %struct.SceneColours, ptr, ptr, i32, [4 x i8] }>
%struct.SceneColours = type { i32, i32, i32, i32, i32, i32 }
%struct.World = type <{ %"class.std::vector", %"class.std::unordered_map", i32, i32, %struct.vec2, float, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Cluster *, std::allocator<Cluster *>>::_Vector_impl" }
%"struct.std::_Vector_base<Cluster *, std::allocator<Cluster *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Cluster *, std::allocator<Cluster *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Cluster *, std::allocator<Cluster *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%struct.Cluster = type { %"class.std::vector.5", %"class.std::vector.10" }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Particle *, std::allocator<Particle *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<Spring *, std::allocator<Spring *>>::_Vector_impl" }
%"struct.std::_Vector_base<Spring *, std::allocator<Spring *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Spring *, std::allocator<Spring *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Spring *, std::allocator<Spring *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Particle = type { i8, %struct.vec2, %struct.vec2, float, float, float, %struct.vec2, [2 x %struct.vec2] }

@palette = external global %struct.Palette, align 4
@renderer = external global %struct.Renderer, 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP8ParticleSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare void @_ZN8Renderer14AddSolidCircleE4vec2fi6colourS1_(ptr noundef nonnull align 8 dereferenceable(16), <2 x float>, float noundef, i32 noundef, <2 x float>, <2 x float>, <2 x float>, <2 x float>) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6colour3SetEffff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP7ClusterSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z6length4vec2(<2 x float>) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmi4vec2S_(<2 x float>, <2 x float>) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zml4vec2f(<2 x float>, float noundef) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z9normalize4vec2(<2 x float>) #6

declare void @_ZN8Particle10AccelerateE4vec2(ptr noundef nonnull align 4 dereferenceable(56), <2 x float>) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Scene18AddAttractionForceE4vec2ff(ptr noundef nonnull align 8 dereferenceable(52) %0, <2 x float> %1, float noundef %2, float noundef %3) #7 align 2 {
  %5 = alloca %struct.vec2, align 4
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca %struct.colour, align 4
  %10 = alloca %struct.colour, align 4
  %11 = alloca %struct.vec2, align 4
  %12 = alloca %struct.colour, align 4
  %13 = alloca %struct.colour, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca ptr, align 8
  %23 = alloca %struct.vec2, align 4
  %24 = alloca %struct.vec2, align 4
  %25 = alloca %struct.vec2, align 4
  %26 = alloca %struct.vec2, align 4
  %27 = alloca %struct.vec2, align 4
  %28 = alloca %struct.vec2, align 4
  %29 = alloca %struct.vec2, align 4
  %30 = alloca %struct.vec2, align 4
  %31 = alloca %struct.vec2, align 4
  store <2 x float> %1, ptr %5, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store float %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !9
  %32 = load ptr, ptr %6, align 8
  %33 = getelementptr inbounds %struct.Scene, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %37

36:                                               ; preds = %4
  br label %132

37:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %38 = getelementptr inbounds %struct.Scene, ptr %32, i32 0, i32 1
  %39 = getelementptr inbounds %struct.SceneColours, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [16 x %struct.colour], ptr @palette, i64 0, i64 %41
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %42, i64 16, i1 false), !tbaa.struct !16
  %43 = getelementptr inbounds %struct.colour, ptr %9, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !17
  %45 = fmul float %44, 5.000000e-01
  %46 = getelementptr inbounds %struct.colour, ptr %9, i32 0, i32 1
  %47 = load float, ptr %46, align 4, !tbaa !19
  %48 = fmul float %47, 5.000000e-01
  %49 = getelementptr inbounds %struct.colour, ptr %9, i32 0, i32 2
  %50 = load float, ptr %49, align 4, !tbaa !20
  %51 = fmul float %50, 5.000000e-01
  %52 = getelementptr inbounds %struct.colour, ptr %9, i32 0, i32 3
  %53 = load float, ptr %52, align 4, !tbaa !21
  %54 = fmul float %53, 2.500000e-01
  call void @_ZN6colour3SetEffff(ptr noundef nonnull align 4 dereferenceable(16) %9, float noundef %45, float noundef %48, float noundef %51, float noundef %54)
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #8
  %55 = getelementptr inbounds %struct.Scene, ptr %32, i32 0, i32 1
  %56 = getelementptr inbounds %struct.SceneColours, ptr %55, i32 0, i32 3
  %57 = load i32, ptr %56, align 4, !tbaa !22
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [16 x %struct.colour], ptr @palette, i64 0, i64 %58
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %59, i64 16, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !23
  %60 = load float, ptr %7, align 4, !tbaa !9
  %61 = load float, ptr %7, align 4, !tbaa !9
  %62 = fptosi float %61 to i32
  %63 = mul nsw i32 %62, 5
  %64 = add nsw i32 %63, 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %9, i64 16, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %10, i64 16, i1 false), !tbaa.struct !16
  %65 = load <2 x float>, ptr %11, align 4
  %66 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  %67 = load <2 x float>, ptr %66, align 4
  %68 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  %69 = load <2 x float>, ptr %68, align 4
  %70 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %13, i32 0, i32 0
  %71 = load <2 x float>, ptr %70, align 4
  %72 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %13, i32 0, i32 1
  %73 = load <2 x float>, ptr %72, align 4
  call void @_ZN8Renderer14AddSolidCircleE4vec2fi6colourS1_(ptr noundef nonnull align 8 dereferenceable(16) @renderer, <2 x float> %65, float noundef %60, i32 noundef %64, <2 x float> %67, <2 x float> %69, <2 x float> %71, <2 x float> %73)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %74 = getelementptr inbounds %struct.Scene, ptr %32, i32 0, i32 2
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  %76 = getelementptr inbounds %struct.World, ptr %75, i32 0, i32 0
  store ptr %76, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  %78 = call ptr @_ZNSt6vectorIP7ClusterSaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %77) #8
  %79 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.16", ptr %15, i32 0, i32 0
  store ptr %78, ptr %79, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = call ptr @_ZNSt6vectorIP7ClusterSaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #8
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.16", ptr %16, i32 0, i32 0
  store ptr %81, ptr %82, align 8
  br label %83

83:                                               ; preds = %129, %37
  %84 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP7ClusterSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  br i1 %84, label %86, label %85

85:                                               ; preds = %83
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %131

86:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  store ptr %88, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.Cluster, ptr %89, i32 0, i32 0
  store ptr %90, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %91 = load ptr, ptr %19, align 8, !tbaa !5
  %92 = call ptr @_ZNSt6vectorIP8ParticleSaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %91) #8
  %93 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %20, i32 0, i32 0
  store ptr %92, ptr %93, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %94 = load ptr, ptr %19, align 8, !tbaa !5
  %95 = call ptr @_ZNSt6vectorIP8ParticleSaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %94) #8
  %96 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %95, ptr %96, align 8
  br label %97

97:                                               ; preds = %126, %86
  %98 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8ParticleSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #8
  br i1 %98, label %100, label %99

99:                                               ; preds = %97
  store i32 4, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %128

100:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  store ptr %102, ptr %22, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !23
  %103 = load ptr, ptr %22, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.Particle, ptr %103, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %104, i64 8, i1 false), !tbaa.struct !23
  %105 = load <2 x float>, ptr %24, align 4
  %106 = load <2 x float>, ptr %25, align 4
  %107 = call <2 x float> @_Zmi4vec2S_(<2 x float> %105, <2 x float> %106)
  store <2 x float> %107, ptr %23, align 4
  %108 = load <2 x float>, ptr %23, align 4
  %109 = call noundef float @_Z6length4vec2(<2 x float> %108)
  %110 = load float, ptr %7, align 4, !tbaa !9
  %111 = fcmp ole float %109, %110
  br i1 %111, label %112, label %125

112:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !23
  %113 = load ptr, ptr %22, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.Particle, ptr %113, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %114, i64 8, i1 false), !tbaa.struct !23
  %115 = load <2 x float>, ptr %29, align 4
  %116 = load <2 x float>, ptr %30, align 4
  %117 = call <2 x float> @_Zmi4vec2S_(<2 x float> %115, <2 x float> %116)
  store <2 x float> %117, ptr %28, align 4
  %118 = load <2 x float>, ptr %28, align 4
  %119 = call <2 x float> @_Z9normalize4vec2(<2 x float> %118)
  store <2 x float> %119, ptr %27, align 4
  %120 = load float, ptr %8, align 4, !tbaa !9
  %121 = load <2 x float>, ptr %27, align 4
  %122 = call <2 x float> @_Zml4vec2f(<2 x float> %121, float noundef %120)
  store <2 x float> %122, ptr %26, align 4
  %123 = load ptr, ptr %22, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %26, i64 8, i1 false), !tbaa.struct !23
  %124 = load <2 x float>, ptr %31, align 4
  call void @_ZN8Particle10AccelerateE4vec2(ptr noundef nonnull align 4 dereferenceable(56) %123, <2 x float> %124)
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  br label %125

125:                                              ; preds = %112, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %126

126:                                              ; preds = %125
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  br label %97

128:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  br label %129

129:                                              ; preds = %128
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #8
  br label %83

131:                                              ; preds = %85
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  br label %132

132:                                              ; preds = %131, %36
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 #7 = { mustprogress uwtable "min-legal-vector-width"="64" "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 #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"_ZTS5Scene", !13, i64 8, !6, i64 32, !6, i64 40, !14, i64 48}
!13 = !{!"_ZTS12SceneColours", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !14, i64 16}
!16 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTS6colour", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!19 = !{!18, !10, i64 4}
!20 = !{!18, !10, i64 8}
!21 = !{!18, !10, i64 12}
!22 = !{!12, !14, i64 20}
!23 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}


; 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.Palette = type { [16 x %struct.colour] }
%struct.colour = type { float, float, float, float }
%struct.Renderer = type { ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.16" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@palette = external local_unnamed_addr global %struct.Palette, align 4
@renderer = external global %struct.Renderer, 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP8ParticleSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare void @_ZN8Renderer14AddSolidCircleE4vec2fi6colourS1_(ptr noundef nonnull align 8 dereferenceable(16), <2 x float>, float noundef, i32 noundef, <2 x float>, <2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6colour3SetEffff(ptr noundef nonnull align 4 dereferenceable(16), float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP7ClusterSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_Z6length4vec2(<2 x float>) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmi4vec2S_(<2 x float>, <2 x float>) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zml4vec2f(<2 x float>, float noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z9normalize4vec2(<2 x float>) local_unnamed_addr #6

declare void @_ZN8Particle10AccelerateE4vec2(ptr noundef nonnull align 4 dereferenceable(56), <2 x float>) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Scene18AddAttractionForceE4vec2ff(ptr nocapture noundef nonnull readonly align 8 dereferenceable(52) %0, <2 x float> %1, float noundef %2, float noundef %3) local_unnamed_addr #7 align 2 {
  %5 = alloca %struct.colour, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.16", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %60, label %13

13:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load i32, ptr %14, align 8, !tbaa !12
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [16 x %struct.colour], ptr @palette, i64 0, i64 %16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(16) %17, i64 16, i1 false), !tbaa.struct !13
  %18 = load float, ptr %5, align 8, !tbaa !16
  %19 = fmul float %18, 5.000000e-01
  %20 = getelementptr inbounds i8, ptr %5, i64 4
  %21 = load float, ptr %20, align 4, !tbaa !18
  %22 = fmul float %21, 5.000000e-01
  %23 = getelementptr inbounds i8, ptr %5, i64 8
  %24 = load float, ptr %23, align 8, !tbaa !19
  %25 = fmul float %24, 5.000000e-01
  %26 = getelementptr inbounds i8, ptr %5, i64 12
  %27 = load float, ptr %26, align 4, !tbaa !20
  %28 = fmul float %27, 2.500000e-01
  call void @_ZN6colour3SetEffff(ptr noundef nonnull align 4 dereferenceable(16) %5, float noundef %19, float noundef %22, float noundef %25, float noundef %28)
  %29 = getelementptr inbounds i8, ptr %0, i64 20
  %30 = load i32, ptr %29, align 4, !tbaa !21
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [16 x %struct.colour], ptr @palette, i64 0, i64 %31
  %.sroa.020.0.copyload = load <2 x float>, ptr %32, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %32, i64 8
  %.sroa.4.0.copyload = load <2 x float>, ptr %.sroa.4.0..sroa_idx, align 4
  %33 = fptosi float %2 to i32
  %34 = mul nsw i32 %33, 5
  %35 = add nsw i32 %34, 10
  %.sroa.017.0.copyload = load <2 x float>, ptr %5, align 8
  %.sroa.218.0.copyload = load <2 x float>, ptr %23, align 8
  call void @_ZN8Renderer14AddSolidCircleE4vec2fi6colourS1_(ptr noundef nonnull align 8 dereferenceable(16) @renderer, <2 x float> %1, float noundef %2, i32 noundef %35, <2 x float> %.sroa.017.0.copyload, <2 x float> %.sroa.218.0.copyload, <2 x float> %.sroa.020.0.copyload, <2 x float> %.sroa.4.0.copyload)
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %37 = call ptr @_ZNSt6vectorIP7ClusterSaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #8
  store ptr %37, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %38 = call ptr @_ZNSt6vectorIP7ClusterSaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #8
  store ptr %38, ptr %7, align 8
  %39 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP7ClusterSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %39, label %.lr.ph30, label %._crit_edge31

._crit_edge31:                                    ; preds = %._crit_edge, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  br label %60

.lr.ph30:                                         ; preds = %13, %._crit_edge
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %41 = load ptr, ptr %40, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  %42 = call ptr @_ZNSt6vectorIP8ParticleSaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #8
  store ptr %42, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %43 = call ptr @_ZNSt6vectorIP8ParticleSaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #8
  store ptr %43, ptr %9, align 8
  %44 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8ParticleSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br i1 %44, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %57, %.lr.ph30
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP7ClusterSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %46 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP7ClusterSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #8
  br i1 %46, label %.lr.ph30, label %._crit_edge31

.lr.ph:                                           ; preds = %.lr.ph30, %57
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %.sroa.06.0.copyload = load <2 x float>, ptr %49, align 4
  %50 = call <2 x float> @_Zmi4vec2S_(<2 x float> %1, <2 x float> %.sroa.06.0.copyload)
  %51 = call noundef float @_Z6length4vec2(<2 x float> %50)
  %52 = fcmp ugt float %51, %2
  br i1 %52, label %57, label %53

53:                                               ; preds = %.lr.ph
  %.sroa.01.0.copyload = load <2 x float>, ptr %49, align 4
  %54 = call <2 x float> @_Zmi4vec2S_(<2 x float> %1, <2 x float> %.sroa.01.0.copyload)
  %55 = call <2 x float> @_Z9normalize4vec2(<2 x float> %54)
  %56 = call <2 x float> @_Zml4vec2f(<2 x float> %55, float noundef %3)
  call void @_ZN8Particle10AccelerateE4vec2(ptr noundef nonnull align 4 dereferenceable(56) %48, <2 x float> %56)
  br label %57

57:                                               ; preds = %53, %.lr.ph
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %59 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8ParticleSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #8
  br i1 %59, label %.lr.ph, label %._crit_edge

60:                                               ; preds = %4, %._crit_edge31
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { inlinehint 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 #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 #7 = { mustprogress uwtable "min-legal-vector-width"="64" "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 #8 = { 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, !11, i64 32}
!6 = !{!"_ZTS5Scene", !7, i64 8, !11, i64 32, !11, i64 40, !8, i64 48}
!7 = !{!"_ZTS12SceneColours", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16, !8, i64 20}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!6, !8, i64 16}
!13 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14, i64 12, i64 4, !14}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !9, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"_ZTS6colour", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!18 = !{!17, !15, i64 4}
!19 = !{!17, !15, i64 8}
!20 = !{!17, !15, i64 12}
!21 = !{!6, !8, i64 20}
!22 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass