; LLVM IR from Columbitech/rohc :: src/dprofile.ll (ZN4ROHC8DProfileC2EPNS_12DecompressorEt)

; 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.ROHC::DProfile" = type <{ ptr, ptr, i16, [2 x i8], i32, i16, i16, i32, i32, i32, i64, i64, i8, [3 x i8], %"struct.ROHC::iphdr", i64, i32, [4 x i8] }>
%"struct.ROHC::iphdr" = type { i8, i8, i16, i16, i16, i8, i8, i16, i32, i32 }

@_ZTVN4ROHC8DProfileE = external dso_local unnamed_addr constant { [8 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4ROHC8DProfileC2EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(92) %0, ptr noundef %1, i16 noundef zeroext %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i16, align 2
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i16 %2, ptr %6, align 2, !tbaa !9
  %7 = load ptr, ptr %4, align 8
  store ptr getelementptr inbounds inrange(-16, 48) ({ [8 x ptr] }, ptr @_ZTVN4ROHC8DProfileE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 1
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %9, ptr %8, align 8, !tbaa !13
  %10 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 2
  %11 = load i16, ptr %6, align 2, !tbaa !9
  store i16 %11, ptr %10, align 8, !tbaa !22
  %12 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 4
  store i32 0, ptr %12, align 4, !tbaa !23
  %13 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 5
  store i16 0, ptr %13, align 8, !tbaa !24
  %14 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 6
  store i16 0, ptr %14, align 2, !tbaa !25
  %15 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 7
  store i32 2, ptr %15, align 4, !tbaa !26
  %16 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 8
  store i32 0, ptr %16, align 8, !tbaa !27
  %17 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 9
  store i32 0, ptr %17, align 4, !tbaa !28
  %18 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 10
  store i64 0, ptr %18, align 8, !tbaa !29
  %19 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 11
  store i64 0, ptr %19, align 8, !tbaa !30
  %20 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 12
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZNK4ROHC12Decompressor8LargeCIDEv(ptr noundef nonnull align 8 dereferenceable(88) %21)
  %23 = zext i1 %22 to i8
  store i8 %23, ptr %20, align 8, !tbaa !31
  %24 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 14
  call void @llvm.memset.p0.i64(ptr align 4 %24, i8 0, i64 20, i1 false)
  %25 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 15
  store i64 0, ptr %25, align 8, !tbaa !32
  %26 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 14
  call void @llvm.memset.p0.i64(ptr align 4 %26, i8 0, i64 20, i1 false)
  %27 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 14
  %28 = load i8, ptr %27, align 4
  %29 = and i8 %28, 15
  %30 = or i8 %29, 64
  store i8 %30, ptr %27, align 4
  %31 = getelementptr inbounds %"class.ROHC::DProfile", ptr %7, i32 0, i32 14
  %32 = load i8, ptr %31, align 4
  %33 = and i8 %32, -16
  %34 = or i8 %33, 5
  store i8 %34, ptr %31, align 4
  call void @_ZN4ROHC8DProfile15SetReorderRatioENS_12Reordering_tE(ptr noundef nonnull align 8 dereferenceable(92) %7, i32 noundef 0)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4ROHC12Decompressor8LargeCIDEv(ptr noundef nonnull align 8 dereferenceable(88)) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4ROHC8DProfile15SetReorderRatioENS_12Reordering_tE(ptr noundef nonnull align 8 dereferenceable(92), i32 noundef) #1 align 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 nounwind willreturn memory(argmem: write) }

!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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"_ZTSN4ROHC8DProfileE", !6, i64 8, !10, i64 16, !15, i64 20, !10, i64 24, !10, i64 26, !16, i64 28, !17, i64 32, !17, i64 36, !18, i64 40, !18, i64 48, !19, i64 56, !20, i64 60, !18, i64 80, !21, i64 88}
!15 = !{!"_ZTSN4ROHC8DProfileUt_E", !7, i64 0}
!16 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTSN4ROHC5iphdrE", !7, i64 0, !7, i64 0, !7, i64 1, !10, i64 2, !10, i64 4, !10, i64 6, !7, i64 8, !7, i64 9, !10, i64 10, !17, i64 12, !17, i64 16}
!21 = !{!"_ZTSN4ROHC12Reordering_tE", !7, i64 0}
!22 = !{!14, !10, i64 16}
!23 = !{!14, !15, i64 20}
!24 = !{!14, !10, i64 24}
!25 = !{!14, !10, i64 26}
!26 = !{!14, !16, i64 28}
!27 = !{!14, !17, i64 32}
!28 = !{!14, !17, i64 36}
!29 = !{!14, !18, i64 40}
!30 = !{!14, !18, i64 48}
!31 = !{!14, !19, i64 56}
!32 = !{!14, !18, i64 80}


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

@_ZTVN4ROHC8DProfileE = external dso_local unnamed_addr constant { [8 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4ROHC8DProfileC2EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(92) %0, ptr noundef nonnull %1, i16 noundef zeroext %2) unnamed_addr #0 align 2 {
  store ptr getelementptr inbounds inrange(-16, 48) (i8, ptr @_ZTVN4ROHC8DProfileE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  store i16 %2, ptr %5, align 8, !tbaa !20
  %6 = getelementptr inbounds i8, ptr %0, i64 20
  %7 = getelementptr inbounds i8, ptr %0, i64 28
  store i64 0, ptr %6, align 4
  store i32 2, ptr %7, align 4, !tbaa !21
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  %10 = tail call noundef zeroext i1 @_ZNK4ROHC12Decompressor8LargeCIDEv(ptr noundef nonnull align 8 dereferenceable(88) %1)
  %11 = zext i1 %10 to i8
  store i8 %11, ptr %9, align 8, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 60
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %12, i8 0, i64 28, i1 false)
  store i8 69, ptr %12, align 4
  tail call void @_ZN4ROHC8DProfile15SetReorderRatioENS_12Reordering_tE(ptr noundef nonnull align 8 dereferenceable(92) %0, i32 noundef 0)
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4ROHC8DProfile15SetReorderRatioENS_12Reordering_tE(ptr noundef nonnull align 8 dereferenceable(92), i32 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN4ROHC8DProfileE", !10, i64 8, !12, i64 16, !13, i64 20, !12, i64 24, !12, i64 26, !14, i64 28, !15, i64 32, !15, i64 36, !16, i64 40, !16, i64 48, !17, i64 56, !18, i64 60, !16, i64 80, !19, i64 88}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"short", !11, i64 0}
!13 = !{!"_ZTSN4ROHC8DProfileUt_E", !11, i64 0}
!14 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !11, i64 0}
!15 = !{!"int", !11, i64 0}
!16 = !{!"long", !11, i64 0}
!17 = !{!"bool", !11, i64 0}
!18 = !{!"_ZTSN4ROHC5iphdrE", !11, i64 0, !11, i64 0, !11, i64 1, !12, i64 2, !12, i64 4, !12, i64 6, !11, i64 8, !11, i64 9, !12, i64 10, !15, i64 12, !15, i64 16}
!19 = !{!"_ZTSN4ROHC12Reordering_tE", !11, i64 0}
!20 = !{!9, !12, i64 16}
!21 = !{!9, !14, i64 28}
!22 = !{!9, !17, i64 56}


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