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

; 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 }
%struct.s2n_kex_raw_server_data = type { %struct.s2n_ecdhe_raw_server_params, %struct.s2n_dhe_raw_server_points, %struct.s2n_kem_raw_server_params }
%struct.s2n_ecdhe_raw_server_params = type { %struct.s2n_blob, %struct.s2n_blob }
%struct.s2n_dhe_raw_server_points = type { %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob }
%struct.s2n_kem_raw_server_params = type { %struct.s2n_blob, %struct.s2n_blob }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.9 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [100 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

declare ptr @s2n_stuffer_raw_read(ptr noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_dhe_server_key_recv_read_data(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 ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca i16, align 2
  %13 = alloca i32, align 4
  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
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.s2n_connection, ptr %14, i32 0, i32 52
  %16 = getelementptr inbounds %struct.s2n_handshake, ptr %15, i32 0, i32 0
  store ptr %16, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.s2n_kex_raw_server_data, ptr %17, i32 0, i32 1
  store ptr %18, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #5
  store i16 0, ptr %10, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #5
  store i16 0, ptr %11, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #5
  store i16 0, ptr %12, align 2, !tbaa !9
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = call ptr @s2n_stuffer_raw_read(ptr noundef %19, i32 noundef 0)
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.s2n_blob, ptr %21, i32 0, i32 0
  store ptr %20, ptr %22, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.s2n_blob, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = icmp ne ptr %26, null
  br i1 %27, label %61, label %28

28:                                               ; preds = %23
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  %31 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %32 = getelementptr inbounds %struct.s2n_debug_info, ptr %31, i32 0, i32 0
  store ptr @.str.9, ptr %32, align 8, !tbaa !14
  %33 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %34 = getelementptr inbounds %struct.s2n_debug_info, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %35, i64 21
  %37 = call ptr @strrchr(ptr noundef %36, i32 noundef 47) #6
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %46

39:                                               ; preds = %30
  %40 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %41 = getelementptr inbounds %struct.s2n_debug_info, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %42, i64 21
  %44 = call ptr @strrchr(ptr noundef %43, i32 noundef 47) #6
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  br label %51

46:                                               ; preds = %30
  %47 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %48 = getelementptr inbounds %struct.s2n_debug_info, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds i8, ptr %49, i64 21
  br label %51

51:                                               ; preds = %46, %39
  %52 = phi ptr [ %45, %39 ], [ %50, %46 ]
  %53 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %54 = getelementptr inbounds %struct.s2n_debug_info, ptr %53, i32 0, i32 1
  store ptr %52, ptr %54, align 8, !tbaa !16
  %55 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %55, align 4, !tbaa !17
  %56 = call i32 @s2n_calculate_stacktrace()
  br label %57

57:                                               ; preds = %51
  br label %58

58:                                               ; preds = %57
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

59:                                               ; No predecessors!
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60, %23
  br label %62

62:                                               ; preds = %61
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = call i32 @s2n_stuffer_read_uint16(ptr noundef %65, ptr noundef %10)
  %67 = icmp sgt i32 %66, -1
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

69:                                               ; preds = %64
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  %72 = load i16, ptr %10, align 2, !tbaa !9
  %73 = zext i16 %72 to i32
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.s2n_blob, ptr %75, i32 0, i32 1
  store i32 %73, ptr %76, align 8, !tbaa !18
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load i16, ptr %10, align 2, !tbaa !9
  %79 = zext i16 %78 to i32
  %80 = call ptr @s2n_stuffer_raw_read(ptr noundef %77, i32 noundef %79)
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.s2n_blob, ptr %82, i32 0, i32 0
  store ptr %80, ptr %83, align 8, !tbaa !20
  br label %84

84:                                               ; preds = %71
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %struct.s2n_blob, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !20
  %89 = icmp ne ptr %88, null
  br i1 %89, label %123, label %90

90:                                               ; preds = %84
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  %93 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %94 = getelementptr inbounds %struct.s2n_debug_info, ptr %93, i32 0, i32 0
  store ptr @.str.10, ptr %94, align 8, !tbaa !14
  %95 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %96 = getelementptr inbounds %struct.s2n_debug_info, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !14
  %98 = getelementptr inbounds i8, ptr %97, i64 21
  %99 = call ptr @strrchr(ptr noundef %98, i32 noundef 47) #6
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %108

101:                                              ; preds = %92
  %102 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %103 = getelementptr inbounds %struct.s2n_debug_info, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !14
  %105 = getelementptr inbounds i8, ptr %104, i64 21
  %106 = call ptr @strrchr(ptr noundef %105, i32 noundef 47) #6
  %107 = getelementptr inbounds i8, ptr %106, i64 1
  br label %113

108:                                              ; preds = %92
  %109 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %110 = getelementptr inbounds %struct.s2n_debug_info, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !14
  %112 = getelementptr inbounds i8, ptr %111, i64 21
  br label %113

113:                                              ; preds = %108, %101
  %114 = phi ptr [ %107, %101 ], [ %112, %108 ]
  %115 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %116 = getelementptr inbounds %struct.s2n_debug_info, ptr %115, i32 0, i32 1
  store ptr %114, ptr %116, align 8, !tbaa !16
  %117 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %117, align 4, !tbaa !17
  %118 = call i32 @s2n_calculate_stacktrace()
  br label %119

119:                                              ; preds = %113
  br label %120

120:                                              ; preds = %119
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

121:                                              ; No predecessors!
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122, %84
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = call i32 @s2n_stuffer_read_uint16(ptr noundef %127, ptr noundef %11)
  %129 = icmp sgt i32 %128, -1
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

131:                                              ; preds = %126
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  %134 = load i16, ptr %11, align 2, !tbaa !9
  %135 = zext i16 %134 to i32
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %136, i32 0, i32 1
  %138 = getelementptr inbounds %struct.s2n_blob, ptr %137, i32 0, i32 1
  store i32 %135, ptr %138, align 8, !tbaa !21
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = load i16, ptr %11, align 2, !tbaa !9
  %141 = zext i16 %140 to i32
  %142 = call ptr @s2n_stuffer_raw_read(ptr noundef %139, i32 noundef %141)
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %143, i32 0, i32 1
  %145 = getelementptr inbounds %struct.s2n_blob, ptr %144, i32 0, i32 0
  store ptr %142, ptr %145, align 8, !tbaa !22
  br label %146

146:                                              ; preds = %133
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %147, i32 0, i32 1
  %149 = getelementptr inbounds %struct.s2n_blob, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !22
  %151 = icmp ne ptr %150, null
  br i1 %151, label %185, label %152

152:                                              ; preds = %146
  br label %153

153:                                              ; preds = %152
  br label %154

154:                                              ; preds = %153
  %155 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %156 = getelementptr inbounds %struct.s2n_debug_info, ptr %155, i32 0, i32 0
  store ptr @.str.11, ptr %156, align 8, !tbaa !14
  %157 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %158 = getelementptr inbounds %struct.s2n_debug_info, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !14
  %160 = getelementptr inbounds i8, ptr %159, i64 21
  %161 = call ptr @strrchr(ptr noundef %160, i32 noundef 47) #6
  %162 = icmp ne ptr %161, null
  br i1 %162, label %163, label %170

163:                                              ; preds = %154
  %164 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %165 = getelementptr inbounds %struct.s2n_debug_info, ptr %164, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !14
  %167 = getelementptr inbounds i8, ptr %166, i64 21
  %168 = call ptr @strrchr(ptr noundef %167, i32 noundef 47) #6
  %169 = getelementptr inbounds i8, ptr %168, i64 1
  br label %175

170:                                              ; preds = %154
  %171 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %172 = getelementptr inbounds %struct.s2n_debug_info, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !14
  %174 = getelementptr inbounds i8, ptr %173, i64 21
  br label %175

175:                                              ; preds = %170, %163
  %176 = phi ptr [ %169, %163 ], [ %174, %170 ]
  %177 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %178 = getelementptr inbounds %struct.s2n_debug_info, ptr %177, i32 0, i32 1
  store ptr %176, ptr %178, align 8, !tbaa !16
  %179 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %179, align 4, !tbaa !17
  %180 = call i32 @s2n_calculate_stacktrace()
  br label %181

181:                                              ; preds = %175
  br label %182

182:                                              ; preds = %181
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

183:                                              ; No predecessors!
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184, %146
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = call i32 @s2n_stuffer_read_uint16(ptr noundef %189, ptr noundef %12)
  %191 = icmp sgt i32 %190, -1
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

193:                                              ; preds = %188
  br label %194

194:                                              ; preds = %193
  br label %195

195:                                              ; preds = %194
  %196 = load i16, ptr %12, align 2, !tbaa !9
  %197 = zext i16 %196 to i32
  %198 = load ptr, ptr %9, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %198, i32 0, i32 2
  %200 = getelementptr inbounds %struct.s2n_blob, ptr %199, i32 0, i32 1
  store i32 %197, ptr %200, align 8, !tbaa !23
  %201 = load ptr, ptr %8, align 8, !tbaa !5
  %202 = load i16, ptr %12, align 2, !tbaa !9
  %203 = zext i16 %202 to i32
  %204 = call ptr @s2n_stuffer_raw_read(ptr noundef %201, i32 noundef %203)
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %205, i32 0, i32 2
  %207 = getelementptr inbounds %struct.s2n_blob, ptr %206, i32 0, i32 0
  store ptr %204, ptr %207, align 8, !tbaa !24
  br label %208

208:                                              ; preds = %195
  %209 = load ptr, ptr %9, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.s2n_dhe_raw_server_points, ptr %209, i32 0, i32 2
  %211 = getelementptr inbounds %struct.s2n_blob, ptr %210, i32 0, i32 0
  %212 = load ptr, ptr %211, align 8, !tbaa !24
  %213 = icmp ne ptr %212, null
  br i1 %213, label %247, label %214

214:                                              ; preds = %208
  br label %215

215:                                              ; preds = %214
  br label %216

216:                                              ; preds = %215
  %217 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %218 = getelementptr inbounds %struct.s2n_debug_info, ptr %217, i32 0, i32 0
  store ptr @.str.12, ptr %218, align 8, !tbaa !14
  %219 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %220 = getelementptr inbounds %struct.s2n_debug_info, ptr %219, i32 0, i32 0
  %221 = load ptr, ptr %220, align 8, !tbaa !14
  %222 = getelementptr inbounds i8, ptr %221, i64 21
  %223 = call ptr @strrchr(ptr noundef %222, i32 noundef 47) #6
  %224 = icmp ne ptr %223, null
  br i1 %224, label %225, label %232

225:                                              ; preds = %216
  %226 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %227 = getelementptr inbounds %struct.s2n_debug_info, ptr %226, i32 0, i32 0
  %228 = load ptr, ptr %227, align 8, !tbaa !14
  %229 = getelementptr inbounds i8, ptr %228, i64 21
  %230 = call ptr @strrchr(ptr noundef %229, i32 noundef 47) #6
  %231 = getelementptr inbounds i8, ptr %230, i64 1
  br label %237

232:                                              ; preds = %216
  %233 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %234 = getelementptr inbounds %struct.s2n_debug_info, ptr %233, i32 0, i32 0
  %235 = load ptr, ptr %234, align 8, !tbaa !14
  %236 = getelementptr inbounds i8, ptr %235, i64 21
  br label %237

237:                                              ; preds = %232, %225
  %238 = phi ptr [ %231, %225 ], [ %236, %232 ]
  %239 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %240 = getelementptr inbounds %struct.s2n_debug_info, ptr %239, i32 0, i32 1
  store ptr %238, ptr %240, align 8, !tbaa !16
  %241 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %241, align 4, !tbaa !17
  %242 = call i32 @s2n_calculate_stacktrace()
  br label %243

243:                                              ; preds = %237
  br label %244

244:                                              ; preds = %243
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

245:                                              ; No predecessors!
  br label %246

246:                                              ; preds = %245
  br label %247

247:                                              ; preds = %246, %208
  br label %248

248:                                              ; preds = %247
  br label %249

249:                                              ; preds = %248
  %250 = load i16, ptr %10, align 2, !tbaa !9
  %251 = zext i16 %250 to i32
  %252 = add nsw i32 2, %251
  %253 = add nsw i32 %252, 2
  %254 = load i16, ptr %11, align 2, !tbaa !9
  %255 = zext i16 %254 to i32
  %256 = add nsw i32 %253, %255
  %257 = add nsw i32 %256, 2
  %258 = load i16, ptr %12, align 2, !tbaa !9
  %259 = zext i16 %258 to i32
  %260 = add nsw i32 %257, %259
  %261 = load ptr, ptr %6, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.s2n_blob, ptr %261, i32 0, i32 1
  store i32 %260, ptr %262, align 8, !tbaa !25
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %263

263:                                              ; preds = %249, %244, %192, %182, %130, %120, %68, %58
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %264 = load i32, ptr %4, align 4
  ret i32 %264
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!16 = !{!15, !6, i64 8}
!17 = !{!13, !13, i64 0}
!18 = !{!19, !13, i64 8}
!19 = !{!"s2n_dhe_raw_server_points", !12, i64 0, !12, i64 24, !12, i64 48}
!20 = !{!19, !6, i64 0}
!21 = !{!19, !13, i64 32}
!22 = !{!19, !6, i64 24}
!23 = !{!19, !13, i64 56}
!24 = !{!19, !6, i64 48}
!25 = !{!12, !13, i64 8}


; 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.9 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [100 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [100 x i8], align 1

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_dhe_server_key_recv_read_data(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #4 {
  %4 = alloca i16, align 2
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  %7 = getelementptr inbounds i8, ptr %0, i64 2016
  %8 = getelementptr inbounds i8, ptr %2, i64 48
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #5
  store i16 0, ptr %4, align 2, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %5) #5
  store i16 0, ptr %5, align 2, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %6) #5
  store i16 0, ptr %6, align 2, !tbaa !5
  %9 = tail call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %7, i32 noundef 0) #5
  store ptr %9, ptr %1, align 8, !tbaa !9
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %18

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

18:                                               ; preds = %3
  %19 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %7, ptr noundef nonnull %4) #5
  %20 = icmp sgt i32 %19, -1
  br i1 %20, label %21, label %79

21:                                               ; preds = %18
  %22 = load i16, ptr %4, align 2, !tbaa !5
  %23 = zext i16 %22 to i32
  %24 = getelementptr inbounds i8, ptr %2, i64 56
  store i32 %23, ptr %24, align 8, !tbaa !17
  %25 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %7, i32 noundef %23) #5
  store ptr %25, ptr %8, align 8, !tbaa !19
  %.not26 = icmp eq ptr %25, null
  br i1 %.not26, label %26, label %34

