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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE9push_backERKh(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4ROHC11CRTPProfile27create_profile_1_flags2_encEbPKNS_6rtphdrERSt6vectorIhSaIhEE(ptr noundef nonnull align 8 dereferenceable(445) %0, i1 noundef zeroext %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  %10 = zext i1 %1 to i8
  store i8 %10, ptr %6, align 1, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8
  %12 = load ptr, ptr %8, align 8, !tbaa !5
  %13 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %14 = trunc i8 %13 to i1
  br i1 %14, label %15, label %49

15:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  store i8 0, ptr %9, align 1, !tbaa !13
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = call noundef zeroext i1 @_ZNK4ROHC11CRTPProfile9PTChangedEPKNS_6rtphdrE(ptr noundef nonnull align 8 dereferenceable(445) %11, ptr noundef %16)
  br i1 %17, label %18, label %23

18:                                               ; preds = %15
  %19 = load i8, ptr %9, align 1, !tbaa !13
  %20 = zext i8 %19 to i32
  %21 = or i32 %20, 64
  %22 = trunc i32 %21 to i8
  store i8 %22, ptr %9, align 1, !tbaa !13
  br label %23

23:                                               ; preds = %18, %15
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load i16, ptr %24, align 4
  %26 = lshr i16 %25, 5
  %27 = and i16 %26, 1
  %28 = trunc i16 %27 to i8
  %29 = icmp ne i8 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %23
  %31 = load i8, ptr %9, align 1, !tbaa !13
  %32 = zext i8 %31 to i32
  %33 = or i32 %32, 16
  %34 = trunc i32 %33 to i8
  store i8 %34, ptr %9, align 1, !tbaa !13
  br label %35

35:                                               ; preds = %30, %23
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load i16, ptr %36, align 4
  %38 = lshr i16 %37, 4
  %39 = and i16 %38, 1
  %40 = trunc i16 %39 to i8
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %47

42:                                               ; preds = %35
  %43 = load i8, ptr %9, align 1, !tbaa !13
  %44 = zext i8 %43 to i32
  %45 = or i32 %44, 128
  %46 = trunc i32 %45 to i8
  store i8 %46, ptr %9, align 1, !tbaa !13
  br label %47

47:                                               ; preds = %42, %35
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZNSt6vectorIhSaIhEE9push_backERKh(ptr noundef nonnull align 8 dereferenceable(24) %48, ptr noundef nonnull align 1 dereferenceable(1) %9)
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  br label %49

49:                                               ; preds = %47, %4
  ret void
}

attributes #0 = { nocallback nofree nosync 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" }
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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!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"

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE9push_backERKh(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4ROHC11CRTPProfile27create_profile_1_flags2_encEbPKNS_6rtphdrERSt6vectorIhSaIhEE(ptr noundef nonnull align 8 dereferenceable(445) %0, i1 noundef zeroext %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #1 align 2 {
  %5 = alloca i8, align 1
  br i1 %1, label %6, label %22

6:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  store i8 0, ptr %5, align 1, !tbaa !5
  %7 = tail call noundef zeroext i1 @_ZNK4ROHC11CRTPProfile9PTChangedEPKNS_6rtphdrE(ptr noundef nonnull align 8 dereferenceable(445) %0, ptr noundef %2)
  br i1 %7, label %8, label %9

8:                                                ; preds = %6
  store i8 64, ptr %5, align 1, !tbaa !5
  br label %9

9:                                                ; preds = %8, %6
  %10 = phi i8 [ 64, %8 ], [ 0, %6 ]
  %11 = load i16, ptr %2, align 4
  %12 = and i16 %11, 48
  %.not7 = icmp eq i16 %12, 0
  br i1 %.not7, label %21, label %13

13:                                               ; preds = %9
  %14 = trunc i16 %11 to i8
  %15 = lshr i8 %14, 1
  %16 = and i8 %15, 16
  %17 = or disjoint i8 %10, %16
  %18 = trunc i16 %11 to i8
  %19 = shl i8 %18, 3
  %20 = and i8 %19, -128
  %simplifycfg.merge = or disjoint i8 %17, %20
  store i8 %simplifycfg.merge, ptr %5, align 1, !tbaa !5
  br label %21

21:                                               ; preds = %9, %13
  call void @_ZNSt6vectorIhSaIhEE9push_backERKh(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  br label %22

22:                                               ; preds = %21, %4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync 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" }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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