; LLVM IR from siconos/siconos :: externals/lbl/metis4/initpart.ll_ (Init2WayPartition)

; 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.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 }
%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 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__Init2WayPartition(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  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 4, ptr %9) #3
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.controldef, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %12, ptr %9, align 4, !tbaa !16
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.controldef, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = and i32 %15, 8
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %23

18:                                               ; preds = %4
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.controldef, ptr %19, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = sub nsw i32 %21, 8
  store i32 %22, ptr %20, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %18, %4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.controldef, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %27 = and i32 %26, 32
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %34

29:                                               ; preds = %23
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.controldef, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = sub nsw i32 %32, 32
  store i32 %33, ptr %31, align 4, !tbaa !11
  br label %34

34:                                               ; preds = %29, %23
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.controldef, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = and i32 %37, 1
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %46

40:                                               ; preds = %34
  %41 = call double @__seconds()
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.controldef, ptr %42, i32 0, i32 13
  %44 = load double, ptr %43, align 8, !tbaa !17
  %45 = fsub double %44, %41
  store double %45, ptr %43, align 8, !tbaa !17
  br label %46

46:                                               ; preds = %40, %34
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.controldef, ptr %47, i32 0, i32 3
  %49 = load i32, ptr %48, align 4, !tbaa !18
  switch i32 %49, label %60 [
    i32 1, label %50
    i32 3, label %55
  ]

50:                                               ; preds = %46
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load float, ptr %8, align 4, !tbaa !9
  call void @__GrowBisection(ptr noundef %51, ptr noundef %52, ptr noundef %53, float noundef %54)
  br label %64

55:                                               ; preds = %46
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load float, ptr %8, align 4, !tbaa !9
  call void @__RandomBisection(ptr noundef %56, ptr noundef %57, ptr noundef %58, float noundef %59)
  br label %64

60:                                               ; preds = %46
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.controldef, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !18
  call void (ptr, ...) @__errexit(ptr noundef @.str, i32 noundef %63)
  br label %64

64:                                               ; preds = %60, %55, %50
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.controldef, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !11
  %68 = and i32 %67, 16
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %75

70:                                               ; preds = %64
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.graphdef, ptr %71, i32 0, i32 12
  %73 = load i32, ptr %72, align 8, !tbaa !19
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %73)
  br label %75

75:                                               ; preds = %70, %64
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.controldef, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !11
  %79 = and i32 %78, 1
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %87

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

87:                                               ; preds = %81, %75
  %88 = load i32, ptr %9, align 4, !tbaa !16
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.controldef, ptr %89, i32 0, i32 1
  store i32 %88, ptr %90, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

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

declare double @__seconds() #2

; Function Attrs: nounwind uwtable
declare dso_local void @__GrowBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @__RandomBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) #0

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

declare i32 @printf(ptr noundef, ...) #2

; 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 = { "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 4}
!12 = !{!"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, !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 = !{!"int", !7, i64 0}
!14 = !{!"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}
!15 = !{!"double", !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !15, i64 112}
!18 = !{!12, !13, i64 12}
!19 = !{!20, !13, i64 88}
!20 = !{!"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}


; 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 [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__Init2WayPartition(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, 8
  %.not.not = icmp eq i32 %7, 0
  %8 = add nsw i32 %6, -8
  %9 = select i1 %.not.not, i32 %6, i32 %8
  %10 = and i32 %9, 32
  %.not22.not = icmp eq i32 %10, 0
  %11 = add nsw i32 %9, -32
  %12 = select i1 %.not22.not, i32 %9, i32 %11
  %13 = or disjoint i32 %7, %10
  %.not26 = icmp eq i32 %13, 0
  br i1 %.not26, label %15, label %14

14:                                               ; preds = %4
  store i32 %12, ptr %5, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %4, %14
  %16 = and i32 %12, 1
  %.not23 = icmp eq i32 %16, 0
  br i1 %.not23, label %22, label %17

17:                                               ; preds = %15
  %18 = tail call double @__seconds() #3
  %19 = getelementptr inbounds i8, ptr %0, i64 112
  %20 = load double, ptr %19, align 8, !tbaa !14
  %21 = fsub double %20, %18
  store double %21, ptr %19, align 8, !tbaa !14
  br label %22

22:                                               ; preds = %17, %15
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !15
  switch i32 %24, label %27 [
    i32 1, label %25
    i32 3, label %26
  ]

25:                                               ; preds = %22
  tail call void @__GrowBisection(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, float noundef %3)
  br label %28

26:                                               ; preds = %22
  tail call void @__RandomBisection(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, float noundef %3)
  br label %28

27:                                               ; preds = %22
  tail call void (ptr, ...) @__errexit(ptr noundef nonnull @.str, i32 noundef %24) #3
  br label %28

28:                                               ; preds = %27, %26, %25
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = and i32 %29, 16
  %.not24 = icmp eq i32 %30, 0
  br i1 %.not24, label %35, label %31

31:                                               ; preds = %28
  %32 = getelementptr inbounds i8, ptr %1, i64 88
  %33 = load i32, ptr %32, align 8, !tbaa !16
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33)
  %.pre = load i32, ptr %5, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %31, %28
  %36 = phi i32 [ %.pre, %31 ], [ %29, %28 ]
  %37 = and i32 %36, 1
  %.not25 = icmp eq i32 %37, 0
  br i1 %.not25, label %43, label %38

38:                                               ; preds = %35
  %39 = tail call double @__seconds() #3
  %40 = getelementptr inbounds i8, ptr %0, i64 112
  %41 = load double, ptr %40, align 8, !tbaa !14
  %42 = fadd double %39, %41
  store double %42, ptr %40, align 8, !tbaa !14
  br label %43

43:                                               ; preds = %38, %35
  store i32 %6, ptr %5, align 4, !tbaa !5
  ret void
}

declare double @__seconds() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @__GrowBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @__RandomBisection(ptr noundef, ptr noundef, ptr noundef, float noundef) local_unnamed_addr #0

declare void @__errexit(ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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


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