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

; 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 zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS8Pipeline7changedEv(ptr noundef nonnull align 8 dereferenceable(100) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #2
  %6 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 6
  %7 = load i8, ptr %6, align 4, !tbaa !9, !range !21, !noundef !22
  %8 = trunc i8 %7 to i1
  %9 = zext i1 %8 to i8
  store i8 %9, ptr %3, align 1, !tbaa !23
  %10 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 6
  store i8 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i64 0, ptr %4, align 8, !tbaa !24
  br label %11

11:                                               ; preds = %25, %1
  %12 = load i64, ptr %4, align 8, !tbaa !24
  %13 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 0
  %14 = call noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #2
  %15 = icmp ult i64 %12, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  br label %28

17:                                               ; preds = %11
  %18 = getelementptr inbounds %"class.GIPS::Pipeline", ptr %5, i32 0, i32 0
  %19 = load i64, ptr %4, align 8, !tbaa !24
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %19) #2
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348) %21)
  br i1 %22, label %23, label %24

23:                                               ; preds = %17
  store i8 1, ptr %3, align 1, !tbaa !23
  br label %24

24:                                               ; preds = %23, %17
  br label %25

25:                                               ; preds = %24
  %26 = load i64, ptr %4, align 8, !tbaa !24
  %27 = add i64 %26, 1
  store i64 %27, ptr %4, align 8, !tbaa !24
  br label %11, !llvm.loop !26

28:                                               ; preds = %16
  %29 = load i8, ptr %3, align 1, !tbaa !23, !range !21, !noundef !22
  %30 = trunc i8 %29 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #2
  ret i1 %30
}

; 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

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, !18, i64 52}
!10 = !{!"_ZTSN4GIPS8PipelineE", !11, i64 0, !15, i64 24, !15, i64 28, !16, i64 32, !7, i64 36, !17, i64 44, !18, i64 52, !19, i64 56, !15, i64 88, !18, i64 92, !18, i64 93, !20, i64 96}
!11 = !{!"_ZTSSt6vectorIPN4GIPS4NodeESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN4GIPS4NodeESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSN4GIPS11PixelFormatE", !7, i64 0}
!17 = !{!"_ZTSN6GLutil3FBOE", !15, i64 0, !15, i64 4}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSN6GLutil6ShaderE", !15, i64 0, !15, i64 4, !15, i64 8, !6, i64 16, !18, i64 24}
!20 = !{!"float", !7, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!18, !18, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"long", !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS8Pipeline7changedEv(ptr noundef nonnull align 8 dereferenceable(100) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 52
  %3 = load i8, ptr %2, align 4, !tbaa !5, !range !20, !noundef !21
  store i8 0, ptr %2, align 4, !tbaa !5
  %4 = tail call noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  %.04.lcssa = phi i8 [ %3, %1 ], [ %spec.select, %.lr.ph ]
  %5 = trunc nuw i8 %.04.lcssa to i1
  ret i1 %5

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.06 = phi i64 [ %9, %.lr.ph ], [ 0, %1 ]
  %.045 = phi i8 [ %spec.select, %.lr.ph ], [ %3, %1 ]
  %6 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIPN4GIPS4NodeESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.06) #1
  %7 = load ptr, ptr %6, align 8, !tbaa !22
  %8 = tail call noundef zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348) %7)
  %spec.select = select i1 %8, i8 1, i8 %.045
  %9 = add nuw i64 %.06, 1
  %10 = tail call noundef i64 @_ZNKSt6vectorIPN4GIPS4NodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1
  %11 = icmp ult i64 %9, %10
  br i1 %11, label %.lr.ph, label %._crit_edge, !llvm.loop !23
}

; 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

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


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