; LLVM IR from NotManyIdeasDev/double-pendulum-sim :: double-pendulum-sim/Double-pendulum-sim/src/pixel_camera.ll (ZN11PixelCamera9DrawWorldEv)

; 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.Camera2D = type { %struct.Vector2, %struct.Vector2, float, float }
%struct.Vector2 = type { float, float }
%struct.Texture = type { i32, i32, i32, i32, i32 }
%struct.Rectangle = type { float, float, float, float }
%struct.Color = type { i8, i8, i8, i8 }
%class.PixelCamera = type { %struct.Vector2, %struct.Vector2, float, float, i32, i32, float, %struct.Color, %struct.Camera2D, %struct.Camera2D, %struct.RenderTexture }
%struct.RenderTexture = type { i32, %struct.Texture, %struct.Texture }

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

declare void @BeginMode2D(ptr noundef byval(%struct.Camera2D) align 8) #1

declare void @EndMode2D() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11PixelCamera9DrawWorldEv(ptr noundef nonnull align 4 dereferenceable(132) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.Camera2D, align 8
  %4 = alloca %struct.Texture, align 8
  %5 = alloca %struct.Rectangle, align 4
  %6 = alloca %struct.Rectangle, align 4
  %7 = alloca %struct.Vector2, align 4
  %8 = alloca %struct.Color, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  %10 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 %10, i64 24, i1 false), !tbaa.struct !9
  call void @BeginMode2D(ptr noundef byval(%struct.Camera2D) align 8 %3)
  %11 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 10
  %12 = getelementptr inbounds %struct.RenderTexture, ptr %11, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %12, i64 20, i1 false), !tbaa.struct !12
  %13 = getelementptr inbounds %struct.Rectangle, ptr %5, i32 0, i32 0
  store float 0.000000e+00, ptr %13, align 4, !tbaa !15
  %14 = getelementptr inbounds %struct.Rectangle, ptr %5, i32 0, i32 1
  store float 0.000000e+00, ptr %14, align 4, !tbaa !17
  %15 = getelementptr inbounds %struct.Rectangle, ptr %5, i32 0, i32 2
  %16 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 10
  %17 = getelementptr inbounds %struct.RenderTexture, ptr %16, i32 0, i32 1
  %18 = getelementptr inbounds %struct.Texture, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !18
  %20 = sitofp i32 %19 to float
  store float %20, ptr %15, align 4, !tbaa !25
  %21 = getelementptr inbounds %struct.Rectangle, ptr %5, i32 0, i32 3
  %22 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 10
  %23 = getelementptr inbounds %struct.RenderTexture, ptr %22, i32 0, i32 1
  %24 = getelementptr inbounds %struct.Texture, ptr %23, i32 0, i32 2
  %25 = load i32, ptr %24, align 4, !tbaa !26
  %26 = sub nsw i32 0, %25
  %27 = sitofp i32 %26 to float
  store float %27, ptr %21, align 4, !tbaa !27
  %28 = getelementptr inbounds %struct.Rectangle, ptr %6, i32 0, i32 0
  %29 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 6
  %30 = load float, ptr %29, align 4, !tbaa !28
  %31 = fneg float %30
  store float %31, ptr %28, align 4, !tbaa !15
  %32 = getelementptr inbounds %struct.Rectangle, ptr %6, i32 0, i32 1
  %33 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 6
  %34 = load float, ptr %33, align 4, !tbaa !28
  %35 = fneg float %34
  store float %35, ptr %32, align 4, !tbaa !17
  %36 = getelementptr inbounds %struct.Rectangle, ptr %6, i32 0, i32 2
  %37 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 4
  %38 = load i32, ptr %37, align 4, !tbaa !29
  %39 = sitofp i32 %38 to float
  %40 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 6
  %41 = load float, ptr %40, align 4, !tbaa !28
  %42 = call float @llvm.fmuladd.f32(float %41, float 2.000000e+00, float %39)
  store float %42, ptr %36, align 4, !tbaa !25
  %43 = getelementptr inbounds %struct.Rectangle, ptr %6, i32 0, i32 3
  %44 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 5
  %45 = load i32, ptr %44, align 4, !tbaa !30
  %46 = sitofp i32 %45 to float
  %47 = getelementptr inbounds %class.PixelCamera, ptr %9, i32 0, i32 6
  %48 = load float, ptr %47, align 4, !tbaa !28
  %49 = call float @llvm.fmuladd.f32(float %48, float 2.000000e+00, float %46)
  store float %49, ptr %43, align 4, !tbaa !27
  %50 = getelementptr inbounds %struct.Vector2, ptr %7, i32 0, i32 0
  store float 0.000000e+00, ptr %50, align 4, !tbaa !31
  %51 = getelementptr inbounds %struct.Vector2, ptr %7, i32 0, i32 1
  store float 0.000000e+00, ptr %51, align 4, !tbaa !32
  %52 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 0
  store i8 -1, ptr %52, align 1, !tbaa !33
  %53 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 1
  store i8 -1, ptr %53, align 1, !tbaa !34
  %54 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 2
  store i8 -1, ptr %54, align 1, !tbaa !35
  %55 = getelementptr inbounds %struct.Color, ptr %8, i32 0, i32 3
  store i8 -1, ptr %55, align 1, !tbaa !36
  %56 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 0
  %57 = load <2 x float>, ptr %56, align 4
  %58 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 1
  %59 = load <2 x float>, ptr %58, align 4
  %60 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 0
  %61 = load <2 x float>, ptr %60, align 4
  %62 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %6, i32 0, i32 1
  %63 = load <2 x float>, ptr %62, align 4
  %64 = load <2 x float>, ptr %7, align 4
  %65 = load i32, ptr %8, align 1
  call void @DrawTexturePro(ptr noundef byval(%struct.Texture) align 8 %4, <2 x float> %57, <2 x float> %59, <2 x float> %61, <2 x float> %63, <2 x float> %64, float noundef 0.000000e+00, i32 %65)
  call void @EndMode2D()
  ret void
}

declare void @DrawTexturePro(ptr noundef byval(%struct.Texture) align 8, <2 x float>, <2 x float>, <2 x float>, <2 x float>, <2 x float>, float noundef, i32) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10, i64 12, i64 4, !10, i64 16, i64 4, !10, i64 20, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13, i64 12, i64 4, !13, i64 16, i64 4, !13}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !11, i64 0}
!16 = !{!"_ZTS9Rectangle", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!17 = !{!16, !11, i64 4}
!18 = !{!19, !14, i64 96}
!19 = !{!"_ZTS11PixelCamera", !20, i64 0, !20, i64 8, !11, i64 16, !11, i64 20, !14, i64 24, !14, i64 28, !11, i64 32, !21, i64 36, !22, i64 40, !22, i64 64, !23, i64 88}
!20 = !{!"_ZTS7Vector2", !11, i64 0, !11, i64 4}
!21 = !{!"_ZTS5Color", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!22 = !{!"_ZTS8Camera2D", !20, i64 0, !20, i64 8, !11, i64 16, !11, i64 20}
!23 = !{!"_ZTS13RenderTexture", !14, i64 0, !24, i64 4, !24, i64 24}
!24 = !{!"_ZTS7Texture", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16}
!25 = !{!16, !11, i64 8}
!26 = !{!19, !14, i64 100}
!27 = !{!16, !11, i64 12}
!28 = !{!19, !11, i64 32}
!29 = !{!19, !14, i64 24}
!30 = !{!19, !14, i64 28}
!31 = !{!20, !11, i64 0}
!32 = !{!20, !11, i64 4}
!33 = !{!21, !7, i64 0}
!34 = !{!21, !7, i64 1}
!35 = !{!21, !7, i64 2}
!36 = !{!21, !7, i64 3}


; 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.Camera2D = type { %struct.Vector2, %struct.Vector2, float, float }
%struct.Vector2 = type { float, float }
%struct.Texture = type { i32, i32, i32, i32, i32 }

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

declare void @BeginMode2D(ptr noundef byval(%struct.Camera2D) align 8) local_unnamed_addr #1

declare void @EndMode2D() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11PixelCamera9DrawWorldEv(ptr nocapture noundef nonnull readonly align 4 dereferenceable(132) %0) local_unnamed_addr #2 align 2 {
  %2 = alloca %struct.Camera2D, align 8
  %3 = alloca %struct.Texture, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(24) %4, i64 24, i1 false), !tbaa.struct !5
  tail call void @BeginMode2D(ptr noundef nonnull byval(%struct.Camera2D) align 8 %2)
  %5 = getelementptr inbounds i8, ptr %0, i64 92
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %3, ptr noundef nonnull align 4 dereferenceable(20) %5, i64 20, i1 false), !tbaa.struct !10
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = load <4 x i32>, ptr %6, align 4
  %8 = shufflevector <4 x i32> %7, <4 x i32> poison, <2 x i32> <i32 0, i32 poison>
  %9 = getelementptr inbounds i8, ptr %0, i64 100
  %10 = load i32, ptr %9, align 4, !tbaa !13
  %11 = sub nsw i32 0, %10
  %12 = insertelement <2 x i32> %8, i32 %11, i64 1
  %13 = sitofp <2 x i32> %12 to <2 x float>
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load float, ptr %14, align 4, !tbaa !20
  %16 = fneg float %15
  %.sroa.03.0.vec.insert = insertelement <2 x float> poison, float %16, i64 0
  %.sroa.03.4.vec.insert = shufflevector <2 x float> %.sroa.03.0.vec.insert, <2 x float> poison, <2 x i32> zeroinitializer
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load <2 x i32>, ptr %17, align 4, !tbaa !11
  %19 = sitofp <2 x i32> %18 to <2 x float>
  %20 = insertelement <2 x float> poison, float %15, i64 0
  %21 = shufflevector <2 x float> %20, <2 x float> poison, <2 x i32> zeroinitializer
  %22 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %21, <2 x float> <float 2.000000e+00, float 2.000000e+00>, <2 x float> %19)
  tail call void @DrawTexturePro(ptr noundef nonnull byval(%struct.Texture) align 8 %3, <2 x float> zeroinitializer, <2 x float> %13, <2 x float> %.sroa.03.4.vec.insert, <2 x float> %22, <2 x float> zeroinitializer, float noundef 0.000000e+00, i32 -1)
  tail call void @EndMode2D()
  ret void
}

declare void @DrawTexturePro(ptr noundef byval(%struct.Texture) align 8, <2 x float>, <2 x float>, <2 x float>, <2 x float>, <2 x float>, float noundef, i32) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #3

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, i64 12, i64 4, !6, i64 16, i64 4, !6, i64 20, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 4, !11}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!14, !12, i64 100}
!14 = !{!"_ZTS11PixelCamera", !15, i64 0, !15, i64 8, !7, i64 16, !7, i64 20, !12, i64 24, !12, i64 28, !7, i64 32, !16, i64 36, !17, i64 40, !17, i64 64, !18, i64 88}
!15 = !{!"_ZTS7Vector2", !7, i64 0, !7, i64 4}
!16 = !{!"_ZTS5Color", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}
!17 = !{!"_ZTS8Camera2D", !15, i64 0, !15, i64 8, !7, i64 16, !7, i64 20}
!18 = !{!"_ZTS13RenderTexture", !12, i64 0, !19, i64 4, !19, i64 24}
!19 = !{!"_ZTS7Texture", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!20 = !{!14, !7, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass,VectorCombinePass