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

; 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_debug_info = type { ptr, ptr }
%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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [92 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strrchr(ptr noundef, i32 noundef) #2

declare i32 @s2n_calculate_stacktrace() #3

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

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

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

declare i32 @s2n_stuffer_reread(ptr noundef) #3

; 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_record_header_parse(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca [2 x i8], align 1
  %11 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.s2n_connection, ptr %12, i32 0, i32 38
  store ptr %13, ptr %8, align 8, !tbaa !5
  br label %14

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

23:                                               ; preds = %14
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  %26 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %27 = getelementptr inbounds %struct.s2n_debug_info, ptr %26, i32 0, i32 0
  store ptr @.str.3, ptr %27, align 8, !tbaa !14
  %28 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %29 = getelementptr inbounds %struct.s2n_debug_info, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds i8, ptr %30, i64 21
  %32 = call ptr @strrchr(ptr noundef %31, i32 noundef 47) #6
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %41

34:                                               ; preds = %25
  %35 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %36 = getelementptr inbounds %struct.s2n_debug_info, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !14
  %38 = getelementptr inbounds i8, ptr %37, i64 21
  %39 = call ptr @strrchr(ptr noundef %38, i32 noundef 47) #6
  %40 = getelementptr inbounds i8, ptr %39, i64 1
  br label %46

41:                                               ; preds = %25
  %42 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %43 = getelementptr inbounds %struct.s2n_debug_info, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %44, i64 21
  br label %46

46:                                               ; preds = %41, %34
  %47 = phi ptr [ %40, %34 ], [ %45, %41 ]
  %48 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %49 = getelementptr inbounds %struct.s2n_debug_info, ptr %48, i32 0, i32 1
  store ptr %47, ptr %49, align 8, !tbaa !16
  %50 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %50, align 4, !tbaa !17
  %51 = call i32 @s2n_calculate_stacktrace()
  br label %52

52:                                               ; preds = %46
  br label %53

53:                                               ; preds = %52
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %183

54:                                               ; No predecessors!
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55, %14
  br label %57

57:                                               ; preds = %56
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call i32 @s2n_stuffer_read_uint8(ptr noundef %60, ptr noundef %61)
  %63 = icmp sgt i32 %62, -1
  br i1 %63, label %65, label %64

64:                                               ; preds = %59
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %183

65:                                               ; preds = %59
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #5
  br label %68

68:                                               ; preds = %67
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds [2 x i8], ptr %10, i64 0, i64 0
  %71 = call i32 @s2n_stuffer_read_bytes(ptr noundef %69, ptr noundef %70, i32 noundef 2)
  %72 = icmp sgt i32 %71, -1
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %182

74:                                               ; preds = %68
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  %77 = getelementptr inbounds [2 x i8], ptr %10, i64 0, i64 0
  %78 = load i8, ptr %77, align 1, !tbaa !18
  %79 = zext i8 %78 to i32
  %80 = mul nsw i32 %79, 10
  %81 = getelementptr inbounds [2 x i8], ptr %10, i64 0, i64 1
  %82 = load i8, ptr %81, align 1, !tbaa !18
  %83 = zext i8 %82 to i32
  %84 = add nsw i32 %80, %83
  %85 = trunc i32 %84 to i8
  store i8 %85, ptr %11, align 1, !tbaa !18
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.s2n_connection, ptr %86, i32 0, i32 71
  %88 = getelementptr inbounds %struct.s2n_client_hello, ptr %87, i32 0, i32 7
  %89 = load i8, ptr %88, align 2
  %90 = and i8 %89, 1
  %91 = zext i8 %90 to i32
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %104, label %93

93:                                               ; preds = %76
  %94 = load i8, ptr %11, align 1, !tbaa !18
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.s2n_connection, ptr %95, i32 0, i32 71
  %97 = getelementptr inbounds %struct.s2n_client_hello, ptr %96, i32 0, i32 6
  store i8 %94, ptr %97, align 1, !tbaa !19
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.s2n_connection, ptr %98, i32 0, i32 71
  %100 = getelementptr inbounds %struct.s2n_client_hello, ptr %99, i32 0, i32 7
  %101 = load i8, ptr %100, align 2
  %102 = and i8 %101, -2
  %103 = or i8 %102, 1
  store i8 %103, ptr %100, align 2
  br label %104

104:                                              ; preds = %93, %76
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.s2n_connection, ptr %106, i32 0, i32 25
  %108 = load i8, ptr %107, align 2, !tbaa !45
  %109 = zext i8 %108 to i32
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %161

111:                                              ; preds = %105
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.s2n_connection, ptr %112, i32 0, i32 23
  %114 = load i8, ptr %113, align 4, !tbaa !46
  %115 = zext i8 %114 to i32
  %116 = icmp slt i32 %115, 33
  br i1 %116, label %117, label %122

117:                                              ; preds = %111
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.s2n_connection, ptr %118, i32 0, i32 23
  %120 = load i8, ptr %119, align 4, !tbaa !46
  %121 = zext i8 %120 to i32
  br label %123

122:                                              ; preds = %111
  br label %123

123:                                              ; preds = %122, %117
  %124 = phi i32 [ %121, %117 ], [ 33, %122 ]
  %125 = load i8, ptr %11, align 1, !tbaa !18
  %126 = zext i8 %125 to i32
  %127 = icmp ne i32 %124, %126
  br i1 %127, label %128, label %161

128:                                              ; preds = %123
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  %131 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %132 = getelementptr inbounds %struct.s2n_debug_info, ptr %131, i32 0, i32 0
  store ptr @.str.4, ptr %132, align 8, !tbaa !14
  %133 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %134 = getelementptr inbounds %struct.s2n_debug_info, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !14
  %136 = getelementptr inbounds i8, ptr %135, i64 21
  %137 = call ptr @strrchr(ptr noundef %136, i32 noundef 47) #6
  %138 = icmp ne ptr %137, null
  br i1 %138, label %139, label %146

139:                                              ; preds = %130
  %140 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %141 = getelementptr inbounds %struct.s2n_debug_info, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !14
  %143 = getelementptr inbounds i8, ptr %142, i64 21
  %144 = call ptr @strrchr(ptr noundef %143, i32 noundef 47) #6
  %145 = getelementptr inbounds i8, ptr %144, i64 1
  br label %151

146:                                              ; preds = %130
  %147 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %148 = getelementptr inbounds %struct.s2n_debug_info, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !14
  %150 = getelementptr inbounds i8, ptr %149, i64 21
  br label %151

151:                                              ; preds = %146, %139
  %152 = phi ptr [ %145, %139 ], [ %150, %146 ]
  %153 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %154 = getelementptr inbounds %struct.s2n_debug_info, ptr %153, i32 0, i32 1
  store ptr %152, ptr %154, align 8, !tbaa !16
  %155 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %155, align 4, !tbaa !17
  %156 = call i32 @s2n_calculate_stacktrace()
  br label %157

157:                                              ; preds = %151
  br label %158

158:                                              ; preds = %157
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %181

159:                                              ; No predecessors!
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160, %123, %105
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = call i32 @s2n_stuffer_read_uint16(ptr noundef %165, ptr noundef %166)
  %168 = icmp sgt i32 %167, -1
  br i1 %168, label %170, label %169

169:                                              ; preds = %164
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %181

170:                                              ; preds = %164
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  %175 = call i32 @s2n_stuffer_reread(ptr noundef %174)
  %176 = icmp sgt i32 %175, -1
  br i1 %176, label %178, label %177

177:                                              ; preds = %173
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %181

178:                                              ; preds = %173
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %181

181:                                              ; preds = %180, %177, %169, %158
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  br label %182

182:                                              ; preds = %181, %73
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #5
  br label %183

183:                                              ; preds = %182, %64, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %184 = load i32, ptr %4, align 4
  ret i32 %184
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind willreturn memory(read) "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 = { 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(read) }

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


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

%struct.s2n_debug_info = type { ptr, ptr }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [92 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

declare i32 @s2n_stuffer_read_uint16(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @s2n_stuffer_read_uint8(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @s2n_stuffer_read_bytes(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @s2n_stuffer_reread(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress 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 range(i32 -1, 1) i32 @s2n_record_header_parse(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #4 {
  %4 = alloca [2 x i8], align 1
  %5 = getelementptr inbounds i8, ptr %0, i64 1776
  %6 = getelementptr inbounds i8, ptr %0, i64 1804
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 1800
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = sub i32 %7, %9
  %11 = icmp ult i32 %10, 5
  br i1 %11, label %12, label %20

12:                                               ; preds = %3
  %13 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.3, ptr %13, align 8, !tbaa !13
  %14 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.3, i64 21), i32 noundef 47) #6
  %.not23 = icmp eq ptr %14, null
  %15 = getelementptr inbounds i8, ptr %14, i64 1
  %16 = select i1 %.not23, ptr getelementptr inbounds (i8, ptr @.str.3, i64 21), ptr %15
  %17 = getelementptr inbounds i8, ptr %13, i64 8
  store ptr %16, ptr %17, align 8, !tbaa !15
  %18 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %18, align 4, !tbaa !16
  %19 = tail call i32 @s2n_calculate_stacktrace() #7
  br label %58

20:                                               ; preds = %3
  %21 = tail call i32 @s2n_stuffer_read_uint8(ptr noundef nonnull %5, ptr noundef %1) #7
  %22 = icmp sgt i32 %21, -1
  br i1 %22, label %23, label %58

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #7
  %24 = call i32 @s2n_stuffer_read_bytes(ptr noundef nonnull %5, ptr noundef nonnull %4, i32 noundef 2) #7
  %25 = icmp sgt i32 %24, -1
  br i1 %25, label %26, label %57

26:                                               ; preds = %23
  %27 = load i8, ptr %4, align 1, !tbaa !17
  %28 = mul i8 %27, 10
  %29 = getelementptr inbounds i8, ptr %4, i64 1
  %30 = load i8, ptr %29, align 1, !tbaa !17
  %31 = add i8 %28, %30
  %32 = getelementptr inbounds i8, ptr %0, i64 3698
  %33 = load i8, ptr %32, align 2
  %34 = and i8 %33, 1
  %.not = icmp eq i8 %34, 0
  br i1 %.not, label %35, label %38

35:                                               ; preds = %26
  %36 = getelementptr inbounds i8, ptr %0, i64 3697
  store i8 %31, ptr %36, align 1, !tbaa !18
  %37 = or disjoint i8 %33, 1
  store i8 %37, ptr %32, align 2
  br label %38

38:                                               ; preds = %26, %35
  %39 = getelementptr inbounds i8, ptr %0, i64 222
  %40 = load i8, ptr %39, align 2, !tbaa !44
  %.not20 = icmp eq i8 %40, 0
  br i1 %.not20, label %52, label %41

41:                                               ; preds = %38
  %42 = getelementptr inbounds i8, ptr %0, i64 220
  %43 = load i8, ptr %42, align 4, !tbaa !45
  %narrow = call i8 @llvm.umin.i8(i8 %43, i8 33)
  %.not21 = icmp eq i8 %narrow, %31
  br i1 %.not21, label %52, label %44

44:                                               ; preds = %41
  %45 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.4, ptr %45, align 8, !tbaa !13
  %46 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.4, i64 21), i32 noundef 47) #6
  %.not22 = icmp eq ptr %46, null
  %47 = getelementptr inbounds i8, ptr %46, i64 1
  %48 = select i1 %.not22, ptr getelementptr inbounds (i8, ptr @.str.4, i64 21), ptr %47
  %49 = getelementptr inbounds i8, ptr %45, i64 8
  store ptr %48, ptr %49, align 8, !tbaa !15
  %50 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 335544322, ptr %50, align 4, !tbaa !16
  %51 = call i32 @s2n_calculate_stacktrace() #7
  br label %57

52:                                               ; preds = %38, %41
  %53 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %5, ptr noundef %2) #7
  %54 = icmp sgt i32 %53, -1
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = call i32 @s2n_stuffer_reread(ptr noundef nonnull %5) #7
  %.lobit = ashr i32 %56, 31
  br label %57

57:                                               ; preds = %44, %52, %55, %23
  %.1 = phi i32 [ -1, %23 ], [ -1, %44 ], [ -1, %52 ], [ %.lobit, %55 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #7
  br label %58

58:                                               ; preds = %20, %57, %12
  %.2 = phi i32 [ -1, %12 ], [ %.1, %57 ], [ -1, %20 ]
  ret i32 %.2
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.umin.i8(i8, i8) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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 = !{!14, !8, i64 0}
!14 = !{!"s2n_debug_info", !8, i64 0, !8, i64 8}
!15 = !{!14, !8, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!9, !9, i64 0}
!18 = !{!19, !9, i64 3697}
!19 = !{!"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, !20, i64 160, !21, i64 168, !21, 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, !22, i64 240, !8, i64 632, !8, i64 640, !23, i64 648, !29, i64 1144, !32, 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, !21, i64 1944, !9, i64 1952, !6, i64 1960, !9, i64 2000, !9, i64 2001, !9, i64 2002, !28, i64 2003, !35, i64 2004, !35, i64 2008, !36, i64 2016, !34, i64 2208, !11, i64 2212, !34, i64 2216, !21, i64 2224, !9, i64 2232, !21, i64 2240, !21, i64 2248, !21, i64 2256, !35, i64 2264, !35, 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, !38, i64 2896, !40, i64 3704, !8, i64 3760, !8, i64 3768, !9, i64 3776, !11, i64 3780, !7, i64 3784, !11, i64 3808, !42, i64 3816, !9, i64 3848, !6, i64 3992, !7, i64 4032, !7, i64 4056, !28, i64 4080, !28, i64 4081, !28, i64 4082, !34, i64 4084, !34, i64 4086, !11, i64 4088, !11, i64 4092, !7, i64 4096, !11, i64 4120, !43, i64 4128, !35, i64 4176, !9, i64 4180, !9, i64 4181}
!20 = !{!"s2n_timer", !21, i64 0}
!21 = !{!"long", !9, i64 0}
!22 = !{!"s2n_secrets", !9, i64 0, !11, i64 388}
!23 = !{!"s2n_kex_parameters", !24, i64 0, !25, i64 8, !9, i64 24, !25, i64 56, !26, i64 72, !26, i64 184, !9, i64 296, !27, i64 360, !7, i64 448, !7, i64 472}
!24 = !{!"s2n_dh_params", !8, i64 0}
!25 = !{!"s2n_ecc_evp_params", !8, i64 0, !8, i64 8}
!26 = !{!"s2n_kem_group_params", !8, i64 0, !27, i64 8, !25, i64 96}
!27 = !{!"s2n_kem_params", !8, i64 0, !7, i64 8, !7, i64 32, !7, i64 56, !28, i64 80}
!28 = !{!"_Bool", !9, i64 0}
!29 = !{!"s2n_handshake_parameters", !30, i64 0, !30, i64 48, !7, i64 96, !11, i64 120, !31, 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}
!30 = !{!"s2n_pkey", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40}
!31 = !{!"s2n_sig_scheme_list", !9, i64 0, !9, i64 256}
!32 = !{!"s2n_psk_parameters", !11, i64 0, !33, i64 8, !34, i64 40, !34, i64 42, !8, i64 48, !11, i64 56}
!33 = !{!"s2n_array", !7, i64 0, !11, i64 24, !11, i64 28}
!34 = !{!"short", !9, i64 0}
!35 = !{!"", !11, i64 0}
!36 = !{!"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, !37, i64 176, !11, i64 184, !11, i64 184, !11, i64 184, !11, i64 184, !11, i64 188}
!37 = !{!"s2n_offered_early_data", !8, i64 0}
!38 = !{!"s2n_client_hello", !7, i64 0, !39, 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}
!39 = !{!"", !9, i64 0, !7, i64 672, !34, i64 696}
!40 = !{!"s2n_x509_validator", !8, i64 0, !8, i64 8, !9, i64 16, !9, i64 17, !34, i64 18, !8, i64 24, !11, i64 32, !8, i64 40, !41, i64 48, !28, i64 52}
!41 = !{!"s2n_cert_validation_info", !11, i64 0, !11, i64 0}
!42 = !{!"s2n_ticket_fields", !7, i64 0, !11, i64 24}
!43 = !{!"s2n_post_handshake", !6, i64 0, !9, i64 40}
!44 = !{!19, !9, i64 222}
!45 = !{!19, !9, i64 220}


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