; LLVM IR from aws/s2n-tls :: tests/unit (s2n_psk_offered_test)

; 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_psk = type { i32, %struct.s2n_blob, %struct.s2n_blob, i32, i32, i64, %struct.s2n_blob, %struct.s2n_early_data_config, i64 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }
%struct.s2n_early_data_config = type { i32, i8, ptr, %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.11 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [84 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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_psk_set_identity(ptr noundef, ptr noundef, i16 noundef zeroext) #6

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

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_psk_set_secret(ptr noundef, ptr noundef, i16 noundef zeroext) #6

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_psk_clone(ptr noundef %0, ptr noundef %1) #6 {
  %3 = alloca %struct.s2n_result, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_psk, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.s2n_result, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %208

15:                                               ; preds = %2
  br label %16

16:                                               ; preds = %15
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %51, label %19

19:                                               ; preds = %16
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  %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
  store ptr @.str.11, ptr %23, align 8, !tbaa !12
  %24 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %25 = getelementptr inbounds %struct.s2n_debug_info, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = getelementptr inbounds i8, ptr %26, i64 21
  %28 = call ptr @strrchr(ptr noundef %27, i32 noundef 47) #8
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %37

30:                                               ; preds = %21
  %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
  %33 = load ptr, ptr %32, align 8, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %33, i64 21
  %35 = call ptr @strrchr(ptr noundef %34, i32 noundef 47) #8
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  br label %42

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

42:                                               ; preds = %37, %30
  %43 = phi ptr [ %36, %30 ], [ %41, %37 ]
  %44 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %45 = getelementptr inbounds %struct.s2n_debug_info, ptr %44, i32 0, i32 1
  store ptr %43, ptr %45, align 8, !tbaa !14
  %46 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %46, align 4, !tbaa !15
  %47 = call i32 @s2n_calculate_stacktrace()
  br label %48

48:                                               ; preds = %42
  %49 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %49, align 4, !tbaa !9
  br label %208

50:                                               ; No predecessors!
  br label %51

51:                                               ; preds = %50, %16
  br label %52

52:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 168, ptr %6) #9
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %53, i64 168, i1 false), !tbaa.struct !16
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %54, ptr align 8 %55, i64 168, i1 false), !tbaa.struct !16
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.s2n_psk, ptr %56, i32 0, i32 1
  %58 = getelementptr inbounds %struct.s2n_psk, ptr %6, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %57, ptr align 8 %58, i64 24, i1 false), !tbaa.struct !20
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.s2n_psk, ptr %59, i32 0, i32 2
  %61 = getelementptr inbounds %struct.s2n_psk, ptr %6, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %60, ptr align 8 %61, i64 24, i1 false), !tbaa.struct !20
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.s2n_psk, ptr %62, i32 0, i32 6
  %64 = getelementptr inbounds %struct.s2n_psk, ptr %6, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %63, ptr align 8 %64, i64 24, i1 false), !tbaa.struct !20
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.s2n_psk, ptr %65, i32 0, i32 7
  %67 = getelementptr inbounds %struct.s2n_psk, ptr %6, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %66, ptr align 8 %67, i64 64, i1 false), !tbaa.struct !21
  br label %68

68:                                               ; preds = %52
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.s2n_psk, ptr %70, i32 0, i32 1
  %72 = getelementptr inbounds %struct.s2n_blob, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.s2n_psk, ptr %74, i32 0, i32 1
  %76 = getelementptr inbounds %struct.s2n_blob, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !26
  %78 = trunc i32 %77 to i16
  %79 = call i32 @s2n_psk_set_identity(ptr noundef %69, ptr noundef %73, i16 noundef zeroext %78)
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %83, label %81

81:                                               ; preds = %68
  %82 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %82, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %207

