; LLVM IR from aws/s2n-tls :: tls (s2n_recv)

; 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.s2n_result = type { i32 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_connection = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, [22 x i8], [22 x i8], [22 x i8], i32, i32, %struct.s2n_timer, i64, i64, [32 x i8], i8, i8, i8, i8, i8, i8, i8, ptr, ptr, %struct.s2n_secrets, ptr, ptr, %struct.s2n_kex_parameters, %struct.s2n_handshake_parameters, %struct.s2n_psk_parameters, ptr, i8, i32, [5 x i8], %struct.s2n_stuffer, %struct.s2n_stuffer, %struct.s2n_stuffer, %struct.s2n_stuffer, i32, i64, [2 x i8], %struct.s2n_stuffer, i8, i8, i8, i8, %struct.s2n_atomic_flag, %struct.s2n_atomic_flag, %struct.s2n_handshake, i16, i32, i16, i64, i8, i64, i64, i64, %struct.s2n_atomic_flag, %struct.s2n_atomic_flag, [256 x i8], [256 x i8], i32, %struct.s2n_blob, i32, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_client_hello, %struct.s2n_x509_validator, ptr, ptr, i8, i32, %struct.s2n_blob, i32, %struct.s2n_ticket_fields, [138 x i8], %struct.s2n_stuffer, %struct.s2n_blob, %struct.s2n_blob, i8, i8, i8, i16, i16, i32, i32, %struct.s2n_blob, i32, %struct.s2n_post_handshake, %struct.s2n_atomic_flag, i8, i8 }
%struct.s2n_timer = type { i64 }
%struct.s2n_secrets = type { %union.anon, i32 }
%union.anon = type { %struct.s2n_tls13_secrets }
%struct.s2n_tls13_secrets = type { [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], [48 x i8], i32 }
%struct.s2n_kex_parameters = type { %struct.s2n_dh_params, %struct.s2n_ecc_evp_params, [4 x ptr], %struct.s2n_ecc_evp_params, %struct.s2n_kem_group_params, %struct.s2n_kem_group_params, [8 x ptr], %struct.s2n_kem_params, %struct.s2n_blob, %struct.s2n_blob }
%struct.s2n_dh_params = type { ptr }
%struct.s2n_ecc_evp_params = type { ptr, ptr }
%struct.s2n_kem_group_params = type { ptr, %struct.s2n_kem_params, %struct.s2n_ecc_evp_params }
%struct.s2n_kem_params = type { ptr, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, i8 }
%struct.s2n_handshake_parameters = type { %struct.s2n_pkey, %struct.s2n_pkey, %struct.s2n_blob, i32, %struct.s2n_sig_scheme_list, ptr, ptr, ptr, [4 x ptr], [4 x ptr], i8, i8, [32 x i8], [32 x i8] }
%struct.s2n_pkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.s2n_sig_scheme_list = type { [128 x i16], i8 }
%struct.s2n_psk_parameters = type { i32, %struct.s2n_array, i16, i16, ptr, i32 }
%struct.s2n_array = type { %struct.s2n_blob, i32, i32 }
%struct.s2n_handshake = type { %struct.s2n_stuffer, ptr, [8 x i8], [48 x i8], [48 x i8], i8, i32, i32, i32, i32, %struct.s2n_offered_early_data, i8, i32 }
%struct.s2n_offered_early_data = type { ptr }
%struct.s2n_client_hello = type { %struct.s2n_blob, %struct.s2n_parsed_extensions_list, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, i8, i8, i8 }
%struct.s2n_parsed_extensions_list = type { [21 x %struct.s2n_parsed_extension], %struct.s2n_blob, i16 }
%struct.s2n_parsed_extension = type { %struct.s2n_blob, i16, i16, i8 }
%struct.s2n_x509_validator = type { ptr, ptr, i8, i8, i16, ptr, i32, ptr, %struct.s2n_cert_validation_info, i8 }
%struct.s2n_cert_validation_info = type { i8, [3 x i8] }
%struct.s2n_ticket_fields = type { %struct.s2n_blob, i32 }
%struct.s2n_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }

; 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 i32 @s2n_read_in_bytes(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca %struct.s2n_result, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.s2n_result, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %94, %3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.s2n_stuffer, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.s2n_stuffer, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = sub i32 %15, %18
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = icmp ult i32 %19, %20
  br i1 %21, label %22, label %95

22:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.s2n_stuffer, ptr %24, i32 0, i32 2
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s2n_stuffer, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 8, !tbaa !14
  %30 = sub i32 %26, %29
  %31 = sub i32 %23, %30
  store i32 %31, ptr %8, align 4, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 8
  %34 = lshr i32 %33, 22
  %35 = and i32 %34, 1
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %61

37:                                               ; preds = %22
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.s2n_stuffer, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.s2n_blob, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !15
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.s2n_stuffer, ptr %43, i32 0, i32 2
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = sub i32 %42, %45
  %47 = icmp ugt i32 %38, %46
  br i1 %47, label %48, label %50

48:                                               ; preds = %37
  %49 = load i32, ptr %8, align 4, !tbaa !9
  br label %59

50:                                               ; preds = %37
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.s2n_stuffer, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.s2n_blob, ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !15
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.s2n_stuffer, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 4, !tbaa !11
  %58 = sub i32 %54, %57
  br label %59

59:                                               ; preds = %50, %48
  %60 = phi i32 [ %49, %48 ], [ %58, %50 ]
  store i32 %60, ptr %8, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %59, %22
  %62 = call ptr @__errno_location() #6
  store i32 0, ptr %62, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = call i32 @s2n_connection_recv_stuffer(ptr noundef %63, ptr noundef %64, i32 noundef %65)
  store i32 %66, ptr %9, align 4, !tbaa !9
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %72

69:                                               ; preds = %61
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.s2n_connection, ptr %70, i32 0, i32 61
  call void @s2n_atomic_flag_set(ptr noundef %71)
  br label %72

72:                                               ; preds = %69, %61
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = sext i32 %74 to i64
  %76 = call i32 @s2n_io_check_read_result(i64 noundef %75)
  %77 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  store i32 %76, ptr %77, align 4
  %78 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  %79 = load i32, ptr %78, align 4
  %80 = call zeroext i1 @s2n_result_is_ok(i32 %79)
  br i1 %80, label %83, label %81

81:                                               ; preds = %73
  %82 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 -1, ptr %82, align 4, !tbaa !16
  store i32 1, ptr %11, align 4
  br label %92

83:                                               ; preds = %73
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.s2n_connection, ptr %88, i32 0, i32 58
  %90 = load i64, ptr %89, align 8, !tbaa !18
  %91 = add i64 %90, %87
  store i64 %91, ptr %89, align 8, !tbaa !18
  store i32 0, ptr %11, align 4
  br label %92

92:                                               ; preds = %85, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %93 = load i32, ptr %11, align 4
  switch i32 %93, label %100 [
    i32 0, label %94
    i32 1, label %97
  ]

94:                                               ; preds = %92
  br label %12, !llvm.loop !43

95:                                               ; preds = %12
  %96 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  store i32 0, ptr %96, align 4, !tbaa !16
  br label %97

97:                                               ; preds = %95, %92
  %98 = getelementptr inbounds %struct.s2n_result, ptr %4, i32 0, i32 0
  %99 = load i32, ptr %98, align 4
  ret i32 %99

100:                                              ; preds = %92
  unreachable
}

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #2

declare i32 @s2n_connection_recv_stuffer(ptr noundef, ptr noundef, i32 noundef) #3

declare void @s2n_atomic_flag_set(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #4

declare i32 @s2n_io_check_read_result(i64 noundef) #3

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 willreturn memory(none) "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 = { 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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, !10, i64 28}
!12 = !{!"s2n_stuffer", !13, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 36, !10, i64 36}
!13 = !{!"s2n_blob", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!14 = !{!12, !10, i64 24}
!15 = !{!12, !10, i64 8}
!16 = !{!17, !10, i64 0}
!17 = !{!"", !10, i64 0}
!18 = !{!19, !21, i64 2240}
!19 = !{!"s2n_connection", !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 0, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 1, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !10, i64 2, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !7, i64 102, !7, i64 124, !10, i64 148, !10, i64 152, !20, i64 160, !21, i64 168, !21, i64 176, !7, i64 184, !7, i64 216, !7, i64 217, !7, i64 218, !7, i64 219, !7, i64 220, !7, i64 221, !7, i64 222, !6, i64 224, !6, i64 232, !22, i64 240, !6, i64 632, !6, i64 640, !23, i64 648, !29, i64 1144, !32, i64 1688, !6, i64 1752, !7, i64 1760, !10, i64 1764, !7, i64 1768, !12, i64 1776, !12, i64 1816, !12, i64 1856, !12, i64 1896, !10, i64 1936, !21, i64 1944, !7, i64 1952, !12, i64 1960, !7, i64 2000, !7, i64 2001, !7, i64 2002, !28, i64 2003, !17, i64 2004, !17, i64 2008, !35, i64 2016, !34, i64 2208, !10, i64 2212, !34, i64 2216, !21, i64 2224, !7, i64 2232, !21, i64 2240, !21, i64 2248, !21, i64 2256, !17, i64 2264, !17, i64 2268, !7, i64 2272, !7, i64 2528, !10, i64 2784, !13, i64 2792, !10, i64 2816, !13, i64 2824, !13, i64 2848, !13, i64 2872, !37, i64 2896, !39, i64 3704, !6, i64 3760, !6, i64 3768, !7, i64 3776, !10, i64 3780, !13, i64 3784, !10, i64 3808, !41, i64 3816, !7, i64 3848, !12, i64 3992, !13, i64 4032, !13, i64 4056, !28, i64 4080, !28, i64 4081, !28, i64 4082, !34, i64 4084, !34, i64 4086, !10, i64 4088, !10, i64 4092, !13, i64 4096, !10, i64 4120, !42, i64 4128, !17, i64 4176, !7, i64 4180, !7, i64 4181}
!20 = !{!"s2n_timer", !21, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"s2n_secrets", !7, i64 0, !10, i64 388}
!23 = !{!"s2n_kex_parameters", !24, i64 0, !25, i64 8, !7, i64 24, !25, i64 56, !26, i64 72, !26, i64 184, !7, i64 296, !27, i64 360, !13, i64 448, !13, i64 472}
!24 = !{!"s2n_dh_params", !6, i64 0}
!25 = !{!"s2n_ecc_evp_params", !6, i64 0, !6, i64 8}
!26 = !{!"s2n_kem_group_params", !6, i64 0, !27, i64 8, !25, i64 96}
!27 = !{!"s2n_kem_params", !6, i64 0, !13, i64 8, !13, i64 32, !13, i64 56, !28, i64 80}
!28 = !{!"_Bool", !7, i64 0}
!29 = !{!"s2n_handshake_parameters", !30, i64 0, !30, i64 48, !13, i64 96, !10, i64 120, !31, i64 124, !6, i64 384, !6, i64 392, !6, i64 400, !7, i64 408, !7, i64 440, !7, i64 472, !7, i64 473, !7, i64 474, !7, i64 506}
!30 = !{!"s2n_pkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!31 = !{!"s2n_sig_scheme_list", !7, i64 0, !7, i64 256}
!32 = !{!"s2n_psk_parameters", !10, i64 0, !33, i64 8, !34, i64 40, !34, i64 42, !6, i64 48, !10, i64 56}
!33 = !{!"s2n_array", !13, i64 0, !10, i64 24, !10, i64 28}
!34 = !{!"short", !7, i64 0}
!35 = !{!"s2n_handshake", !12, i64 0, !6, i64 40, !7, i64 48, !7, i64 56, !7, i64 104, !7, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !36, i64 176, !10, i64 184, !10, i64 184, !10, i64 184, !10, i64 184, !10, i64 188}
!36 = !{!"s2n_offered_early_data", !6, i64 0}
!37 = !{!"s2n_client_hello", !13, i64 0, !38, i64 24, !13, i64 728, !13, i64 752, !13, i64 776, !7, i64 800, !7, i64 801, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802, !10, i64 802}
!38 = !{!"", !7, i64 0, !13, i64 672, !34, i64 696}
!39 = !{!"s2n_x509_validator", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 17, !34, i64 18, !6, i64 24, !10, i64 32, !6, i64 40, !40, i64 48, !28, i64 52}
!40 = !{!"s2n_cert_validation_info", !10, i64 0, !10, i64 0}
!41 = !{!"s2n_ticket_fields", !13, i64 0, !10, i64 24}
!42 = !{!"s2n_post_handshake", !12, i64 0, !7, i64 40}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}


; 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 noundef i32 @s2n_read_in_bytes(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 28
  %5 = getelementptr inbounds i8, ptr %1, i64 24
  %6 = load i32, ptr %4, align 4, !tbaa !5
  %7 = load i32, ptr %5, align 8, !tbaa !12
  %8 = sub i32 %6, %7
  %9 = icmp ult i32 %8, %2
  br i1 %9, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %3
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = tail call ptr @__errno_location() #5
  %12 = getelementptr inbounds i8, ptr %0, i64 2264
  %13 = getelementptr inbounds i8, ptr %0, i64 2240
  br label %14

14:                                               ; preds = %.lr.ph, %31
  %15 = phi i32 [ %8, %.lr.ph ], [ %36, %31 ]
  %16 = phi i32 [ %6, %.lr.ph ], [ %34, %31 ]
  %17 = sub i32 %2, %15
  %18 = load i32, ptr %0, align 8
  %19 = and i32 %18, 4194304
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %23, label %20

20:                                               ; preds = %14
  %21 = load i32, ptr %10, align 8, !tbaa !13
  %22 = sub i32 %21, %16
  %. = tail call i32 @llvm.umax.i32(i32 %17, i32 %22)
  br label %23

23:                                               ; preds = %20, %14
  %.022 = phi i32 [ %., %20 ], [ %17, %14 ]
  store i32 0, ptr %11, align 4, !tbaa !14
  %24 = tail call i32 @s2n_connection_recv_stuffer(ptr noundef nonnull %1, ptr noundef nonnull %0, i32 noundef %.022) #6
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  tail call void @s2n_atomic_flag_set(ptr noundef nonnull %12) #6
  br label %27

27:                                               ; preds = %23, %26
  %28 = sext i32 %24 to i64
  %29 = tail call i32 @s2n_io_check_read_result(i64 noundef %28) #6
  %30 = tail call zeroext i1 @s2n_result_is_ok(i32 %29)
  br i1 %30, label %31, label %.thread

31:                                               ; preds = %27
  %32 = load i64, ptr %13, align 8, !tbaa !15
  %33 = add i64 %32, %28
  store i64 %33, ptr %13, align 8, !tbaa !15
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr %5, align 8, !tbaa !12
  %36 = sub i32 %34, %35
  %37 = icmp ult i32 %36, %2
  br i1 %37, label %14, label %.thread

.thread:                                          ; preds = %31, %27, %3
  %.sroa.021.2 = phi i32 [ 0, %3 ], [ -1, %27 ], [ 0, %31 ]
  ret i32 %.sroa.021.2
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #1

declare i32 @s2n_connection_recv_stuffer(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @s2n_atomic_flag_set(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #3

declare i32 @s2n_io_check_read_result(i64 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #4

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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { "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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind willreturn memory(none) }
attributes #6 = { 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, !11, i64 28}
!6 = !{!"s2n_stuffer", !7, i64 0, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 36, !11, i64 36}
!7 = !{!"s2n_blob", !8, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!6, !11, i64 24}
!13 = !{!6, !11, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !18, i64 2240}
!16 = !{!"s2n_connection", !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 0, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 1, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !11, i64 2, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !9, i64 80, !9, i64 102, !9, i64 124, !11, i64 148, !11, i64 152, !17, i64 160, !18, i64 168, !18, i64 176, !9, i64 184, !9, i64 216, !9, i64 217, !9, i64 218, !9, i64 219, !9, i64 220, !9, i64 221, !9, i64 222, !8, i64 224, !8, i64 232, !19, i64 240, !8, i64 632, !8, i64 640, !20, i64 648, !26, i64 1144, !29, i64 1688, !8, i64 1752, !9, i64 1760, !11, i64 1764, !9, i64 1768, !6, i64 1776, !6, i64 1816, !6, i64 1856, !6, i64 1896, !11, i64 1936, !18, i64 1944, !9, i64 1952, !6, i64 1960, !9, i64 2000, !9, i64 2001, !9, i64 2002, !25, i64 2003, !32, i64 2004, !32, i64 2008, !33, i64 2016, !31, i64 2208, !11, i64 2212, !31, i64 2216, !18, i64 2224, !9, i64 2232, !18, i64 2240, !18, i64 2248, !18, i64 2256, !32, i64 2264, !32, i64 2268, !9, i64 2272, !9, i64 2528, !11, i64 2784, !7, i64 2792, !11, i64 2816, !7, i64 2824, !7, i64 2848, !7, i64 2872, !35, i64 2896, !37, i64 3704, !8, i64 3760, !8, i64 3768, !9, i64 3776, !11, i64 3780, !7, i64 3784, !11, i64 3808, !39, i64 3816, !9, i64 3848, !6, i64 3992, !7, i64 4032, !7, i64 4056, !25, i64 4080, !25, i64 4081, !25, i64 4082, !31, i64 4084, !31, i64 4086, !11, i64 4088, !11, i64 4092, !7, i64 4096, !11, i64 4120, !40, i64 4128, !32, i64 4176, !9, i64 4180, !9, i64 4181}
!17 = !{!"s2n_timer", !18, i64 0}
!18 = !{!"long", !9, i64 0}
!19 = !{!"s2n_secrets", !9, i64 0, !11, i64 388}
!20 = !{!"s2n_kex_parameters", !21, i64 0, !22, i64 8, !9, i64 24, !22, i64 56, !23, i64 72, !23, i64 184, !9, i64 296, !24, i64 360, !7, i64 448, !7, i64 472}
!21 = !{!"s2n_dh_params", !8, i64 0}
!22 = !{!"s2n_ecc_evp_params", !8, i64 0, !8, i64 8}
!23 = !{!"s2n_kem_group_params", !8, i64 0, !24, i64 8, !22, i64 96}
!24 = !{!"s2n_kem_params", !8, i64 0, !7, i64 8, !7, i64 32, !7, i64 56, !25, i64 80}
!25 = !{!"_Bool", !9, i64 0}
!26 = !{!"s2n_handshake_parameters", !27, i64 0, !27, i64 48, !7, i64 96, !11, i64 120, !28, i64 124, !8, i64 384, !8, i64 392, !8, i64 400, !9, i64 408, !9, i64 440, !9, i64 472, !9, i64 473, !9, i64 474, !9, i64 506}
!27 = !{!"s2n_pkey", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40}
!28 = !{!"s2n_sig_scheme_list", !9, i64 0, !9, i64 256}
!29 = !{!"s2n_psk_parameters", !11, i64 0, !30, i64 8, !31, i64 40, !31, i64 42, !8, i64 48, !11, i64 56}
!30 = !{!"s2n_array", !7, i64 0, !11, i64 24, !11, i64 28}
!31 = !{!"short", !9, i64 0}
!32 = !{!"", !11, i64 0}
!33 = !{!"s2n_handshake", !6, i64 0, !8, i64 40, !9, i64 48, !9, i64 56, !9, i64 104, !9, i64 152, !11, i64 156, !11, i64 160, !11, i64 164, !11, i64 168, !34, i64 176, !11, i64 184, !11, i64 184, !11, i64 184, !11, i64 184, !11, i64 188}
!34 = !{!"s2n_offered_early_data", !8, i64 0}
!35 = !{!"s2n_client_hello", !7, i64 0, !36, i64 24, !7, i64 728, !7, i64 752, !7, i64 776, !9, i64 800, !9, i64 801, !11, i64 802, !11, i64 802, !11, i64 802, !11, i64 802, !11, i64 802, !11, i64 802, !11, i64 802}
!36 = !{!"", !9, i64 0, !7, i64 672, !31, i64 696}
!37 = !{!"s2n_x509_validator", !8, i64 0, !8, i64 8, !9, i64 16, !9, i64 17, !31, i64 18, !8, i64 24, !11, i64 32, !8, i64 40, !38, i64 48, !25, i64 52}
!38 = !{!"s2n_cert_validation_info", !11, i64 0, !11, i64 0}
!39 = !{!"s2n_ticket_fields", !7, i64 0, !11, i64 24}
!40 = !{!"s2n_post_handshake", !6, i64 0, !9, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass