; LLVM IR from siconos/siconos :: externals/lbl/metis4 (mpmetis)

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

%struct.graphdef = type { ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr }
%struct.controldef = type { i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, %struct.workspacedef, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%struct.workspacedef = type { ptr, i32, i32, ptr, ptr, i32, ptr, ptr }

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

declare void @__InitRandom(i32 noundef) #1

declare void @__AllocateWorkSpace(ptr noundef, ptr noundef, i32 noundef) #1

declare void @__InitTimers(ptr noundef) #1

declare double @__seconds() #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @__MCMlevelRecursiveBisection(ptr noundef, ptr noundef, i32 noundef, ptr noundef, float noundef, i32 noundef) #2

declare void @__PrintTimers(ptr noundef) #1

declare void @__FreeWorkSpace(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @METIS_mCPartGraphRecursiveInternal(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9) #2 {
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.graphdef, align 8
  %24 = alloca %struct.controldef, align 8
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store ptr %3, ptr %14, align 8, !tbaa !5
  store ptr %4, ptr %15, align 8, !tbaa !5
  store ptr %5, ptr %16, align 8, !tbaa !5
  store ptr %6, ptr %17, align 8, !tbaa !5
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  store ptr %9, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 216, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 232, ptr %24) #3
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = load ptr, ptr %14, align 8, !tbaa !5
  %31 = load ptr, ptr %15, align 8, !tbaa !5
  %32 = load ptr, ptr %16, align 8, !tbaa !5
  call void @__SetUpGraph2(ptr noundef %23, i32 noundef %26, i32 noundef %28, ptr noundef %29, ptr noundef %30, ptr noundef %31, ptr noundef %32)
  %33 = load ptr, ptr %18, align 8, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %33, i64 0
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %42

37:                                               ; preds = %10
  %38 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 2
  store i32 3, ptr %38, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 3
  store i32 1, ptr %39, align 4, !tbaa !16
  %40 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 4
  store i32 1, ptr %40, align 8, !tbaa !17
  %41 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  store i32 0, ptr %41, align 4, !tbaa !18
  br label %59

42:                                               ; preds = %10
  %43 = load ptr, ptr %18, align 8, !tbaa !5
  %44 = getelementptr inbounds i32, ptr %43, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 2
  store i32 %45, ptr %46, align 8, !tbaa !11
  %47 = load ptr, ptr %18, align 8, !tbaa !5
  %48 = getelementptr inbounds i32, ptr %47, i64 2
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 3
  store i32 %49, ptr %50, align 4, !tbaa !16
  %51 = load ptr, ptr %18, align 8, !tbaa !5
  %52 = getelementptr inbounds i32, ptr %51, i64 3
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 4
  store i32 %53, ptr %54, align 8, !tbaa !17
  %55 = load ptr, ptr %18, align 8, !tbaa !5
  %56 = getelementptr inbounds i32, ptr %55, i64 4
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  store i32 %57, ptr %58, align 4, !tbaa !18
  br label %59

59:                                               ; preds = %42, %37
  %60 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 7
  store i32 1, ptr %60, align 4, !tbaa !19
  %61 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 0
  store i32 100, ptr %61, align 8, !tbaa !20
  %62 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 0
  %63 = load i32, ptr %62, align 8, !tbaa !20
  %64 = sitofp i32 %63 to double
  %65 = fmul double 1.000000e+00, %64
  %66 = fdiv double 1.500000e+00, %65
  %67 = fptrunc double %66 to float
  %68 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 6
  store float %67, ptr %68, align 8, !tbaa !21
  call void @__InitRandom(i32 noundef -1)
  %69 = load ptr, ptr %17, align 8, !tbaa !5
  %70 = load i32, ptr %69, align 4, !tbaa !9
  call void @__AllocateWorkSpace(ptr noundef %24, ptr noundef %23, i32 noundef %70)
  %71 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !18
  %73 = and i32 %72, 1
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %59
  call void @__InitTimers(ptr noundef %24)
  br label %76

76:                                               ; preds = %75, %59
  %77 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !18
  %79 = and i32 %78, 1
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %86

81:                                               ; preds = %76
  %82 = call double @__seconds()
  %83 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 12
  %84 = load double, ptr %83, align 8, !tbaa !22
  %85 = fsub double %84, %82
  store double %85, ptr %83, align 8, !tbaa !22
  br label %86

86:                                               ; preds = %81, %76
  %87 = load ptr, ptr %17, align 8, !tbaa !5
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = load ptr, ptr %20, align 8, !tbaa !5
  %90 = call i32 @__MCMlevelRecursiveBisection(ptr noundef %24, ptr noundef %23, i32 noundef %88, ptr noundef %89, float noundef 1.000000e+00, i32 noundef 0)
  %91 = load ptr, ptr %19, align 8, !tbaa !5
  store i32 %90, ptr %91, align 4, !tbaa !9
  %92 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !18
  %94 = and i32 %93, 1
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %101

96:                                               ; preds = %86
  %97 = call double @__seconds()
  %98 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 12
  %99 = load double, ptr %98, align 8, !tbaa !22
  %100 = fadd double %99, %97
  store double %100, ptr %98, align 8, !tbaa !22
  br label %101

101:                                              ; preds = %96, %86
  %102 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  %103 = load i32, ptr %102, align 4, !tbaa !18
  %104 = and i32 %103, 1
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %107

106:                                              ; preds = %101
  call void @__PrintTimers(ptr noundef %24)
  br label %107

107:                                              ; preds = %106, %101
  call void @__FreeWorkSpace(ptr noundef %24, ptr noundef %23)
  call void @llvm.lifetime.end.p0(i64 232, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 216, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  ret void
}

declare void @__SetUpGraph2(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"controldef", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !14, i64 48, !15, i64 104, !15, i64 112, !15, i64 120, !15, i64 128, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !15, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224}
!13 = !{!"float", !7, i64 0}
!14 = !{!"workspacedef", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!"double", !7, i64 0}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 4}
!19 = !{!12, !10, i64 28}
!20 = !{!12, !10, i64 0}
!21 = !{!12, !13, i64 24}
!22 = !{!12, !15, i64 104}


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

%struct.graphdef = type { ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr }
%struct.controldef = type { i32, i32, i32, i32, i32, i32, float, i32, i32, i32, i32, %struct.workspacedef, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%struct.workspacedef = type { ptr, i32, i32, ptr, ptr, i32, ptr, ptr }

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

declare void @__InitRandom(i32 noundef) local_unnamed_addr #1

declare void @__AllocateWorkSpace(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @__InitTimers(ptr noundef) local_unnamed_addr #1

declare double @__seconds() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @__MCMlevelRecursiveBisection(ptr noundef, ptr noundef, i32 noundef, ptr noundef, float noundef, i32 noundef) local_unnamed_addr #2

declare void @__PrintTimers(ptr noundef) local_unnamed_addr #1

declare void @__FreeWorkSpace(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @METIS_mCPartGraphRecursiveInternal(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr nocapture noundef readonly %6, ptr nocapture noundef readonly %7, ptr nocapture noundef writeonly %8, ptr noundef %9) local_unnamed_addr #2 {
  %11 = alloca %struct.graphdef, align 8
  %12 = alloca %struct.controldef, align 8
  call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 232, ptr nonnull %12) #3
  %13 = load i32, ptr %0, align 4, !tbaa !5
  %14 = load i32, ptr %1, align 4, !tbaa !5
  call void @__SetUpGraph2(ptr noundef nonnull %11, i32 noundef %13, i32 noundef %14, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3
  %15 = load i32, ptr %7, align 4, !tbaa !5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %20, label %17

17:                                               ; preds = %10
  %18 = getelementptr inbounds i8, ptr %7, i64 4
  %19 = load <4 x i32>, ptr %18, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %10, %17
  %21 = phi <4 x i32> [ %19, %17 ], [ <i32 3, i32 1, i32 1, i32 0>, %10 ]
  %22 = getelementptr inbounds i8, ptr %12, i64 4
  %23 = shufflevector <4 x i32> %21, <4 x i32> poison, <4 x i32> <i32 3, i32 0, i32 1, i32 2>
  store <4 x i32> %23, ptr %22, align 4
  %24 = getelementptr inbounds i8, ptr %12, i64 28
  store i32 1, ptr %24, align 4, !tbaa !9
  store i32 100, ptr %12, align 8, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %12, i64 24
  store float 0x3F8EB851E0000000, ptr %25, align 8, !tbaa !16
  call void @__InitRandom(i32 noundef -1) #3
  %26 = load i32, ptr %6, align 4, !tbaa !5
  call void @__AllocateWorkSpace(ptr noundef nonnull %12, ptr noundef nonnull %11, i32 noundef %26) #3
  %27 = load i32, ptr %22, align 4, !tbaa !17
  %28 = and i32 %27, 1
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %.thread, label %29

29:                                               ; preds = %20
  call void @__InitTimers(ptr noundef nonnull %12) #3
  %.pre = load i32, ptr %22, align 4, !tbaa !17
  %.pre22 = and i32 %.pre, 1
  %30 = icmp eq i32 %.pre22, 0
  br i1 %30, label %.thread, label %31

31:                                               ; preds = %29
  %32 = call double @__seconds() #3
  %33 = getelementptr inbounds i8, ptr %12, i64 104
  %34 = load double, ptr %33, align 8, !tbaa !18
  %35 = fsub double %34, %32
  store double %35, ptr %33, align 8, !tbaa !18
  br label %.thread

.thread:                                          ; preds = %20, %31, %29
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = call i32 @__MCMlevelRecursiveBisection(ptr noundef nonnull %12, ptr noundef nonnull %11, i32 noundef %36, ptr noundef %9, float noundef 1.000000e+00, i32 noundef 0)
  store i32 %37, ptr %8, align 4, !tbaa !5
  %38 = load i32, ptr %22, align 4, !tbaa !17
  %39 = and i32 %38, 1
  %.not16 = icmp eq i32 %39, 0
  br i1 %.not16, label %.thread26, label %40

40:                                               ; preds = %.thread
  %41 = call double @__seconds() #3
  %42 = getelementptr inbounds i8, ptr %12, i64 104
  %43 = load double, ptr %42, align 8, !tbaa !18
  %44 = fadd double %41, %43
  store double %44, ptr %42, align 8, !tbaa !18
  %.pre21 = load i32, ptr %22, align 4, !tbaa !17
  %.pre23 = and i32 %.pre21, 1
  %45 = icmp eq i32 %.pre23, 0
  br i1 %45, label %.thread26, label %46

46:                                               ; preds = %40
  call void @__PrintTimers(ptr noundef nonnull %12) #3
  br label %.thread26

.thread26:                                        ; preds = %.thread, %46, %40
  call void @__FreeWorkSpace(ptr noundef nonnull %12, ptr noundef nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 232, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %11) #3
  ret void
}

declare void @__SetUpGraph2(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 28}
!10 = !{!"controldef", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !11, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !12, i64 48, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !14, i64 184, !14, i64 192, !14, i64 200, !14, i64 208, !14, i64 216, !14, i64 224}
!11 = !{!"float", !7, i64 0}
!12 = !{!"workspacedef", !13, i64 0, !6, i64 8, !6, i64 12, !13, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 48}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !11, i64 24}
!17 = !{!10, !6, i64 4}
!18 = !{!10, !14, i64 104}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass