; LLVM IR from siconos/siconos :: externals/lbl/metis4/pqueue.ll_ (PQueueFree)

; 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.PQueueType = type { i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @__PQueueFree(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.PQueueType, ptr %5, i32 0, i32 0
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp eq i32 %7, 1
  br i1 %8, label %9, label %51

9:                                                ; preds = %2
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.PQueueType, ptr %10, i32 0, i32 3
  %12 = load i32, ptr %11, align 4, !tbaa !12
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %28

14:                                               ; preds = %9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.PQueueType, ptr %15, i32 0, i32 5
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.PQueueType, ptr %18, i32 0, i32 8
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = sext i32 %17 to i64
  %22 = sub i64 0, %21
  %23 = getelementptr inbounds ptr, ptr %20, i64 %22
  store ptr %23, ptr %19, align 8, !tbaa !14
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.PQueueType, ptr %24, i32 0, i32 7
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.PQueueType, ptr %26, i32 0, i32 8
  call void (ptr, ...) @GKfree(ptr noundef %25, ptr noundef %27, ptr noundef null)
  br label %50

28:                                               ; preds = %9
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.PQueueType, ptr %30, i32 0, i32 5
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.PQueueType, ptr %33, i32 0, i32 4
  %35 = load i32, ptr %34, align 8, !tbaa !15
  %36 = add nsw i32 %32, %35
  %37 = add nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = mul i64 8, %38
  %40 = udiv i64 %39, 4
  %41 = trunc i64 %40 to i32
  call void @__idxwspacefree(ptr noundef %29, i32 noundef %41)
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.PQueueType, ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = sext i32 %45 to i64
  %47 = mul i64 24, %46
  %48 = udiv i64 %47, 4
  %49 = trunc i64 %48 to i32
  call void @__idxwspacefree(ptr noundef %42, i32 noundef %49)
  br label %50

50:                                               ; preds = %28, %14
  br label %64

51:                                               ; preds = %2
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.PQueueType, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !16
  %56 = sext i32 %55 to i64
  %57 = mul i64 8, %56
  %58 = udiv i64 %57, 4
  %59 = trunc i64 %58 to i32
  call void @__idxwspacefree(ptr noundef %52, i32 noundef %59)
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.PQueueType, ptr %61, i32 0, i32 2
  %63 = load i32, ptr %62, align 8, !tbaa !16
  call void @__idxwspacefree(ptr noundef %60, i32 noundef %63)
  br label %64

64:                                               ; preds = %51, %50
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.PQueueType, ptr %65, i32 0, i32 2
  store i32 0, ptr %66, align 8, !tbaa !16
  ret void
}

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

declare void @__idxwspacefree(ptr noundef, i32 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 0}
!10 = !{!"PQueueType", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 12}
!13 = !{!10, !11, i64 20}
!14 = !{!10, !6, i64 40}
!15 = !{!10, !11, i64 16}
!16 = !{!10, !11, i64 8}


; 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 @__PQueueFree(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %1, align 8, !tbaa !5
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %5, label %29

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 12
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %.not = icmp eq i32 %7, 0
  %8 = getelementptr inbounds i8, ptr %1, i64 20
  %9 = load i32, ptr %8, align 4, !tbaa !12
  br i1 %.not, label %17, label %10

10:                                               ; preds = %5
  %11 = getelementptr inbounds i8, ptr %1, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = sext i32 %9 to i64
  %14 = sub nsw i64 0, %13
  %15 = getelementptr inbounds ptr, ptr %12, i64 %14
  store ptr %15, ptr %11, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %1, i64 32
  tail call void (ptr, ...) @GKfree(ptr noundef nonnull %16, ptr noundef nonnull %11, ptr noundef null) #2
  br label %34

17:                                               ; preds = %5
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load i32, ptr %18, align 8, !tbaa !14
  %20 = add nsw i32 %19, %9
  %21 = shl i32 %20, 1
  %22 = add i32 %21, 2
  tail call void @__idxwspacefree(ptr noundef %0, i32 noundef %22) #2
  %23 = getelementptr inbounds i8, ptr %1, i64 8
  %24 = load i32, ptr %23, align 8, !tbaa !15
  %25 = sext i32 %24 to i64
  %26 = mul nsw i64 %25, 24
  %27 = lshr exact i64 %26, 2
  %28 = trunc i64 %27 to i32
  tail call void @__idxwspacefree(ptr noundef %0, i32 noundef %28) #2
  br label %34

29:                                               ; preds = %2
  %30 = getelementptr inbounds i8, ptr %1, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = shl i32 %31, 1
  tail call void @__idxwspacefree(ptr noundef %0, i32 noundef %32) #2
  %33 = load i32, ptr %30, align 8, !tbaa !15
  tail call void @__idxwspacefree(ptr noundef %0, i32 noundef %33) #2
  br label %34

34:                                               ; preds = %10, %17, %29
  %35 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 0, ptr %35, align 8, !tbaa !15
  ret void
}

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

declare void @__idxwspacefree(ptr noundef, i32 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 0}
!6 = !{!"PQueueType", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 12}
!12 = !{!6, !7, i64 20}
!13 = !{!6, !10, i64 40}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !7, i64 8}


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