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

; 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.sframe_list_st = type { ptr, ptr, i32, i64, i64, i32, i32 }
%struct.stream_frame_st = type { ptr, ptr, %struct.uint_range_st, ptr, ptr }
%struct.uint_range_st = type { i64, i64 }

@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [58 x i8], align 1

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ossl_assert_int(i32 noundef, ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_sframe_list_drop_frames(ptr noundef %0, i64 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %9 = load i64, ptr %5, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.sframe_list_st, ptr %10, i32 0, i32 4
  %12 = load i64, ptr %11, align 8, !tbaa !11
  %13 = icmp uge i64 %9, %12
  %14 = zext i1 %13 to i32
  %15 = icmp ne i32 %14, 0
  %16 = zext i1 %15 to i32
  %17 = call i32 @ossl_assert_int(i32 noundef %16, ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 223)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %58

19:                                               ; preds = %2
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.sframe_list_st, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = icmp eq ptr %22, null
  br i1 %23, label %33, label %24

24:                                               ; preds = %19
  %25 = load i64, ptr %5, align 8, !tbaa !9
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.sframe_list_st, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = getelementptr inbounds %struct.stream_frame_st, ptr %28, i32 0, i32 2
  %30 = getelementptr inbounds %struct.uint_range_st, ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !15
  %32 = icmp ule i64 %25, %31
  br label %33

33:                                               ; preds = %24, %19
  %34 = phi i1 [ true, %19 ], [ %32, %24 ]
  %35 = zext i1 %34 to i32
  %36 = icmp ne i32 %35, 0
  %37 = zext i1 %36 to i32
  %38 = call i32 @ossl_assert_int(i32 noundef %37, ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 225)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %58

40:                                               ; preds = %33
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.sframe_list_st, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  %44 = icmp ne ptr %43, null
  br i1 %44, label %51, label %45

45:                                               ; preds = %40
  %46 = load i64, ptr %5, align 8, !tbaa !9
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.sframe_list_st, ptr %47, i32 0, i32 4
  %49 = load i64, ptr %48, align 8, !tbaa !11
  %50 = icmp eq i64 %46, %49
  br label %51

51:                                               ; preds = %45, %40
  %52 = phi i1 [ true, %40 ], [ %50, %45 ]
  %53 = zext i1 %52 to i32
  %54 = icmp ne i32 %53, 0
  %55 = zext i1 %54 to i32
  %56 = call i32 @ossl_assert_int(i32 noundef %55, ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 227)
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %59, label %58

58:                                               ; preds = %51, %33, %2
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %104

59:                                               ; preds = %51
  %60 = load i64, ptr %5, align 8, !tbaa !9
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.sframe_list_st, ptr %61, i32 0, i32 4
  store i64 %60, ptr %62, align 8, !tbaa !11
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.sframe_list_st, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !18
  store ptr %65, ptr %6, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %78, %59
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %76

69:                                               ; preds = %66
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.stream_frame_st, ptr %70, i32 0, i32 2
  %72 = getelementptr inbounds %struct.uint_range_st, ptr %71, i32 0, i32 1
  %73 = load i64, ptr %72, align 8, !tbaa !15
  %74 = load i64, ptr %5, align 8, !tbaa !9
  %75 = icmp ule i64 %73, %74
  br label %76

76:                                               ; preds = %69, %66
  %77 = phi i1 [ false, %66 ], [ %75, %69 ]
  br i1 %77, label %78, label %89

78:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %79, ptr %8, align 8, !tbaa !5
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.stream_frame_st, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  store ptr %82, ptr %6, align 8, !tbaa !5
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.sframe_list_st, ptr %83, i32 0, i32 3
  %85 = load i64, ptr %84, align 8, !tbaa !20
  %86 = add i64 %85, -1
  store i64 %86, ptr %84, align 8, !tbaa !20
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  call void @stream_frame_free(ptr noundef %87, ptr noundef %88)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %66, !llvm.loop !21

89:                                               ; preds = %76
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.sframe_list_st, ptr %91, i32 0, i32 0
  store ptr %90, ptr %92, align 8, !tbaa !18
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %98

95:                                               ; preds = %89
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.stream_frame_st, ptr %96, i32 0, i32 0
  store ptr null, ptr %97, align 8, !tbaa !23
  br label %101

98:                                               ; preds = %89
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.sframe_list_st, ptr %99, i32 0, i32 1
  store ptr null, ptr %100, align 8, !tbaa !14
  br label %101

101:                                              ; preds = %98, %95
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.sframe_list_st, ptr %102, i32 0, i32 5
  store i32 0, ptr %103, align 8, !tbaa !24
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %104

104:                                              ; preds = %101, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %105 = load i32, ptr %3, align 4
  ret i32 %105
}

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 = { inlinehint 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"sframe_list_st", !6, i64 0, !6, i64 8, !13, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 44}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 8}
!15 = !{!16, !10, i64 24}
!16 = !{!"stream_frame_st", !6, i64 0, !6, i64 8, !17, i64 16, !6, i64 32, !6, i64 40}
!17 = !{!"uint_range_st", !10, i64 0, !10, i64 8}
!18 = !{!12, !6, i64 0}
!19 = !{!16, !6, i64 8}
!20 = !{!12, !10, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!16, !6, i64 0}
!24 = !{!12, !13, 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"

@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [58 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_sframe_list_drop_frames(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = icmp ule i64 %4, %1
  %6 = zext i1 %5 to i32
  %7 = tail call i32 @ossl_assert_int(i32 noundef %6, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 223)
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %43, label %8

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = icmp eq ptr %10, null
  br i1 %11, label %17, label %12

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %10, i64 24
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = icmp uge i64 %14, %1
  %16 = zext i1 %15 to i32
  br label %17

17:                                               ; preds = %12, %8
  %18 = phi i32 [ 1, %8 ], [ %16, %12 ]
  %19 = tail call i32 @ossl_assert_int(i32 noundef %18, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 225)
  %.not27 = icmp eq i32 %19, 0
  br i1 %.not27, label %43, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %9, align 8, !tbaa !12
  %.not28 = icmp eq ptr %21, null
  br i1 %.not28, label %22, label %26

22:                                               ; preds = %20
  %23 = load i64, ptr %3, align 8, !tbaa !5
  %24 = icmp eq i64 %23, %1
  %25 = zext i1 %24 to i32
  br label %26

26:                                               ; preds = %22, %20
  %27 = phi i32 [ 1, %20 ], [ %25, %22 ]
  %28 = tail call i32 @ossl_assert_int(i32 noundef %27, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 227)
  %.not29 = icmp eq i32 %28, 0
  br i1 %.not29, label %43, label %29

29:                                               ; preds = %26
  store i64 %1, ptr %3, align 8, !tbaa !5
  %30 = load ptr, ptr %0, align 8, !tbaa !16
  %.not3034 = icmp eq ptr %30, null
  br i1 %.not3034, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %29
  %31 = getelementptr inbounds i8, ptr %0, i64 24
  br label %32

32:                                               ; preds = %.lr.ph, %35
  %.02535 = phi ptr [ %30, %.lr.ph ], [ %37, %35 ]
  %33 = getelementptr inbounds i8, ptr %.02535, i64 24
  %34 = load i64, ptr %33, align 8, !tbaa !13
  %.not31 = icmp ugt i64 %34, %1
  br i1 %.not31, label %40, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %.02535, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = load i64, ptr %31, align 8, !tbaa !18
  %39 = add i64 %38, -1
  store i64 %39, ptr %31, align 8, !tbaa !18
  tail call void @stream_frame_free(ptr noundef nonnull %0, ptr noundef nonnull %.02535)
  %.not30 = icmp eq ptr %37, null
  br i1 %.not30, label %._crit_edge, label %32, !llvm.loop !19

40:                                               ; preds = %32
  store ptr %.02535, ptr %0, align 8, !tbaa !16
  store ptr null, ptr %.02535, align 8, !tbaa !21
  br label %41

._crit_edge:                                      ; preds = %35, %29
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  br label %41

41:                                               ; preds = %._crit_edge, %40
  %42 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 0, ptr %42, align 8, !tbaa !22
  br label %43

43:                                               ; preds = %2, %17, %26, %41
  %.0 = phi i32 [ 1, %41 ], [ 0, %26 ], [ 0, %17 ], [ 0, %2 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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" }
attributes #1 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 32}
!6 = !{!"sframe_list_st", !7, i64 0, !7, i64 8, !10, i64 16, !11, i64 24, !11, i64 32, !10, i64 40, !10, i64 44}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 8}
!13 = !{!14, !11, i64 24}
!14 = !{!"stream_frame_st", !7, i64 0, !7, i64 8, !15, i64 16, !7, i64 32, !7, i64 40}
!15 = !{!"uint_range_st", !11, i64 0, !11, i64 8}
!16 = !{!6, !7, i64 0}
!17 = !{!14, !7, i64 8}
!18 = !{!6, !11, i64 24}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!14, !7, i64 0}
!22 = !{!6, !10, i64 40}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass