; LLVM IR from doyubkim/fluid-engine-dev :: src/jet (point_particle_emitter2)

; 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.jet::PointParticleEmitter2" = type { %"class.jet::ParticleEmitter2", %"class.std::mersenne_twister_engine", double, i64, i64, i64, %"class.jet::Vector", %"class.jet::Vector", double, double }
%"class.jet::ParticleEmitter2" = type { ptr, i8, %"class.std::shared_ptr", %"class.std::function" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.std::mersenne_twister_engine" = type { [624 x i64], i64 }
%"class.jet::Vector" = type { double, double }

@_ZTVN3jet21PointParticleEmitter2E = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3jet21PointParticleEmitter2C2ERKNS_6VectorIdLm2EEES4_ddmmj(ptr noundef nonnull align 8 dereferenceable(5144) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, double noundef %3, double noundef %4, i64 noundef %5, i64 noundef %6, i32 noundef %7) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store double %3, ptr %12, align 8, !tbaa !9
  store double %4, ptr %13, align 8, !tbaa !9
  store i64 %5, ptr %14, align 8, !tbaa !11
  store i64 %6, ptr %15, align 8, !tbaa !11
  store i32 %7, ptr %16, align 4, !tbaa !13
  %19 = load ptr, ptr %9, align 8
  call void @_ZN3jet16ParticleEmitter2C2Ev(ptr noundef nonnull align 8 dereferenceable(64) %19)
  store ptr getelementptr inbounds inrange(-16, 32) ({ [6 x ptr] }, ptr @_ZTVN3jet21PointParticleEmitter2E, i32 0, i32 0, i32 2), ptr %19, align 8, !tbaa !15
  %20 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 1
  %21 = load i32, ptr %16, align 4, !tbaa !13
  %22 = zext i32 %21 to i64
  invoke void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000) %20, i64 noundef %22)
          to label %23 unwind label %42

23:                                               ; preds = %8
  %24 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 2
  store double 0.000000e+00, ptr %24, align 8, !tbaa !17
  %25 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 3
  store i64 0, ptr %25, align 8, !tbaa !28
  %26 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 4
  %27 = load i64, ptr %14, align 8, !tbaa !11
  store i64 %27, ptr %26, align 8, !tbaa !29
  %28 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 5
  %29 = load i64, ptr %15, align 8, !tbaa !11
  store i64 %29, ptr %28, align 8, !tbaa !30
  %30 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 6
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  invoke void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(16) %31)
          to label %32 unwind label %42

32:                                               ; preds = %23
  %33 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 7
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  invoke void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(16) %34)
          to label %35 unwind label %42

35:                                               ; preds = %32
  %36 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 8
  %37 = load double, ptr %12, align 8, !tbaa !9
  store double %37, ptr %36, align 8, !tbaa !31
  %38 = getelementptr inbounds %"class.jet::PointParticleEmitter2", ptr %19, i32 0, i32 9
  %39 = load double, ptr %13, align 8, !tbaa !9
  %40 = invoke noundef double @_ZN3jet16degreesToRadiansIdEET_S1_(double noundef %39)
          to label %41 unwind label %42

41:                                               ; preds = %35
  store double %40, ptr %38, align 8, !tbaa !32
  ret void

42:                                               ; preds = %35, %32, %23, %8
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %17, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %18, align 4
  call void @_ZN3jet16ParticleEmitter2D2Ev(ptr noundef nonnull align 8 dereferenceable(64) %19) #5
  br label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %17, align 8
  %48 = load i32, ptr %18, align 4
  %49 = insertvalue { ptr, i32 } poison, ptr %47, 0
  %50 = insertvalue { ptr, i32 } %49, i32 %48, 1
  resume { ptr, i32 } %50
}

declare void @_ZN3jet16ParticleEmitter2C2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000), i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN3jet16degreesToRadiansIdEET_S1_(double noundef) #3

; Function Attrs: nounwind
declare void @_ZN3jet16ParticleEmitter2D2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #4

attributes #0 = { 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 #1 = { "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 = { 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 = { inlinehint 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 #4 = { nounwind "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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !10, i64 5064}
!18 = !{!"_ZTSN3jet21PointParticleEmitter2E", !19, i64 0, !26, i64 64, !10, i64 5064, !12, i64 5072, !12, i64 5080, !12, i64 5088, !27, i64 5096, !27, i64 5112, !10, i64 5128, !10, i64 5136}
!19 = !{!"_ZTSN3jet16ParticleEmitter2E", !20, i64 8, !21, i64 16, !24, i64 32}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSSt10shared_ptrIN3jet19ParticleSystemData2EE", !22, i64 0}
!22 = !{!"_ZTSSt12__shared_ptrIN3jet19ParticleSystemData2ELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !23, i64 8}
!23 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!24 = !{!"_ZTSSt8functionIFvPN3jet16ParticleEmitter2EddEE", !25, i64 0, !6, i64 24}
!25 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!26 = !{!"_ZTSSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE", !7, i64 0, !12, i64 4992}
!27 = !{!"_ZTSN3jet6VectorIdLm2EEE", !10, i64 0, !10, i64 8}
!28 = !{!18, !12, i64 5072}
!29 = !{!18, !12, i64 5080}
!30 = !{!18, !12, i64 5088}
!31 = !{!18, !10, i64 5128}
!32 = !{!18, !10, i64 5136}


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

@_ZTVN3jet21PointParticleEmitter2E = external dso_local unnamed_addr constant { [6 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3jet21PointParticleEmitter2C2ERKNS_6VectorIdLm2EEES4_ddmmj(ptr noundef nonnull align 8 dereferenceable(5144) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, double noundef %3, double noundef %4, i64 noundef %5, i64 noundef %6, i32 noundef %7) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN3jet16ParticleEmitter2C2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0)
  store ptr getelementptr inbounds inrange(-16, 32) (i8, ptr @_ZTVN3jet21PointParticleEmitter2E, i64 16), ptr %0, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  %10 = zext i32 %7 to i64
  invoke void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000) %9, i64 noundef %10)
          to label %11 unwind label %21

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 5064
  %13 = getelementptr inbounds i8, ptr %0, i64 5080
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %12, i8 0, i64 16, i1 false)
  store i64 %5, ptr %13, align 8, !tbaa !8
  %14 = getelementptr inbounds i8, ptr %0, i64 5088
  store i64 %6, ptr %14, align 8, !tbaa !23
  %15 = getelementptr inbounds i8, ptr %0, i64 5096
  tail call void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %16 = getelementptr inbounds i8, ptr %0, i64 5112
  tail call void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %17 = getelementptr inbounds i8, ptr %0, i64 5128
  store double %3, ptr %17, align 8, !tbaa !24
  %18 = invoke noundef double @_ZN3jet16degreesToRadiansIdEET_S1_(double noundef %4)
          to label %19 unwind label %21

19:                                               ; preds = %11
  %20 = getelementptr inbounds i8, ptr %0, i64 5136
  store double %18, ptr %20, align 8, !tbaa !25
  ret void

21:                                               ; preds = %11, %8
  %22 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3jet16ParticleEmitter2D2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0) #6
  resume { ptr, i32 } %22
}

declare void @_ZN3jet16ParticleEmitter2C2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EEC2Em(ptr noundef nonnull align 8 dereferenceable(5000), i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN3jet16degreesToRadiansIdEET_S1_(double noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN3jet16ParticleEmitter2D2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #4

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

attributes #0 = { 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 #1 = { "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 = { 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 = { inlinehint 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 #4 = { nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !20, i64 5080}
!9 = !{!"_ZTSN3jet21PointParticleEmitter2E", !10, i64 0, !19, i64 64, !21, i64 5064, !20, i64 5072, !20, i64 5080, !20, i64 5088, !22, i64 5096, !22, i64 5112, !21, i64 5128, !21, i64 5136}
!10 = !{!"_ZTSN3jet16ParticleEmitter2E", !11, i64 8, !13, i64 16, !17, i64 32}
!11 = !{!"bool", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"_ZTSSt10shared_ptrIN3jet19ParticleSystemData2EE", !14, i64 0}
!14 = !{!"_ZTSSt12__shared_ptrIN3jet19ParticleSystemData2ELN9__gnu_cxx12_Lock_policyE2EE", !15, i64 0, !16, i64 8}
!15 = !{!"any pointer", !12, i64 0}
!16 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !15, i64 0}
!17 = !{!"_ZTSSt8functionIFvPN3jet16ParticleEmitter2EddEE", !18, i64 0, !15, i64 24}
!18 = !{!"_ZTSSt14_Function_base", !12, i64 0, !15, i64 16}
!19 = !{!"_ZTSSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE", !12, i64 0, !20, i64 4992}
!20 = !{!"long", !12, i64 0}
!21 = !{!"double", !12, i64 0}
!22 = !{!"_ZTSN3jet6VectorIdLm2EEE", !21, i64 0, !21, i64 8}
!23 = !{!9, !20, i64 5088}
!24 = !{!9, !21, i64 5128}
!25 = !{!9, !21, i64 5136}


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