; LLVM IR from siconos/siconos :: numerics/src/FrictionContact/Generated (fc3d_AlartCurnierJeanMoreauFGenerated)

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

; Function Attrs: nounwind uwtable
define dso_local void @fc3d_AlartCurnierJeanMoreauFGenerated(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, ptr noundef %10) #0 {
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca ptr, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca double, align 8
  %29 = alloca double, align 8
  %30 = alloca double, align 8
  %31 = alloca double, align 8
  %32 = alloca double, align 8
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca double, align 8
  %36 = alloca double, align 8
  %37 = alloca double, align 8
  store double %0, ptr %12, align 8, !tbaa !5
  store double %1, ptr %13, align 8, !tbaa !5
  store double %2, ptr %14, align 8, !tbaa !5
  store double %3, ptr %15, align 8, !tbaa !5
  store double %4, ptr %16, align 8, !tbaa !5
  store double %5, ptr %17, align 8, !tbaa !5
  store double %6, ptr %18, align 8, !tbaa !5
  store double %7, ptr %19, align 8, !tbaa !5
  store double %8, ptr %20, align 8, !tbaa !5
  store double %9, ptr %21, align 8, !tbaa !5
  store ptr %10, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  store double 0.000000e+00, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  store double 0.000000e+00, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  store double 0.000000e+00, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  store double 0.000000e+00, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  store double 0.000000e+00, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  store double 0.000000e+00, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #4
  store double 0.000000e+00, ptr %29, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  store double 0.000000e+00, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  store double 0.000000e+00, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #4
  store double 0.000000e+00, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #4
  store i32 0, ptr %33, align 4, !tbaa !11
  %38 = load double, ptr %20, align 8, !tbaa !5
  %39 = load double, ptr %16, align 8, !tbaa !5
  %40 = fmul double %38, %39
  store double %40, ptr %23, align 8, !tbaa !5
  %41 = load double, ptr %13, align 8, !tbaa !5
  %42 = fneg double %41
  %43 = load double, ptr %23, align 8, !tbaa !5
  %44 = fadd double %42, %43
  store double %44, ptr %24, align 8, !tbaa !5
  %45 = load double, ptr %24, align 8, !tbaa !5
  %46 = load double, ptr %24, align 8, !tbaa !5
  %47 = fmul double %45, %46
  store double %47, ptr %25, align 8, !tbaa !5
  %48 = load double, ptr %21, align 8, !tbaa !5
  %49 = load double, ptr %17, align 8, !tbaa !5
  %50 = fmul double %48, %49
  store double %50, ptr %26, align 8, !tbaa !5
  %51 = load double, ptr %14, align 8, !tbaa !5
  %52 = fneg double %51
  %53 = load double, ptr %26, align 8, !tbaa !5
  %54 = fadd double %52, %53
  store double %54, ptr %27, align 8, !tbaa !5
  %55 = load double, ptr %27, align 8, !tbaa !5
  %56 = load double, ptr %27, align 8, !tbaa !5
  %57 = fmul double %55, %56
  store double %57, ptr %28, align 8, !tbaa !5
  %58 = load double, ptr %25, align 8, !tbaa !5
  %59 = load double, ptr %28, align 8, !tbaa !5
  %60 = fadd double %58, %59
  store double %60, ptr %29, align 8, !tbaa !5
  %61 = load double, ptr %29, align 8, !tbaa !5
  %62 = call double @sqrt(double noundef %61) #4
  store double %62, ptr %30, align 8, !tbaa !5
  %63 = load double, ptr %12, align 8, !tbaa !5
  %64 = call double @llvm.maxnum.f64(double 0.000000e+00, double %63)
  store double %64, ptr %31, align 8, !tbaa !5
  %65 = load double, ptr %18, align 8, !tbaa !5
  %66 = load double, ptr %31, align 8, !tbaa !5
  %67 = fmul double %65, %66
  %68 = call double @llvm.maxnum.f64(double 0x3CB0000000000000, double %67)
  store double %68, ptr %32, align 8, !tbaa !5
  %69 = load double, ptr %30, align 8, !tbaa !5
  %70 = load double, ptr %32, align 8, !tbaa !5
  %71 = fcmp ole double %69, %70
  %72 = zext i1 %71 to i32
  store i32 %72, ptr %33, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #4
  store i32 0, ptr %34, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #4
  store double 0.000000e+00, ptr %35, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #4
  store double 0.000000e+00, ptr %36, align 8, !tbaa !5
  %73 = load double, ptr %30, align 8, !tbaa !5
  %74 = load double, ptr %32, align 8, !tbaa !5
  %75 = fcmp ogt double %73, %74
  %76 = zext i1 %75 to i32
  store i32 %76, ptr %34, align 4, !tbaa !11
  %77 = load i32, ptr %33, align 4, !tbaa !11
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %11
  br label %80

80:                                               ; preds = %79, %11
  %81 = load i32, ptr %34, align 4, !tbaa !11
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %89

83:                                               ; preds = %80
  %84 = load double, ptr %30, align 8, !tbaa !5
  %85 = fdiv double 1.000000e+00, %84
  store double %85, ptr %35, align 8, !tbaa !5
  %86 = load double, ptr %32, align 8, !tbaa !5
  %87 = load double, ptr %35, align 8, !tbaa !5
  %88 = fmul double %86, %87
  store double %88, ptr %36, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %83, %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #4
  store double 0.000000e+00, ptr %37, align 8, !tbaa !5
  %90 = load double, ptr %19, align 8, !tbaa !5
  %91 = fneg double %90
  %92 = load double, ptr %15, align 8, !tbaa !5
  %93 = load double, ptr %12, align 8, !tbaa !5
  %94 = call double @llvm.fmuladd.f64(double %91, double %92, double %93)
  %95 = call double @llvm.maxnum.f64(double 0.000000e+00, double %94)
  store double %95, ptr %37, align 8, !tbaa !5
  %96 = load double, ptr %12, align 8, !tbaa !5
  %97 = load double, ptr %37, align 8, !tbaa !5
  %98 = fsub double %96, %97
  %99 = load ptr, ptr %22, align 8, !tbaa !9
  %100 = getelementptr inbounds double, ptr %99, i64 0
  store double %98, ptr %100, align 8, !tbaa !5
  %101 = load i32, ptr %33, align 4, !tbaa !11
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %107

103:                                              ; preds = %89
  %104 = load double, ptr %23, align 8, !tbaa !5
  %105 = load ptr, ptr %22, align 8, !tbaa !9
  %106 = getelementptr inbounds double, ptr %105, i64 1
  store double %104, ptr %106, align 8, !tbaa !5
  br label %118

107:                                              ; preds = %89
  %108 = load i32, ptr %34, align 4, !tbaa !11
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %117

110:                                              ; preds = %107
  %111 = load double, ptr %13, align 8, !tbaa !5
  %112 = load double, ptr %36, align 8, !tbaa !5
  %113 = load double, ptr %24, align 8, !tbaa !5
  %114 = call double @llvm.fmuladd.f64(double %112, double %113, double %111)
  %115 = load ptr, ptr %22, align 8, !tbaa !9
  %116 = getelementptr inbounds double, ptr %115, i64 1
  store double %114, ptr %116, align 8, !tbaa !5
  br label %117

117:                                              ; preds = %110, %107
  br label %118

118:                                              ; preds = %117, %103
  %119 = load i32, ptr %33, align 4, !tbaa !11
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %125

121:                                              ; preds = %118
  %122 = load double, ptr %26, align 8, !tbaa !5
  %123 = load ptr, ptr %22, align 8, !tbaa !9
  %124 = getelementptr inbounds double, ptr %123, i64 2
  store double %122, ptr %124, align 8, !tbaa !5
  br label %136

125:                                              ; preds = %118
  %126 = load i32, ptr %34, align 4, !tbaa !11
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %135

128:                                              ; preds = %125
  %129 = load double, ptr %14, align 8, !tbaa !5
  %130 = load double, ptr %36, align 8, !tbaa !5
  %131 = load double, ptr %27, align 8, !tbaa !5
  %132 = call double @llvm.fmuladd.f64(double %130, double %131, double %129)
  %133 = load ptr, ptr %22, align 8, !tbaa !9
  %134 = getelementptr inbounds double, ptr %133, i64 2
  store double %132, ptr %134, align 8, !tbaa !5
  br label %135

135:                                              ; preds = %128, %125
  br label %136

136:                                              ; preds = %135, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.maxnum.f64(double, double) #3

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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 norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @fc3d_AlartCurnierJeanMoreauFGenerated(double noundef %0, double noundef %1, double noundef %2, double noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, ptr nocapture noundef writeonly %10) local_unnamed_addr #0 {
  %12 = fmul double %4, %8
  %13 = fsub double %12, %1
  %14 = fmul double %13, %13
  %15 = fmul double %5, %9
  %16 = fsub double %15, %2
  %17 = fmul double %16, %16
  %18 = fadd double %14, %17
  %sqrt = tail call double @llvm.sqrt.f64(double %18)
  %19 = tail call double @llvm.maxnum.f64(double %0, double 0.000000e+00)
  %20 = fmul double %19, %6
  %21 = tail call double @llvm.maxnum.f64(double %20, double 0x3CB0000000000000)
  %22 = fcmp ugt double %sqrt, %21
  %23 = fdiv double 1.000000e+00, %sqrt
  %24 = fmul double %21, %23
  %25 = fneg double %7
  %26 = tail call double @llvm.fmuladd.f64(double %25, double %3, double %0)
  %27 = tail call double @llvm.maxnum.f64(double %26, double 0.000000e+00)
  %28 = fsub double %0, %27
  store double %28, ptr %10, align 8, !tbaa !5
  br i1 %22, label %29, label %31

29:                                               ; preds = %11
  %30 = fcmp ogt double %sqrt, %21
  br i1 %30, label %33, label %38

31:                                               ; preds = %11
  %32 = getelementptr inbounds i8, ptr %10, i64 8
  store double %12, ptr %32, align 8, !tbaa !5
  br label %.sink.split

33:                                               ; preds = %29
  %34 = tail call double @llvm.fmuladd.f64(double %24, double %13, double %1)
  %35 = getelementptr inbounds i8, ptr %10, i64 8
  store double %34, ptr %35, align 8, !tbaa !5
  %36 = tail call double @llvm.fmuladd.f64(double %24, double %16, double %2)
  br label %.sink.split

.sink.split:                                      ; preds = %31, %33
  %.sink = phi double [ %36, %33 ], [ %15, %31 ]
  %37 = getelementptr inbounds i8, ptr %10, i64 16
  store double %.sink, ptr %37, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %.sink.split, %29
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.maxnum.f64(double, double) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #2

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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