; LLVM IR from siconos/siconos :: externals/lbl/metis4/graph.ll_ (RandomizeGraph)

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

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

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

24:                                               ; preds = %115, %1
  %25 = load i32, ptr %3, align 4, !tbaa !12
  %26 = load i32, ptr %8, align 4, !tbaa !12
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %28, label %118

28:                                               ; preds = %24
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = load i32, ptr %3, align 4, !tbaa !12
  %31 = add nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %29, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !12
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %35, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !12
  %40 = sub nsw i32 %34, %39
  store i32 %40, ptr %6, align 4, !tbaa !12
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !12
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !12
  store i32 %45, ptr %4, align 4, !tbaa !12
  br label %46

46:                                               ; preds = %111, %28
  %47 = load i32, ptr %4, align 4, !tbaa !12
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load i32, ptr %3, align 4, !tbaa !12
  %50 = add nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %48, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !12
  %54 = icmp slt i32 %47, %53
  br i1 %54, label %55, label %114

55:                                               ; preds = %46
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !12
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr %56, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !12
  %61 = call double @drand48() #3
  %62 = load i32, ptr %6, align 4, !tbaa !12
  %63 = sitofp i32 %62 to double
  %64 = fmul double %61, %63
  %65 = fptosi double %64 to i32
  %66 = add nsw i32 %60, %65
  store i32 %66, ptr %5, align 4, !tbaa !12
  br label %67

67:                                               ; preds = %55
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !12
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %68, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !12
  store i32 %72, ptr %7, align 4, !tbaa !12
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !12
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !12
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i32, ptr %4, align 4, !tbaa !12
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %78, i64 %80
  store i32 %77, ptr %81, align 4, !tbaa !12
  %82 = load i32, ptr %7, align 4, !tbaa !12
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = load i32, ptr %5, align 4, !tbaa !12
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr %83, i64 %85
  store i32 %82, ptr %86, align 4, !tbaa !12
  br label %87

87:                                               ; preds = %67
  br label %88

88:                                               ; preds = %87
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = load i32, ptr %4, align 4, !tbaa !12
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr %90, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !12
  store i32 %94, ptr %7, align 4, !tbaa !12
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = load i32, ptr %5, align 4, !tbaa !12
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %95, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !12
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = load i32, ptr %4, align 4, !tbaa !12
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr %100, i64 %102
  store i32 %99, ptr %103, align 4, !tbaa !12
  %104 = load i32, ptr %7, align 4, !tbaa !12
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load i32, ptr %5, align 4, !tbaa !12
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %105, i64 %107
  store i32 %104, ptr %108, align 4, !tbaa !12
  br label %109

109:                                              ; preds = %89
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %4, align 4, !tbaa !12
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %4, align 4, !tbaa !12
  br label %46, !llvm.loop !16

114:                                              ; preds = %46
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %3, align 4, !tbaa !12
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %3, align 4, !tbaa !12
  br label %24, !llvm.loop !18

118:                                              ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

; Function Attrs: nounwind
declare double @drand48() #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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, !11, i64 16}
!10 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !6, i64 48}
!15 = !{!10, !6, i64 56}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

; Function Attrs: nounwind uwtable
define dso_local void @__RandomizeGraph(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = load ptr, ptr %6, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = icmp sgt i32 %3, 0
  br i1 %10, label %.lr.ph40.preheader, label %._crit_edge

.lr.ph40.preheader:                               ; preds = %1
  %wide.trip.count = zext nneg i32 %3 to i64
  %.pre = load i32, ptr %5, align 4, !tbaa !14
  br label %.lr.ph40

.loopexit:                                        ; preds = %20, %.lr.ph40
  %11 = phi i32 [ %15, %.lr.ph40 ], [ %35, %20 ]
  %exitcond.not = icmp eq i64 %indvars.iv.next43, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph40, !llvm.loop !15

.lr.ph40:                                         ; preds = %.lr.ph40.preheader, %.loopexit
  %12 = phi i32 [ %.pre, %.lr.ph40.preheader ], [ %11, %.loopexit ]
  %indvars.iv42 = phi i64 [ 0, %.lr.ph40.preheader ], [ %indvars.iv.next43, %.loopexit ]
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %13 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv.next43
  %14 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv42
  %15 = load i32, ptr %13, align 4, !tbaa !14
  %16 = icmp slt i32 %12, %15
  br i1 %16, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph40
  %17 = sub nsw i32 %15, %12
  %18 = sitofp i32 %17 to double
  %19 = sext i32 %12 to i64
  br label %20

20:                                               ; preds = %.lr.ph, %20
  %indvars.iv = phi i64 [ %19, %.lr.ph ], [ %indvars.iv.next, %20 ]
  %21 = load i32, ptr %14, align 4, !tbaa !14
  %22 = tail call double @drand48() #2
  %23 = fmul double %22, %18
  %24 = fptosi double %23 to i32
  %25 = add nsw i32 %21, %24
  %26 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv
  %27 = load i32, ptr %26, align 4, !tbaa !14
  %28 = sext i32 %25 to i64
  %29 = getelementptr inbounds i32, ptr %7, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !14
  store i32 %30, ptr %26, align 4, !tbaa !14
  store i32 %27, ptr %29, align 4, !tbaa !14
  %31 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv
  %32 = load i32, ptr %31, align 4, !tbaa !14
  %33 = getelementptr inbounds i32, ptr %9, i64 %28
  %34 = load i32, ptr %33, align 4, !tbaa !14
  store i32 %34, ptr %31, align 4, !tbaa !14
  store i32 %32, ptr %33, align 4, !tbaa !14
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %35 = load i32, ptr %13, align 4, !tbaa !14
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next, %36
  br i1 %37, label %20, label %.loopexit, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %1
  ret void
}

; Function Attrs: nounwind
declare double @drand48() 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 = { 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 #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, !7, i64 24}
!12 = !{!6, !7, i64 48}
!13 = !{!6, !7, i64 56}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass