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

; 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_AlartCurnierFGenerated(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
  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
  %37 = load double, ptr %19, align 8, !tbaa !5
  %38 = fneg double %37
  %39 = load double, ptr %15, align 8, !tbaa !5
  %40 = load double, ptr %12, align 8, !tbaa !5
  %41 = call double @llvm.fmuladd.f64(double %38, double %39, double %40)
  %42 = call double @llvm.maxnum.f64(double 0.000000e+00, double %41)
  store double %42, ptr %23, align 8, !tbaa !5
  %43 = load double, ptr %20, align 8, !tbaa !5
  %44 = load double, ptr %16, align 8, !tbaa !5
  %45 = fmul double %43, %44
  store double %45, ptr %24, align 8, !tbaa !5
  %46 = load double, ptr %13, align 8, !tbaa !5
  %47 = fneg double %46
  %48 = load double, ptr %24, align 8, !tbaa !5
  %49 = fadd double %47, %48
  store double %49, ptr %25, align 8, !tbaa !5
  %50 = load double, ptr %25, align 8, !tbaa !5
  %51 = load double, ptr %25, align 8, !tbaa !5
  %52 = fmul double %50, %51
  store double %52, ptr %26, align 8, !tbaa !5
  %53 = load double, ptr %21, align 8, !tbaa !5
  %54 = load double, ptr %17, align 8, !tbaa !5
  %55 = fmul double %53, %54
  store double %55, ptr %27, align 8, !tbaa !5
  %56 = load double, ptr %14, align 8, !tbaa !5
  %57 = fneg double %56
  %58 = load double, ptr %27, align 8, !tbaa !5
  %59 = fadd double %57, %58
  store double %59, ptr %28, align 8, !tbaa !5
  %60 = load double, ptr %28, align 8, !tbaa !5
  %61 = load double, ptr %28, align 8, !tbaa !5
  %62 = fmul double %60, %61
  store double %62, ptr %29, align 8, !tbaa !5
  %63 = load double, ptr %26, align 8, !tbaa !5
  %64 = load double, ptr %29, align 8, !tbaa !5
  %65 = fadd double %63, %64
  store double %65, ptr %30, align 8, !tbaa !5
  %66 = load double, ptr %30, align 8, !tbaa !5
  %67 = call double @sqrt(double noundef %66) #4
  store double %67, ptr %31, align 8, !tbaa !5
  %68 = load double, ptr %18, align 8, !tbaa !5
  %69 = load double, ptr %23, align 8, !tbaa !5
  %70 = fmul double %68, %69
  %71 = call double @llvm.maxnum.f64(double 0x3CB0000000000000, double %70)
  store double %71, ptr %32, align 8, !tbaa !5
  %72 = load double, ptr %31, align 8, !tbaa !5
  %73 = load double, ptr %32, align 8, !tbaa !5
  %74 = fcmp ole double %72, %73
  %75 = zext i1 %74 to i32
  store i32 %75, 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
  %76 = load double, ptr %31, align 8, !tbaa !5
  %77 = load double, ptr %32, align 8, !tbaa !5
  %78 = fcmp ogt double %76, %77
  %79 = zext i1 %78 to i32
  store i32 %79, ptr %34, align 4, !tbaa !11
  %80 = load i32, ptr %33, align 4, !tbaa !11
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %11
  br label %83

83:                                               ; preds = %82, %11
  %84 = load i32, ptr %34, align 4, !tbaa !11
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %92

86:                                               ; preds = %83
  %87 = load double, ptr %31, align 8, !tbaa !5
  %88 = fdiv double 1.000000e+00, %87
  store double %88, ptr %35, align 8, !tbaa !5
  %89 = load double, ptr %32, align 8, !tbaa !5
  %90 = load double, ptr %35, align 8, !tbaa !5
  %91 = fmul double %89, %90
  store double %91, ptr %36, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %86, %83
  %93 = load double, ptr %12, align 8, !tbaa !5
  %94 = load double, ptr %23, align 8, !tbaa !5
  %95 = fsub double %93, %94
  %96 = load ptr, ptr %22, align 8, !tbaa !9
  %97 = getelementptr inbounds double, ptr %96, i64 0
  store double %95, ptr %97, align 8, !tbaa !5
  %98 = load i32, ptr %33, align 4, !tbaa !11
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %104

100:                                              ; preds = %92
  %101 = load double, ptr %24, align 8, !tbaa !5
  %102 = load ptr, ptr %22, align 8, !tbaa !9
  %103 = getelementptr inbounds double, ptr %102, i64 1
  store double %101, ptr %103, align 8, !tbaa !5
  br label %115

104:                                              ; preds = %92
  %105 = load i32, ptr %34, align 4, !tbaa !11
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %114

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

114:                                              ; preds = %107, %104
  br label %115

115:                                              ; preds = %114, %100
  %116 = load i32, ptr %33, align 4, !tbaa !11
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %122

118:                                              ; preds = %115
  %119 = load double, ptr %27, align 8, !tbaa !5
  %120 = load ptr, ptr %22, align 8, !tbaa !9
  %121 = getelementptr inbounds double, ptr %120, i64 2
  store double %119, ptr %121, align 8, !tbaa !5
  br label %133

122:                                              ; preds = %115
  %123 = load i32, ptr %34, align 4, !tbaa !11
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %132

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

132:                                              ; preds = %125, %122
  br label %133

133:                                              ; preds = %132, %118
  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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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_AlartCurnierFGenerated(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 = fneg double %7
  %13 = tail call double @llvm.fmuladd.f64(double %12, double %3, double %0)
  %14 = tail call double @llvm.maxnum.f64(double %13, double 0.000000e+00)
  %15 = fmul double %4, %8
  %16 = fsub double %15, %1
  %17 = fmul double %16, %16
  %18 = fmul double %5, %9
  %19 = fsub double %18, %2
  %20 = fmul double %19, %19
  %21 = fadd double %17, %20
  %sqrt = tail call double @llvm.sqrt.f64(double %21)
  %22 = fmul double %14, %6
  %23 = tail call double @llvm.maxnum.f64(double %22, double 0x3CB0000000000000)
  %24 = fcmp ugt double %sqrt, %23
  %25 = fdiv double 1.000000e+00, %sqrt
  %26 = fmul double %23, %25
  %27 = fsub double %0, %14
  store double %27, ptr %10, align 8, !tbaa !5
  br i1 %24, label %28, label %30

28:                                               ; preds = %11
  %29 = fcmp ogt double %sqrt, %23
  br i1 %29, label %32, label %37

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

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

.sink.split:                                      ; preds = %30, %32
  %.sink = phi double [ %35, %32 ], [ %18, %30 ]
  %36 = getelementptr inbounds i8, ptr %10, i64 16
  store double %.sink, ptr %36, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %.sink.split, %28
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.maxnum.f64(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