26:                                               ; preds = %21
  %27 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.10, ptr %27, align 8, !tbaa !13
  %28 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.10, i64 21), i32 noundef 47) #6
  %.not27 = icmp eq ptr %28, null
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  %30 = select i1 %.not27, ptr getelementptr inbounds (i8, ptr @.str.10, i64 21), ptr %29
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr %30, ptr %31, align 8, !tbaa !15
  %32 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %32, align 4, !tbaa !16
  %33 = call i32 @s2n_calculate_stacktrace() #5
  br label %79

34:                                               ; preds = %21
  %35 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %7, ptr noundef nonnull %5) #5
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %37, label %79

37:                                               ; preds = %34
  %38 = load i16, ptr %5, align 2, !tbaa !5
  %39 = zext i16 %38 to i32
  %40 = getelementptr inbounds i8, ptr %2, i64 72
  %41 = getelementptr inbounds i8, ptr %2, i64 80
  store i32 %39, ptr %41, align 8, !tbaa !20
  %42 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %7, i32 noundef %39) #5
  store ptr %42, ptr %40, align 8, !tbaa !21
  %.not28 = icmp eq ptr %42, null
  br i1 %.not28, label %43, label %51

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

51:                                               ; preds = %37
  %52 = call i32 @s2n_stuffer_read_uint16(ptr noundef nonnull %7, ptr noundef nonnull %6) #5
  %53 = icmp sgt i32 %52, -1
  br i1 %53, label %54, label %79

54:                                               ; preds = %51
  %55 = load i16, ptr %6, align 2, !tbaa !5
  %56 = zext i16 %55 to i32
  %57 = getelementptr inbounds i8, ptr %2, i64 96
  %58 = getelementptr inbounds i8, ptr %2, i64 104
  store i32 %56, ptr %58, align 8, !tbaa !22
  %59 = call ptr @s2n_stuffer_raw_read(ptr noundef nonnull %7, i32 noundef %56) #5
  store ptr %59, ptr %57, align 8, !tbaa !23
  %.not30 = icmp eq ptr %59, null
  br i1 %.not30, label %60, label %68

60:                                               ; preds = %54
  %61 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.12, ptr %61, align 8, !tbaa !13
  %62 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.12, i64 21), i32 noundef 47) #6
  %.not31 = icmp eq ptr %62, null
  %63 = getelementptr inbounds i8, ptr %62, i64 1
  %64 = select i1 %.not31, ptr getelementptr inbounds (i8, ptr @.str.12, i64 21), ptr %63
  %65 = getelementptr inbounds i8, ptr %61, i64 8
  store ptr %64, ptr %65, align 8, !tbaa !15
  %66 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %66, align 4, !tbaa !16
  %67 = call i32 @s2n_calculate_stacktrace() #5
  br label %79

68:                                               ; preds = %54
  %69 = load i16, ptr %4, align 2, !tbaa !5
  %70 = zext i16 %69 to i32
  %71 = load i16, ptr %5, align 2, !tbaa !5
  %72 = zext i16 %71 to i32
  %73 = load i16, ptr %6, align 2, !tbaa !5
  %74 = zext i16 %73 to i32
  %75 = add nuw nsw i32 %70, 6
  %76 = add nuw nsw i32 %75, %72
  %77 = add nuw nsw i32 %76, %74
  %78 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %77, ptr %78, align 8, !tbaa !24
  br label %79

79:                                               ; preds = %51, %34, %18, %68, %60, %43, %26, %10
  %.0 = phi i32 [ 0, %68 ], [ -1, %60 ], [ -1, %43 ], [ -1, %26 ], [ -1, %10 ], [ -1, %18 ], [ -1, %34 ], [ -1, %51 ]
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #5
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"s2n_blob", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !11, i64 0}
!14 = !{!"s2n_debug_info", !11, i64 0, !11, i64 8}
!15 = !{!14, !11, i64 8}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 8}
!18 = !{!"s2n_dhe_raw_server_points", !10, i64 0, !10, i64 24, !10, i64 48}
!19 = !{!18, !11, i64 0}
!20 = !{!18, !12, i64 32}
!21 = !{!18, !11, i64 24}
!22 = !{!18, !12, i64 56}
!23 = !{!18, !11, i64 48}
!24 = !{!10, !12, i64 8}


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