; LLVM IR from siconos/siconos :: externals/lbl/metis4/estmem.ll_ (EstimateCFraction)

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

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @__EstimateCFraction(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  store i32 %0, ptr %6, align 4, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = call ptr @__idxmalloc(i32 noundef %20, ptr noundef @.str)
  store ptr %21, ptr %18, align 8, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = call ptr @__idxsmalloc(i32 noundef %22, i32 noundef -1, ptr noundef @.str.1)
  store ptr %23, ptr %17, align 8, !tbaa !9
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = call ptr @__idxmalloc(i32 noundef %24, ptr noundef @.str.2)
  store ptr %25, ptr %19, align 8, !tbaa !9
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = load ptr, ptr %19, align 8, !tbaa !9
  call void @__RandomPermute(i32 noundef %26, ptr noundef %27, i32 noundef 1)
  store i32 0, ptr %14, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %103, %5
  %29 = load i32, ptr %12, align 4, !tbaa !5
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %32, label %106

32:                                               ; preds = %28
  %33 = load ptr, ptr %19, align 8, !tbaa !9
  %34 = load i32, ptr %12, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr %33, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  store i32 %37, ptr %11, align 4, !tbaa !5
  %38 = load ptr, ptr %17, align 8, !tbaa !9
  %39 = load i32, ptr %11, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp eq i32 %42, -1
  br i1 %43, label %44, label %102

44:                                               ; preds = %32
  %45 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %45, ptr %16, align 4, !tbaa !5
  %46 = load ptr, ptr %7, align 8, !tbaa !9
  %47 = load i32, ptr %11, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %46, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  store i32 %50, ptr %13, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %78, %44
  %52 = load i32, ptr %13, align 4, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr %53, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp slt i32 %52, %58
  br i1 %59, label %60, label %81

60:                                               ; preds = %51
  %61 = load ptr, ptr %17, align 8, !tbaa !9
  %62 = load ptr, ptr %8, align 8, !tbaa !9
  %63 = load i32, ptr %13, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr %61, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp eq i32 %69, -1
  br i1 %70, label %71, label %77

71:                                               ; preds = %60
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = load i32, ptr %13, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr %72, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %16, align 4, !tbaa !5
  br label %81

77:                                               ; preds = %60
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %13, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %13, align 4, !tbaa !5
  br label %51, !llvm.loop !11

81:                                               ; preds = %71, %51
  %82 = load i32, ptr %14, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %14, align 4, !tbaa !5
  %84 = load ptr, ptr %18, align 8, !tbaa !9
  %85 = load i32, ptr %16, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %84, i64 %86
  store i32 %82, ptr %87, align 4, !tbaa !5
  %88 = load ptr, ptr %18, align 8, !tbaa !9
  %89 = load i32, ptr %11, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %88, i64 %90
  store i32 %82, ptr %91, align 4, !tbaa !5
  %92 = load i32, ptr %16, align 4, !tbaa !5
  %93 = load ptr, ptr %17, align 8, !tbaa !9
  %94 = load i32, ptr %11, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %93, i64 %95
  store i32 %92, ptr %96, align 4, !tbaa !5
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = load ptr, ptr %17, align 8, !tbaa !9
  %99 = load i32, ptr %16, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %98, i64 %100
  store i32 %97, ptr %101, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %81, %32
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %12, align 4, !tbaa !5
  br label %28, !llvm.loop !13

106:                                              ; preds = %28
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = load ptr, ptr %7, align 8, !tbaa !9
  %109 = load ptr, ptr %8, align 8, !tbaa !9
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = load ptr, ptr %18, align 8, !tbaa !9
  %112 = load ptr, ptr %17, align 8, !tbaa !9
  %113 = load ptr, ptr %19, align 8, !tbaa !9
  %114 = call i32 @__ComputeCoarseGraphSize(i32 noundef %107, ptr noundef %108, ptr noundef %109, i32 noundef %110, ptr noundef %111, ptr noundef %112, ptr noundef %113)
  store i32 %114, ptr %15, align 4, !tbaa !5
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = sitofp i32 %115 to double
  %117 = fmul double 1.000000e+00, %116
  %118 = load i32, ptr %6, align 4, !tbaa !5
  %119 = sitofp i32 %118 to double
  %120 = fmul double 1.000000e+00, %119
  %121 = fdiv double %117, %120
  %122 = fptrunc double %121 to float
  %123 = load ptr, ptr %9, align 8, !tbaa !9
  store float %122, ptr %123, align 4, !tbaa !14
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = sitofp i32 %124 to double
  %126 = fmul double 1.000000e+00, %125
  %127 = load ptr, ptr %7, align 8, !tbaa !9
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %127, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sitofp i32 %131 to double
  %133 = fmul double 1.000000e+00, %132
  %134 = fdiv double %126, %133
  %135 = fptrunc double %134 to float
  %136 = load ptr, ptr %10, align 8, !tbaa !9
  store float %135, ptr %136, align 4, !tbaa !14
  call void (ptr, ...) @GKfree(ptr noundef %18, ptr noundef %17, ptr noundef %19, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  ret void
}

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

declare ptr @__idxmalloc(i32 noundef, ptr noundef) #2

declare ptr @__idxsmalloc(i32 noundef, i32 noundef, ptr noundef) #2

declare void @__RandomPermute(i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @__ComputeCoarseGraphSize(i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @GKfree(ptr noundef, ...) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = !{!"int", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !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"

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @__EstimateCFraction(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %9 = tail call ptr @__idxmalloc(i32 noundef %0, ptr noundef nonnull @.str) #3
  store ptr %9, ptr %7, align 8, !tbaa !5
  %10 = tail call ptr @__idxsmalloc(i32 noundef %0, i32 noundef -1, ptr noundef nonnull @.str.1) #3
  store ptr %10, ptr %6, align 8, !tbaa !5
  %11 = tail call ptr @__idxmalloc(i32 noundef %0, ptr noundef nonnull @.str.2) #3
  store ptr %11, ptr %8, align 8, !tbaa !5
  tail call void @__RandomPermute(i32 noundef %0, ptr noundef %11, i32 noundef 1) #3
  %12 = icmp sgt i32 %0, 0
  br i1 %12, label %.lr.ph47, label %._crit_edge48

.lr.ph47:                                         ; preds = %5
  %wide.trip.count = zext nneg i32 %0 to i64
  br label %13

13:                                               ; preds = %.lr.ph47, %38
  %indvars.iv51 = phi i64 [ 0, %.lr.ph47 ], [ %indvars.iv.next52, %38 ]
  %.03844 = phi i32 [ 0, %.lr.ph47 ], [ %.1, %38 ]
  %14 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv51
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr %10, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = icmp eq i32 %18, -1
  br i1 %19, label %20, label %38

20:                                               ; preds = %13
  %21 = getelementptr inbounds i32, ptr %1, i64 %16
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = getelementptr i8, ptr %21, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %20
  %26 = sext i32 %22 to i64
  br label %.lr.ph

27:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %24, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph.preheader, %27
  %indvars.iv = phi i64 [ %26, %.lr.ph.preheader ], [ %indvars.iv.next, %27 ]
  %28 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %10, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = icmp eq i32 %32, -1
  br i1 %33, label %._crit_edge, label %27

._crit_edge:                                      ; preds = %27, %.lr.ph, %20
  %.pre-phi = phi i64 [ %16, %20 ], [ %16, %27 ], [ %30, %.lr.ph ]
  %.0 = phi i32 [ %15, %20 ], [ %15, %27 ], [ %29, %.lr.ph ]
  %34 = add nsw i32 %.03844, 1
  %35 = getelementptr inbounds i32, ptr %9, i64 %.pre-phi
  store i32 %.03844, ptr %35, align 4, !tbaa !9
  %36 = getelementptr inbounds i32, ptr %9, i64 %16
  store i32 %.03844, ptr %36, align 4, !tbaa !9
  store i32 %.0, ptr %17, align 4, !tbaa !9
  %37 = getelementptr inbounds i32, ptr %10, i64 %.pre-phi
  store i32 %15, ptr %37, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %13, %._crit_edge
  %.1 = phi i32 [ %34, %._crit_edge ], [ %.03844, %13 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
  br i1 %exitcond54.not, label %._crit_edge48, label %13, !llvm.loop !13

._crit_edge48:                                    ; preds = %38, %5
  %.038.lcssa = phi i32 [ 0, %5 ], [ %.1, %38 ]
  %39 = tail call i32 @__ComputeCoarseGraphSize(i32 noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %.038.lcssa, ptr noundef %9, ptr noundef %10, ptr noundef %11)
  %40 = sitofp i32 %.038.lcssa to double
  %41 = sitofp i32 %0 to double
  %42 = fdiv double %40, %41
  %43 = fptrunc double %42 to float
  store float %43, ptr %3, align 4, !tbaa !14
  %44 = sitofp i32 %39 to double
  %45 = sext i32 %0 to i64
  %46 = getelementptr inbounds i32, ptr %1, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = sitofp i32 %47 to double
  %49 = fdiv double %44, %48
  %50 = fptrunc double %49 to float
  store float %50, ptr %4, align 4, !tbaa !14
  call void (ptr, ...) @GKfree(ptr noundef nonnull %7, ptr noundef nonnull %6, ptr noundef nonnull %8, ptr noundef null) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  ret void
}

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

declare ptr @__idxmalloc(i32 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @__idxsmalloc(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @__RandomPermute(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @__ComputeCoarseGraphSize(i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @GKfree(ptr noundef, ...) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass