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

; 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: mustprogress uwtable
define dso_local noundef ptr @_ZN4ROHC8DProfile6CreateEPNS_12DecompressorEtj(ptr noundef %0, i16 noundef zeroext %1, i32 noundef %2) #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i16, align 2
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i16 %1, ptr %6, align 2, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  %10 = call noundef zeroext i16 @_ZN4ROHC11DUDPProfile9ProfileIDEv()
  %11 = zext i16 %10 to i32
  %12 = and i32 %11, 255
  %13 = load i32, ptr %7, align 4, !tbaa !11
  %14 = icmp eq i32 %12, %13
  br i1 %14, label %15, label %24

15:                                               ; preds = %3
  %16 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 104) #5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load i16, ptr %6, align 2, !tbaa !9
  invoke void @_ZN4ROHC11DUDPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(102) %16, ptr noundef %17, i16 noundef zeroext %18)
          to label %19 unwind label %20

19:                                               ; preds = %15
  store ptr %16, ptr %4, align 8
  br label %50

20:                                               ; preds = %15
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %8, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %16, i64 noundef 104) #6
  br label %52

24:                                               ; preds = %3
  %25 = call noundef zeroext i16 @_ZN4ROHC11DRTPProfile9ProfileIDEv()
  %26 = zext i16 %25 to i32
  %27 = and i32 %26, 255
  %28 = load i32, ptr %7, align 4, !tbaa !11
  %29 = icmp eq i32 %27, %28
  br i1 %29, label %30, label %39

30:                                               ; preds = %24
  %31 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 136) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i16, ptr %6, align 2, !tbaa !9
  invoke void @_ZN4ROHC11DRTPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(132) %31, ptr noundef %32, i16 noundef zeroext %33)
          to label %34 unwind label %35

34:                                               ; preds = %30
  store ptr %31, ptr %4, align 8
  br label %50

35:                                               ; preds = %30
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %8, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %31, i64 noundef 136) #6
  br label %52

39:                                               ; preds = %24
  br label %40

40:                                               ; preds = %39
  %41 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 96) #5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i16, ptr %6, align 2, !tbaa !9
  %44 = zext i16 %43 to i32
  invoke void @_ZN4ROHC20DUncompressedProfileC1EPNS_12DecompressorEj(ptr noundef nonnull align 8 dereferenceable(92) %41, ptr noundef %42, i32 noundef %44)
          to label %45 unwind label %46

45:                                               ; preds = %40
  store ptr %41, ptr %4, align 8
  br label %50

46:                                               ; preds = %40
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %8, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %9, align 4
  call void @_ZdlPvm(ptr noundef %41, i64 noundef 96) #6
  br label %52

50:                                               ; preds = %45, %34, %19
  %51 = load ptr, ptr %4, align 8
  ret ptr %51

52:                                               ; preds = %46, %35, %20
  %53 = load ptr, ptr %8, align 8
  %54 = load i32, ptr %9, align 4
  %55 = insertvalue { ptr, i32 } poison, ptr %53, 0
  %56 = insertvalue { ptr, i32 } %55, i32 %54, 1
  resume { ptr, i32 } %56
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

declare void @_ZN4ROHC11DUDPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(102), ptr noundef, i16 noundef zeroext) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #4

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

declare void @_ZN4ROHC11DRTPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(132), ptr noundef, i16 noundef zeroext) unnamed_addr #3

declare void @_ZN4ROHC20DUncompressedProfileC1EPNS_12DecompressorEj(ptr noundef nonnull align 8 dereferenceable(92), ptr noundef, i32 noundef) unnamed_addr #3

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 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #6 = { builtin 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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !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 uwtable
define dso_local noundef nonnull ptr @_ZN4ROHC8DProfile6CreateEPNS_12DecompressorEtj(ptr noundef %0, i16 noundef zeroext %1, i32 noundef %2) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = tail call noundef zeroext i16 @_ZN4ROHC11DUDPProfile9ProfileIDEv()
  %5 = and i16 %4, 255
  %6 = zext nneg i16 %5 to i32
  %7 = icmp eq i32 %6, %2
  br i1 %7, label %8, label %12

8:                                                ; preds = %3
  %9 = tail call noalias noundef nonnull dereferenceable(104) ptr @_Znwm(i64 noundef 104) #5
  invoke void @_ZN4ROHC11DUDPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(102) %9, ptr noundef %0, i16 noundef zeroext %1)
          to label %26 unwind label %10

10:                                               ; preds = %8
  %11 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %9, i64 noundef 104) #6
  br label %27

12:                                               ; preds = %3
  %13 = tail call noundef zeroext i16 @_ZN4ROHC11DRTPProfile9ProfileIDEv()
  %14 = and i16 %13, 255
  %15 = zext nneg i16 %14 to i32
  %16 = icmp eq i32 %15, %2
  br i1 %16, label %17, label %21

17:                                               ; preds = %12
  %18 = tail call noalias noundef nonnull dereferenceable(136) ptr @_Znwm(i64 noundef 136) #5
  invoke void @_ZN4ROHC11DRTPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(132) %18, ptr noundef %0, i16 noundef zeroext %1)
          to label %26 unwind label %19

19:                                               ; preds = %17
  %20 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %18, i64 noundef 136) #6
  br label %27

21:                                               ; preds = %12
  %22 = tail call noalias noundef nonnull dereferenceable(96) ptr @_Znwm(i64 noundef 96) #5
  %23 = zext i16 %1 to i32
  invoke void @_ZN4ROHC20DUncompressedProfileC1EPNS_12DecompressorEj(ptr noundef nonnull align 8 dereferenceable(92) %22, ptr noundef %0, i32 noundef %23)
          to label %26 unwind label %24

24:                                               ; preds = %21
  %25 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %22, i64 noundef 96) #6
  br label %27

26:                                               ; preds = %21, %17, %8
  %.011 = phi ptr [ %9, %8 ], [ %18, %17 ], [ %22, %21 ]
  ret ptr %.011

27:                                               ; preds = %24, %19, %10
  %.pn = phi { ptr, i32 } [ %11, %10 ], [ %20, %19 ], [ %25, %24 ]
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

declare void @_ZN4ROHC11DUDPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(102), ptr noundef, i16 noundef zeroext) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #4

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

declare void @_ZN4ROHC11DRTPProfileC1EPNS_12DecompressorEt(ptr noundef nonnull align 8 dereferenceable(132), ptr noundef, i16 noundef zeroext) unnamed_addr #3

declare void @_ZN4ROHC20DUncompressedProfileC1EPNS_12DecompressorEj(ptr noundef nonnull align 8 dereferenceable(92), ptr noundef, i32 noundef) unnamed_addr #3

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 = { nobuiltin allocsize(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 = { "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 = { nobuiltin nounwind "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 = { builtin allocsize(0) }
attributes #6 = { builtin 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)"}


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