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

; 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_result = type { i32 }
%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_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_post_handshake = type { %struct.s2n_stuffer, [4 x i8] }
%struct.s2n_atomic_flag = type { i32 }
%struct.s2n_tls12_secrets = type { [48 x i8], [48 x i8] }
%struct.s2n_key_material = type { [160 x i8], %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, %struct.s2n_blob, %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.48 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [84 x i8], align 1
@__const.s2n_prf_generate_key_material.key_expansion_label = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_key_material_init(ptr noundef, ptr noundef) #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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_prf(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_prf_generate_key_material(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca %struct.s2n_result, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_blob, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.s2n_blob, align 8
  %9 = alloca %struct.s2n_blob, align 8
  %10 = alloca %struct.s2n_blob, align 8
  %11 = alloca [14 x i8], align 1
  %12 = alloca %struct.s2n_result, align 4
  %13 = alloca %struct.s2n_blob, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %49, label %17

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %21 = getelementptr inbounds %struct.s2n_debug_info, ptr %20, i32 0, i32 0
  store ptr @.str.48, ptr %21, align 8, !tbaa !9
  %22 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %23 = getelementptr inbounds %struct.s2n_debug_info, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %24, i64 21
  %26 = call ptr @strrchr(ptr noundef %25, i32 noundef 47) #8
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %35

28:                                               ; preds = %19
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %30 = getelementptr inbounds %struct.s2n_debug_info, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = getelementptr inbounds i8, ptr %31, i64 21
  %33 = call ptr @strrchr(ptr noundef %32, i32 noundef 47) #8
  %34 = getelementptr inbounds i8, ptr %33, i64 1
  br label %40

35:                                               ; preds = %19
  %36 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %37 = getelementptr inbounds %struct.s2n_debug_info, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %38, i64 21
  br label %40

40:                                               ; preds = %35, %28
  %41 = phi ptr [ %34, %28 ], [ %39, %35 ]
  %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 1
  store ptr %41, ptr %43, align 8, !tbaa !11
  %44 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %44, align 4, !tbaa !12
  %45 = call i32 @s2n_calculate_stacktrace()
  br label %46

46:                                               ; preds = %40
  %47 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %47, align 4, !tbaa !14
  br label %173

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48, %14
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %86, label %54

54:                                               ; preds = %51
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %58 = getelementptr inbounds %struct.s2n_debug_info, ptr %57, i32 0, i32 0
  store ptr @.str.49, ptr %58, align 8, !tbaa !9
  %59 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %60 = getelementptr inbounds %struct.s2n_debug_info, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %61, i64 21
  %63 = call ptr @strrchr(ptr noundef %62, i32 noundef 47) #8
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %72

65:                                               ; preds = %56
  %66 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %67 = getelementptr inbounds %struct.s2n_debug_info, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds i8, ptr %68, i64 21
  %70 = call ptr @strrchr(ptr noundef %69, i32 noundef 47) #8
  %71 = getelementptr inbounds i8, ptr %70, i64 1
  br label %77

72:                                               ; preds = %56
  %73 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %74 = getelementptr inbounds %struct.s2n_debug_info, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %75, i64 21
  br label %77

77:                                               ; preds = %72, %65
  %78 = phi ptr [ %71, %65 ], [ %76, %72 ]
  %79 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %80 = getelementptr inbounds %struct.s2n_debug_info, ptr %79, i32 0, i32 1
  store ptr %78, ptr %80, align 8, !tbaa !11
  %81 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %81, align 4, !tbaa !12
  %82 = call i32 @s2n_calculate_stacktrace()
  br label %83

83:                                               ; preds = %77
  %84 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %84, align 4, !tbaa !14
  br label %173

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %51
  br label %87

87:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #9
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 24, i1 false)
  br label %88

88:                                               ; preds = %87
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.s2n_connection, ptr %89, i32 0, i32 32
  %91 = getelementptr inbounds %struct.s2n_handshake_parameters, ptr %90, i32 0, i32 12
  %92 = getelementptr inbounds [32 x i8], ptr %91, i64 0, i64 0
  %93 = call i32 @s2n_blob_init(ptr noundef %6, ptr noundef %92, i32 noundef 32)
  %94 = icmp sgt i32 %93, -1
  br i1 %94, label %97, label %95

95:                                               ; preds = %88
  %96 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %96, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %172