83:                                               ; preds = %68
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.s2n_psk, ptr %88, i32 0, i32 2
  %90 = getelementptr inbounds %struct.s2n_blob, ptr %89, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !27
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.s2n_psk, ptr %92, i32 0, i32 2
  %94 = getelementptr inbounds %struct.s2n_blob, ptr %93, i32 0, i32 1
  %95 = load i32, ptr %94, align 8, !tbaa !28
  %96 = trunc i32 %95 to i16
  %97 = call i32 @s2n_psk_set_secret(ptr noundef %87, ptr noundef %91, i16 noundef zeroext %96)
  %98 = icmp sgt i32 %97, -1
  br i1 %98, label %101, label %99

99:                                               ; preds = %86
  %100 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %100, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %207

101:                                              ; preds = %86
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.s2n_psk, ptr %105, i32 0, i32 6
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.s2n_psk, ptr %107, i32 0, i32 6
  %109 = getelementptr inbounds %struct.s2n_blob, ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 8, !tbaa !29
  %111 = call i32 @s2n_realloc(ptr noundef %106, i32 noundef %110)
  %112 = icmp sgt i32 %111, -1
  br i1 %112, label %115, label %113

113:                                              ; preds = %104
  %114 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %114, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %207

115:                                              ; preds = %104
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.s2n_psk, ptr %119, i32 0, i32 6
  %121 = getelementptr inbounds %struct.s2n_blob, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 8, !tbaa !29
  store i32 %122, ptr %8, align 4, !tbaa !15
  %123 = load i32, ptr %8, align 4, !tbaa !15
  %124 = icmp ne i32 %123, 0
  %125 = xor i1 %124, true
  %126 = xor i1 %125, true
  %127 = zext i1 %126 to i32
  %128 = sext i32 %127 to i64
  %129 = call i64 @llvm.expect.i64(i64 %128, i64 1)
  %130 = icmp ne i64 %129, 0
  br i1 %130, label %131, label %186

131:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.s2n_psk, ptr %132, i32 0, i32 6
  %134 = getelementptr inbounds %struct.s2n_blob, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !30
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.s2n_psk, ptr %136, i32 0, i32 6
  %138 = getelementptr inbounds %struct.s2n_blob, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !30
  %140 = load i32, ptr %8, align 4, !tbaa !15
  %141 = zext i32 %140 to i64
  %142 = call ptr @s2n_ensure_memmove_trace(ptr noundef %135, ptr noundef %139, i64 noundef %141)
  store ptr %142, ptr %9, align 8, !tbaa !5
  br label %143

143:                                              ; preds = %131
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %180, label %146

146:                                              ; preds = %143
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  %149 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %150 = getelementptr inbounds %struct.s2n_debug_info, ptr %149, i32 0, i32 0
  store ptr @.str.12, ptr %150, align 8, !tbaa !12
  %151 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %152 = getelementptr inbounds %struct.s2n_debug_info, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !12
  %154 = getelementptr inbounds i8, ptr %153, i64 21
  %155 = call ptr @strrchr(ptr noundef %154, i32 noundef 47) #8
  %156 = icmp ne ptr %155, null
  br i1 %156, label %157, label %164

157:                                              ; preds = %148
  %158 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %159 = getelementptr inbounds %struct.s2n_debug_info, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !12
  %161 = getelementptr inbounds i8, ptr %160, i64 21
  %162 = call ptr @strrchr(ptr noundef %161, i32 noundef 47) #8
  %163 = getelementptr inbounds i8, ptr %162, i64 1
  br label %169

164:                                              ; preds = %148
  %165 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %166 = getelementptr inbounds %struct.s2n_debug_info, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !12
  %168 = getelementptr inbounds i8, ptr %167, i64 21
  br label %169

169:                                              ; preds = %164, %157
  %170 = phi ptr [ %163, %157 ], [ %168, %164 ]
  %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 1
  store ptr %170, ptr %172, align 8, !tbaa !14
  %173 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %173, align 4, !tbaa !15
  %174 = call i32 @s2n_calculate_stacktrace()
  br label %175

175:                                              ; preds = %169
  br label %176

176:                                              ; preds = %175
  %177 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %177, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %183

178:                                              ; No predecessors!
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179, %143
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181
  store i32 0, ptr %7, align 4
  br label %183

183:                                              ; preds = %182, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  %184 = load i32, ptr %7, align 4
  switch i32 %184, label %187 [
    i32 0, label %185
  ]

185:                                              ; preds = %183
  br label %186

186:                                              ; preds = %185, %118
  store i32 0, ptr %7, align 4
  br label %187

187:                                              ; preds = %186, %183
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  %188 = load i32, ptr %7, align 4
  switch i32 %188, label %207 [
    i32 0, label %189
  ]

189:                                              ; preds = %187
  br label %190

190:                                              ; preds = %189
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  %193 = load ptr, ptr %4, align 8, !tbaa !5
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.s2n_psk, ptr %194, i32 0, i32 7
  %196 = call i32 @s2n_early_data_config_clone(ptr noundef %193, ptr noundef %195)
  %197 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  store i32 %196, ptr %197, align 4
  %198 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  %199 = load i32, ptr %198, align 4
  %200 = call zeroext i1 @s2n_result_is_ok(i32 %199)
  br i1 %200, label %203, label %201

201:                                              ; preds = %192
  %202 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %202, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %207

203:                                              ; preds = %192
  br label %204

204:                                              ; preds = %203
  br label %205

205:                                              ; preds = %204
  %206 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %206, align 4, !tbaa !9
  store i32 1, ptr %7, align 4
  br label %207

207:                                              ; preds = %205, %201, %187, %113, %99, %81
  call void @llvm.lifetime.end.p0(i64 168, ptr %6) #9
  br label %208

208:                                              ; preds = %207, %48, %13
  %209 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  %210 = load i32, ptr %209, align 4
  ret i32 %210
}

; 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

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

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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #5 = { 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 #6 = { 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, !11, i64 0}
!10 = !{!"", !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!14 = !{!13, !6, i64 8}
!15 = !{!11, !11, i64 0}
!16 = !{i64 0, i64 4, !15, i64 8, i64 8, !5, i64 16, i64 4, !15, i64 20, i64 4, !15, i64 24, i64 1, !17, i64 32, i64 8, !5, i64 40, i64 4, !15, i64 44, i64 4, !15, i64 48, i64 1, !17, i64 56, i64 4, !15, i64 60, i64 4, !15, i64 64, i64 8, !18, i64 72, i64 8, !5, i64 80, i64 4, !15, i64 84, i64 4, !15, i64 88, i64 1, !17, i64 96, i64 4, !15, i64 100, i64 1, !17, i64 104, i64 8, !5, i64 112, i64 8, !5, i64 120, i64 4, !15, i64 124, i64 4, !15, i64 128, i64 1, !17, i64 136, i64 8, !5, i64 144, i64 4, !15, i64 148, i64 4, !15, i64 152, i64 1, !17, i64 160, i64 8, !18}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{i64 0, i64 8, !5, i64 8, i64 4, !15, i64 12, i64 4, !15, i64 16, i64 1, !17}
!21 = !{i64 0, i64 4, !15, i64 4, i64 1, !17, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 4, !15, i64 28, i64 4, !15, i64 32, i64 1, !17, i64 40, i64 8, !5, i64 48, i64 4, !15, i64 52, i64 4, !15, i64 56, i64 1, !17}
!22 = !{!23, !6, i64 8}
!23 = !{!"s2n_psk", !11, i64 0, !24, i64 8, !24, i64 32, !11, i64 56, !11, i64 60, !19, i64 64, !24, i64 72, !25, i64 96, !19, i64 160}
!24 = !{!"s2n_blob", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16}
!25 = !{!"s2n_early_data_config", !11, i64 0, !7, i64 4, !6, i64 8, !24, i64 16, !24, i64 40}
!26 = !{!23, !11, i64 16}
!27 = !{!23, !6, i64 32}
!28 = !{!23, !11, i64 40}
!29 = !{!23, !11, i64 80}
!30 = !{!23, !6, i64 72}


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

@_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.11 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [84 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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_psk_set_identity(ptr noundef, ptr noundef, i16 noundef zeroext) local_unnamed_addr #5

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

declare ptr @s2n_ensure_memmove_trace(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_psk_set_secret(ptr noundef, ptr noundef, i16 noundef zeroext) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_psk_clone(ptr noundef %0, ptr noundef %1) local_unnamed_addr #5 {
  %3 = alloca %struct.s2n_psk, align 8
  %4 = icmp eq ptr %1, null
  br i1 %4, label %63, label %5

5:                                                ; preds = %2
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %14

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

14:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 168, ptr nonnull %3)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(168) %3, ptr noundef nonnull align 8 dereferenceable(168) %0, i64 168, i1 false), !tbaa.struct !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(168) %0, ptr noundef nonnull align 8 dereferenceable(168) %1, i64 168, i1 false), !tbaa.struct !13
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  %16 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %16, i64 24, i1 false), !tbaa.struct !18
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  %18 = getelementptr inbounds i8, ptr %3, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %18, i64 24, i1 false), !tbaa.struct !18
  %19 = getelementptr inbounds i8, ptr %0, i64 72
  %20 = getelementptr inbounds i8, ptr %3, i64 72
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %20, i64 24, i1 false), !tbaa.struct !18
  %21 = getelementptr inbounds i8, ptr %0, i64 96
  %22 = getelementptr inbounds i8, ptr %3, i64 96
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %21, ptr noundef nonnull align 8 dereferenceable(64) %22, i64 64, i1 false), !tbaa.struct !19
  %23 = getelementptr inbounds i8, ptr %1, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !20
  %25 = getelementptr inbounds i8, ptr %1, i64 16
  %26 = load i32, ptr %25, align 8, !tbaa !24
  %27 = trunc i32 %26 to i16
  %28 = tail call i32 @s2n_psk_set_identity(ptr noundef nonnull %0, ptr noundef %24, i16 noundef zeroext %27)
  %29 = icmp sgt i32 %28, -1
  br i1 %29, label %30, label %62

30:                                               ; preds = %14
  %31 = getelementptr inbounds i8, ptr %1, i64 32
  %32 = load ptr, ptr %31, align 8, !tbaa !25
  %33 = getelementptr inbounds i8, ptr %1, i64 40
  %34 = load i32, ptr %33, align 8, !tbaa !26
  %35 = trunc i32 %34 to i16
  %36 = tail call i32 @s2n_psk_set_secret(ptr noundef nonnull %0, ptr noundef %32, i16 noundef zeroext %35)
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %38, label %62

38:                                               ; preds = %30
  %39 = getelementptr inbounds i8, ptr %1, i64 72
  %40 = getelementptr inbounds i8, ptr %1, i64 80
  %41 = load i32, ptr %40, align 8, !tbaa !27
  %42 = tail call i32 @s2n_realloc(ptr noundef nonnull %19, i32 noundef %41) #8
  %43 = icmp sgt i32 %42, -1
  br i1 %43, label %44, label %62

44:                                               ; preds = %38
  %45 = load i32, ptr %40, align 8, !tbaa !27
  %.not34 = icmp eq i32 %45, 0
  br i1 %.not34, label %.critedge38, label %46, !prof !28

46:                                               ; preds = %44
  %47 = load ptr, ptr %19, align 8, !tbaa !29
  %48 = load ptr, ptr %39, align 8, !tbaa !29
  %49 = zext i32 %45 to i64
  %50 = tail call ptr @s2n_ensure_memmove_trace(ptr noundef %47, ptr noundef %48, i64 noundef %49) #8
  %.not35.not = icmp eq ptr %50, null
  br i1 %.not35.not, label %51, label %.critedge38

