; LLVM IR from mickypaganini/SSI2016-jet-clustering :: spartyjet-4.0.2_mac/ExternalTools (DetectorModel)

; 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.DetectorModel::Line" = type { ptr, %"class.DetectorModel::SpacePoint", double, double, double, double }
%"class.DetectorModel::SpacePoint" = type { ptr, double, double, double, double }

@_ZTVN13DetectorModel4LineE = external dso_local unnamed_addr constant { [13 x ptr] }, align 8

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13DetectorModel4LineC2ERKNS_10SpacePointES3_(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %2) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  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
  %10 = load ptr, ptr %4, align 8
  store ptr getelementptr inbounds inrange(-16, 88) ({ [13 x ptr] }, ptr @_ZTVN13DetectorModel4LineE, i32 0, i32 0, i32 2), ptr %10, align 8, !tbaa !9
  %11 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN13DetectorModel10SpacePointC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %11, ptr noundef nonnull align 8 dereferenceable(40) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %13, align 8, !tbaa !9
  %16 = getelementptr inbounds ptr, ptr %15, i64 5
  %17 = load ptr, ptr %16, align 8
  %18 = invoke noundef double %17(ptr noundef nonnull align 8 dereferenceable(40) %13, ptr noundef nonnull align 8 dereferenceable(40) %14)
          to label %19 unwind label %64

19:                                               ; preds = %3
  store double %18, ptr %7, align 8, !tbaa !11
  %20 = load double, ptr %7, align 8, !tbaa !11
  %21 = fcmp ogt double %20, 0.000000e+00
  br i1 %21, label %22, label %68

22:                                               ; preds = %19
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 2
  %26 = load ptr, ptr %25, align 8
  %27 = invoke noundef double %26(ptr noundef nonnull align 8 dereferenceable(40) %23)
          to label %28 unwind label %64

28:                                               ; preds = %22
  %29 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 1
  %30 = invoke noundef double @_ZNK13DetectorModel10SpacePoint1xEv(ptr noundef nonnull align 8 dereferenceable(40) %29)
          to label %31 unwind label %64

31:                                               ; preds = %28
  %32 = fsub double %27, %30
  %33 = load double, ptr %7, align 8, !tbaa !11
  %34 = fdiv double %32, %33
  %35 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 2
  store double %34, ptr %35, align 8, !tbaa !13
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 3
  %39 = load ptr, ptr %38, align 8
  %40 = invoke noundef double %39(ptr noundef nonnull align 8 dereferenceable(40) %36)
          to label %41 unwind label %64

41:                                               ; preds = %31
  %42 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 1
  %43 = invoke noundef double @_ZNK13DetectorModel10SpacePoint1yEv(ptr noundef nonnull align 8 dereferenceable(40) %42)
          to label %44 unwind label %64

44:                                               ; preds = %41
  %45 = fsub double %40, %43
  %46 = load double, ptr %7, align 8, !tbaa !11
  %47 = fdiv double %45, %46
  %48 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 3
  store double %47, ptr %48, align 8, !tbaa !16
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds ptr, ptr %50, i64 4
  %52 = load ptr, ptr %51, align 8
  %53 = invoke noundef double %52(ptr noundef nonnull align 8 dereferenceable(40) %49)
          to label %54 unwind label %64

54:                                               ; preds = %44
  %55 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 1
  %56 = invoke noundef double @_ZNK13DetectorModel10SpacePoint1zEv(ptr noundef nonnull align 8 dereferenceable(40) %55)
          to label %57 unwind label %64

57:                                               ; preds = %54
  %58 = fsub double %53, %56
  %59 = load double, ptr %7, align 8, !tbaa !11
  %60 = fdiv double %58, %59
  %61 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 4
  store double %60, ptr %61, align 8, !tbaa !17
  %62 = load double, ptr %7, align 8, !tbaa !11
  %63 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 5
  store double %62, ptr %63, align 8, !tbaa !18
  br label %73

64:                                               ; preds = %54, %44, %41, %31, %28, %22, %3
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %8, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @_ZN13DetectorModel10SpacePointD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #3
  br label %74

68:                                               ; preds = %19
  %69 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 2
  store double 0.000000e+00, ptr %69, align 8, !tbaa !13
  %70 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 3
  store double 0.000000e+00, ptr %70, align 8, !tbaa !16
  %71 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 4
  store double 1.000000e+00, ptr %71, align 8, !tbaa !17
  %72 = getelementptr inbounds %"class.DetectorModel::Line", ptr %10, i32 0, i32 5
  store double 0.000000e+00, ptr %72, align 8, !tbaa !18
  br label %73

