; LLVM IR from siconos/siconos :: externals/lbl/metis4/pmetis.ll_ (SetUpSplitGraph)

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

@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1

declare ptr @__fmalloc(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @__SetUpSplitGraph(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  call void @__InitGraph(ptr noundef %9)
  %10 = load i32, ptr %7, align 4, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.graphdef, ptr %11, i32 0, i32 2
  store i32 %10, ptr %12, align 8, !tbaa !11
  %13 = load i32, ptr %8, align 4, !tbaa !9
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.graphdef, ptr %14, i32 0, i32 3
  store i32 %13, ptr %15, align 4, !tbaa !13
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.graphdef, ptr %16, i32 0, i32 24
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.graphdef, ptr %19, i32 0, i32 24
  store i32 %18, ptr %20, align 8, !tbaa !14
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.graphdef, ptr %21, i32 0, i32 24
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %25, label %92

25:                                               ; preds = %4
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = mul nsw i32 4, %26
  %28 = add nsw i32 %27, 1
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = mul nsw i32 2, %29
  %31 = add nsw i32 %28, %30
  %32 = call ptr @__idxmalloc(i32 noundef %31, ptr noundef @.str.3)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.graphdef, ptr %33, i32 0, i32 0
  store ptr %32, ptr %34, align 8, !tbaa !15
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.graphdef, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.graphdef, ptr %38, i32 0, i32 4
  store ptr %37, ptr %39, align 8, !tbaa !16
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.graphdef, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !15
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %42, i64 %44
  %46 = getelementptr inbounds i32, ptr %45, i64 1
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.graphdef, ptr %47, i32 0, i32 5
  store ptr %46, ptr %48, align 8, !tbaa !17
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.graphdef, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = mul nsw i32 2, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr %51, i64 %54
  %56 = getelementptr inbounds i32, ptr %55, i64 1
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.graphdef, ptr %57, i32 0, i32 9
  store ptr %56, ptr %58, align 8, !tbaa !18
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.graphdef, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = mul nsw i32 3, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %61, i64 %64
  %66 = getelementptr inbounds i32, ptr %65, i64 1
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.graphdef, ptr %67, i32 0, i32 11
  store ptr %66, ptr %68, align 8, !tbaa !19
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.graphdef, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !15
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = mul nsw i32 4, %72
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr %71, i64 %74
  %76 = getelementptr inbounds i32, ptr %75, i64 1
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.graphdef, ptr %77, i32 0, i32 7
  store ptr %76, ptr %78, align 8, !tbaa !20
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.graphdef, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !15
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = mul nsw i32 4, %82
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr %81, i64 %84
  %86 = getelementptr inbounds i32, ptr %85, i64 1
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.graphdef, ptr %90, i32 0, i32 8
  store ptr %89, ptr %91, align 8, !tbaa !21
  br label %157

92:                                               ; preds = %4
  %93 = load i32, ptr %7, align 4, !tbaa !9
  %94 = mul nsw i32 3, %93
  %95 = add nsw i32 %94, 1
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = mul nsw i32 2, %96
  %98 = add nsw i32 %95, %97
  %99 = call ptr @__idxmalloc(i32 noundef %98, ptr noundef @.str.3)
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.graphdef, ptr %100, i32 0, i32 0
  store ptr %99, ptr %101, align 8, !tbaa !15
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.graphdef, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !15
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.graphdef, ptr %105, i32 0, i32 4
  store ptr %104, ptr %106, align 8, !tbaa !16
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.graphdef, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !15
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  %113 = getelementptr inbounds i32, ptr %112, i64 1
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.graphdef, ptr %114, i32 0, i32 9
  store ptr %113, ptr %115, align 8, !tbaa !18
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.graphdef, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !15
  %119 = load i32, ptr %7, align 4, !tbaa !9
  %120 = mul nsw i32 2, %119
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %118, i64 %121
  %123 = getelementptr inbounds i32, ptr %122, i64 1
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.graphdef, ptr %124, i32 0, i32 11
  store ptr %123, ptr %125, align 8, !tbaa !19
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.graphdef, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !15
  %129 = load i32, ptr %7, align 4, !tbaa !9
  %130 = mul nsw i32 3, %129
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i32, ptr %128, i64 %131
  %133 = getelementptr inbounds i32, ptr %132, i64 1
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.graphdef, ptr %134, i32 0, i32 7
  store ptr %133, ptr %135, align 8, !tbaa !20
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.graphdef, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !15
  %139 = load i32, ptr %7, align 4, !tbaa !9
  %140 = mul nsw i32 3, %139
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds i32, ptr %138, i64 %141
  %143 = getelementptr inbounds i32, ptr %142, i64 1
  %144 = load i32, ptr %8, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr %143, i64 %145
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.graphdef, ptr %147, i32 0, i32 8
  store ptr %146, ptr %148, align 8, !tbaa !21
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.graphdef, ptr %149, i32 0, i32 24
  %151 = load i32, ptr %150, align 8, !tbaa !14
  %152 = load i32, ptr %7, align 4, !tbaa !9
  %153 = mul nsw i32 %151, %152
  %154 = call ptr @__fmalloc(i32 noundef %153, ptr noundef @.str.4)
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.graphdef, ptr %155, i32 0, i32 25
  store ptr %154, ptr %156, align 8, !tbaa !22
  br label %157

157:                                              ; preds = %92, %25
  %158 = load i32, ptr %7, align 4, !tbaa !9
  %159 = call ptr @__idxmalloc(i32 noundef %158, ptr noundef @.str.5)
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.graphdef, ptr %160, i32 0, i32 10
  store ptr %159, ptr %161, align 8, !tbaa !23
  ret void
}

declare void @__InitGraph(ptr noundef) #0

declare ptr @__idxmalloc(i32 noundef, ptr noundef) #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" }

!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 16}
!12 = !{!"graphdef", !6, i64 0, !6, i64 8, !10, i64 16, !10, 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, !10, i64 88, !10, i64 92, !6, i64 96, !6, i64 104, !10, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !10, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208}
!13 = !{!12, !10, i64 20}
!14 = !{!12, !10, i64 176}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 24}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 64}
!19 = !{!12, !6, i64 80}
!20 = !{!12, !6, i64 48}
!21 = !{!12, !6, i64 56}
!22 = !{!12, !6, i64 184}
!23 = !{!12, !6, i64 72}