51:                                               ; preds = %46
  %52 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.12, ptr %52, align 8, !tbaa !5
  %53 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.12, i64 21), i32 noundef 47) #7
  %.not36 = icmp eq ptr %53, null
  %54 = getelementptr inbounds i8, ptr %53, i64 1
  %55 = select i1 %.not36, ptr getelementptr inbounds (i8, ptr @.str.12, i64 21), ptr %54
  %56 = getelementptr inbounds i8, ptr %52, i64 8
  store ptr %55, ptr %56, align 8, !tbaa !10
  %57 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %57, align 4, !tbaa !11
  %58 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %62

.critedge38:                                      ; preds = %46, %44
  %59 = getelementptr inbounds i8, ptr %1, i64 96
  %60 = tail call i32 @s2n_early_data_config_clone(ptr noundef nonnull %0, ptr noundef nonnull %59) #8
  %61 = tail call zeroext i1 @s2n_result_is_ok(i32 %60)
  %not. = xor i1 %61, true
  %spec.select = sext i1 %not. to i32
  br label %62

62:                                               ; preds = %.critedge38, %51, %38, %30, %14
  %.sroa.027.3 = phi i32 [ -1, %14 ], [ -1, %30 ], [ -1, %38 ], [ -1, %51 ], [ %spec.select, %.critedge38 ]
  call void @llvm.lifetime.end.p0(i64 168, ptr nonnull %3)
  br label %63

63:                                               ; preds = %2, %62, %6
  %.sroa.027.4 = phi i32 [ %.sroa.027.3, %62 ], [ -1, %6 ], [ 0, %2 ]
  ret i32 %.sroa.027.4
}

; 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) #6

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

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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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}
!13 = !{i64 0, i64 4, !11, i64 8, i64 8, !14, i64 16, i64 4, !11, i64 20, i64 4, !11, i64 24, i64 1, !15, i64 32, i64 8, !14, i64 40, i64 4, !11, i64 44, i64 4, !11, i64 48, i64 1, !15, i64 56, i64 4, !11, i64 60, i64 4, !11, i64 64, i64 8, !16, i64 72, i64 8, !14, i64 80, i64 4, !11, i64 84, i64 4, !11, i64 88, i64 1, !15, i64 96, i64 4, !11, i64 100, i64 1, !15, i64 104, i64 8, !14, i64 112, i64 8, !14, i64 120, i64 4, !11, i64 124, i64 4, !11, i64 128, i64 1, !15, i64 136, i64 8, !14, i64 144, i64 4, !11, i64 148, i64 4, !11, i64 152, i64 1, !15, i64 160, i64 8, !16}
!14 = !{!7, !7, i64 0}
!15 = !{!8, !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{i64 0, i64 8, !14, i64 8, i64 4, !11, i64 12, i64 4, !11, i64 16, i64 1, !15}
!19 = !{i64 0, i64 4, !11, i64 4, i64 1, !15, i64 8, i64 8, !14, i64 16, i64 8, !14, i64 24, i64 4, !11, i64 28, i64 4, !11, i64 32, i64 1, !15, i64 40, i64 8, !14, i64 48, i64 4, !11, i64 52, i64 4, !11, i64 56, i64 1, !15}
!20 = !{!21, !7, i64 8}
!21 = !{!"s2n_psk", !12, i64 0, !22, i64 8, !22, i64 32, !12, i64 56, !12, i64 60, !17, i64 64, !22, i64 72, !23, i64 96, !17, i64 160}
!22 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!23 = !{!"s2n_early_data_config", !12, i64 0, !8, i64 4, !7, i64 8, !22, i64 16, !22, i64 40}
!24 = !{!21, !12, i64 16}
!25 = !{!21, !7, i64 32}
!26 = !{!21, !12, i64 40}
!27 = !{!21, !12, i64 80}
!28 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!29 = !{!21, !7, i64 72}


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