; LLVM IR from sagar0710/particle-simul :: util.ll (Z25check_stat_rect_collisionRK8Sim_BodyS1_)

; 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.std::pair" = type { float, float }
%class.Sim_Body = type { ptr, i32, %"class.std::vector", float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, i8, i8, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<float, float>, std::allocator<std::pair<float, float>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<float, float>, std::allocator<std::pair<float, float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<float, float>, std::allocator<std::pair<float, float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<float, float>, std::allocator<std::pair<float, float>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 uwtable
declare dso_local <2 x float> @_Z28get_point_in_shifted_rotatedfffff(float noundef, float noundef, float noundef, float noundef, float noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z25check_stat_rect_collisionRK8Sim_BodyS1_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(144) %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"struct.std::pair", align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %class.Sim_Body, ptr %12, i32 0, i32 3
  %14 = load float, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.Sim_Body, ptr %15, i32 0, i32 4
  %17 = load float, ptr %16, align 4, !tbaa !19
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %class.Sim_Body, ptr %18, i32 0, i32 15
  %20 = load float, ptr %19, align 8, !tbaa !20
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.Sim_Body, ptr %21, i32 0, i32 3
  %23 = load float, ptr %22, align 8, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.Sim_Body, ptr %24, i32 0, i32 4
  %26 = load float, ptr %25, align 4, !tbaa !19
  %27 = call <2 x float> @_Z28get_point_in_shifted_rotatedfffff(float noundef %14, float noundef %17, float noundef %20, float noundef %23, float noundef %26)
  store <2 x float> %27, ptr %6, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  %28 = getelementptr inbounds %"struct.std::pair", ptr %6, i32 0, i32 0
  %29 = load float, ptr %28, align 4, !tbaa !21
  store float %29, ptr %7, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  %30 = getelementptr inbounds %"struct.std::pair", ptr %6, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !24
  store float %31, ptr %8, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.Sim_Body, ptr %32, i32 0, i32 12
  %34 = load float, ptr %33, align 4, !tbaa !25
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.Sim_Body, ptr %35, i32 0, i32 16
  %37 = load float, ptr %36, align 4, !tbaa !26
  %38 = fdiv float %37, 2.000000e+00
  %39 = fadd float %34, %38
  store float %39, ptr %9, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %class.Sim_Body, ptr %40, i32 0, i32 12
  %42 = load float, ptr %41, align 4, !tbaa !25
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %class.Sim_Body, ptr %43, i32 0, i32 17
  %45 = load float, ptr %44, align 8, !tbaa !27
  %46 = fdiv float %45, 2.000000e+00
  %47 = fadd float %42, %46
  store float %47, ptr %10, align 4, !tbaa !23
  %48 = load float, ptr %8, align 4, !tbaa !23
  %49 = load float, ptr %10, align 4, !tbaa !23
  %50 = fcmp olt float %48, %49
  br i1 %50, label %51, label %67

51:                                               ; preds = %2
  %52 = load float, ptr %8, align 4, !tbaa !23
  %53 = load float, ptr %10, align 4, !tbaa !23
  %54 = fneg float %53
  %55 = fcmp ogt float %52, %54
  br i1 %55, label %56, label %67

56:                                               ; preds = %51
  %57 = load float, ptr %7, align 4, !tbaa !23
  %58 = load float, ptr %9, align 4, !tbaa !23
  %59 = fcmp olt float %57, %58
  br i1 %59, label %60, label %65

60:                                               ; preds = %56
  %61 = load float, ptr %7, align 4, !tbaa !23
  %62 = load float, ptr %9, align 4, !tbaa !23
  %63 = fneg float %62
  %64 = fcmp ogt float %61, %63
  br label %65

65:                                               ; preds = %60, %56
  %66 = phi i1 [ false, %56 ], [ %64, %60 ]
  store i1 %66, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %88

67:                                               ; preds = %51, %2
  %68 = load float, ptr %7, align 4, !tbaa !23
  %69 = load float, ptr %9, align 4, !tbaa !23
  %70 = fcmp olt float %68, %69
  br i1 %70, label %71, label %87

71:                                               ; preds = %67
  %72 = load float, ptr %7, align 4, !tbaa !23
  %73 = load float, ptr %9, align 4, !tbaa !23
  %74 = fneg float %73
  %75 = fcmp ogt float %72, %74
  br i1 %75, label %76, label %87

76:                                               ; preds = %71
  %77 = load float, ptr %8, align 4, !tbaa !23
  %78 = load float, ptr %10, align 4, !tbaa !23
  %79 = fcmp olt float %77, %78
  br i1 %79, label %80, label %85

80:                                               ; preds = %76
  %81 = load float, ptr %8, align 4, !tbaa !23
  %82 = load float, ptr %10, align 4, !tbaa !23
  %83 = fneg float %82
  %84 = fcmp ogt float %81, %83
  br label %85

85:                                               ; preds = %80, %76
  %86 = phi i1 [ false, %76 ], [ %84, %80 ]
  store i1 %86, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %88

87:                                               ; preds = %71, %67
  store i1 false, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %88

88:                                               ; preds = %87, %85, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %89 = load i1, ptr %3, align 1
  ret i1 %89
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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, !16, i64 40}
!10 = !{!"_ZTS8Sim_Body", !11, i64 8, !12, i64 16, !16, i64 40, !16, i64 44, !16, i64 48, !16, i64 52, !16, i64 56, !16, i64 60, !16, i64 64, !16, i64 68, !16, i64 72, !16, i64 76, !16, i64 80, !16, i64 84, !16, i64 88, !16, i64 92, !16, i64 96, !16, i64 100, !16, i64 104, !16, i64 108, !16, i64 112, !16, i64 116, !16, i64 120, !16, i64 124, !16, i64 128, !17, i64 132, !17, i64 133, !11, i64 136, !18, i64 140}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorISt4pairIffESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseISt4pairIffESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt4pairIffESaIS1_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt4pairIffESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"float", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS9body_type", !7, i64 0}
!19 = !{!10, !16, i64 44}
!20 = !{!10, !16, i64 88}
!21 = !{!22, !16, i64 0}
!22 = !{!"_ZTSSt4pairIffE", !16, i64 0, !16, i64 4}
!23 = !{!16, !16, i64 0}
!24 = !{!22, !16, i64 4}
!25 = !{!10, !16, i64 76}
!26 = !{!10, !16, i64 92}
!27 = !{!10, !16, i64 96}


; 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 uwtable
declare dso_local <2 x float> @_Z28get_point_in_shifted_rotatedfffff(float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z25check_stat_rect_collisionRK8Sim_BodyS1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(144) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(144) %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 40
  %4 = load float, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 44
  %6 = load float, ptr %5, align 4, !tbaa !18
  %7 = getelementptr inbounds i8, ptr %1, i64 88
  %8 = load float, ptr %7, align 8, !tbaa !19
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load float, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 44
  %12 = load float, ptr %11, align 4, !tbaa !18
  %13 = tail call <2 x float> @_Z28get_point_in_shifted_rotatedfffff(float noundef %4, float noundef %6, float noundef %8, float noundef %10, float noundef %12)
  %.sroa.0.4.vec.extract = extractelement <2 x float> %13, i64 1
  %14 = getelementptr inbounds i8, ptr %0, i64 76
  %15 = load float, ptr %14, align 4, !tbaa !20
  %16 = getelementptr inbounds i8, ptr %1, i64 96
  %17 = load float, ptr %16, align 8, !tbaa !21
  %18 = fmul float %17, 5.000000e-01
  %19 = fadd float %15, %18
  %20 = fcmp olt float %.sroa.0.4.vec.extract, %19
  %21 = fneg float %19
  %22 = fcmp ogt float %.sroa.0.4.vec.extract, %21
  %or.cond = and i1 %20, %22
  br i1 %or.cond, label %23, label %32

23:                                               ; preds = %2
  %24 = getelementptr inbounds i8, ptr %1, i64 92
  %25 = load float, ptr %24, align 4, !tbaa !22
  %26 = fmul float %25, 5.000000e-01
  %27 = fadd float %15, %26
  %.sroa.0.0.vec.extract = extractelement <2 x float> %13, i64 0
  %28 = fcmp olt float %.sroa.0.0.vec.extract, %27
  %29 = fneg float %27
  %30 = fcmp ogt float %.sroa.0.0.vec.extract, %29
  %31 = and i1 %28, %30
  br label %32

32:                                               ; preds = %2, %23
  %.0 = phi i1 [ %31, %23 ], [ false, %2 ]
  ret i1 %.0
}

attributes #0 = { 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" }

!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, !15, i64 40}
!6 = !{!"_ZTS8Sim_Body", !7, i64 8, !10, i64 16, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !15, i64 84, !15, i64 88, !15, i64 92, !15, i64 96, !15, i64 100, !15, i64 104, !15, i64 108, !15, i64 112, !15, i64 116, !15, i64 120, !15, i64 124, !15, i64 128, !16, i64 132, !16, i64 133, !7, i64 136, !17, i64 140}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorISt4pairIffESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseISt4pairIffESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseISt4pairIffESaIS1_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseISt4pairIffESaIS1_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"float", !8, i64 0}
!16 = !{!"bool", !8, i64 0}
!17 = !{!"_ZTS9body_type", !8, i64 0}
!18 = !{!6, !15, i64 44}
!19 = !{!6, !15, i64 88}
!20 = !{!6, !15, i64 76}
!21 = !{!6, !15, i64 96}
!22 = !{!6, !15, i64 92}


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