; LLVM IR from siconos/siconos :: externals/lbl/metis4/ometis.ll_ (MlevelNodeBisection)

; 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 double @__seconds() #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 @__MlevelNodeBisection(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store float %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.graphdef, ptr %10, i32 0, i32 2
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = sdiv i32 %12, 8
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.controldef, ptr %14, i32 0, i32 0
  store i32 %13, ptr %15, align 8, !tbaa !14
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.controldef, ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = icmp sgt i32 %18, 100
  br i1 %19, label %20, label %23

20:                                               ; preds = %4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.controldef, ptr %21, i32 0, i32 0
  store i32 100, ptr %22, align 8, !tbaa !14
  br label %32

23:                                               ; preds = %4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !14
  %27 = icmp slt i32 %26, 40
  br i1 %27, label %28, label %31

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.controldef, ptr %29, i32 0, i32 0
  store i32 40, ptr %30, align 8, !tbaa !14
  br label %31

31:                                               ; preds = %28, %23
  br label %32

32:                                               ; preds = %31, %20
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds i32, ptr %33, i64 0
  %35 = load i32, ptr %34, align 4, !tbaa !18
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds i32, ptr %36, i64 1
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = add nsw i32 %35, %38
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.controldef, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !14
  %43 = sdiv i32 %39, %42
  %44 = sitofp i32 %43 to double
  %45 = fmul double 1.500000e+00, %44
  %46 = fptosi double %45 to i32
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.controldef, ptr %47, i32 0, i32 5
  store i32 %46, ptr %48, align 4, !tbaa !19
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call ptr @__Coarsen2Way(ptr noundef %49, ptr noundef %50)
  store ptr %51, ptr %9, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.controldef, ptr %52, i32 0, i32 3
  %54 = load i32, ptr %53, align 4, !tbaa !20
  switch i32 %54, label %93 [
    i32 1, label %55
    i32 2, label %89
  ]

55:                                               ; preds = %32
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load float, ptr %8, align 4, !tbaa !9
  call void @__Init2WayPartition(ptr noundef %56, ptr noundef %57, ptr noundef %58, float noundef %59)
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.controldef, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !21
  %63 = and i32 %62, 1
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %71

65:                                               ; preds = %55
  %66 = call double @__seconds()
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.controldef, ptr %67, i32 0, i32 18
  %69 = load double, ptr %68, align 8, !tbaa !22
  %70 = fsub double %69, %66
  store double %70, ptr %68, align 8, !tbaa !22
  br label %71

71:                                               ; preds = %65, %55
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  call void @__Compute2WayPartitionParams(ptr noundef %72, ptr noundef %73)
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load float, ptr %8, align 4, !tbaa !9
  call void @__ConstructSeparator(ptr noundef %74, ptr noundef %75, float noundef %76)
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.controldef, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !21
  %80 = and i32 %79, 1
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %88

82:                                               ; preds = %71
  %83 = call double @__seconds()
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.controldef, ptr %84, i32 0, i32 18
  %86 = load double, ptr %85, align 8, !tbaa !22
  %87 = fadd double %86, %83
  store double %87, ptr %85, align 8, !tbaa !22
  br label %88

88:                                               ; preds = %82, %71
  br label %93

89:                                               ; preds = %32
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load float, ptr %8, align 4, !tbaa !9
  call void @__InitSeparator(ptr noundef %90, ptr noundef %91, float noundef %92)
  br label %93

93:                                               ; preds = %89, %88, %32
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = load float, ptr %8, align 4, !tbaa !9
  call void @__Refine2WayNode(ptr noundef %94, ptr noundef %95, ptr noundef %96, float noundef %97)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

declare ptr @__Coarsen2Way(ptr noundef, ptr noundef) #1

declare void @__Refine2WayNode(ptr noundef, ptr noundef, ptr noundef, float noundef) #1

declare void @__Init2WayPartition(ptr noundef, ptr noundef, ptr noundef, float noundef) #1

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

declare void @__ConstructSeparator(ptr noundef, ptr noundef, float noundef) #1

declare void @__InitSeparator(ptr noundef, ptr noundef, float 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 = !{!"float", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"graphdef", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88, !13, i64 92, !6, i64 96, !6, i64 104, !13, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !13, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"controldef", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !10, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !16, i64 48, !17, i64 104, !17, i64 112, !17, i64 120, !17, i64 128, !17, i64 136, !17, i64 144, !17, i64 152, !17, i64 160, !17, i64 168, !17, i64 176, !17, i64 184, !17, i64 192, !17, i64 200, !17, i64 208, !17, i64 216, !17, i64 224}
!16 = !{!"workspacedef", !6, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24, !13, i64 32, !6, i64 40, !6, i64 48}
!17 = !{!"double", !7, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!15, !13, i64 20}
!20 = !{!15, !13, i64 12}
!21 = !{!15, !13, i64 4}
!22 = !{!15, !17, i64 152}


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

declare double @__seconds() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @__MlevelNodeBisection(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = sdiv i32 %6, 8
  store i32 %7, ptr %0, align 8, !tbaa !11
  %8 = icmp sgt i32 %6, 807
  br i1 %8, label %.sink.split, label %9

9:                                                ; preds = %4
  %10 = icmp slt i32 %6, 320
  br i1 %10, label %.sink.split, label %11

.sink.split:                                      ; preds = %9, %4
  %.sink = phi i32 [ 100, %4 ], [ 40, %9 ]
  store i32 %.sink, ptr %0, align 8, !tbaa !11
  br label %11

11:                                               ; preds = %.sink.split, %9
  %12 = phi i32 [ %7, %9 ], [ %.sink, %.sink.split ]
  %13 = load i32, ptr %2, align 4, !tbaa !16
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !16
  %16 = add nsw i32 %15, %13
  %17 = sdiv i32 %16, %12
  %18 = sitofp i32 %17 to double
  %19 = fmul double %18, 1.500000e+00
  %20 = fptosi double %19 to i32
  %21 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %20, ptr %21, align 4, !tbaa !17
  %22 = tail call ptr @__Coarsen2Way(ptr noundef nonnull %0, ptr noundef nonnull %1) #2
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !18
  switch i32 %24, label %43 [
    i32 1, label %25
    i32 2, label %42
  ]

25:                                               ; preds = %11
  tail call void @__Init2WayPartition(ptr noundef nonnull %0, ptr noundef %22, ptr noundef nonnull %2, float noundef %3) #2
  %26 = getelementptr inbounds i8, ptr %0, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !19
  %28 = and i32 %27, 1
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %34, label %29

29:                                               ; preds = %25
  %30 = tail call double @__seconds() #2
  %31 = getelementptr inbounds i8, ptr %0, i64 152
  %32 = load double, ptr %31, align 8, !tbaa !20
  %33 = fsub double %32, %30
  store double %33, ptr %31, align 8, !tbaa !20
  br label %34

34:                                               ; preds = %29, %25
  tail call void @__Compute2WayPartitionParams(ptr noundef nonnull %0, ptr noundef %22) #2
  tail call void @__ConstructSeparator(ptr noundef nonnull %0, ptr noundef %22, float noundef %3) #2
  %35 = load i32, ptr %26, align 4, !tbaa !19
  %36 = and i32 %35, 1
  %.not33 = icmp eq i32 %36, 0
  br i1 %.not33, label %43, label %37

37:                                               ; preds = %34
  %38 = tail call double @__seconds() #2
  %39 = getelementptr inbounds i8, ptr %0, i64 152
  %40 = load double, ptr %39, align 8, !tbaa !20
  %41 = fadd double %38, %40
  store double %41, ptr %39, align 8, !tbaa !20
  br label %43

42:                                               ; preds = %11
  tail call void @__InitSeparator(ptr noundef nonnull %0, ptr noundef %22, float noundef %3) #2
  br label %43

43:                                               ; preds = %34, %37, %42, %11
  tail call void @__Refine2WayNode(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %22, float noundef %3) #2
  ret void
}

declare ptr @__Coarsen2Way(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @__Refine2WayNode(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

declare void @__Init2WayPartition(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

declare void @__Compute2WayPartitionParams(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @__ConstructSeparator(ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

declare void @__InitSeparator(ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !10, i64 16}
!6 = !{!"graphdef", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !10, i64 88, !10, i64 92, !7, i64 96, !7, i64 104, !10, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !10, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !10, i64 0}
!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", !8, i64 0}
!14 = !{!"workspacedef", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !7, i64 48}
!15 = !{!"double", !8, i64 0}
!16 = !{!10, !10, i64 0}
!17 = !{!12, !10, i64 20}
!18 = !{!12, !10, i64 12}
!19 = !{!12, !10, i64 4}
!20 = !{!12, !15, i64 152}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass