; LLVM IR from OpenDiS/OpenDiS :: core/pydis/c/util (QueueOps)

; 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._node = type { i32, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, %struct._tag, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, i32 }
%struct._tag = type { i32, i32 }
%struct._home = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, double, double, double, double, double, double, i32, i32, i32, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, [3 x [3 x double]], [3 x [3 x double]], %struct.BurgInfo_t, i32, i32, i32, i32, i32, i32, i32, %struct.timeval }
%struct.BurgInfo_t = type { i32, i32, ptr, ptr, ptr, ptr }
%struct.timeval = type { i64, i64 }
%struct._cell = type { ptr, i32, ptr, i32, ptr, i32, i32, double, double, double, i32, i32, i32 }

; 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 @RemoveNodeFromCellQ(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  store i32 1, ptr %8, align 4
  br label %71

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._node, ptr %13, i32 0, i32 35
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  store i32 1, ptr %8, align 4
  br label %71

18:                                               ; preds = %12
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._home, ptr %19, i32 0, i32 23
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._node, ptr %22, i32 0, i32 35
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds ptr, ptr %21, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %27, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._cell, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !19
  %32 = icmp eq ptr %28, %31
  br i1 %32, label %33, label %43

33:                                               ; preds = %18
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._node, ptr %34, i32 0, i32 40
  %36 = load ptr, ptr %35, align 8, !tbaa !21
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._cell, ptr %37, i32 0, i32 0
  store ptr %36, ptr %38, align 8, !tbaa !19
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._cell, ptr %39, i32 0, i32 1
  %41 = load i32, ptr %40, align 8, !tbaa !22
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %40, align 8, !tbaa !22
  br label %70

43:                                               ; preds = %18
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._cell, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !19
  store ptr %46, ptr %7, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %64, %43
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %69

50:                                               ; preds = %47
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = icmp eq ptr %51, %52
  br i1 %53, label %54, label %64

54:                                               ; preds = %50
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._node, ptr %55, i32 0, i32 40
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._node, ptr %58, i32 0, i32 40
  store ptr %57, ptr %59, align 8, !tbaa !21
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._cell, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 8, !tbaa !22
  %63 = add nsw i32 %62, -1
  store i32 %63, ptr %61, align 8, !tbaa !22
  store i32 1, ptr %8, align 4
  br label %71

64:                                               ; preds = %50
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %65, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._node, ptr %66, i32 0, i32 40
  %68 = load ptr, ptr %67, align 8, !tbaa !21
  store ptr %68, ptr %7, align 8, !tbaa !5
  br label %47, !llvm.loop !23

69:                                               ; preds = %47
  br label %70

70:                                               ; preds = %69, %33
  store i32 1, ptr %8, align 4
  br label %71

71:                                               ; preds = %70, %54, %17, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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 }

!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 276}
!10 = !{!"_node", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !13, i64 152, !11, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !6, i64 296, !6, i64 304, !11, i64 312}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_tag", !11, i64 0, !11, i64 4}
!14 = !{!15, !6, i64 144}
!15 = !{!"_home", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !6, i64 104, !11, i64 112, !11, i64 116, !6, i64 120, !11, i64 128, !11, i64 132, !11, i64 136, !6, i64 144, !11, i64 152, !11, i64 156, !6, i64 160, !6, i64 168, !6, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !11, i64 232, !11, i64 236, !11, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !11, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !11, i64 320, !11, i64 324, !6, i64 328, !11, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !11, i64 368, !11, i64 372, !11, i64 376, !6, i64 384, !6, i64 392, !11, i64 400, !11, i64 404, !6, i64 408, !6, i64 416, !6, i64 424, !11, i64 432, !11, i64 436, !11, i64 440, !7, i64 448, !7, i64 520, !16, i64 592, !11, i64 632, !11, i64 636, !11, i64 640, !11, i64 644, !11, i64 648, !11, i64 652, !11, i64 656, !17, i64 664}
!16 = !{!"", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!17 = !{!"timeval", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"_cell", !6, i64 0, !11, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !12, i64 48, !12, i64 56, !12, i64 64, !11, i64 72, !11, i64 76, !11, i64 80}
!21 = !{!10, !6, i64 304}
!22 = !{!20, !11, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local void @RemoveNodeFromCellQ(ptr nocapture noundef readonly %0, ptr noundef readonly %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %.loopexit, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 276
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 0
  br i1 %7, label %.loopexit, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 144
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = zext nneg i32 %6 to i64
  %12 = getelementptr inbounds ptr, ptr %10, i64 %11
  %13 = load ptr, ptr %12, align 8, !tbaa !18
  %14 = load ptr, ptr %13, align 8, !tbaa !19
  %15 = icmp eq ptr %14, %1
  br i1 %15, label %17, label %.preheader

.preheader:                                       ; preds = %8
  %.not23 = icmp eq ptr %14, null
  br i1 %.not23, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %16 = icmp ne ptr %14, %1
  tail call void @llvm.assume(i1 %16)
  br label %.lr.ph32

17:                                               ; preds = %8
  %18 = getelementptr inbounds i8, ptr %1, i64 304
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  store ptr %19, ptr %13, align 8, !tbaa !19
  br label %.loopexit.sink.split

.lr.ph:                                           ; preds = %.lr.ph32
  %20 = icmp eq ptr %25, %1
  br i1 %20, label %.lr.ph._crit_edge, label %.lr.ph32, !llvm.loop !22

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %21 = getelementptr inbounds i8, ptr %1, i64 304
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %.02531, i64 304
  store ptr %22, ptr %23, align 8, !tbaa !21
  br label %.loopexit.sink.split

.lr.ph32:                                         ; preds = %.lr.ph.preheader, %.lr.ph
  %.02531 = phi ptr [ %25, %.lr.ph ], [ %14, %.lr.ph.preheader ]
  %24 = getelementptr inbounds i8, ptr %.02531, i64 304
  %25 = load ptr, ptr %24, align 8, !tbaa !21
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %.loopexit, label %.lr.ph, !llvm.loop !22

.loopexit.sink.split:                             ; preds = %.lr.ph._crit_edge, %17
  %26 = getelementptr inbounds i8, ptr %13, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !24
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %26, align 8, !tbaa !24
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph32, %.loopexit.sink.split, %.preheader, %4, %2
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #1

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) 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(inaccessiblemem: write) }

!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 276}
!6 = !{!"_node", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !11, i64 152, !7, i64 160, !12, i64 168, !12, i64 176, !12, i64 184, !12, i64 192, !12, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !7, i64 272, !7, i64 276, !7, i64 280, !7, i64 284, !7, i64 288, !12, i64 296, !12, i64 304, !7, i64 312}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_tag", !7, i64 0, !7, i64 4}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !12, i64 144}
!14 = !{!"_home", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !7, i64 96, !7, i64 100, !12, i64 104, !7, i64 112, !7, i64 116, !12, i64 120, !7, i64 128, !7, i64 132, !7, i64 136, !12, i64 144, !7, i64 152, !7, i64 156, !12, i64 160, !12, i64 168, !12, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !7, i64 232, !7, i64 236, !7, i64 240, !12, i64 248, !12, i64 256, !12, i64 264, !7, i64 272, !12, i64 280, !7, i64 288, !12, i64 296, !12, i64 304, !12, i64 312, !7, i64 320, !7, i64 324, !12, i64 328, !7, i64 336, !12, i64 344, !12, i64 352, !12, i64 360, !7, i64 368, !7, i64 372, !7, i64 376, !12, i64 384, !12, i64 392, !7, i64 400, !7, i64 404, !12, i64 408, !12, i64 416, !12, i64 424, !7, i64 432, !7, i64 436, !7, i64 440, !8, i64 448, !8, i64 520, !15, i64 592, !7, i64 632, !7, i64 636, !7, i64 640, !7, i64 644, !7, i64 648, !7, i64 652, !7, i64 656, !16, i64 664}
!15 = !{!"", !7, i64 0, !7, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!16 = !{!"timeval", !17, i64 0, !17, i64 8}
!17 = !{!"long", !8, i64 0}
!18 = !{!12, !12, i64 0}
!19 = !{!20, !12, i64 0}
!20 = !{!"_cell", !12, i64 0, !7, i64 8, !12, i64 16, !7, i64 24, !12, i64 32, !7, i64 40, !7, i64 44, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !7, i64 76, !7, i64 80}
!21 = !{!6, !12, i64 304}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!20, !7, i64 8}


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