; LLVM IR from chensoft/libsocket :: src/ip/ip_version.ll (ZNK4chen11ip_version49isPrivateEv)

; 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.chen::ip_version4" = type { %"class.chen::ip_version", i32 }
%"class.chen::ip_version" = type { i8 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK4chen11ip_version49isPrivateEv(ptr noundef nonnull align 4 dereferenceable(8) %0) #0 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %"class.chen::ip_version4", ptr %4, i32 0, i32 1
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = and i32 %6, -16777216
  %8 = icmp eq i32 %7, 167772160
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i1 true, ptr %2, align 1
  br label %33

10:                                               ; preds = %1
  %11 = getelementptr inbounds %"class.chen::ip_version4", ptr %4, i32 0, i32 1
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = and i32 %12, -4194304
  %14 = icmp eq i32 %13, 1681915904
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  store i1 true, ptr %2, align 1
  br label %33

16:                                               ; preds = %10
  %17 = getelementptr inbounds %"class.chen::ip_version4", ptr %4, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = and i32 %18, -1048576
  %20 = icmp eq i32 %19, -1408237568
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store i1 true, ptr %2, align 1
  br label %33

22:                                               ; preds = %16
  %23 = getelementptr inbounds %"class.chen::ip_version4", ptr %4, i32 0, i32 1
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = and i32 %24, -65536
  %26 = icmp eq i32 %25, -1062731776
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  store i1 true, ptr %2, align 1
  br label %33

28:                                               ; preds = %22
  %29 = getelementptr inbounds %"class.chen::ip_version4", ptr %4, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = and i32 %30, -131072
  %32 = icmp eq i32 %31, -971898880
  store i1 %32, ptr %2, align 1
  br label %33

33:                                               ; preds = %28, %27, %21, %15, %9
  %34 = load i1, ptr %2, align 1
  ret i1 %34
}

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

!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, !12, i64 4}
!10 = !{!"_ZTSN4chen11ip_version4E", !11, i64 0, !12, i64 4}
!11 = !{!"_ZTSN4chen10ip_versionE", !7, i64 0}
!12 = !{!"int", !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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_ZNK4chen11ip_version49isPrivateEv(ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 4
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = insertelement <4 x i32> poison, i32 %3, i64 0
  %5 = shufflevector <4 x i32> %4, <4 x i32> poison, <4 x i32> zeroinitializer
  %6 = and <4 x i32> %5, <i32 -16777216, i32 -4194304, i32 -1048576, i32 -65536>
  %7 = icmp eq <4 x i32> %6, <i32 167772160, i32 1681915904, i32 -1408237568, i32 -1062731776>
  %8 = bitcast <4 x i1> %7 to i4
  %.not = icmp eq i4 %8, 0
  %9 = and i32 %3, -131072
  %10 = icmp eq i32 %9, -971898880
  %.0 = select i1 %.not, i1 %10, i1 true
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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" }

!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, !10, i64 4}
!6 = !{!"_ZTSN4chen11ip_version4E", !7, i64 0, !10, i64 4}
!7 = !{!"_ZTSN4chen10ip_versionE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass