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

; 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 uwtable
define dso_local void @_ZN5Scene17AddRepulsionForceE4vec2ff(ptr noundef nonnull align 8 dereferenceable(52) %0, <2 x float> %1, float noundef %2, float noundef %3) #5 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
  %32 = 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
  %33 = load ptr, ptr %6, align 8
  %34 = getelementptr inbounds %struct.Scene, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %4
  br label %135

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

84:                                               ; preds = %132, %38
  %85 = 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 %85, label %87, label %86

86:                                               ; preds = %84
  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 %134

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

98:                                               ; preds = %129, %87
  %99 = 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 %99, label %101, label %100

100:                                              ; preds = %98
  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 %131

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

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

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

129:                                              ; preds = %128
  %130 = 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 %98

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

132:                                              ; preds = %131
  %133 = 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 %84

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

135:                                              ; preds = %134, %37
  ret void
}

; 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>) #6

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

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

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

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

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

; 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

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 = { 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 #6 = { 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 #7 = { 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 #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 uwtable
define dso_local void @_ZN5Scene17AddRepulsionForceE4vec2ff(ptr nocapture noundef nonnull readonly align 8 dereferenceable(52) %0, <2 x float> %1, float noundef %2, float noundef %3) local_unnamed_addr #5 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 %61, 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.021.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.018.0.copyload = load <2 x float>, ptr %5, align 8
  %.sroa.219.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.018.0.copyload, <2 x float> %.sroa.219.0.copyload, <2 x float> %.sroa.021.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.ph31, label %._crit_edge32

._crit_edge32:                                    ; 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 %61

.lr.ph31:                                         ; 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 = %58, %.lr.ph31
  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.ph31, label %._crit_edge32

.lr.ph:                                           ; preds = %.lr.ph31, %58
  %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.07.0.copyload = load <2 x float>, ptr %49, align 4
  %50 = call <2 x float> @_Zmi4vec2S_(<2 x float> %1, <2 x float> %.sroa.07.0.copyload)
  %51 = call noundef float @_Z6length4vec2(<2 x float> %50)
  %52 = fcmp ugt float %51, %2
  br i1 %52, label %58, label %53

53:                                               ; preds = %.lr.ph
  %.sroa.02.0.copyload = load <2 x float>, ptr %49, align 4
  %54 = call <2 x float> @_Zmi4vec2S_(<2 x float> %1, <2 x float> %.sroa.02.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)
  %57 = call <2 x float> @_Zng4vec2(<2 x float> %56)
  call void @_ZN8Particle10AccelerateE4vec2(ptr noundef nonnull align 4 dereferenceable(56) %48, <2 x float> %57)
  br label %58

58:                                               ; preds = %53, %.lr.ph
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8ParticleSt6vectorIS2_SaIS2_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  %60 = 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 %60, label %.lr.ph, label %._crit_edge

61:                                               ; preds = %4, %._crit_edge32
  ret void
}

; 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 #6

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

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

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

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

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

; 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

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 = { 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 #6 = { 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 #7 = { 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 #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