; 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.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1

declare ptr @__fmalloc(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @__SetUpSplitGraph(ptr nocapture noundef readonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  tail call void @__InitGraph(ptr noundef %1) #2
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %2, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 20
  store i32 %3, ptr %6, align 4, !tbaa !11
  %7 = getelementptr inbounds i8, ptr %0, i64 176
  %8 = load i32, ptr %7, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %1, i64 176
  store i32 %8, ptr %9, align 8, !tbaa !12
  %10 = icmp eq i32 %8, 1
  %11 = shl nsw i32 %3, 1
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  %13 = sext i32 %2 to i64
  %14 = shl nsw i32 %2, 1
  %15 = sext i32 %14 to i64
  br i1 %10, label %16, label %38

16:                                               ; preds = %4
  %17 = shl nsw i32 %2, 2
  %18 = or disjoint i32 %17, 1
  %19 = add nsw i32 %18, %11
  %20 = tail call ptr @__idxmalloc(i32 noundef %19, ptr noundef nonnull @.str.3) #2
  store ptr %20, ptr %1, align 8, !tbaa !13
  store ptr %20, ptr %12, align 8, !tbaa !14
  %21 = getelementptr inbounds i32, ptr %20, i64 %13
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  %23 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %22, ptr %23, align 8, !tbaa !15
  %24 = getelementptr inbounds i32, ptr %20, i64 %15
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %26 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr %25, ptr %26, align 8, !tbaa !16
  %27 = mul nsw i32 %2, 3
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %20, i64 %28
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  %31 = getelementptr inbounds i8, ptr %1, i64 80
  store ptr %30, ptr %31, align 8, !tbaa !17
  %32 = sext i32 %17 to i64
  %33 = getelementptr inbounds i32, ptr %20, i64 %32
  %34 = getelementptr inbounds i8, ptr %33, i64 4
  %35 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %34, ptr %35, align 8, !tbaa !18
  %36 = sext i32 %3 to i64
  %37 = getelementptr inbounds i32, ptr %34, i64 %36
  br label %59

38:                                               ; preds = %4
  %39 = mul nsw i32 %2, 3
  %40 = add nsw i32 %39, 1
  %41 = add nsw i32 %40, %11
  %42 = tail call ptr @__idxmalloc(i32 noundef %41, ptr noundef nonnull @.str.3) #2
  store ptr %42, ptr %1, align 8, !tbaa !13
  store ptr %42, ptr %12, align 8, !tbaa !14
  %43 = getelementptr inbounds i32, ptr %42, i64 %13
  %44 = getelementptr inbounds i8, ptr %43, i64 4
  %45 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr %44, ptr %45, align 8, !tbaa !16
  %46 = getelementptr inbounds i32, ptr %42, i64 %15
  %47 = getelementptr inbounds i8, ptr %46, i64 4
  %48 = getelementptr inbounds i8, ptr %1, i64 80
  store ptr %47, ptr %48, align 8, !tbaa !17
  %49 = sext i32 %39 to i64
  %50 = getelementptr inbounds i32, ptr %42, i64 %49
  %51 = getelementptr inbounds i8, ptr %50, i64 4
  %52 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %51, ptr %52, align 8, !tbaa !18
  %53 = sext i32 %3 to i64
  %54 = getelementptr inbounds i32, ptr %51, i64 %53
  %55 = getelementptr inbounds i8, ptr %1, i64 56
  store ptr %54, ptr %55, align 8, !tbaa !19
  %56 = load i32, ptr %7, align 8, !tbaa !12
  %57 = mul nsw i32 %56, %2
  %58 = tail call ptr @__fmalloc(i32 noundef %57, ptr noundef nonnull @.str.4) #2
  br label %59

59:                                               ; preds = %38, %16
  %.sink52 = phi i64 [ 184, %38 ], [ 56, %16 ]
  %.sink = phi ptr [ %58, %38 ], [ %37, %16 ]
  %60 = getelementptr inbounds i8, ptr %1, i64 %.sink52
  store ptr %.sink, ptr %60, align 8, !tbaa !20
  %61 = tail call ptr @__idxmalloc(i32 noundef %2, ptr noundef nonnull @.str.5) #2
  %62 = getelementptr inbounds i8, ptr %1, i64 72
  store ptr %61, ptr %62, align 8, !tbaa !21
  ret void
}

declare void @__InitGraph(ptr noundef) local_unnamed_addr #0

declare ptr @__idxmalloc(i32 noundef, ptr 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 = !{!6, !10, i64 20}
!12 = !{!6, !10, i64 176}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !7, i64 24}
!15 = !{!6, !7, i64 32}
!16 = !{!6, !7, i64 64}
!17 = !{!6, !7, i64 80}
!18 = !{!6, !7, i64 48}
!19 = !{!6, !7, i64 56}
!20 = !{!7, !7, i64 0}
!21 = !{!6, !7, i64 72}


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