97:                                               ; preds = %88
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #9
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 24, i1 false)
  br label %100

100:                                              ; preds = %99
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.s2n_connection, ptr %101, i32 0, i32 32
  %103 = getelementptr inbounds %struct.s2n_handshake_parameters, ptr %102, i32 0, i32 13
  %104 = getelementptr inbounds [32 x i8], ptr %103, i64 0, i64 0
  %105 = call i32 @s2n_blob_init(ptr noundef %8, ptr noundef %104, i32 noundef 32)
  %106 = icmp sgt i32 %105, -1
  br i1 %106, label %109, label %107

107:                                              ; preds = %100
  %108 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %108, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %171

109:                                              ; preds = %100
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #9
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 24, i1 false)
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.s2n_connection, ptr %113, i32 0, i32 28
  %115 = getelementptr inbounds %struct.s2n_secrets, ptr %114, i32 0, i32 0
  %116 = getelementptr inbounds %struct.s2n_tls12_secrets, ptr %115, i32 0, i32 1
  %117 = getelementptr inbounds [48 x i8], ptr %116, i64 0, i64 0
  %118 = call i32 @s2n_blob_init(ptr noundef %9, ptr noundef %117, i32 noundef 48)
  %119 = icmp sgt i32 %118, -1
  br i1 %119, label %122, label %120

120:                                              ; preds = %112
  %121 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %121, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %170

122:                                              ; preds = %112
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #9
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 14, ptr %11) #9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 1 @__const.s2n_prf_generate_key_material.key_expansion_label, i64 14, i1 false)
  br label %125

125:                                              ; preds = %124
  %126 = getelementptr inbounds [14 x i8], ptr %11, i64 0, i64 0
  %127 = call i32 @s2n_blob_init(ptr noundef %10, ptr noundef %126, i32 noundef 13)
  %128 = icmp sgt i32 %127, -1
  br i1 %128, label %131, label %129

129:                                              ; preds = %125
  %130 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %130, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %169

131:                                              ; preds = %125
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = call i32 @s2n_key_material_init(ptr noundef %135, ptr noundef %136)
  %138 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  store i32 %137, ptr %138, align 4
  %139 = getelementptr inbounds %struct.s2n_result, ptr %12, i32 0, i32 0
  %140 = load i32, ptr %139, align 4
  %141 = call zeroext i1 @s2n_result_is_ok(i32 %140)
  br i1 %141, label %144, label %142

142:                                              ; preds = %134
  %143 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %143, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %169

144:                                              ; preds = %134
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #9
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 24, i1 false)
  br label %147

147:                                              ; preds = %146
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.s2n_key_material, ptr %148, i32 0, i32 0
  %150 = getelementptr inbounds [160 x i8], ptr %149, i64 0, i64 0
  %151 = call i32 @s2n_blob_init(ptr noundef %13, ptr noundef %150, i32 noundef 160)
  %152 = icmp sgt i32 %151, -1
  br i1 %152, label %155, label %153

153:                                              ; preds = %147
  %154 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %154, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %168

155:                                              ; preds = %147
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = call i32 @s2n_prf(ptr noundef %159, ptr noundef %9, ptr noundef %10, ptr noundef %8, ptr noundef %6, ptr noundef null, ptr noundef %13)
  %161 = icmp sgt i32 %160, -1
  br i1 %161, label %164, label %162

162:                                              ; preds = %158
  %163 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %163, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %168

164:                                              ; preds = %158
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  %167 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %167, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %168

168:                                              ; preds = %166, %162, %153
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #9
  br label %169

169:                                              ; preds = %168, %142, %129
  call void @llvm.lifetime.end.p0(i64 14, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #9
  br label %170

170:                                              ; preds = %169, %120
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #9
  br label %171

171:                                              ; preds = %170, %107
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #9
  br label %172

172:                                              ; preds = %171, %95
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #9
  br label %173

173:                                              ; preds = %172, %83, %46
  %174 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  %175 = load i32, ptr %174, align 4
  ret i32 %175
}

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0}


; 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 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@_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.48 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [84 x i8], align 1
@__const.s2n_prf_generate_key_material.key_expansion_label = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_key_material_init(ptr noundef, ptr noundef) local_unnamed_addr #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

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

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

declare i32 @s2n_blob_init(ptr noundef, ptr noundef, i32 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) #4

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_prf(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_prf_generate_key_material(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.s2n_blob, align 8
  %4 = alloca %struct.s2n_blob, align 8
  %5 = alloca %struct.s2n_blob, align 8
  %6 = alloca %struct.s2n_blob, align 8
  %7 = alloca [14 x i8], align 1
  %8 = alloca %struct.s2n_blob, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %9, label %17

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

17:                                               ; preds = %2
  %.not14 = icmp eq ptr %1, null
  br i1 %.not14, label %18, label %26

18:                                               ; preds = %17
  %19 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.49, ptr %19, align 8, !tbaa !5
  %20 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.49, i64 21), i32 noundef 47) #8
  %.not15 = icmp eq ptr %20, null
  %21 = getelementptr inbounds i8, ptr %20, i64 1
  %22 = select i1 %.not15, ptr getelementptr inbounds (i8, ptr @.str.49, i64 21), ptr %21
  %23 = getelementptr inbounds i8, ptr %19, i64 8
  store ptr %22, ptr %23, align 8, !tbaa !10
  %24 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %24, align 4, !tbaa !11
  %25 = tail call i32 @s2n_calculate_stacktrace() #9
  br label %54

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  %27 = getelementptr inbounds i8, ptr %0, i64 1618
  %28 = call i32 @s2n_blob_init(ptr noundef nonnull %3, ptr noundef nonnull %27, i32 noundef 32) #9
  %29 = icmp sgt i32 %28, -1
  br i1 %29, label %30, label %53

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %4, i8 0, i64 24, i1 false)
  %31 = getelementptr inbounds i8, ptr %0, i64 1650
  %32 = call i32 @s2n_blob_init(ptr noundef nonnull %4, ptr noundef nonnull %31, i32 noundef 32) #9
  %33 = icmp sgt i32 %32, -1
  br i1 %33, label %34, label %52

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  %35 = getelementptr inbounds i8, ptr %0, i64 288
  %36 = call i32 @s2n_blob_init(ptr noundef nonnull %5, ptr noundef nonnull %35, i32 noundef 48) #9
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %51

38:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 14, ptr nonnull %7) #9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(14) %7, ptr noundef nonnull align 1 dereferenceable(14) @__const.s2n_prf_generate_key_material.key_expansion_label, i64 14, i1 false)
  %39 = call i32 @s2n_blob_init(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef 13) #9
  %40 = icmp sgt i32 %39, -1
  br i1 %40, label %41, label %50

41:                                               ; preds = %38
  %42 = call i32 @s2n_key_material_init(ptr noundef nonnull %1, ptr noundef nonnull %0)
  %43 = call zeroext i1 @s2n_result_is_ok(i32 %42)
  br i1 %43, label %44, label %50

44:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  %45 = call i32 @s2n_blob_init(ptr noundef nonnull %8, ptr noundef nonnull %1, i32 noundef 160) #9
  %46 = icmp sgt i32 %45, -1
  br i1 %46, label %47, label %49

47:                                               ; preds = %44
  %48 = call i32 @s2n_prf(ptr noundef nonnull %0, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef null, ptr noundef nonnull %8)
  %.lobit = ashr i32 %48, 31
  br label %49

49:                                               ; preds = %47, %44
  %.sroa.09.0 = phi i32 [ -1, %44 ], [ %.lobit, %47 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #9
  br label %50

50:                                               ; preds = %41, %38, %49
  %.sroa.09.1 = phi i32 [ %.sroa.09.0, %49 ], [ -1, %38 ], [ -1, %41 ]
  call void @llvm.lifetime.end.p0(i64 14, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #9
  br label %51

51:                                               ; preds = %34, %50
  %.sroa.09.2 = phi i32 [ %.sroa.09.1, %50 ], [ -1, %34 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #9
  br label %52

52:                                               ; preds = %30, %51
  %.sroa.09.3 = phi i32 [ %.sroa.09.2, %51 ], [ -1, %30 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  br label %53

53:                                               ; preds = %26, %52
  %.sroa.09.4 = phi i32 [ %.sroa.09.3, %52 ], [ -1, %26 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  br label %54

54:                                               ; preds = %53, %18, %9
  %.sroa.09.5 = phi i32 [ %.sroa.09.4, %53 ], [ -1, %18 ], [ -1, %9 ]
  ret i32 %.sroa.09.5
}

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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}


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