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

; 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.quic_cfq_item_ex_st = type { %struct.quic_cfq_item_st, ptr, ptr, ptr, ptr, ptr, i64, i64, i32, i32, i32, i32 }
%struct.quic_cfq_item_st = type { ptr, ptr }
%struct.quic_cfq_st = type { %struct.quic_cfq_item_list_st, %struct.quic_cfq_item_list_st, %struct.quic_cfq_item_list_st }
%struct.quic_cfq_item_list_st = type { ptr, ptr }

; 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: nounwind uwtable
define dso_local ptr @ossl_quic_cfq_add_frame(ptr noundef %0, i32 noundef %1, i32 noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, ptr noundef %8) #1 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %11, align 8, !tbaa !5
  store i32 %1, ptr %12, align 4, !tbaa !9
  store i32 %2, ptr %13, align 4, !tbaa !9
  store i64 %3, ptr %14, align 8, !tbaa !11
  store i32 %4, ptr %15, align 4, !tbaa !9
  store ptr %5, ptr %16, align 8, !tbaa !5
  store i64 %6, ptr %17, align 8, !tbaa !11
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #2
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  %23 = call ptr @cfq_get_free(ptr noundef %22)
  store ptr %23, ptr %20, align 8, !tbaa !5
  %24 = load ptr, ptr %20, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %9
  store ptr null, ptr %10, align 8
  store i32 1, ptr %21, align 4
  br label %62

27:                                               ; preds = %9
  %28 = load i32, ptr %12, align 4, !tbaa !9
  %29 = load ptr, ptr %20, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %29, i32 0, i32 8
  store i32 %28, ptr %30, align 8, !tbaa !13
  %31 = load i64, ptr %14, align 8, !tbaa !11
  %32 = load ptr, ptr %20, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %32, i32 0, i32 6
  store i64 %31, ptr %33, align 8, !tbaa !16
  %34 = load i32, ptr %13, align 4, !tbaa !9
  %35 = load ptr, ptr %20, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %35, i32 0, i32 9
  store i32 %34, ptr %36, align 4, !tbaa !17
  %37 = load ptr, ptr %16, align 8, !tbaa !5
  %38 = load ptr, ptr %20, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %38, i32 0, i32 3
  store ptr %37, ptr %39, align 8, !tbaa !18
  %40 = load i64, ptr %17, align 8, !tbaa !11
  %41 = load ptr, ptr %20, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %41, i32 0, i32 7
  store i64 %40, ptr %42, align 8, !tbaa !19
  %43 = load ptr, ptr %18, align 8, !tbaa !5
  %44 = load ptr, ptr %20, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %44, i32 0, i32 4
  store ptr %43, ptr %45, align 8, !tbaa !20
  %46 = load ptr, ptr %19, align 8, !tbaa !5
  %47 = load ptr, ptr %20, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %47, i32 0, i32 5
  store ptr %46, ptr %48, align 8, !tbaa !21
  %49 = load ptr, ptr %20, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %49, i32 0, i32 11
  store i32 0, ptr %50, align 4, !tbaa !22
  %51 = load i32, ptr %15, align 4, !tbaa !9
  %52 = load ptr, ptr %20, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %52, i32 0, i32 10
  store i32 %51, ptr %53, align 8, !tbaa !23
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.quic_cfq_st, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %20, align 8, !tbaa !5
  call void @list_remove(ptr noundef %55, ptr noundef %56)
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.quic_cfq_st, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %20, align 8, !tbaa !5
  call void @list_insert_sorted(ptr noundef %58, ptr noundef %59, ptr noundef @compare)
  %60 = load ptr, ptr %20, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.quic_cfq_item_ex_st, ptr %60, i32 0, i32 0
  store ptr %61, ptr %10, align 8
  store i32 1, ptr %21, align 4
  br label %62

62:                                               ; preds = %27, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #2
  %63 = load ptr, ptr %10, align 8
  ret ptr %63
}

; Function Attrs: nounwind uwtable
declare hidden ptr @cfq_get_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @list_remove(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @list_insert_sorted(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @compare(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 72}
!14 = !{!"quic_cfq_item_ex_st", !15, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84}
!15 = !{!"quic_cfq_item_st", !6, i64 0, !6, i64 8}
!16 = !{!14, !12, i64 56}
!17 = !{!14, !10, i64 76}
!18 = !{!14, !6, i64 32}
!19 = !{!14, !12, i64 64}
!20 = !{!14, !6, i64 40}
!21 = !{!14, !6, i64 48}
!22 = !{!14, !10, i64 84}
!23 = !{!14, !10, i64 80}


; 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 ptr @ossl_quic_cfq_add_frame(ptr noundef %0, i32 noundef %1, i32 noundef %2, i64 noundef %3, i32 noundef %4, ptr noundef %5, i64 noundef %6, ptr noundef %7, ptr noundef %8) local_unnamed_addr #0 {
  %10 = tail call ptr @cfq_get_free(ptr noundef %0)
  %11 = icmp eq ptr %10, null
  br i1 %11, label %23, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %10, i64 72
  store i32 %1, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %10, i64 56
  store i64 %3, ptr %14, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %10, i64 76
  store i32 %2, ptr %15, align 4, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %10, i64 32
  store ptr %5, ptr %16, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %10, i64 64
  store i64 %6, ptr %17, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %10, i64 40
  store ptr %7, ptr %18, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %10, i64 48
  store ptr %8, ptr %19, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %10, i64 84
  store i32 0, ptr %20, align 4, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %10, i64 80
  store i32 %4, ptr %21, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @list_remove(ptr noundef nonnull %22, ptr noundef nonnull %10)
  tail call void @list_insert_sorted(ptr noundef %0, ptr noundef nonnull %10, ptr noundef nonnull @compare)
  br label %23

23:                                               ; preds = %9, %12
  ret ptr %10
}

; Function Attrs: nounwind uwtable
declare hidden ptr @cfq_get_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @list_remove(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @list_insert_sorted(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @compare(ptr noundef, ptr noundef) #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, !12, i64 72}
!6 = !{!"quic_cfq_item_ex_st", !7, i64 0, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !11, i64 56, !11, i64 64, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84}
!7 = !{!"quic_cfq_item_st", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!6, !11, i64 56}
!14 = !{!6, !12, i64 76}
!15 = !{!6, !8, i64 32}
!16 = !{!6, !11, i64 64}
!17 = !{!6, !8, i64 40}
!18 = !{!6, !8, i64 48}
!19 = !{!6, !12, i64 84}
!20 = !{!6, !12, i64 80}


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