73:                                               ; preds = %68, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void

74:                                               ; preds = %64
  %75 = load ptr, ptr %8, align 8
  %76 = load i32, ptr %9, align 4
  %77 = insertvalue { ptr, i32 } poison, ptr %75, 0
  %78 = insertvalue { ptr, i32 } %77, i32 %76, 1
  resume { ptr, i32 } %78
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1xEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1yEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1zEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

declare void @_ZN13DetectorModel10SpacePointC1ERKS0_(ptr, ptr)

declare void @_ZN13DetectorModel10SpacePointD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 48}
!14 = !{!"_ZTSN13DetectorModel4LineE", !15, i64 8, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72}
!15 = !{!"_ZTSN13DetectorModel10SpacePointE", !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!16 = !{!14, !12, i64 56}
!17 = !{!14, !12, i64 64}
!18 = !{!14, !12, i64 72}


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

@_ZTVN13DetectorModel4LineE = external dso_local unnamed_addr constant { [13 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13DetectorModel4LineC2ERKNS_10SpacePointES3_(ptr noundef nonnull align 8 dereferenceable(80) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 88) (i8, ptr @_ZTVN13DetectorModel4LineE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN13DetectorModel10SpacePointC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %1)
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 40
  %7 = load ptr, ptr %6, align 8
  %8 = invoke noundef double %7(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %9 unwind label %39

9:                                                ; preds = %3
  %10 = fcmp ogt double %8, 0.000000e+00
  br i1 %10, label %11, label %41

11:                                               ; preds = %9
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = invoke noundef double %14(ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %16 unwind label %39

16:                                               ; preds = %11
  %17 = tail call noundef double @_ZNK13DetectorModel10SpacePoint1xEv(ptr noundef nonnull align 8 dereferenceable(40) %4)
  %18 = fsub double %15, %17
  %19 = fdiv double %18, %8
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store double %19, ptr %20, align 8, !tbaa !8
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 24
  %23 = load ptr, ptr %22, align 8
  %24 = invoke noundef double %23(ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %25 unwind label %39

25:                                               ; preds = %16
  %26 = tail call noundef double @_ZNK13DetectorModel10SpacePoint1yEv(ptr noundef nonnull align 8 dereferenceable(40) %4)
  %27 = fsub double %24, %26
  %28 = fdiv double %27, %8
  %29 = getelementptr inbounds i8, ptr %0, i64 56
  store double %28, ptr %29, align 8, !tbaa !13
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 32
  %32 = load ptr, ptr %31, align 8
  %33 = invoke noundef double %32(ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %34 unwind label %39

34:                                               ; preds = %25
  %35 = tail call noundef double @_ZNK13DetectorModel10SpacePoint1zEv(ptr noundef nonnull align 8 dereferenceable(40) %4)
  %36 = fsub double %33, %35
  %37 = fdiv double %36, %8
  %38 = getelementptr inbounds i8, ptr %0, i64 64
  store double %37, ptr %38, align 8, !tbaa !14
  br label %44

39:                                               ; preds = %25, %16, %11, %3
  %40 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN13DetectorModel10SpacePointD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #3
  resume { ptr, i32 } %40

41:                                               ; preds = %9
  %42 = getelementptr inbounds i8, ptr %0, i64 48
  %43 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %42, i8 0, i64 16, i1 false)
  store double 1.000000e+00, ptr %43, align 8, !tbaa !14
  br label %44

44:                                               ; preds = %41, %34
  %.sink = phi double [ 0.000000e+00, %41 ], [ %8, %34 ]
  %45 = getelementptr inbounds i8, ptr %0, i64 72
  store double %.sink, ptr %45, align 8, !tbaa !15
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1xEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1yEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK13DetectorModel10SpacePoint1zEv(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1 align 2

declare void @_ZN13DetectorModel10SpacePointC1ERKS0_(ptr, ptr) local_unnamed_addr

declare void @_ZN13DetectorModel10SpacePointD1Ev(ptr) local_unnamed_addr

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

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 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !11, i64 48}
!9 = !{!"_ZTSN13DetectorModel4LineE", !10, i64 8, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72}
!10 = !{!"_ZTSN13DetectorModel10SpacePointE", !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!11 = !{!"double", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!9, !11, i64 56}
!14 = !{!9, !11, i64 64}
!15 = !{!9, !11, i64 72}


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