; 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" = type { ptr }
%"struct.ROHC::global_control" = type { i16, i32, i32, i32, i32, i32, i32, %"struct.ROHC::iphdr", i8, %"struct.ROHC::udphdr", %"struct.ROHC::rtphdr" }
%"struct.ROHC::iphdr" = type { i8, i8, i16, i16, i16, i8, i8, i16, i32, i32 }
%"struct.ROHC::udphdr" = type { i16, i16, i16, i16 }
%"struct.ROHC::rtphdr" = type { i16, i16, i32, i32 }

; 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) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4ROHC8DProfile19parse_ip_id_enc_dynERNS_14global_controlERN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEESB_(ptr noundef nonnull align 4 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.ROHC::global_control", ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp eq i32 3, %13
  br i1 %14, label %15, label %19

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.ROHC::global_control", ptr %16, i32 0, i32 7
  %18 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %17, i32 0, i32 3
  store i16 0, ptr %18, align 4, !tbaa !19
  store i1 true, ptr %4, align 1
  br label %56

19:                                               ; preds = %3
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.ROHC::global_control", ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = icmp eq i32 2, %22
  br i1 %23, label %24, label %33

24:                                               ; preds = %19
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %26, i64 8, i1 false), !tbaa.struct !20
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.ROHC::global_control", ptr %27, i32 0, i32 7
  %29 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %28, i32 0, i32 3
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8
  %32 = call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr %31, ptr noundef nonnull align 2 dereferenceable(2) %29)
  store i1 %32, ptr %4, align 1
  br label %56

33:                                               ; preds = %19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.ROHC::global_control", ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = icmp eq i32 0, %36
  br i1 %37, label %38, label %47

38:                                               ; preds = %33
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %40, i64 8, i1 false), !tbaa.struct !20
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.ROHC::global_control", ptr %41, i32 0, i32 7
  %43 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %42, i32 0, i32 3
  %44 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8
  %46 = call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr %45, ptr noundef nonnull align 2 dereferenceable(2) %43)
  store i1 %46, ptr %4, align 1
  br label %56

47:                                               ; preds = %33
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %49, i64 8, i1 false), !tbaa.struct !20
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.ROHC::global_control", ptr %50, i32 0, i32 7
  %52 = getelementptr inbounds %"struct.ROHC::iphdr", ptr %51, i32 0, i32 3
  %53 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8
  %55 = call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr %54, ptr noundef nonnull align 2 dereferenceable(2) %52)
  store i1 %55, ptr %4, align 1
  br label %56

56:                                               ; preds = %47, %38, %24, %15
  %57 = load i1, ptr %4, align 1
  ret i1 %57
}

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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, !13, i64 8}
!10 = !{!"_ZTSN4ROHC14global_controlE", !11, i64 0, !12, i64 4, !13, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !15, i64 28, !16, i64 48, !17, i64 50, !18, i64 60}
!11 = !{!"short", !7, i64 0}
!12 = !{!"_ZTSN4ROHC12Reordering_tE", !7, i64 0}
!13 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN4ROHC5iphdrE", !7, i64 0, !7, i64 0, !7, i64 1, !11, i64 2, !11, i64 4, !11, i64 6, !7, i64 8, !7, i64 9, !11, i64 10, !14, i64 12, !14, i64 16}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN4ROHC6udphdrE", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6}
!18 = !{!"_ZTSN4ROHC6rtphdrE", !7, i64 0, !7, i64 0, !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !11, i64 2, !14, i64 4, !14, i64 8}
!19 = !{!10, !11, i64 32}
!20 = !{i64 0, i64 8, !5}


; 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
define dso_local noundef zeroext i1 @_ZN4ROHC8DProfile19parse_ip_id_enc_dynERNS_14global_controlERN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEESB_(ptr noundef nonnull align 4 dereferenceable(72) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %5, label %14 [
    i32 3, label %6
    i32 2, label %8
    i32 0, label %11
  ]

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  store i16 0, ptr %7, align 4, !tbaa !17
  br label %17

8:                                                ; preds = %3
  %.sroa.02.0.copyload = load ptr, ptr %2, align 8, !tbaa !18
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = tail call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr %.sroa.02.0.copyload, ptr noundef nonnull align 2 dereferenceable(2) %9)
  br label %17

11:                                               ; preds = %3
  %.sroa.01.0.copyload = load ptr, ptr %2, align 8, !tbaa !18
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = tail call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr %.sroa.01.0.copyload, ptr noundef nonnull align 2 dereferenceable(2) %12)
  br label %17

14:                                               ; preds = %3
  %.sroa.0.0.copyload = load ptr, ptr %2, align 8, !tbaa !18
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = tail call noundef zeroext i1 @_ZN4ROHC8GetValueItN9__gnu_cxx17__normal_iteratorIPKhSt6vectorIhSaIhEEEEEEbRT0_S9_RT_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr %.sroa.0.0.copyload, ptr noundef nonnull align 2 dereferenceable(2) %15)
  br label %17

17:                                               ; preds = %14, %11, %8, %6
  %.0 = phi i1 [ true, %6 ], [ %10, %8 ], [ %13, %11 ], [ %16, %14 ]
  ret i1 %.0
}

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

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, !11, i64 8}
!6 = !{!"_ZTSN4ROHC14global_controlE", !7, i64 0, !10, i64 4, !11, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !13, i64 28, !14, i64 48, !15, i64 50, !16, i64 60}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN4ROHC12Reordering_tE", !8, i64 0}
!11 = !{!"_ZTSN4ROHC15IPIDBehaviour_tE", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTSN4ROHC5iphdrE", !8, i64 0, !8, i64 0, !8, i64 1, !7, i64 2, !7, i64 4, !7, i64 6, !8, i64 8, !8, i64 9, !7, i64 10, !12, i64 12, !12, i64 16}
!14 = !{!"bool", !8, i64 0}
!15 = !{!"_ZTSN4ROHC6udphdrE", !7, i64 0, !7, i64 2, !7, i64 4, !7, i64 6}
!16 = !{!"_ZTSN4ROHC6rtphdrE", !8, i64 0, !8, i64 0, !8, i64 0, !8, i64 0, !8, i64 1, !8, i64 1, !7, i64 2, !12, i64 4, !12, i64 8}
!17 = !{!6, !7, i64 32}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !8, i64 0}


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