; 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.3 = external hidden unnamed_addr constant [40 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: 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) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_sframe_list_peek(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %16, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %26

19:                                               ; preds = %5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.sframe_list_st, ptr %20, i32 0, i32 4
  %22 = load i64, ptr %21, align 8, !tbaa !9
  store i64 %22, ptr %13, align 8, !tbaa !13
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.sframe_list_st, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  store ptr %25, ptr %12, align 8, !tbaa !5
  br label %34

26:                                               ; preds = %5
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.stream_frame_st, ptr %27, i32 0, i32 2
  %29 = getelementptr inbounds %struct.uint_range_st, ptr %28, i32 0, i32 1
  %30 = load i64, ptr %29, align 8, !tbaa !15
  store i64 %30, ptr %13, align 8, !tbaa !13
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.stream_frame_st, ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  store ptr %33, ptr %12, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %26, %19
  %35 = load i64, ptr %13, align 8, !tbaa !13
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.uint_range_st, ptr %36, i32 0, i32 0
  store i64 %35, ptr %37, align 8, !tbaa !19
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %59, label %40

40:                                               ; preds = %34
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.stream_frame_st, ptr %41, i32 0, i32 2
  %43 = getelementptr inbounds %struct.uint_range_st, ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !20
  %45 = load i64, ptr %13, align 8, !tbaa !13
  %46 = icmp ugt i64 %44, %45
  br i1 %46, label %59, label %47

47:                                               ; preds = %40
  %48 = load i64, ptr %13, align 8, !tbaa !13
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.stream_frame_st, ptr %49, i32 0, i32 2
  %51 = getelementptr inbounds %struct.uint_range_st, ptr %50, i32 0, i32 1
  %52 = load i64, ptr %51, align 8, !tbaa !15
  %53 = icmp ult i64 %48, %52
  %54 = zext i1 %53 to i32
  %55 = icmp ne i32 %54, 0
  %56 = zext i1 %55 to i32
  %57 = call i32 @ossl_assert_int(i32 noundef %56, ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 199)
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %75, label %59

59:                                               ; preds = %47, %40, %34
  %60 = load i64, ptr %13, align 8, !tbaa !13
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.uint_range_st, ptr %61, i32 0, i32 1
  store i64 %60, ptr %62, align 8, !tbaa !21
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %63, align 8, !tbaa !5
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %64, align 8, !tbaa !5
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %71

67:                                               ; preds = %59
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.sframe_list_st, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 8, !tbaa !22
  br label %72

71:                                               ; preds = %59
  br label %72

72:                                               ; preds = %71, %67
  %73 = phi i32 [ %70, %67 ], [ 0, %71 ]
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %73, ptr %74, align 4, !tbaa !23
  store i32 0, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %115

75:                                               ; preds = %47
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.stream_frame_st, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.uint_range_st, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !15
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.uint_range_st, ptr %80, i32 0, i32 1
  store i64 %79, ptr %81, align 8, !tbaa !21
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.stream_frame_st, ptr %82, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !24
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %98

86:                                               ; preds = %75
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.stream_frame_st, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %88, align 8, !tbaa !24
  %90 = load i64, ptr %13, align 8, !tbaa !13
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.stream_frame_st, ptr %91, i32 0, i32 2
  %93 = getelementptr inbounds %struct.uint_range_st, ptr %92, i32 0, i32 0
  %94 = load i64, ptr %93, align 8, !tbaa !20
  %95 = sub i64 %90, %94
  %96 = getelementptr inbounds i8, ptr %89, i64 %95
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %96, ptr %97, align 8, !tbaa !5
  br label %100

98:                                               ; preds = %75
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %99, align 8, !tbaa !5
  br label %100

100:                                              ; preds = %98, %86
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.stream_frame_st, ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !18
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %109

105:                                              ; preds = %100
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.sframe_list_st, ptr %106, i32 0, i32 2
  %108 = load i32, ptr %107, align 8, !tbaa !22
  br label %110

109:                                              ; preds = %100
  br label %110

110:                                              ; preds = %109, %105
  %111 = phi i32 [ %108, %105 ], [ 0, %109 ]
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %111, ptr %112, align 4, !tbaa !23
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %113, ptr %114, align 8, !tbaa !5
  store i32 1, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %115

115:                                              ; preds = %110, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %116 = load i32, ptr %6, align 4
  ret i32 %116
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !12, i64 32}
!10 = !{!"sframe_list_st", !6, i64 0, !6, i64 8, !11, i64 16, !12, i64 24, !12, i64 32, !11, i64 40, !11, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !6, i64 0}
!15 = !{!16, !12, 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", !12, i64 0, !12, i64 8}
!18 = !{!16, !6, i64 8}
!19 = !{!17, !12, i64 0}
!20 = !{!16, !12, i64 16}
!21 = !{!17, !12, i64 8}
!22 = !{!10, !11, i64 16}
!23 = !{!11, !11, i64 0}
!24 = !{!16, !6, 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.3 = external hidden unnamed_addr constant [40 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_sframe_list_peek(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #1 {
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  %9 = getelementptr inbounds i8, ptr %6, i64 24
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  %.033.in = select i1 %7, ptr %0, ptr %10
  %.0.in = select i1 %7, ptr %8, ptr %9
  %.0 = load i64, ptr %.0.in, align 8, !tbaa !9
  %.033 = load ptr, ptr %.033.in, align 8, !tbaa !5
  store i64 %.0, ptr %2, align 8, !tbaa !11
  %11 = icmp eq ptr %.033, null
  br i1 %11, label %24, label %12

12:                                               ; preds = %5
  %13 = getelementptr inbounds i8, ptr %.033, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = icmp ugt i64 %14, %.0
  br i1 %15, label %22, label %16

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %.033, i64 24
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = icmp ult i64 %.0, %18
  %20 = zext i1 %19 to i32
  %21 = tail call i32 @ossl_assert_int(i32 noundef %20, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 199)
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %22, label %30

22:                                               ; preds = %16, %12
  %23 = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %.0, ptr %23, align 8, !tbaa !16
  store ptr null, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %1, align 8, !tbaa !5
  br label %28

24:                                               ; preds = %5
  %25 = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %.0, ptr %25, align 8, !tbaa !16
  store ptr null, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %1, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load i32, ptr %26, align 8, !tbaa !17
  br label %28

28:                                               ; preds = %22, %24
  %29 = phi i32 [ %27, %24 ], [ 0, %22 ]
  store i32 %29, ptr %4, align 4, !tbaa !20
  br label %48

30:                                               ; preds = %16
  %31 = load i64, ptr %17, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %31, ptr %32, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %.033, i64 40
  %34 = load ptr, ptr %33, align 8, !tbaa !21
  %.not37 = icmp eq ptr %34, null
  br i1 %.not37, label %39, label %35

35:                                               ; preds = %30
  %36 = load i64, ptr %13, align 8, !tbaa !13
  %37 = sub i64 %.0, %36
  %38 = getelementptr inbounds i8, ptr %34, i64 %37
  br label %39

39:                                               ; preds = %30, %35
  %storemerge = phi ptr [ %38, %35 ], [ null, %30 ]
  store ptr %storemerge, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %.033, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !22
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %46

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %0, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !17
  br label %46

46:                                               ; preds = %39, %43
  %47 = phi i32 [ %45, %43 ], [ 0, %39 ]
  store i32 %47, ptr %4, align 4, !tbaa !20
  store ptr %.033, ptr %1, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %46, %28
  %.034 = phi i32 [ 0, %28 ], [ 1, %46 ]
  ret i32 %.034
}

attributes #0 = { 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 #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" }

!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 0}
!12 = !{!"uint_range_st", !10, i64 0, !10, i64 8}
!13 = !{!14, !10, i64 16}
!14 = !{!"stream_frame_st", !6, i64 0, !6, i64 8, !12, i64 16, !6, i64 32, !6, i64 40}
!15 = !{!14, !10, i64 24}
!16 = !{!12, !10, i64 8}
!17 = !{!18, !19, i64 16}
!18 = !{!"sframe_list_st", !6, i64 0, !6, i64 8, !19, i64 16, !10, i64 24, !10, i64 32, !19, i64 40, !19, i64 44}
!19 = !{!"int", !7, i64 0}
!20 = !{!19, !19, i64 0}
!21 = !{!14, !6, i64 40}
!22 = !{!14, !6, i64 8}


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