; LLVM IR from AF-GRILL/DISPluginForUnreal :: Source/ThirdParty/include/dis6/VariableDatum.ll (ZNK3DIS13VariableDatumeqERKS0_)

; 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.DIS::VariableDatum" = type <{ ptr, i32, i32, %"class.std::vector", i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK3DIS13VariableDatumeqERKS0_(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(44) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #2
  store i8 1, ptr %5, align 1, !tbaa !9
  %9 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %8, i32 0, i32 1
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %11, i32 0, i32 1
  %13 = load i32, ptr %12, align 8, !tbaa !11
  %14 = icmp eq i32 %10, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %2
  store i8 0, ptr %5, align 1, !tbaa !9
  br label %16

16:                                               ; preds = %15, %2
  %17 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %8, i32 0, i32 2
  %18 = load i32, ptr %17, align 4, !tbaa !18
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %19, i32 0, i32 2
  %21 = load i32, ptr %20, align 4, !tbaa !18
  %22 = icmp eq i32 %18, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %16
  store i8 0, ptr %5, align 1, !tbaa !9
  br label %24

24:                                               ; preds = %23, %16
  %25 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %8, i32 0, i32 3
  %26 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %27, i32 0, i32 3
  %29 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #2
  %30 = icmp eq i64 %26, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %24
  store i8 0, ptr %5, align 1, !tbaa !9
  br label %59

32:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store i64 0, ptr %6, align 8, !tbaa !19
  br label %33

33:                                               ; preds = %54, %32
  %34 = load i64, ptr %6, align 8, !tbaa !19
  %35 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %8, i32 0, i32 3
  %36 = call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #2
  %37 = icmp ult i64 %34, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %33
  store i32 2, ptr %7, align 4
  br label %57

39:                                               ; preds = %33
  %40 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %8, i32 0, i32 3
  %41 = load i64, ptr %6, align 8, !tbaa !19
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %41) #2
  %43 = load i8, ptr %42, align 1, !tbaa !21
  %44 = sext i8 %43 to i32
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.DIS::VariableDatum", ptr %45, i32 0, i32 3
  %47 = load i64, ptr %6, align 8, !tbaa !19
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #2
  %49 = load i8, ptr %48, align 1, !tbaa !21
  %50 = sext i8 %49 to i32
  %51 = icmp eq i32 %44, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %39
  store i8 0, ptr %5, align 1, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %57

53:                                               ; preds = %39
  br label %54

54:                                               ; preds = %53
  %55 = load i64, ptr %6, align 8, !tbaa !19
  %56 = add i64 %55, 1
  store i64 %56, ptr %6, align 8, !tbaa !19
  br label %33, !llvm.loop !22

57:                                               ; preds = %52, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58, %31
  %60 = load i8, ptr %5, align 1, !tbaa !9, !range !24, !noundef !25
  %61 = trunc i8 %60 to i1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #2
  ret i1 %61
}

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 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN3DIS13VariableDatumE", !13, i64 8, !13, i64 12, !14, i64 16, !13, i64 40}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIcSaIcEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIcSaIcEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIcSaIcEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIcSaIcEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!12, !13, i64 12}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{i8 0, i8 2}
!25 = !{}


; 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 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK3DIS13VariableDatumeqERKS0_(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef nonnull align 8 dereferenceable(44) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load <2 x i32>, ptr %3, align 8, !tbaa !5
  %6 = load <2 x i32>, ptr %4, align 8, !tbaa !5
  %7 = icmp eq <2 x i32> %5, %6
  %8 = extractelement <2 x i1> %7, i64 0
  %9 = extractelement <2 x i1> %7, i64 1
  %narrow = select i1 %9, i1 %8, i1 false
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = tail call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #1
  %12 = getelementptr inbounds i8, ptr %1, i64 16
  %13 = tail call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #1
  %14 = icmp eq i64 %11, %13
  br i1 %14, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %2
  %15 = tail call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #1
  %.not = icmp eq i64 %15, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

16:                                               ; preds = %.lr.ph
  %17 = add nuw i64 %.011, 1
  %18 = tail call noundef i64 @_ZNKSt6vectorIcSaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #1
  %19 = icmp ult i64 %17, %18
  br i1 %19, label %.lr.ph, label %.loopexit, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader, %16
  %.011 = phi i64 [ %17, %16 ], [ 0, %.preheader ]
  %20 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %.011) #1
  %21 = load i8, ptr %20, align 1, !tbaa !11
  %22 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %.011) #1
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = icmp eq i8 %21, %23
  br i1 %24, label %16, label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %16, %.preheader, %2
  %.1 = phi i1 [ false, %2 ], [ %narrow, %.preheader ], [ false, %.lr.ph ], [ %narrow, %16 ]
  ret i1 %.1
}

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}


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