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

; 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.__gnu_cxx::__normal_iterator.0" = type { ptr }
%"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 }

@.str.4 = external hidden unnamed_addr constant [48 x i8], align 1

declare void @_ZN4ROHC5errorEPKcz(ptr noundef, ...) #0

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ROHC8DProfile31parse_ip_id_sequential_variableEbRN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEERKS7_RtSB_(ptr noundef nonnull align 8 dereferenceable(92) %0, i1 noundef zeroext %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 2 dereferenceable(2) %4, ptr noundef nonnull align 2 dereferenceable(2) %5) #3 align 2 {
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  %18 = zext i1 %1 to i8
  store i8 %18, ptr %9, align 1, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8
  %20 = getelementptr inbounds %"class.ROHC::DProfile", ptr %19, i32 0, i32 7
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = icmp sle i32 %21, 1
  br i1 %22, label %23, label %51

23:                                               ; preds = %6
  %24 = load i8, ptr %9, align 1, !tbaa !9, !range !20, !noundef !21
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %33

26:                                               ; preds = %23
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %28, i64 8, i1 false), !tbaa.struct !22
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %14, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEbRT0_S8_RT_(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr %31, ptr noundef nonnull align 2 dereferenceable(2) %29)
  store i1 %32, ptr %7, align 1
  br label %52

33:                                               ; preds = %23
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %34, i64 8, i1 false), !tbaa.struct !22
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %35, i64 8, i1 false), !tbaa.struct !22
  %36 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %15, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8
  %38 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %16, i32 0, i32 0
  %39 = load ptr, ptr %38, align 8
  %40 = call noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEENSt15iterator_traitsIT_E15difference_typeES8_S8_(ptr %37, ptr %39)
  %41 = icmp slt i64 %40, 1
  br i1 %41, label %42, label %43

42:                                               ; preds = %33
  call void (ptr, ...) @_ZN4ROHC5errorEPKcz(ptr noundef @.str.4)
  store i1 false, ptr %7, align 1
  br label %52

43:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %44, i32 noundef 0) #6
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %17, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  %48 = load i8, ptr %47, align 1, !tbaa !23
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZNK4ROHC8DProfile16UpdateIPIDOffsetEhjRt(ptr noundef nonnull align 8 dereferenceable(92) %19, i8 noundef zeroext %48, i32 noundef 8, ptr noundef nonnull align 2 dereferenceable(2) %49)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %50

50:                                               ; preds = %43
  br label %51

51:                                               ; preds = %50, %6
  store i1 true, ptr %7, align 1
  br label %52

52:                                               ; preds = %51, %42, %26
  %53 = load i1, ptr %7, align 1
  ret i1 %53
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEbRT0_S8_RT_(ptr noundef nonnull align 8 dereferenceable(8), ptr, ptr noundef nonnull align 2 dereferenceable(2)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEENSt15iterator_traitsIT_E15difference_typeES8_S8_(ptr, ptr) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4ROHC8DProfile16UpdateIPIDOffsetEhjRt(ptr noundef nonnull align 8 dereferenceable(92), i8 noundef zeroext, i32 noundef, ptr noundef nonnull align 2 dereferenceable(2)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

attributes #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { inlinehint 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 #6 = { 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, !15, i64 28}
!12 = !{!"_ZTSN4ROHC8DProfileE", !6, i64 8, !13, i64 16, !14, i64 20, !13, i64 24, !13, i64 26, !15, i64 28, !16, i64 32, !16, i64 36, !17, i64 40, !17, i64 48, !10, i64 56, !18, i64 60, !17, i64 80, !19, i64 88}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTSN4ROHC8DProfileUt_E", !7, i64 0}
!15 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_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, !16, i64 12, !16, i64 16}
!19 = !{!"_ZTSN4ROHC12Reordering_tE", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{i64 0, i64 8, !5}
!23 = !{!7, !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"

%"class.__gnu_cxx::__normal_iterator.0" = type { ptr }

@.str.4 = external hidden unnamed_addr constant [48 x i8], align 1

declare void @_ZN4ROHC5errorEPKcz(ptr noundef, ...) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ROHC8DProfile31parse_ip_id_sequential_variableEbRN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEERKS7_RtSB_(ptr noundef nonnull align 8 dereferenceable(92) %0, i1 noundef zeroext %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %3, ptr noundef nonnull align 2 dereferenceable(2) %4, ptr noundef nonnull align 2 dereferenceable(2) %5) local_unnamed_addr #2 align 2 {
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 28
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = icmp slt i32 %9, 2
  br i1 %10, label %11, label %22

11:                                               ; preds = %6
  br i1 %1, label %12, label %14

12:                                               ; preds = %11
  %.sroa.02.0.copyload = load ptr, ptr %3, align 8, !tbaa !18
  %13 = tail call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEbRT0_S8_RT_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr %.sroa.02.0.copyload, ptr noundef nonnull align 2 dereferenceable(2) %5)
  br label %22

14:                                               ; preds = %11
  %.sroa.01.0.copyload = load ptr, ptr %2, align 8, !tbaa !18
  %.sroa.0.0.copyload = load ptr, ptr %3, align 8, !tbaa !18
  %15 = tail call noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEENSt15iterator_traitsIT_E15difference_typeES8_S8_(ptr %.sroa.01.0.copyload, ptr %.sroa.0.0.copyload)
  %16 = icmp slt i64 %15, 1
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  tail call void (ptr, ...) @_ZN4ROHC5errorEPKcz(ptr noundef nonnull @.str.4)
  br label %22

18:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %19 = tail call ptr @_ZN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0) #5
  store ptr %19, ptr %7, align 8
  %20 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  %21 = load i8, ptr %20, align 1, !tbaa !19
  call void @_ZNK4ROHC8DProfile16UpdateIPIDOffsetEhjRt(ptr noundef nonnull align 8 dereferenceable(92) %0, i8 noundef zeroext %21, i32 noundef 8, ptr noundef nonnull align 2 dereferenceable(2) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %22

22:                                               ; preds = %6, %18, %17, %12
  %.0 = phi i1 [ %13, %12 ], [ false, %17 ], [ true, %18 ], [ true, %6 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEEEbRT0_S8_RT_(ptr noundef nonnull align 8 dereferenceable(8), ptr, ptr noundef nonnull align 2 dereferenceable(2)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEEENSt15iterator_traitsIT_E15difference_typeES8_S8_(ptr, ptr) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK4ROHC8DProfile16UpdateIPIDOffsetEhjRt(ptr noundef nonnull align 8 dereferenceable(92), i8 noundef zeroext, i32 noundef, ptr noundef nonnull align 2 dereferenceable(2)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPhSt6vectorIhSaIhEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

attributes #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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { inlinehint 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 #5 = { 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, !12, i64 28}
!6 = !{!"_ZTSN4ROHC8DProfileE", !7, i64 8, !10, i64 16, !11, i64 20, !10, i64 24, !10, i64 26, !12, i64 28, !13, i64 32, !13, i64 36, !14, i64 40, !14, i64 48, !15, i64 56, !16, i64 60, !14, i64 80, !17, i64 88}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"_ZTSN4ROHC8DProfileUt_E", !8, i64 0}
!12 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !8, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!"long", !8, i64 0}
!15 = !{!"bool", !8, i64 0}
!16 = !{!"_ZTSN4ROHC5iphdrE", !8, i64 0, !8, i64 0, !8, i64 1, !10, i64 2, !10, i64 4, !10, i64 6, !8, i64 8, !8, i64 9, !10, i64 10, !13, i64 12, !13, i64 16}
!17 = !{!"_ZTSN4ROHC12Reordering_tE", !8, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!8, !8, i64 0}


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