; LLVM IR from buresjan/optim_lbm :: nomad/src/Math/Direction.ll (ZNK9NOMAD_4_39Direction4normENS_8NormTypeE)

; 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.NOMAD_4_3::Double" = type <{ ptr, double, i8, [7 x i8] }>
%"class.NOMAD_4_3::ArrayOfDouble" = type { ptr, i64, ptr }

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoublepLERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK9NOMAD_4_39Direction13squaredL2NormEv(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

declare void @_ZN9NOMAD_4_36DoubleC1ERKd(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK9NOMAD_4_39Direction4normENS_8NormTypeE(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::Double") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i1, align 1
  %8 = alloca double, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.NOMAD_4_3::Double", align 8
  %13 = alloca %"class.NOMAD_4_3::Double", align 8
  %14 = alloca i64, align 8
  %15 = alloca %"class.NOMAD_4_3::Double", align 8
  %16 = alloca %"class.NOMAD_4_3::Double", align 8
  %17 = alloca %"class.NOMAD_4_3::Double", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %18 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store double 0.000000e+00, ptr %8, align 8, !tbaa !11
  call void @_ZN9NOMAD_4_36DoubleC1ERKd(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %19 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %19, label %54 [
    i32 0, label %20
    i32 1, label %53
    i32 2, label %77
  ]

20:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !13
  br label %21

21:                                               ; preds = %39, %20
  %22 = load i64, ptr %9, align 8, !tbaa !13
  %23 = invoke noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
          to label %24 unwind label %27

24:                                               ; preds = %21
  %25 = icmp ult i64 %22, %23
  br i1 %25, label %31, label %26

26:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %52

27:                                               ; preds = %21
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %10, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %11, align 4
  br label %51

31:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  %32 = getelementptr inbounds %"class.NOMAD_4_3::ArrayOfDouble", ptr %18, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load i64, ptr %9, align 8, !tbaa !13
  %35 = getelementptr inbounds %"class.NOMAD_4_3::Double", ptr %33, i64 %34
  invoke void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8 %12, ptr noundef nonnull align 8 dereferenceable(17) %35)
          to label %36 unwind label %42

36:                                               ; preds = %31
  %37 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoublepLERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %12)
          to label %38 unwind label %46

38:                                               ; preds = %36
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %39

39:                                               ; preds = %38
  %40 = load i64, ptr %9, align 8, !tbaa !13
  %41 = add i64 %40, 1
  store i64 %41, ptr %9, align 8, !tbaa !13
  br label %21, !llvm.loop !17

42:                                               ; preds = %31
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %10, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %11, align 4
  br label %50

46:                                               ; preds = %36
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %10, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %11, align 4
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %12) #6
  br label %50

50:                                               ; preds = %46, %42
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  br label %51

51:                                               ; preds = %50, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %126

52:                                               ; preds = %26
  br label %122

53:                                               ; preds = %3
  br label %54

54:                                               ; preds = %53, %3
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #6
  invoke void @_ZNK9NOMAD_4_39Direction13squaredL2NormEv(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %18)
          to label %55 unwind label %64

55:                                               ; preds = %54
  %56 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %13)
          to label %57 unwind label %68

57:                                               ; preds = %55
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  %58 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NOMAD_4_36Double8todoubleEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
          to label %59 unwind label %73

59:                                               ; preds = %57
  %60 = load double, ptr %58, align 8, !tbaa !11
  %61 = call double @sqrt(double noundef %60) #6
  %62 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSEd(ptr noundef nonnull align 8 dereferenceable(17) %0, double noundef %61)
          to label %63 unwind label %73

63:                                               ; preds = %59
  br label %122

64:                                               ; preds = %54
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %10, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %11, align 4
  br label %72

68:                                               ; preds = %55
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %10, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %11, align 4
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %13) #6
  br label %72

72:                                               ; preds = %68, %64
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  br label %126

73:                                               ; preds = %59, %57
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %10, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %11, align 4
  br label %126

77:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store i64 0, ptr %14, align 8, !tbaa !13
  br label %78

78:                                               ; preds = %98, %77
  %79 = load i64, ptr %14, align 8, !tbaa !13
  %80 = invoke noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
          to label %81 unwind label %84

81:                                               ; preds = %78
  %82 = icmp ult i64 %79, %80
  br i1 %82, label %88, label %83

83:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %121

84:                                               ; preds = %78
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %10, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %11, align 4
  br label %120

88:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #6
  invoke void @_ZN9NOMAD_4_36DoubleC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %16, ptr noundef nonnull align 8 dereferenceable(17) %0)
          to label %89 unwind label %101

89:                                               ; preds = %88
  %90 = getelementptr inbounds %"class.NOMAD_4_3::ArrayOfDouble", ptr %18, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !15
  %92 = load i64, ptr %14, align 8, !tbaa !13
  %93 = getelementptr inbounds %"class.NOMAD_4_3::Double", ptr %91, i64 %92
  invoke void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8 %17, ptr noundef nonnull align 8 dereferenceable(17) %93)
          to label %94 unwind label %105

94:                                               ; preds = %89
  invoke void @_ZN9NOMAD_4_33maxENS_6DoubleES0_(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8 %15, ptr noundef %16, ptr noundef %17)
          to label %95 unwind label %109

95:                                               ; preds = %94
  %96 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %15)
          to label %97 unwind label %113

97:                                               ; preds = %95
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %15) #6
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %17) #6
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  br label %98

98:                                               ; preds = %97
  %99 = load i64, ptr %14, align 8, !tbaa !13
  %100 = add i64 %99, 1
  store i64 %100, ptr %14, align 8, !tbaa !13
  br label %78, !llvm.loop !19

101:                                              ; preds = %88
  %102 = landingpad { ptr, i32 }
          cleanup
  %103 = extractvalue { ptr, i32 } %102, 0
  store ptr %103, ptr %10, align 8
  %104 = extractvalue { ptr, i32 } %102, 1
  store i32 %104, ptr %11, align 4
  br label %119

105:                                              ; preds = %89
  %106 = landingpad { ptr, i32 }
          cleanup
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %10, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %11, align 4
  br label %118

109:                                              ; preds = %94
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %10, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %11, align 4
  br label %117

113:                                              ; preds = %95
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %10, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %11, align 4
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %15) #6
  br label %117

117:                                              ; preds = %113, %109
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %17) #6
  br label %118

118:                                              ; preds = %117, %105
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %16) #6
  br label %119

119:                                              ; preds = %118, %101
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  br label %120

120:                                              ; preds = %119, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %126

121:                                              ; preds = %83
  br label %122

122:                                              ; preds = %121, %63, %52
  store i1 true, ptr %7, align 1
  %123 = load i1, ptr %7, align 1
  br i1 %123, label %125, label %124

124:                                              ; preds = %122
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) #6
  br label %125

125:                                              ; preds = %124, %122
  ret void

126:                                              ; preds = %120, %73, %72, %51
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) #6
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %10, align 8
  %129 = load i32, ptr %11, align 4
  %130 = insertvalue { ptr, i32 } poison, ptr %128, 0
  %131 = insertvalue { ptr, i32 } %130, i32 %129, 1
  resume { ptr, i32 } %131
}

declare void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef nonnull align 8 dereferenceable(17)) #2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NOMAD_4_36Double8todoubleEv(ptr noundef nonnull align 8 dereferenceable(17)) #2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSEd(ptr noundef nonnull align 8 dereferenceable(17), double noundef) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9NOMAD_4_33maxENS_6DoubleES0_(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef, ptr noundef) #5

declare void @_ZN9NOMAD_4_36DoubleC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { 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 #4 = { 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 #5 = { inlinehint 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 #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 = !{!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 = !{!"_ZTSN9NOMAD_4_38NormTypeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !6, i64 16}
!16 = !{!"_ZTSN9NOMAD_4_313ArrayOfDoubleE", !14, i64 8, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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.NOMAD_4_3::Double" = type <{ ptr, double, i8, [7 x i8] }>

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoublepLERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK9NOMAD_4_39Direction13squaredL2NormEv(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

declare void @_ZN9NOMAD_4_36DoubleC1ERKd(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK9NOMAD_4_39Direction4normENS_8NormTypeE(ptr dead_on_unwind noalias nonnull writable sret(%"class.NOMAD_4_3::Double") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca double, align 8
  %5 = alloca %"class.NOMAD_4_3::Double", align 8
  %6 = alloca %"class.NOMAD_4_3::Double", align 8
  %7 = alloca %"class.NOMAD_4_3::Double", align 8
  %8 = alloca %"class.NOMAD_4_3::Double", align 8
  %9 = alloca %"class.NOMAD_4_3::Double", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  call void @_ZN9NOMAD_4_36DoubleC1ERKd(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  switch i32 %2, label %28 [
    i32 0, label %.preheader
    i32 2, label %.preheader27
  ]

.preheader27:                                     ; preds = %3
  %10 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader27
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  br label %44

.preheader:                                       ; preds = %3
  %12 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not32 = icmp eq i64 %12, 0
  br i1 %.not32, label %.loopexit, label %.lr.ph31

.lr.ph31:                                         ; preds = %.preheader
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  br label %14

14:                                               ; preds = %.lr.ph31, %19
  %.01730 = phi i64 [ 0, %.lr.ph31 ], [ %20, %19 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  %15 = load ptr, ptr %13, align 8, !tbaa !9
  %16 = getelementptr inbounds %"class.NOMAD_4_3::Double", ptr %15, i64 %.01730
  invoke void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind nonnull writable sret(%"class.NOMAD_4_3::Double") align 8 %5, ptr noundef nonnull align 8 dereferenceable(17) %16)
          to label %17 unwind label %23

17:                                               ; preds = %14
  %18 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoublepLERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %5)
          to label %19 unwind label %25

19:                                               ; preds = %17
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  %20 = add nuw i64 %.01730, 1
  %21 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %22 = icmp ult i64 %20, %21
  br i1 %22, label %14, label %.loopexit, !llvm.loop !13

23:                                               ; preds = %14
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %17
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %5) #7
  br label %27

27:                                               ; preds = %25, %23
  %.pn21 = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  br label %66

28:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  invoke void @_ZNK9NOMAD_4_39Direction13squaredL2NormEv(ptr dead_on_unwind nonnull writable sret(%"class.NOMAD_4_3::Double") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %29 unwind label %37

29:                                               ; preds = %28
  %30 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %6)
          to label %31 unwind label %39

31:                                               ; preds = %29
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  %32 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NOMAD_4_36Double8todoubleEv(ptr noundef nonnull align 8 dereferenceable(17) %0)
          to label %33 unwind label %42

33:                                               ; preds = %31
  %34 = load double, ptr %32, align 8, !tbaa !5
  %35 = call double @sqrt(double noundef %34) #7
  %36 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSEd(ptr noundef nonnull align 8 dereferenceable(17) %0, double noundef %35)
          to label %.loopexit unwind label %42

37:                                               ; preds = %28
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %41

39:                                               ; preds = %29
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %6) #7
  br label %41

41:                                               ; preds = %39, %37
  %.pn23 = phi { ptr, i32 } [ %40, %39 ], [ %38, %37 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  br label %66

42:                                               ; preds = %33, %31
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %66

44:                                               ; preds = %.lr.ph, %51
  %.029 = phi i64 [ 0, %.lr.ph ], [ %52, %51 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  invoke void @_ZN9NOMAD_4_36DoubleC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %8, ptr noundef nonnull align 8 dereferenceable(17) %0)
          to label %45 unwind label %55

45:                                               ; preds = %44
  %46 = load ptr, ptr %11, align 8, !tbaa !9
  %47 = getelementptr inbounds %"class.NOMAD_4_3::Double", ptr %46, i64 %.029
  invoke void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind nonnull writable sret(%"class.NOMAD_4_3::Double") align 8 %9, ptr noundef nonnull align 8 dereferenceable(17) %47)
          to label %48 unwind label %57

48:                                               ; preds = %45
  invoke void @_ZN9NOMAD_4_33maxENS_6DoubleES0_(ptr dead_on_unwind nonnull writable sret(%"class.NOMAD_4_3::Double") align 8 %7, ptr noundef nonnull %8, ptr noundef nonnull %9)
          to label %49 unwind label %59

49:                                               ; preds = %48
  %50 = invoke noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17) %0, ptr noundef nonnull align 8 dereferenceable(17) %7)
          to label %51 unwind label %61

51:                                               ; preds = %49
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %7) #7
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %9) #7
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  %52 = add nuw i64 %.029, 1
  %53 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %54 = icmp ult i64 %52, %53
  br i1 %54, label %44, label %.loopexit, !llvm.loop !15

55:                                               ; preds = %44
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %65

57:                                               ; preds = %45
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %64

59:                                               ; preds = %48
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %63

61:                                               ; preds = %49
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %7) #7
  br label %63

63:                                               ; preds = %61, %59
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %60, %59 ]
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %9) #7
  br label %64

64:                                               ; preds = %63, %57
  %.pn.pn = phi { ptr, i32 } [ %.pn, %63 ], [ %58, %57 ]
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %8) #7
  br label %65

65:                                               ; preds = %64, %55
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %64 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  br label %66

.loopexit:                                        ; preds = %51, %19, %.preheader27, %.preheader, %33
  ret void

66:                                               ; preds = %65, %42, %41, %27
  %.pn25 = phi { ptr, i32 } [ %43, %42 ], [ %.pn23, %41 ], [ %.pn.pn.pn, %65 ], [ %.pn21, %27 ]
  call void @_ZN9NOMAD_4_36DoubleD1Ev(ptr noundef nonnull align 8 dereferenceable(17) %0) #7
  resume { ptr, i32 } %.pn25
}

declare void @_ZNK9NOMAD_4_36Double3absEv(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9NOMAD_4_36Double8todoubleEv(ptr noundef nonnull align 8 dereferenceable(17)) local_unnamed_addr #2

declare noundef nonnull align 8 dereferenceable(17) ptr @_ZN9NOMAD_4_36DoubleaSEd(ptr noundef nonnull align 8 dereferenceable(17), double noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN9NOMAD_4_33maxENS_6DoubleES0_(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::Double") align 8, ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @_ZN9NOMAD_4_36DoubleC1ERKS0_(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef nonnull align 8 dereferenceable(17)) unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(write) "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 = { inlinehint 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 #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"_ZTSN9NOMAD_4_313ArrayOfDoubleE", !11, i64 8, !12, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass