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

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

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

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

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

18:                                               ; preds = %15
  br label %19

19:                                               ; preds = %18
  br label %20

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

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

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

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

47:                                               ; preds = %41
  %48 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %48, align 4, !tbaa !17
  br label %205

49:                                               ; No predecessors!
  br label %50

50:                                               ; preds = %49, %15
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.s2n_blob, ptr %53, i32 0, i32 1
  %55 = load i32, ptr %54, align 8, !tbaa !19
  %56 = icmp uge i32 %55, 13
  br i1 %56, label %89, label %57

57:                                               ; preds = %52
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  %60 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %61 = getelementptr inbounds %struct.s2n_debug_info, ptr %60, i32 0, i32 0
  store ptr @.str.1, ptr %61, align 8, !tbaa !12
  %62 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %63 = getelementptr inbounds %struct.s2n_debug_info, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !12
  %65 = getelementptr inbounds i8, ptr %64, i64 21
  %66 = call ptr @strrchr(ptr noundef %65, i32 noundef 47) #5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %75

68:                                               ; preds = %59
  %69 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %70 = getelementptr inbounds %struct.s2n_debug_info, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !12
  %72 = getelementptr inbounds i8, ptr %71, i64 21
  %73 = call ptr @strrchr(ptr noundef %72, i32 noundef 47) #5
  %74 = getelementptr inbounds i8, ptr %73, i64 1
  br label %80

75:                                               ; preds = %59
  %76 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %77 = getelementptr inbounds %struct.s2n_debug_info, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !12
  %79 = getelementptr inbounds i8, ptr %78, i64 21
  br label %80

80:                                               ; preds = %75, %68
  %81 = phi ptr [ %74, %68 ], [ %79, %75 ]
  %82 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %83 = getelementptr inbounds %struct.s2n_debug_info, ptr %82, i32 0, i32 1
  store ptr %81, ptr %83, align 8, !tbaa !14
  %84 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %84, align 4, !tbaa !15
  %85 = call i32 @s2n_calculate_stacktrace()
  br label %86

86:                                               ; preds = %80
  %87 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %87, align 4, !tbaa !17
  br label %205

88:                                               ; No predecessors!
  br label %89

89:                                               ; preds = %88, %52
  br label %90

90:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.s2n_blob, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  store ptr %93, ptr %12, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %90
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %99, label %97

97:                                               ; preds = %94
  %98 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %98, align 4, !tbaa !17
  store i32 1, ptr %13, align 4
  br label %204

99:                                               ; preds = %94
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store i64 0, ptr %14, align 8, !tbaa !22
  br label %102

102:                                              ; preds = %113, %101
  %103 = load i64, ptr %14, align 8, !tbaa !22
  %104 = icmp ult i64 %103, 8
  br i1 %104, label %105, label %116

105:                                              ; preds = %102
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = load i64, ptr %14, align 8, !tbaa !22
  %108 = getelementptr inbounds i8, ptr %106, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !9
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = load i64, ptr %14, align 8, !tbaa !22
  %112 = getelementptr inbounds i8, ptr %110, i64 %111
  store i8 %109, ptr %112, align 1, !tbaa !9
  br label %113

113:                                              ; preds = %105
  %114 = load i64, ptr %14, align 8, !tbaa !22
  %115 = add i64 %114, 1
  store i64 %115, ptr %14, align 8, !tbaa !22
  br label %102, !llvm.loop !24

116:                                              ; preds = %102
  %117 = load i8, ptr %9, align 1, !tbaa !9
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = load i64, ptr %14, align 8, !tbaa !22
  %120 = add i64 %119, 1
  store i64 %120, ptr %14, align 8, !tbaa !22
  %121 = getelementptr inbounds i8, ptr %118, i64 %119
  store i8 %117, ptr %121, align 1, !tbaa !9
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.s2n_connection, ptr %122, i32 0, i32 23
  %124 = load i8, ptr %123, align 4, !tbaa !26
  %125 = zext i8 %124 to i32
  %126 = sdiv i32 %125, 10
  %127 = trunc i32 %126 to i8
  %128 = load ptr, ptr %12, align 8, !tbaa !5
  %129 = load i64, ptr %14, align 8, !tbaa !22
  %130 = add i64 %129, 1
  store i64 %130, ptr %14, align 8, !tbaa !22
  %131 = getelementptr inbounds i8, ptr %128, i64 %129
  store i8 %127, ptr %131, align 1, !tbaa !9
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.s2n_connection, ptr %132, i32 0, i32 23
  %134 = load i8, ptr %133, align 4, !tbaa !26
  %135 = zext i8 %134 to i32
  %136 = srem i32 %135, 10
  %137 = trunc i32 %136 to i8
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = load i64, ptr %14, align 8, !tbaa !22
  %140 = add i64 %139, 1
  store i64 %140, ptr %14, align 8, !tbaa !22
  %141 = getelementptr inbounds i8, ptr %138, i64 %139
  store i8 %137, ptr %141, align 1, !tbaa !9
  %142 = load i16, ptr %10, align 2, !tbaa !10
  %143 = zext i16 %142 to i32
  %144 = ashr i32 %143, 8
  %145 = trunc i32 %144 to i8
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = load i64, ptr %14, align 8, !tbaa !22
  %148 = add i64 %147, 1
  store i64 %148, ptr %14, align 8, !tbaa !22
  %149 = getelementptr inbounds i8, ptr %146, i64 %147
  store i8 %145, ptr %149, align 1, !tbaa !9
  %150 = load i16, ptr %10, align 2, !tbaa !10
  %151 = zext i16 %150 to i32
  %152 = and i32 %151, 255
  %153 = trunc i32 %152 to i8
  %154 = load ptr, ptr %12, align 8, !tbaa !5
  %155 = load i64, ptr %14, align 8, !tbaa !22
  %156 = add i64 %155, 1
  store i64 %156, ptr %14, align 8, !tbaa !22
  %157 = getelementptr inbounds i8, ptr %154, i64 %155
  store i8 %153, ptr %157, align 1, !tbaa !9
  br label %158

158:                                              ; preds = %116
  %159 = load i64, ptr %14, align 8, !tbaa !22
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.s2n_blob, ptr %160, i32 0, i32 1
  %162 = load i32, ptr %161, align 8, !tbaa !19
  %163 = zext i32 %162 to i64
  %164 = icmp ule i64 %159, %163
  br i1 %164, label %199, label %165

165:                                              ; preds = %158
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  %168 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %169 = getelementptr inbounds %struct.s2n_debug_info, ptr %168, i32 0, i32 0
  store ptr @.str.2, ptr %169, align 8, !tbaa !12
  %170 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %171 = getelementptr inbounds %struct.s2n_debug_info, ptr %170, i32 0, i32 0
  %172 = load ptr, ptr %171, align 8, !tbaa !12
  %173 = getelementptr inbounds i8, ptr %172, i64 21
  %174 = call ptr @strrchr(ptr noundef %173, i32 noundef 47) #5
  %175 = icmp ne ptr %174, null
  br i1 %175, label %176, label %183

176:                                              ; preds = %167
  %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 0
  %179 = load ptr, ptr %178, align 8, !tbaa !12
  %180 = getelementptr inbounds i8, ptr %179, i64 21
  %181 = call ptr @strrchr(ptr noundef %180, i32 noundef 47) #5
  %182 = getelementptr inbounds i8, ptr %181, i64 1
  br label %188

183:                                              ; preds = %167
  %184 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %185 = getelementptr inbounds %struct.s2n_debug_info, ptr %184, i32 0, i32 0
  %186 = load ptr, ptr %185, align 8, !tbaa !12
  %187 = getelementptr inbounds i8, ptr %186, i64 21
  br label %188

188:                                              ; preds = %183, %176
  %189 = phi ptr [ %182, %176 ], [ %187, %183 ]
  %190 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %191 = getelementptr inbounds %struct.s2n_debug_info, ptr %190, i32 0, i32 1
  store ptr %189, ptr %191, align 8, !tbaa !14
  %192 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653194, ptr %192, align 4, !tbaa !15
  %193 = call i32 @s2n_calculate_stacktrace()
  br label %194

194:                                              ; preds = %188
  br label %195

195:                                              ; preds = %194
  %196 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 -1, ptr %196, align 4, !tbaa !17
  store i32 1, ptr %13, align 4
  br label %203

197:                                              ; No predecessors!
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198, %158
  br label %200

200:                                              ; preds = %199
  br label %201

201:                                              ; preds = %200
  %202 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  store i32 0, ptr %202, align 4, !tbaa !17
  store i32 1, ptr %13, align 4
  br label %203

203:                                              ; preds = %201, %195
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %204

204:                                              ; preds = %203, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %205

205:                                              ; preds = %204, %86, %47
  %206 = getelementptr inbounds %struct.s2n_result, ptr %6, i32 0, i32 0
  %207 = load i32, ptr %206, align 4
  ret i32 %207
}

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #4

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { nounwind willreturn memory(read) }
attributes #6 = { nounwind }

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

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


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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_aead_aad_init(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i8 noundef zeroext %2, i16 noundef zeroext %3, ptr noundef readonly %4) local_unnamed_addr #0 {
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %.sink.split, label %6

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %4, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp ugt i32 %8, 12
  br i1 %9, label %10, label %.sink.split

10:                                               ; preds = %6
  %11 = load ptr, ptr %4, align 8, !tbaa !11
  %.not33 = icmp eq ptr %11, null
  br i1 %.not33, label %55, label %.preheader.preheader

.preheader.preheader:                             ; preds = %10
  %12 = load i8, ptr %1, align 1, !tbaa !12
  store i8 %12, ptr %11, align 1, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %1, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %11, i64 1
  store i8 %14, ptr %15, align 1, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %1, i64 2
  %17 = load i8, ptr %16, align 1, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %11, i64 2
  store i8 %17, ptr %18, align 1, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %1, i64 3
  %20 = load i8, ptr %19, align 1, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %11, i64 3
  store i8 %20, ptr %21, align 1, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %1, i64 4
  %23 = load i8, ptr %22, align 1, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %11, i64 4
  store i8 %23, ptr %24, align 1, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %1, i64 5
  %26 = load i8, ptr %25, align 1, !tbaa !12
  %27 = getelementptr inbounds i8, ptr %11, i64 5
  store i8 %26, ptr %27, align 1, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %1, i64 6
  %29 = load i8, ptr %28, align 1, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %11, i64 6
  store i8 %29, ptr %30, align 1, !tbaa !12
  %31 = getelementptr inbounds i8, ptr %1, i64 7
  %32 = load i8, ptr %31, align 1, !tbaa !12
  %33 = getelementptr inbounds i8, ptr %11, i64 7
  store i8 %32, ptr %33, align 1, !tbaa !12
  %34 = getelementptr inbounds i8, ptr %11, i64 8
  store i8 %2, ptr %34, align 1, !tbaa !12
  %35 = getelementptr inbounds i8, ptr %0, i64 220
  %36 = load i8, ptr %35, align 4, !tbaa !13
  %37 = udiv i8 %36, 10
  %38 = getelementptr inbounds i8, ptr %11, i64 9
  store i8 %37, ptr %38, align 1, !tbaa !12
  %39 = load i8, ptr %35, align 4, !tbaa !13
  %40 = urem i8 %39, 10
  %41 = getelementptr inbounds i8, ptr %11, i64 10
  store i8 %40, ptr %41, align 1, !tbaa !12
  %42 = lshr i16 %3, 8
  %43 = trunc nuw i16 %42 to i8
  %44 = getelementptr inbounds i8, ptr %11, i64 11
  store i8 %43, ptr %44, align 1, !tbaa !12
  %45 = trunc i16 %3 to i8
  %46 = getelementptr inbounds i8, ptr %11, i64 12
  store i8 %45, ptr %46, align 1, !tbaa !12
  %47 = load i32, ptr %7, align 8, !tbaa !5
  %.not34 = icmp ult i32 %47, 13
  br i1 %.not34, label %.sink.split, label %55

.sink.split:                                      ; preds = %.preheader.preheader, %6, %5
  %.str.2.sink = phi ptr [ @.str, %5 ], [ @.str.1, %6 ], [ @.str.2, %.preheader.preheader ]
  %.sink45 = phi ptr [ getelementptr inbounds (i8, ptr @.str, i64 21), %5 ], [ getelementptr inbounds (i8, ptr @.str.1, i64 21), %6 ], [ getelementptr inbounds (i8, ptr @.str.2, i64 21), %.preheader.preheader ]
  %.sink = phi i32 [ 402653193, %5 ], [ 402653194, %6 ], [ 402653194, %.preheader.preheader ]
  %48 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr %.str.2.sink, ptr %48, align 8, !tbaa !40
  %49 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) %.sink45, i32 noundef 47) #4
  %.not35 = icmp eq ptr %49, null
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = select i1 %.not35, ptr %.sink45, ptr %50
  %52 = getelementptr inbounds i8, ptr %48, i64 8
  store ptr %51, ptr %52, align 8, !tbaa !42
  %53 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 %.sink, ptr %53, align 4, !tbaa !43
  %54 = tail call i32 @s2n_calculate_stacktrace() #5
  br label %55

55:                                               ; preds = %.sink.split, %10, %.preheader.preheader
  %.sroa.0.2 = phi i32 [ -1, %10 ], [ 0, %.preheader.preheader ], [ -1, %.sink.split ]
  ret i32 %.sroa.0.2
}

; 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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass