; LLVM IR from Columbitech/rohc :: src/ctcp_profile.ll (ZNK4ROHC11CTCPProfile7MatchesEjPKNS_5iphdrE)

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

%"struct.ROHC::iphdr" = type { i8, i8, i16, i16, i16, i8, i8, i16, i32, i32 }
%"class.ROHC::CProfile" = type { ptr, ptr, i16, i64, i32, i32, i32, i32, i64, i64, i32, i32, i16, %"class.ROHC::WLSB", i32, i32, i8, i32, i32, i32, %"struct.ROHC::iphdr", i16, i16, %"class.ROHC::WLSB", [11 x i64] }
%"class.ROHC::WLSB" = type { %"class.std::vector", i64, i64, i64, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ROHC::WLSB<int>::LSB, std::allocator<ROHC::WLSB<int>::LSB>>::_Vector_impl" }
%"struct.std::_Vector_base<ROHC::WLSB<int>::LSB, std::allocator<ROHC::WLSB<int>::LSB>>::_Vector_impl" = type { %"struct.std::_Vector_base<ROHC::WLSB<int>::LSB, std::allocator<ROHC::WLSB<int>::LSB>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ROHC::WLSB<int>::LSB, std::allocator<ROHC::WLSB<int>::LSB>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.ROHC::CTCPProfile" = type <{ %"class.ROHC::CProfile", %"struct.ROHC::tcphdr", [4 x i8] }>
%"struct.ROHC::tcphdr" = type { i16, i16, i32, i32, i16, i16, i16, i16 }

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK4ROHC11CTCPProfile7MatchesEjPKNS_5iphdrE(ptr noundef nonnull align 8 dereferenceable(348) %0, i32 noundef %1, ptr noundef %2) unnamed_addr #0 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = call noundef zeroext i16 @_ZN4ROHC11CTCPProfile9ProfileIDEv()
  %12 = zext i16 %11 to i32
  %13 = icmp ne i32 %10, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %67

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = load i8, ptr %17, align 4
  %19 = and i8 %18, 15
  %20 = zext i8 %19 to i32
  %21 = mul nsw i32 4, %20
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %16, i64 %22
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = call noundef zeroext i16 @_ZN4ROHC11CTCPProfile10ProtocolIDEv()
  %25 = zext i16 %24 to i32
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %26, i32 0, i32 6
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = zext i8 %28 to i32
  %30 = icmp eq i32 %25, %29
  br i1 %30, label %31, label %65

31:                                               ; preds = %15
  %32 = getelementptr inbounds %"class.ROHC::CProfile", ptr %9, i32 0, i32 18
  %33 = load i32, ptr %32, align 8, !tbaa !14
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %34, i32 0, i32 8
  %36 = load i32, ptr %35, align 4, !tbaa !26
  %37 = icmp eq i32 %33, %36
  br i1 %37, label %38, label %65

38:                                               ; preds = %31
  %39 = getelementptr inbounds %"class.ROHC::CProfile", ptr %9, i32 0, i32 19
  %40 = load i32, ptr %39, align 4, !tbaa !27
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %41, i32 0, i32 9
  %43 = load i32, ptr %42, align 4, !tbaa !28
  %44 = icmp eq i32 %40, %43
  br i1 %44, label %45, label %65

45:                                               ; preds = %38
  %46 = getelementptr inbounds %"class.ROHC::CTCPProfile", ptr %9, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.ROHC::tcphdr", ptr %46, i32 0, i32 0
  %48 = load i16, ptr %47, align 8, !tbaa !29
  %49 = zext i16 %48 to i32
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.ROHC::tcphdr", ptr %50, i32 0, i32 0
  %52 = load i16, ptr %51, align 4, !tbaa !32
  %53 = zext i16 %52 to i32
  %54 = icmp eq i32 %49, %53
  br i1 %54, label %55, label %65

55:                                               ; preds = %45
  %56 = getelementptr inbounds %"class.ROHC::CTCPProfile", ptr %9, i32 0, i32 1
  %57 = getelementptr inbounds %"struct.ROHC::tcphdr", ptr %56, i32 0, i32 1
  %58 = load i16, ptr %57, align 2, !tbaa !33
  %59 = zext i16 %58 to i32
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.ROHC::tcphdr", ptr %60, i32 0, i32 1
  %62 = load i16, ptr %61, align 2, !tbaa !34
  %63 = zext i16 %62 to i32
  %64 = icmp eq i32 %59, %63
  br label %65

65:                                               ; preds = %55, %45, %38, %31, %15
  %66 = phi i1 [ false, %45 ], [ false, %38 ], [ false, %31 ], [ false, %15 ], [ %64, %55 ]
  store i1 %66, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %67

67:                                               ; preds = %65, %14
  %68 = load i1, ptr %4, align 1
  ret i1 %68
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN4ROHC11CTCPProfile9ProfileIDEv() #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN4ROHC11CTCPProfile10ProtocolIDEv() #1 align 2

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

attributes #0 = { mustprogress 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = !{!12, !7, i64 9}
!12 = !{!"_ZTSN4ROHC5iphdrE", !7, i64 0, !7, i64 0, !7, i64 1, !13, i64 2, !13, i64 4, !13, i64 6, !7, i64 8, !7, i64 9, !13, i64 10, !10, i64 12, !10, i64 16}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !10, i64 152}
!15 = !{!"_ZTSN4ROHC8CProfileE", !6, i64 8, !13, i64 16, !16, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !16, i64 48, !16, i64 56, !10, i64 64, !10, i64 68, !13, i64 72, !17, i64 80, !22, i64 136, !23, i64 140, !24, i64 144, !25, i64 148, !10, i64 152, !10, i64 156, !12, i64 160, !13, i64 180, !13, i64 182, !17, i64 184, !7, i64 240}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN4ROHC4WLSBIiEE", !18, i64 0, !16, i64 24, !16, i64 32, !16, i64 40, !10, i64 48, !10, i64 52}
!18 = !{!"_ZTSSt6vectorIN4ROHC4WLSBIiE3LSBESaIS3_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSN4ROHC12Reordering_tE", !7, i64 0}
!23 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !7, i64 0}
!24 = !{!"bool", !7, i64 0}
!25 = !{!"_ZTSN4ROHC8CProfileUt_E", !7, i64 0}
!26 = !{!12, !10, i64 12}
!27 = !{!15, !10, i64 156}
!28 = !{!12, !10, i64 16}
!29 = !{!30, !13, i64 328}
!30 = !{!"_ZTSN4ROHC11CTCPProfileE", !15, i64 0, !31, i64 328}
!31 = !{!"_ZTSN4ROHC6tcphdrE", !13, i64 0, !13, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 12, !7, i64 12, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !13, i64 14, !13, i64 16, !13, i64 18}
!32 = !{!31, !13, i64 0}
!33 = !{!30, !13, i64 330}
!34 = !{!31, !13, i64 2}


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

%"struct.ROHC::iphdr" = type { i8, i8, i16, i16, i16, i8, i8, i16, i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZNK4ROHC11CTCPProfile7MatchesEjPKNS_5iphdrE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(348) %0, i32 noundef %1, ptr nocapture noundef readonly %2) unnamed_addr #0 align 2 {
  %4 = tail call noundef zeroext i16 @_ZN4ROHC11CTCPProfile9ProfileIDEv()
  %5 = zext i16 %4 to i32
  %.not = icmp eq i32 %5, %1
  br i1 %.not, label %6, label %40

6:                                                ; preds = %3
  %7 = load i8, ptr %2, align 4
  %8 = shl i8 %7, 2
  %9 = and i8 %8, 60
  %10 = zext nneg i8 %9 to i64
  %11 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %2, i64 %10
  %12 = tail call noundef zeroext i16 @_ZN4ROHC11CTCPProfile10ProtocolIDEv()
  %13 = getelementptr inbounds i8, ptr %2, i64 9
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = zext i8 %14 to i16
  %16 = icmp eq i16 %12, %15
  br i1 %16, label %17, label %40

17:                                               ; preds = %6
  %18 = getelementptr inbounds i8, ptr %0, i64 152
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds i8, ptr %2, i64 12
  %21 = load i32, ptr %20, align 4, !tbaa !24
  %22 = icmp eq i32 %19, %21
  br i1 %22, label %23, label %40

23:                                               ; preds = %17
  %24 = getelementptr inbounds i8, ptr %0, i64 156
  %25 = load i32, ptr %24, align 4, !tbaa !25
  %26 = getelementptr inbounds i8, ptr %2, i64 16
  %27 = load i32, ptr %26, align 4, !tbaa !26
  %28 = icmp eq i32 %25, %27
  br i1 %28, label %29, label %40

29:                                               ; preds = %23
  %30 = getelementptr inbounds i8, ptr %0, i64 328
  %31 = load i16, ptr %30, align 8, !tbaa !27
  %32 = load i16, ptr %11, align 4, !tbaa !30
  %33 = icmp eq i16 %31, %32
  br i1 %33, label %34, label %40

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %0, i64 330
  %36 = load i16, ptr %35, align 2, !tbaa !31
  %37 = getelementptr inbounds i8, ptr %11, i64 2
  %38 = load i16, ptr %37, align 2, !tbaa !32
  %39 = icmp eq i16 %36, %38
  br label %40

40:                                               ; preds = %6, %17, %23, %29, %34, %3
  %.0 = phi i1 [ false, %3 ], [ false, %29 ], [ false, %23 ], [ false, %17 ], [ false, %6 ], [ %39, %34 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN4ROHC11CTCPProfile9ProfileIDEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i16 @_ZN4ROHC11CTCPProfile10ProtocolIDEv() 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" }

!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, !7, i64 9}
!6 = !{!"_ZTSN4ROHC5iphdrE", !7, i64 0, !7, i64 0, !7, i64 1, !9, i64 2, !9, i64 4, !9, i64 6, !7, i64 8, !7, i64 9, !9, i64 10, !10, i64 12, !10, i64 16}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 152}
!12 = !{!"_ZTSN4ROHC8CProfileE", !13, i64 8, !9, i64 16, !14, i64 24, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !14, i64 48, !14, i64 56, !10, i64 64, !10, i64 68, !9, i64 72, !15, i64 80, !20, i64 136, !21, i64 140, !22, i64 144, !23, i64 148, !10, i64 152, !10, i64 156, !6, i64 160, !9, i64 180, !9, i64 182, !15, i64 184, !7, i64 240}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSN4ROHC4WLSBIiEE", !16, i64 0, !14, i64 24, !14, i64 32, !14, i64 40, !10, i64 48, !10, i64 52}
!16 = !{!"_ZTSSt6vectorIN4ROHC4WLSBIiE3LSBESaIS3_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN4ROHC4WLSBIiE3LSBESaIS3_EE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!20 = !{!"_ZTSN4ROHC12Reordering_tE", !7, i64 0}
!21 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !7, i64 0}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSN4ROHC8CProfileUt_E", !7, i64 0}
!24 = !{!6, !10, i64 12}
!25 = !{!12, !10, i64 156}
!26 = !{!6, !10, i64 16}
!27 = !{!28, !9, i64 328}
!28 = !{!"_ZTSN4ROHC11CTCPProfileE", !12, i64 0, !29, i64 328}
!29 = !{!"_ZTSN4ROHC6tcphdrE", !9, i64 0, !9, i64 2, !10, i64 4, !10, i64 8, !7, i64 12, !7, i64 12, !7, i64 12, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !7, i64 13, !9, i64 14, !9, i64 16, !9, i64 18}
!30 = !{!29, !9, i64 0}
!31 = !{!28, !9, i64 330}
!32 = !{!29, !9, i64 2}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass