; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/c_bindings/cbindings.ll (ZN9CBindings8to_classE17DiffuseParticle_t)

; 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.vmath::vec3" = type { float, float, float }
%struct.DiffuseParticle = type <{ %"class.vmath::vec3", %"class.vmath::vec3", float, i8, [3 x i8] }>
%struct.DiffuseParticle_t = type { %struct.Vector3_t, %struct.Vector3_t, float, i8 }
%struct.Vector3_t = type { float, float, float }

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, <2 x float>, float) #2

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9CBindings8to_classE17DiffuseParticle_t(ptr dead_on_unwind noalias writable sret(%struct.DiffuseParticle) align 4 %0, ptr noundef byval(%struct.DiffuseParticle_t) align 8 %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca %"class.vmath::vec3", align 4
  %5 = alloca %struct.Vector3_t, align 4
  %6 = alloca { <2 x float>, float }, align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %struct.Vector3_t, align 4
  %9 = alloca { <2 x float>, float }, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i1, align 1
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #6
  %15 = getelementptr inbounds %struct.DiffuseParticle_t, ptr %1, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 8 %15, i64 12, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %5, i64 12, i1 false)
  %16 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 0
  %17 = load <2 x float>, ptr %16, align 4
  %18 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 1
  %19 = load float, ptr %18, align 4
  call void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %4, <2 x float> %17, float %19)
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #6
  %20 = getelementptr inbounds %struct.DiffuseParticle_t, ptr %1, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 4 %20, i64 12, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %8, i64 12, i1 false)
  %21 = getelementptr inbounds { <2 x float>, float }, ptr %9, i32 0, i32 0
  %22 = load <2 x float>, ptr %21, align 4
  %23 = getelementptr inbounds { <2 x float>, float }, ptr %9, i32 0, i32 1
  %24 = load float, ptr %23, align 4
  invoke void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %7, <2 x float> %22, float %24)
          to label %25 unwind label %33

25:                                               ; preds = %2
  store i1 false, ptr %12, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %4, i64 12, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %7, i64 12, i1 false), !tbaa.struct !5
  %26 = getelementptr inbounds %struct.DiffuseParticle_t, ptr %1, i32 0, i32 2
  %27 = load float, ptr %26, align 8, !tbaa !10
  invoke void @_ZN15DiffuseParticleC2EN5vmath4vec3ES1_f(ptr noundef nonnull align 4 dereferenceable(29) %0, ptr noundef %13, ptr noundef %14, float noundef %27)
          to label %28 unwind label %37

28:                                               ; preds = %25
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #6
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #6
  %29 = getelementptr inbounds %struct.DiffuseParticle_t, ptr %1, i32 0, i32 3
  %30 = load i8, ptr %29, align 4, !tbaa !13
  %31 = getelementptr inbounds %struct.DiffuseParticle, ptr %0, i32 0, i32 3
  store i8 %30, ptr %31, align 4, !tbaa !14
  store i1 true, ptr %12, align 1
  %32 = load i1, ptr %12, align 1
  br i1 %32, label %42, label %41

33:                                               ; preds = %2
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %10, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %11, align 4
  br label %43

37:                                               ; preds = %25
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %10, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #6
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #6
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #6
  br label %43

41:                                               ; preds = %28
  call void @_ZN15DiffuseParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(29) %0) #6
  br label %42

42:                                               ; preds = %41, %28
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #6
  ret void

43:                                               ; preds = %37, %33
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #6
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #6
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %10, align 8
  %46 = load i32, ptr %11, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15DiffuseParticleC2EN5vmath4vec3ES1_f(ptr noundef nonnull align 4 dereferenceable(29), ptr noundef, ptr noundef, float noundef) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN15DiffuseParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(29)) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 24}
!11 = !{!"_ZTS17DiffuseParticle_t", !12, i64 0, !12, i64 12, !7, i64 24, !8, i64 28}
!12 = !{!"_ZTS9Vector3_t", !7, i64 0, !7, i64 4, !7, i64 8}
!13 = !{!11, !8, i64 28}
!14 = !{!15, !17, i64 28}
!15 = !{!"_ZTS15DiffuseParticle", !16, i64 0, !16, i64 12, !7, i64 24, !17, i64 28}
!16 = !{!"_ZTSN5vmath4vec3E", !7, i64 0, !7, i64 4, !7, i64 8}
!17 = !{!"_ZTS19DiffuseParticleType", !8, i64 0}


; 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.vmath::vec3" = type { float, float, float }
%struct.DiffuseParticle = type <{ %"class.vmath::vec3", %"class.vmath::vec3", float, i8, [3 x i8] }>
%struct.DiffuseParticle_t = type { %struct.Vector3_t, %struct.Vector3_t, float, i8 }
%struct.Vector3_t = type { float, float, float }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, <2 x float>, float) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9CBindings8to_classE17DiffuseParticle_t(ptr dead_on_unwind noalias writable sret(%struct.DiffuseParticle) align 4 %0, ptr nocapture noundef readonly byval(%struct.DiffuseParticle_t) align 8 %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.vmath::vec3", align 4
  %4 = alloca %"class.vmath::vec3", align 4
  %5 = alloca %"class.vmath::vec3", align 4
  %6 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  %.sroa.06.0.copyload = load <2 x float>, ptr %1, align 8
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.27.0.copyload = load float, ptr %.sroa.27.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %3, <2 x float> %.sroa.06.0.copyload, float %.sroa.27.0.copyload)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  %7 = getelementptr inbounds i8, ptr %1, i64 12
  %.sroa.02.0.copyload = load <2 x float>, ptr %7, align 4
  %.sroa.23.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 20
  %.sroa.23.0.copyload = load float, ptr %.sroa.23.0..sroa_idx, align 4, !tbaa !5
  invoke void @_ZN9CBindings8to_classE9Vector3_t(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %4, <2 x float> %.sroa.02.0.copyload, float %.sroa.23.0.copyload)
          to label %8 unwind label %14

8:                                                ; preds = %2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %3, i64 12, i1 false), !tbaa.struct !9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %4, i64 12, i1 false), !tbaa.struct !9
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = load float, ptr %9, align 8, !tbaa !10
  call void @_ZN15DiffuseParticleC2EN5vmath4vec3ES1_f(ptr noundef nonnull align 4 dereferenceable(29) %0, ptr noundef nonnull %5, ptr noundef nonnull %6, float noundef %10)
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #5
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #5
  %11 = getelementptr inbounds i8, ptr %1, i64 28
  %12 = load i8, ptr %11, align 4, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 28
  store i8 %12, ptr %13, align 4, !tbaa !14
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  ret void

14:                                               ; preds = %2
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  resume { ptr, i32 } %15
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15DiffuseParticleC2EN5vmath4vec3ES1_f(ptr noundef nonnull align 4 dereferenceable(29), ptr noundef, ptr noundef, float noundef) unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!10 = !{!11, !6, i64 24}
!11 = !{!"_ZTS17DiffuseParticle_t", !12, i64 0, !12, i64 12, !6, i64 24, !7, i64 28}
!12 = !{!"_ZTS9Vector3_t", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!11, !7, i64 28}
!14 = !{!15, !17, i64 28}
!15 = !{!"_ZTS15DiffuseParticle", !16, i64 0, !16, i64 12, !6, i64 24, !17, i64 28}
!16 = !{!"_ZTSN5vmath4vec3E", !6, i64 0, !6, i64 4, !6, i64 8}
!17 = !{!"_ZTS19DiffuseParticleType", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass