; LLVM IR from siconos/siconos :: externals/lbl/metis4/mrefine2.ll_ (MocRefine2Way2)

; 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 [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__MocRefine2Way2(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.controldef, ptr %11, i32 0, i32 1
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = and i32 %13, 1
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %22

16:                                               ; preds = %5
  %17 = call double @__seconds()
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.controldef, ptr %18, i32 0, i32 17
  %20 = load double, ptr %19, align 8, !tbaa !15
  %21 = fsub double %20, %17
  store double %21, ptr %19, align 8, !tbaa !15
  br label %22

22:                                               ; preds = %16, %5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__MocCompute2WayPartitionParams(ptr noundef %23, ptr noundef %24)
  br label %25

25:                                               ; preds = %100, %22
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.controldef, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = and i32 %28, 1
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %37

31:                                               ; preds = %25
  %32 = call double @__seconds()
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.controldef, ptr %33, i32 0, i32 19
  %35 = load double, ptr %34, align 8, !tbaa !16
  %36 = fsub double %35, %32
  store double %36, ptr %34, align 8, !tbaa !16
  br label %37

37:                                               ; preds = %31, %25
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.controldef, ptr %38, i32 0, i32 4
  %40 = load i32, ptr %39, align 8, !tbaa !17
  switch i32 %40, label %50 [
    i32 1, label %41
  ]

41:                                               ; preds = %37
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  call void @__MocBalance2Way2(ptr noundef %42, ptr noundef %43, ptr noundef %44, ptr noundef %45)
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  call void @__MocFM_2WayEdgeRefine2(ptr noundef %46, ptr noundef %47, ptr noundef %48, ptr noundef %49, i32 noundef 8)
  br label %54

50:                                               ; preds = %37
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.controldef, ptr %51, i32 0, i32 4
  %53 = load i32, ptr %52, align 8, !tbaa !17
  call void (ptr, ...) @__errexit(ptr noundef @.str, i32 noundef %53)
  br label %54

54:                                               ; preds = %50, %41
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.controldef, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = and i32 %57, 1
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %66

60:                                               ; preds = %54
  %61 = call double @__seconds()
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.controldef, ptr %62, i32 0, i32 19
  %64 = load double, ptr %63, align 8, !tbaa !16
  %65 = fadd double %64, %61
  store double %65, ptr %63, align 8, !tbaa !16
  br label %66

66:                                               ; preds = %60, %54
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = icmp eq ptr %67, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %66
  br label %101

71:                                               ; preds = %66
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.graphdef, ptr %72, i32 0, i32 28
  %74 = load ptr, ptr %73, align 8, !tbaa !18
  store ptr %74, ptr %8, align 8, !tbaa !5
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.controldef, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = and i32 %77, 1
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %86

80:                                               ; preds = %71
  %81 = call double @__seconds()
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.controldef, ptr %82, i32 0, i32 20
  %84 = load double, ptr %83, align 8, !tbaa !20
  %85 = fsub double %84, %81
  store double %85, ptr %83, align 8, !tbaa !20
  br label %86

86:                                               ; preds = %80, %71
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__MocProject2WayPartition(ptr noundef %87, ptr noundef %88)
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.controldef, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = and i32 %91, 1
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %100

94:                                               ; preds = %86
  %95 = call double @__seconds()
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.controldef, ptr %96, i32 0, i32 20
  %98 = load double, ptr %97, align 8, !tbaa !20
  %99 = fadd double %98, %95
  store double %99, ptr %97, align 8, !tbaa !20
  br label %100

100:                                              ; preds = %94, %86
  br label %25

101:                                              ; preds = %70
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.controldef, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = and i32 %104, 1
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %113

107:                                              ; preds = %101
  %108 = call double @__seconds()
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.controldef, ptr %109, i32 0, i32 17
  %111 = load double, ptr %110, align 8, !tbaa !15
  %112 = fadd double %111, %108
  store double %112, ptr %110, align 8, !tbaa !15
  br label %113

113:                                              ; preds = %107, %101
  ret void
}

declare double @__seconds() #1

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

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

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

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

declare void @__MocProject2WayPartition(ptr noundef, ptr noundef) #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 = { "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" }

!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, !11, i64 4}
!10 = !{!"controldef", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !12, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !13, 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 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"workspacedef", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !6, i64 48}
!14 = !{!"double", !7, i64 0}
!15 = !{!10, !14, i64 144}
!16 = !{!10, !14, i64 160}
!17 = !{!10, !11, i64 16}
!18 = !{!19, !6, i64 208}
!19 = !{!"graphdef", !6, i64 0, !6, i64 8, !11, i64 16, !11, 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, !11, i64 88, !11, i64 92, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !11, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208}
!20 = !{!10, !14, i64 168}


; 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 [29 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @__MocRefine2Way2(ptr noundef %0, ptr noundef readnone %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = and i32 %7, 1
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %14, label %9

9:                                                ; preds = %5
  %10 = tail call double @__seconds() #2
  %11 = getelementptr inbounds i8, ptr %0, i64 144
  %12 = load double, ptr %11, align 8, !tbaa !14
  %13 = fsub double %12, %10
  store double %13, ptr %11, align 8, !tbaa !14
  br label %14

14:                                               ; preds = %9, %5
  tail call void @__MocCompute2WayPartitionParams(ptr noundef nonnull %0, ptr noundef %2) #2
  %15 = getelementptr inbounds i8, ptr %0, i64 160
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = getelementptr inbounds i8, ptr %0, i64 168
  br label %18

18:                                               ; preds = %.backedge, %14
  %.0 = phi ptr [ %2, %14 ], [ %40, %.backedge ]
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = and i32 %19, 1
  %.not30 = icmp eq i32 %20, 0
  br i1 %.not30, label %25, label %21

21:                                               ; preds = %18
  %22 = tail call double @__seconds() #2
  %23 = load double, ptr %15, align 8, !tbaa !15
  %24 = fsub double %23, %22
  store double %24, ptr %15, align 8, !tbaa !15
  br label %25

25:                                               ; preds = %21, %18
  %26 = load i32, ptr %16, align 8, !tbaa !16
  %cond = icmp eq i32 %26, 1
  br i1 %cond, label %27, label %28

27:                                               ; preds = %25
  tail call void @__MocBalance2Way2(ptr noundef nonnull %0, ptr noundef %.0, ptr noundef %3, ptr noundef %4) #2
  tail call void @__MocFM_2WayEdgeRefine2(ptr noundef nonnull %0, ptr noundef %.0, ptr noundef %3, ptr noundef %4, i32 noundef 8) #2
  br label %29

28:                                               ; preds = %25
  tail call void (ptr, ...) @__errexit(ptr noundef nonnull @.str, i32 noundef %26) #2
  br label %29

29:                                               ; preds = %28, %27
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = and i32 %30, 1
  %.not31 = icmp eq i32 %31, 0
  br i1 %.not31, label %36, label %32

32:                                               ; preds = %29
  %33 = tail call double @__seconds() #2
  %34 = load double, ptr %15, align 8, !tbaa !15
  %35 = fadd double %33, %34
  store double %35, ptr %15, align 8, !tbaa !15
  br label %36

36:                                               ; preds = %32, %29
  %37 = icmp eq ptr %.0, %1
  br i1 %37, label %54, label %38

38:                                               ; preds = %36
  %39 = getelementptr inbounds i8, ptr %.0, i64 208
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = and i32 %41, 1
  %.not32 = icmp eq i32 %42, 0
  br i1 %.not32, label %47, label %43

43:                                               ; preds = %38
  %44 = tail call double @__seconds() #2
  %45 = load double, ptr %17, align 8, !tbaa !19
  %46 = fsub double %45, %44
  store double %46, ptr %17, align 8, !tbaa !19
  br label %47

47:                                               ; preds = %43, %38
  tail call void @__MocProject2WayPartition(ptr noundef nonnull %0, ptr noundef %40) #2
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = and i32 %48, 1
  %.not33 = icmp eq i32 %49, 0
  br i1 %.not33, label %.backedge, label %50

50:                                               ; preds = %47
  %51 = tail call double @__seconds() #2
  %52 = load double, ptr %17, align 8, !tbaa !19
  %53 = fadd double %51, %52
  store double %53, ptr %17, align 8, !tbaa !19
  br label %.backedge

.backedge:                                        ; preds = %50, %47
  br label %18

54:                                               ; preds = %36
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = and i32 %55, 1
  %.not34 = icmp eq i32 %56, 0
  br i1 %.not34, label %62, label %57

57:                                               ; preds = %54
  %58 = tail call double @__seconds() #2
  %59 = getelementptr inbounds i8, ptr %0, i64 144
  %60 = load double, ptr %59, align 8, !tbaa !14
  %61 = fadd double %58, %60
  store double %61, ptr %59, align 8, !tbaa !14
  br label %62

62:                                               ; preds = %57, %54
  ret void
}

declare double @__seconds() local_unnamed_addr #1

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

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

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

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

declare void @__MocProject2WayPartition(ptr noundef, ptr noundef) local_unnamed_addr #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 = { "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, !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 144}
!15 = !{!6, !13, i64 160}
!16 = !{!6, !7, i64 16}
!17 = !{!18, !12, i64 208}
!18 = !{!"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}
!19 = !{!6, !13, i64 168}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass