; LLVM IR from mstern98/Collision-Physics-Engine :: src/Object (Colliders)

; 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.BoxCollider = type { float, float, float, ptr }

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @box_quad(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %9 = call noalias ptr @malloc(i64 noundef 8) #6
  store ptr %9, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %10 = call noalias ptr @calloc(i64 noundef 8, i64 noundef 8) #7
  store ptr %10, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.BoxCollider, ptr %11, i32 0, i32 3
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds ptr, ptr %14, i64 0
  store ptr %13, ptr %15, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.BoxCollider, ptr %16, i32 0, i32 3
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.BoxCollider, ptr %19, i32 0, i32 0
  %21 = load float, ptr %20, align 8, !tbaa !12
  %22 = call ptr @vector_init(float noundef %21, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %23 = call ptr @vector_add(ptr noundef %18, ptr noundef %22)
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds ptr, ptr %24, i64 1
  store ptr %23, ptr %25, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.BoxCollider, ptr %26, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.BoxCollider, ptr %29, i32 0, i32 0
  %31 = load float, ptr %30, align 8, !tbaa !12
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.BoxCollider, ptr %32, i32 0, i32 1
  %34 = load float, ptr %33, align 4, !tbaa !13
  %35 = call ptr @vector_init(float noundef %31, float noundef %34, float noundef 0.000000e+00)
  %36 = call ptr @vector_add(ptr noundef %28, ptr noundef %35)
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds ptr, ptr %37, i64 2
  store ptr %36, ptr %38, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.BoxCollider, ptr %39, i32 0, i32 3
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.BoxCollider, ptr %42, i32 0, i32 1
  %44 = load float, ptr %43, align 4, !tbaa !13
  %45 = call ptr @vector_init(float noundef 0.000000e+00, float noundef %44, float noundef 0.000000e+00)
  %46 = call ptr @vector_add(ptr noundef %41, ptr noundef %45)
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds ptr, ptr %47, i64 3
  store ptr %46, ptr %48, align 8, !tbaa !5
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.BoxCollider, ptr %49, i32 0, i32 3
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.BoxCollider, ptr %52, i32 0, i32 2
  %54 = load float, ptr %53, align 8, !tbaa !14
  %55 = call ptr @vector_init(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef %54)
  %56 = call ptr @vector_add(ptr noundef %51, ptr noundef %55)
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds ptr, ptr %57, i64 4
  store ptr %56, ptr %58, align 8, !tbaa !5
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.BoxCollider, ptr %59, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.BoxCollider, ptr %62, i32 0, i32 0
  %64 = load float, ptr %63, align 8, !tbaa !12
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.BoxCollider, ptr %65, i32 0, i32 2
  %67 = load float, ptr %66, align 8, !tbaa !14
  %68 = call ptr @vector_init(float noundef %64, float noundef 0.000000e+00, float noundef %67)
  %69 = call ptr @vector_add(ptr noundef %61, ptr noundef %68)
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds ptr, ptr %70, i64 5
  store ptr %69, ptr %71, align 8, !tbaa !5
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.BoxCollider, ptr %72, i32 0, i32 3
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.BoxCollider, ptr %75, i32 0, i32 0
  %77 = load float, ptr %76, align 8, !tbaa !12
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.BoxCollider, ptr %78, i32 0, i32 1
  %80 = load float, ptr %79, align 4, !tbaa !13
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.BoxCollider, ptr %81, i32 0, i32 2
  %83 = load float, ptr %82, align 8, !tbaa !14
  %84 = call ptr @vector_init(float noundef %77, float noundef %80, float noundef %83)
  %85 = call ptr @vector_add(ptr noundef %74, ptr noundef %84)
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds ptr, ptr %86, i64 6
  store ptr %85, ptr %87, align 8, !tbaa !5
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.BoxCollider, ptr %88, i32 0, i32 3
  %90 = load ptr, ptr %89, align 8, !tbaa !9
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.BoxCollider, ptr %91, i32 0, i32 1
  %93 = load float, ptr %92, align 4, !tbaa !13
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.BoxCollider, ptr %94, i32 0, i32 2
  %96 = load float, ptr %95, align 8, !tbaa !14
  %97 = call ptr @vector_init(float noundef 0.000000e+00, float noundef %93, float noundef %96)
  %98 = call ptr @vector_add(ptr noundef %90, ptr noundef %97)
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds ptr, ptr %99, i64 7
  store ptr %98, ptr %100, align 8, !tbaa !5
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret ptr %101
}

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

declare ptr @vector_add(ptr noundef, ptr noundef) #4

declare ptr @vector_init(float noundef, float noundef, float noundef) #4

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

!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/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"BoxCollider", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 8}


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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @box_quad(ptr nocapture noundef readonly %0, ptr nocapture noundef readnone %1, ptr nocapture noundef readnone %2) local_unnamed_addr #1 {
  %4 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = load float, ptr %0, align 8, !tbaa !11
  %8 = tail call ptr @vector_init(float noundef %7, float noundef 0.000000e+00, float noundef 0.000000e+00) #4
  %9 = tail call ptr @vector_add(ptr noundef %6, ptr noundef %8) #4
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = load float, ptr %0, align 8, !tbaa !11
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  %13 = load float, ptr %12, align 4, !tbaa !12
  %14 = tail call ptr @vector_init(float noundef %11, float noundef %13, float noundef 0.000000e+00) #4
  %15 = tail call ptr @vector_add(ptr noundef %10, ptr noundef %14) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load float, ptr %12, align 4, !tbaa !12
  %18 = tail call ptr @vector_init(float noundef 0.000000e+00, float noundef %17, float noundef 0.000000e+00) #4
  %19 = tail call ptr @vector_add(ptr noundef %16, ptr noundef %18) #4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load float, ptr %21, align 8, !tbaa !13
  %23 = tail call ptr @vector_init(float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef %22) #4
  %24 = tail call ptr @vector_add(ptr noundef %20, ptr noundef %23) #4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load float, ptr %0, align 8, !tbaa !11
  %27 = load float, ptr %21, align 8, !tbaa !13
  %28 = tail call ptr @vector_init(float noundef %26, float noundef 0.000000e+00, float noundef %27) #4
  %29 = tail call ptr @vector_add(ptr noundef %25, ptr noundef %28) #4
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load float, ptr %0, align 8, !tbaa !11
  %32 = load float, ptr %12, align 4, !tbaa !12
  %33 = load float, ptr %21, align 8, !tbaa !13
  %34 = tail call ptr @vector_init(float noundef %31, float noundef %32, float noundef %33) #4
  %35 = tail call ptr @vector_add(ptr noundef %30, ptr noundef %34) #4
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load float, ptr %12, align 4, !tbaa !12
  %38 = load float, ptr %21, align 8, !tbaa !13
  %39 = tail call ptr @vector_init(float noundef 0.000000e+00, float noundef %37, float noundef %38) #4
  %40 = tail call ptr @vector_add(ptr noundef %36, ptr noundef %39) #4
  ret ptr %4
}

declare ptr @vector_add(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @vector_init(float noundef, float noundef, float noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { "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 allocsize(0) }
attributes #4 = { 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, !10, i64 16}
!6 = !{!"BoxCollider", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}


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