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

; 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::Node" = type <{ %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, [4 x i8], [4 x %"struct.GIPS::Node::PassData"], %"class.std::vector", i8, i8, i8, [5 x i8], %"class.FileUtil::FileFingerprint", i32, [4 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.GIPS::Node::PassData" = type { i8, i32, %"class.GLutil::Program", i32, i32, i32, [4 x i8] }
%"class.GLutil::Program" = type <{ i32, i32, ptr, i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<GIPS::Parameter, std::allocator<GIPS::Parameter>>::_Vector_impl" }
%"struct.std::_Vector_base<GIPS::Parameter, std::allocator<GIPS::Parameter>>::_Vector_impl" = type { %"struct.std::_Vector_base<GIPS::Parameter, std::allocator<GIPS::Parameter>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GIPS::Parameter, std::allocator<GIPS::Parameter>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.FileUtil::FileFingerprint" = type { i64, i64 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4GIPS9Parameter7changedEv(ptr noundef nonnull align 8 dereferenceable(176)) #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348) %0) #0 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::Node", ptr %5, i32 0, i32 7
  %7 = load i8, ptr %6, align 8, !tbaa !9, !range !22, !noundef !23
  %8 = trunc i8 %7 to i1
  br i1 %8, label %19, label %9

9:                                                ; preds = %1
  %10 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 9
  %11 = load i8, ptr %10, align 2, !tbaa !24, !range !22, !noundef !23
  %12 = trunc i8 %11 to i1
  %13 = zext i1 %12 to i32
  %14 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 8
  %15 = load i8, ptr %14, align 1, !tbaa !25, !range !22, !noundef !23
  %16 = trunc i8 %15 to i1
  %17 = zext i1 %16 to i32
  %18 = icmp ne i32 %13, %17
  br label %19

19:                                               ; preds = %9, %1
  %20 = phi i1 [ true, %1 ], [ %18, %9 ]
  %21 = zext i1 %20 to i8
  store i8 %21, ptr %3, align 1, !tbaa !26
  %22 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 7
  store i8 0, ptr %22, align 8, !tbaa !9
  %23 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 8
  %24 = load i8, ptr %23, align 1, !tbaa !25, !range !22, !noundef !23
  %25 = trunc i8 %24 to i1
  %26 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 9
  %27 = zext i1 %25 to i8
  store i8 %27, ptr %26, align 2, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  store i64 0, ptr %4, align 8, !tbaa !27
  br label %28

28:                                               ; preds = %41, %19
  %29 = load i64, ptr %4, align 8, !tbaa !27
  %30 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 6
  %31 = call noundef i64 @_ZNKSt6vectorIN4GIPS9ParameterESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %30) #2
  %32 = icmp ult i64 %29, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %28
  %35 = getelementptr inbounds %"class.GIPS::Node", ptr %5, i32 0, i32 6
  %36 = load i64, ptr %4, align 8, !tbaa !27
  %37 = call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorIN4GIPS9ParameterESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %36) #2
  %38 = call noundef zeroext i1 @_ZN4GIPS9Parameter7changedEv(ptr noundef nonnull align 8 dereferenceable(176) %37)
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  store i8 1, ptr %3, align 1, !tbaa !26
  br label %40

40:                                               ; preds = %39, %34
  br label %41

41:                                               ; preds = %40
  %42 = load i64, ptr %4, align 8, !tbaa !27
  %43 = add i64 %42, 1
  store i64 %43, ptr %4, align 8, !tbaa !27
  br label %28, !llvm.loop !28

44:                                               ; preds = %33
  %45 = load i8, ptr %3, align 1, !tbaa !26, !range !22, !noundef !23
  %46 = trunc i8 %45 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #2
  ret i1 %46
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorIN4GIPS9ParameterESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !19, i64 320}
!10 = !{!"_ZTSN4GIPS4NodeE", !11, i64 0, !11, i64 32, !11, i64 64, !14, i64 96, !7, i64 104, !15, i64 296, !19, i64 320, !19, i64 321, !19, i64 322, !20, i64 328, !21, i64 344}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIN4GIPS9ParameterESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSN8FileUtil15FileFingerprintE", !13, i64 0, !13, i64 8}
!21 = !{!"_ZTSN4GIPS11PixelFormatE", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !19, i64 322}
!25 = !{!10, !19, i64 321}
!26 = !{!19, !19, i64 0}
!27 = !{!13, !13, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"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 @_ZN4GIPS9Parameter7changedEv(ptr noundef nonnull align 8 dereferenceable(176)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN4GIPS4Node7changedEv(ptr noundef nonnull align 8 dereferenceable(348) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 320
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !21, !noundef !22
  %4 = trunc nuw i8 %3 to i1
  %5 = getelementptr inbounds i8, ptr %0, i64 322
  %6 = load i8, ptr %5, align 2, !range !21
  %7 = getelementptr inbounds i8, ptr %0, i64 321
  %8 = load i8, ptr %7, align 1, !range !21
  %9 = icmp ne i8 %6, %8
  %narrow = select i1 %4, i1 true, i1 %9
  store i8 0, ptr %2, align 8, !tbaa !5
  store i8 %8, ptr %5, align 2, !tbaa !23
  %10 = getelementptr inbounds i8, ptr %0, i64 296
  %11 = tail call noundef i64 @_ZNKSt6vectorIN4GIPS9ParameterESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #1
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  %.04.lcssa = phi i1 [ %narrow, %1 ], [ %spec.select, %.lr.ph ]
  ret i1 %.04.lcssa

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.06 = phi i64 [ %14, %.lr.ph ], [ 0, %1 ]
  %.045 = phi i1 [ %spec.select, %.lr.ph ], [ %narrow, %1 ]
  %12 = tail call noundef nonnull align 8 dereferenceable(176) ptr @_ZNSt6vectorIN4GIPS9ParameterESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %.06) #1
  %13 = tail call noundef zeroext i1 @_ZN4GIPS9Parameter7changedEv(ptr noundef nonnull align 8 dereferenceable(176) %12)
  %spec.select = select i1 %13, i1 true, i1 %.045
  %14 = add nuw i64 %.06, 1
  %15 = tail call noundef i64 @_ZNKSt6vectorIN4GIPS9ParameterESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #1
  %16 = icmp ult i64 %14, %15
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !24
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN4GIPS9ParameterESaIS1_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(176) ptr @_ZNSt6vectorIN4GIPS9ParameterESaIS1_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, !18, i64 320}
!6 = !{!"_ZTSN4GIPS4NodeE", !7, i64 0, !7, i64 32, !7, i64 64, !13, i64 96, !10, i64 104, !14, i64 296, !18, i64 320, !18, i64 321, !18, i64 322, !19, i64 328, !20, i64 344}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"int", !10, i64 0}
!14 = !{!"_ZTSSt6vectorIN4GIPS9ParameterESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN4GIPS9ParameterESaIS1_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!18 = !{!"bool", !10, i64 0}
!19 = !{!"_ZTSN8FileUtil15FileFingerprintE", !12, i64 0, !12, i64 8}
!20 = !{!"_ZTSN4GIPS11PixelFormatE", !10, i64 0}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!6, !18, i64 322}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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