; LLVM IR from openanolis/openssl :: ssl/quic (quic_fc)

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

%struct.OSSL_TIME = type { i64 }
%struct.quic_rxfc_st = type { i64, i64, i64, i64, i64, i64, i64, %struct.OSSL_TIME, ptr, ptr, ptr, i8, i8, i8, i8 }

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_quic_rxfc_on_retire(ptr noundef %0, i64 noundef %1, i64 %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca %struct.OSSL_TIME, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = getelementptr inbounds %struct.OSSL_TIME, ptr %5, i32 0, i32 0
  store i64 %2, ptr %8, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.quic_rxfc_st, ptr %9, i32 0, i32 10
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %19

13:                                               ; preds = %3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.quic_rxfc_st, ptr %14, i32 0, i32 14
  %16 = load i8, ptr %15, align 1, !tbaa !14
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  store i32 0, ptr %4, align 4
  br label %56

19:                                               ; preds = %13, %3
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  store i32 1, ptr %4, align 4
  br label %56

23:                                               ; preds = %19
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.quic_rxfc_st, ptr %24, i32 0, i32 2
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = add i64 %26, %27
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.quic_rxfc_st, ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !16
  %32 = icmp ugt i64 %28, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %23
  store i32 0, ptr %4, align 4
  br label %56

34:                                               ; preds = %23
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load i64, ptr %7, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.OSSL_TIME, ptr %5, i32 0, i32 0
  %38 = load i64, ptr %37, align 8
  %39 = call i32 @rxfc_on_retire(ptr noundef %35, i64 noundef %36, i64 noundef 0, i64 %38)
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.quic_rxfc_st, ptr %40, i32 0, i32 14
  %42 = load i8, ptr %41, align 1, !tbaa !14
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %55, label %44

44:                                               ; preds = %34
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.quic_rxfc_st, ptr %45, i32 0, i32 10
  %47 = load ptr, ptr %46, align 8, !tbaa !11
  %48 = load i64, ptr %7, align 8, !tbaa !9
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.quic_rxfc_st, ptr %49, i32 0, i32 5
  %51 = load i64, ptr %50, align 8, !tbaa !17
  %52 = getelementptr inbounds %struct.OSSL_TIME, ptr %5, i32 0, i32 0
  %53 = load i64, ptr %52, align 8
  %54 = call i32 @rxfc_on_retire(ptr noundef %47, i64 noundef %48, i64 noundef %51, i64 %53)
  br label %55

55:                                               ; preds = %44, %34
  store i32 1, ptr %4, align 4
  br label %56

56:                                               ; preds = %55, %33, %22, %18
  %57 = load i32, ptr %4, align 4
  ret i32 %57
}

; Function Attrs: nounwind uwtable
declare hidden i32 @rxfc_on_retire(ptr noundef, i64 noundef, i64 noundef, i64) #0

attributes #0 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 80}
!12 = !{!"quic_rxfc_st", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !7, i64 88, !7, i64 89, !7, i64 90, !7, i64 91}
!13 = !{!"", !10, i64 0}
!14 = !{!12, !7, i64 91}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 8}
!17 = !{!12, !10, i64 40}


; 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: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_quic_rxfc_on_retire(ptr noundef %0, i64 noundef %1, i64 %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 80
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %7, label %10

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 91
  %9 = load i8, ptr %8, align 1, !tbaa !12
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %28, label %10

10:                                               ; preds = %7, %3
  %11 = icmp eq i64 %1, 0
  br i1 %11, label %28, label %12

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = add i64 %14, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %18 = icmp ugt i64 %15, %17
  br i1 %18, label %28, label %19

19:                                               ; preds = %12
  %20 = tail call i32 @rxfc_on_retire(ptr noundef nonnull %0, i64 noundef %1, i64 noundef 0, i64 %2)
  %21 = getelementptr inbounds i8, ptr %0, i64 91
  %22 = load i8, ptr %21, align 1, !tbaa !12
  %.not14 = icmp eq i8 %22, 0
  br i1 %.not14, label %23, label %28

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = tail call i32 @rxfc_on_retire(ptr noundef %24, i64 noundef %1, i64 noundef %26, i64 %2)
  br label %28

28:                                               ; preds = %19, %23, %12, %10, %7
  %.0 = phi i32 [ 0, %7 ], [ 1, %10 ], [ 0, %12 ], [ 1, %23 ], [ 1, %19 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @rxfc_on_retire(ptr noundef, i64 noundef, i64 noundef, i64) local_unnamed_addr #0

attributes #0 = { 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 80}
!6 = !{!"quic_rxfc_st", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !8, i64 88, !8, i64 89, !8, i64 90, !8, i64 91}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !7, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !8, i64 91}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 40}


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