; LLVM IR from kajott/GIPS :: src/gips_core.ll (ZN4GIPS8Pipeline8moveNodeEii)

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

%"class.GIPS::Pipeline" = type <{ %"class.std::vector.3", i32, i32, i32, [2 x i32], %"class.GLutil::FBO", i8, [3 x i8], %"class.GLutil::Shader", i32, i8, i8, [2 x i8], float, [4 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl" }
%"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl" = type { %"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GIPS::Node *, std::allocator<GIPS::Node *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.GLutil::FBO" = type { i32, i32 }
%"class.GLutil::Shader" = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8] }>

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4GIPS8Pipeline8moveNodeEii(ptr noundef nonnull align 8 dereferenceable(100) %0, i32 noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %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
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  %11 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %12 = call noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #2
  %13 = sub i64 %12, 1
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %7, align 4, !tbaa !9
  %15 = load i32, ptr %5, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %32, label %17

17:                                               ; preds = %3
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp sgt i32 %18, %19
  br i1 %20, label %32, label %21

21:                                               ; preds = %17
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %32, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp sgt i32 %25, %26
  br i1 %27, label %32, label %28

28:                                               ; preds = %24
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %28, %24, %21, %17, %3
  store i32 1, ptr %8, align 4
  br label %81

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %34 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %34, i64 noundef %36) #2
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  store ptr %38, ptr %9, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %43, %33
  %40 = load i32, ptr %5, align 4, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %56

43:                                               ; preds = %39
  %44 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %47) #2
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %51 = load i32, ptr %5, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %52) #2
  store ptr %49, ptr %53, align 8, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %5, align 4, !tbaa !9
  br label %39, !llvm.loop !11

56:                                               ; preds = %39
  br label %57

57:                                               ; preds = %61, %56
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = icmp sgt i32 %58, %59
  br i1 %60, label %61, label %74

61:                                               ; preds = %57
  %62 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %63 = load i32, ptr %5, align 4, !tbaa !9
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef %65) #2
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %68, i64 noundef %70) #2
  store ptr %67, ptr %71, align 8, !tbaa !5
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr %5, align 4, !tbaa !9
  br label %57, !llvm.loop !13

74:                                               ; preds = %57
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 0
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %78) #2
  store ptr %75, ptr %79, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %10, i32 0, i32 6
  store i8 1, ptr %80, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  store i32 0, ptr %8, align 4
  br label %81

81:                                               ; preds = %74, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  %82 = load i32, ptr %8, align 4
  switch i32 %82, label %84 [
    i32 0, label %83
    i32 1, label %83
  ]

83:                                               ; preds = %81, %81
  ret void

84:                                               ; preds = %81
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !22, i64 52}
!15 = !{!"_ZTSN4GIPS8PipelineE", !16, i64 0, !10, i64 24, !10, i64 28, !20, i64 32, !7, i64 36, !21, i64 44, !22, i64 52, !23, i64 56, !10, i64 88, !22, i64 92, !22, i64 93, !24, i64 96}
!16 = !{!"_ZTSSt6vectorIPN4GIPS4NodeESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTSN4GIPS11PixelFormatE", !7, i64 0}
!21 = !{!"_ZTSN6GLutil3FBOE", !10, i64 0, !10, i64 4}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSN6GLutil6ShaderE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !22, i64 24}
!24 = !{!"float", !7, i64 0}


; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4GIPS8Pipeline8moveNodeEii(ptr noundef nonnull align 8 dereferenceable(100) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = tail call noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1
  %5 = icmp slt i32 %1, 0
  br i1 %5, label %34, label %6

6:                                                ; preds = %3
  %7 = trunc i64 %4 to i32
  %8 = add i32 %7, -1
  %9 = icmp slt i32 %8, %1
  %10 = icmp slt i32 %2, 0
  %or.cond = or i1 %10, %9
  %11 = icmp slt i32 %8, %2
  %or.cond25 = or i1 %11, %or.cond
  %12 = icmp eq i32 %1, %2
  %or.cond26 = or i1 %12, %or.cond25
  br i1 %or.cond26, label %34, label %13

13:                                               ; preds = %6
  %14 = zext nneg i32 %1 to i64
  %15 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %14) #1
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = icmp ult i32 %1, %2
  br i1 %17, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %13
  %.0.lcssa = phi i32 [ %1, %13 ], [ %22, %.lr.ph ]
  %18 = icmp sgt i32 %.0.lcssa, %2
  br i1 %18, label %.lr.ph29, label %._crit_edge

.lr.ph:                                           ; preds = %13, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %14, %13 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv.next) #1
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #1
  store ptr %20, ptr %21, align 8, !tbaa !5
  %22 = trunc nuw i64 %indvars.iv.next to i32
  %23 = icmp slt i32 %22, %2
  br i1 %23, label %.lr.ph, label %.preheader, !llvm.loop !9

.lr.ph29:                                         ; preds = %.preheader, %.lr.ph29
  %.128 = phi i32 [ %24, %.lr.ph29 ], [ %.0.lcssa, %.preheader ]
  %24 = add nsw i32 %.128, -1
  %25 = zext nneg i32 %24 to i64
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %25) #1
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = zext nneg i32 %.128 to i64
  %29 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %28) #1
  store ptr %27, ptr %29, align 8, !tbaa !5
  %30 = icmp sgt i32 %24, %2
  br i1 %30, label %.lr.ph29, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph29, %.preheader
  %31 = zext nneg i32 %2 to i64
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %31) #1
  store ptr %16, ptr %32, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %0, i64 52
  store i8 1, ptr %33, align 4, !tbaa !12
  br label %34

34:                                               ; preds = %3, %6, %._crit_edge
  ret void
}

attributes #0 = { mustprogress 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 }

!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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !21, i64 52}
!13 = !{!"_ZTSN4GIPS8PipelineE", !14, i64 0, !18, i64 24, !18, i64 28, !19, i64 32, !7, i64 36, !20, i64 44, !21, i64 52, !22, i64 56, !18, i64 88, !21, i64 92, !21, i64 93, !23, i64 96}
!14 = !{!"_ZTSSt6vectorIPN4GIPS4NodeESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSN4GIPS11PixelFormatE", !7, i64 0}
!20 = !{!"_ZTSN6GLutil3FBOE", !18, i64 0, !18, i64 4}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSN6GLutil6ShaderE", !18, i64 0, !18, i64 4, !18, i64 8, !6, i64 16, !21, i64 24}
!23 = !{!"float", !7, i64 0}


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