; LLVM IR from tleonhardt/practical_cryptography_engineering :: mbedtls (ssl_tls)

; 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.mbedtls_ssl_context = type { ptr, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64, i64, i16, i64, i64, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64, i64, i8, i32, ptr, ptr, ptr, i64, i32, i64, [12 x i8], [12 x i8] }
%struct.mbedtls_ssl_config = type { [4 x ptr], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.mbedtls_mpi, %struct.mbedtls_mpi, ptr, i64, ptr, i64, ptr, i32, i32, i32, i32, [8 x i8], i32, i32, i8, i8, i8, i8, i32 }
%struct.mbedtls_mpi = type { i32, i64, ptr }
%struct.mbedtls_ssl_handshake_params = type { %struct.mbedtls_ssl_sig_hash_set_t, %struct.mbedtls_dhm_context, %struct.mbedtls_ecdh_context, ptr, ptr, i64, ptr, i32, ptr, ptr, ptr, i32, i32, ptr, i8, ptr, i32, i8, ptr, ptr, i32, ptr, [8 x i8], %struct.mbedtls_md5_context, %struct.mbedtls_sha1_context, %struct.mbedtls_sha256_context, %struct.mbedtls_sha512_context, ptr, ptr, ptr, ptr, i64, [64 x i8], [1060 x i8], i32, i32, i32, i32, i32, i32 }
%struct.mbedtls_ssl_sig_hash_set_t = type { i32, i32 }
%struct.mbedtls_dhm_context = type { i64, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi }
%struct.mbedtls_ecdh_context = type { %struct.mbedtls_ecp_group, %struct.mbedtls_mpi, %struct.mbedtls_ecp_point, %struct.mbedtls_ecp_point, %struct.mbedtls_mpi, i32, %struct.mbedtls_ecp_point, %struct.mbedtls_ecp_point, %struct.mbedtls_mpi }
%struct.mbedtls_ecp_group = type { i32, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_ecp_point, %struct.mbedtls_mpi, i64, i64, i32, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.mbedtls_ecp_point = type { %struct.mbedtls_mpi, %struct.mbedtls_mpi, %struct.mbedtls_mpi }
%struct.mbedtls_md5_context = type { [2 x i32], [4 x i32], [64 x i8] }
%struct.mbedtls_sha1_context = type { [2 x i32], [5 x i32], [64 x i8] }
%struct.mbedtls_sha256_context = type { [2 x i32], [8 x i32], [64 x i8], i32 }
%struct.mbedtls_sha512_context = type { [2 x i64], [8 x i64], [128 x i8], i32 }

@.str = external hidden unnamed_addr constant [97 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [16 x i8], align 1

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

declare void @mbedtls_debug_print_msg(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

declare void @mbedtls_debug_print_buf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) #1

declare void @mbedtls_debug_print_ret(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ssl_flush_output(ptr noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @mbedtls_ssl_hdr_len(ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_write_record(ptr noundef %0) #4 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %9, i32 0, i32 47
  %11 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %11, ptr %7, align 8, !tbaa !15
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %12, i32 noundef 2, ptr noundef @.str, i32 noundef 2701, ptr noundef @.str.49)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %15, i32 0, i32 46
  %17 = load i32, ptr %16, align 4
  %18 = lshr i32 %17, 1
  %19 = and i32 %18, 1
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %35

21:                                               ; preds = %1
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %22, i32 0, i32 15
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %35

26:                                               ; preds = %21
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %27, i32 0, i32 15
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %29, i32 0, i32 17
  %31 = load i8, ptr %30, align 4, !tbaa !18
  %32 = zext i8 %31 to i32
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %34, label %35

34:                                               ; preds = %26
  br label %175

35:                                               ; preds = %26, %21, %1
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %36, i32 0, i32 46
  %38 = load i32, ptr %37, align 8, !tbaa !30
  %39 = icmp eq i32 %38, 22
  br i1 %39, label %40, label %174

40:                                               ; preds = %35
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %41, i32 0, i32 45
  %43 = load ptr, ptr %42, align 8, !tbaa !31
  %44 = getelementptr inbounds i8, ptr %43, i64 0
  %45 = load i8, ptr %44, align 1, !tbaa !32
  %46 = zext i8 %45 to i32
  store i32 %46, ptr %6, align 4, !tbaa !9
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %56

49:                                               ; preds = %40
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %50, i32 0, i32 15
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %56

54:                                               ; preds = %49
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %55, i32 noundef 1, ptr noundef @.str, i32 noundef 2719, ptr noundef @.str.4)
  store i32 -27648, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %349

56:                                               ; preds = %49, %40
  %57 = load i64, ptr %7, align 8, !tbaa !15
  %58 = sub i64 %57, 4
  %59 = lshr i64 %58, 16
  %60 = trunc i64 %59 to i8
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %61, i32 0, i32 45
  %63 = load ptr, ptr %62, align 8, !tbaa !31
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  store i8 %60, ptr %64, align 1, !tbaa !32
  %65 = load i64, ptr %7, align 8, !tbaa !15
  %66 = sub i64 %65, 4
  %67 = lshr i64 %66, 8
  %68 = trunc i64 %67 to i8
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %69, i32 0, i32 45
  %71 = load ptr, ptr %70, align 8, !tbaa !31
  %72 = getelementptr inbounds i8, ptr %71, i64 2
  store i8 %68, ptr %72, align 1, !tbaa !32
  %73 = load i64, ptr %7, align 8, !tbaa !15
  %74 = sub i64 %73, 4
  %75 = trunc i64 %74 to i8
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %76, i32 0, i32 45
  %78 = load ptr, ptr %77, align 8, !tbaa !31
  %79 = getelementptr inbounds i8, ptr %78, i64 3
  store i8 %75, ptr %79, align 1, !tbaa !32
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !16
  %83 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %82, i32 0, i32 46
  %84 = load i32, ptr %83, align 4
  %85 = lshr i32 %84, 1
  %86 = and i32 %85, 1
  %87 = icmp eq i32 %86, 1
  br i1 %87, label %88, label %159

88:                                               ; preds = %56
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %89, i32 0, i32 45
  %91 = load ptr, ptr %90, align 8, !tbaa !31
  %92 = getelementptr inbounds i8, ptr %91, i64 12
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %93, i32 0, i32 45
  %95 = load ptr, ptr %94, align 8, !tbaa !31
  %96 = getelementptr inbounds i8, ptr %95, i64 4
  %97 = load i64, ptr %7, align 8, !tbaa !15
  %98 = sub i64 %97, 4
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %92, ptr align 1 %96, i64 %98, i1 false)
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %99, i32 0, i32 47
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = add i64 %101, 8
  store i64 %102, ptr %100, align 8, !tbaa !11
  %103 = load i64, ptr %7, align 8, !tbaa !15
  %104 = add i64 %103, 8
  store i64 %104, ptr %7, align 8, !tbaa !15
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %137

107:                                              ; preds = %88
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %108, i32 0, i32 15
  %110 = load ptr, ptr %109, align 8, !tbaa !17
  %111 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %110, i32 0, i32 11
  %112 = load i32, ptr %111, align 8, !tbaa !33
  %113 = lshr i32 %112, 8
  %114 = and i32 %113, 255
  %115 = trunc i32 %114 to i8
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %116, i32 0, i32 45
  %118 = load ptr, ptr %117, align 8, !tbaa !31
  %119 = getelementptr inbounds i8, ptr %118, i64 4
  store i8 %115, ptr %119, align 1, !tbaa !32
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %120, i32 0, i32 15
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %122, i32 0, i32 11
  %124 = load i32, ptr %123, align 8, !tbaa !33
  %125 = and i32 %124, 255
  %126 = trunc i32 %125 to i8
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %127, i32 0, i32 45
  %129 = load ptr, ptr %128, align 8, !tbaa !31
  %130 = getelementptr inbounds i8, ptr %129, i64 5
  store i8 %126, ptr %130, align 1, !tbaa !32
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %131, i32 0, i32 15
  %133 = load ptr, ptr %132, align 8, !tbaa !17
  %134 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %133, i32 0, i32 11
  %135 = load i32, ptr %134, align 8, !tbaa !33
  %136 = add i32 %135, 1
  store i32 %136, ptr %134, align 8, !tbaa !33
  br label %146

137:                                              ; preds = %88
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %138, i32 0, i32 45
  %140 = load ptr, ptr %139, align 8, !tbaa !31
  %141 = getelementptr inbounds i8, ptr %140, i64 4
  store i8 0, ptr %141, align 1, !tbaa !32
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %142, i32 0, i32 45
  %144 = load ptr, ptr %143, align 8, !tbaa !31
  %145 = getelementptr inbounds i8, ptr %144, i64 5
  store i8 0, ptr %145, align 1, !tbaa !32
  br label %146

146:                                              ; preds = %137, %107
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %147, i32 0, i32 45
  %149 = load ptr, ptr %148, align 8, !tbaa !31
  %150 = getelementptr inbounds i8, ptr %149, i64 6
  call void @llvm.memset.p0.i64(ptr align 1 %150, i8 0, i64 3, i1 false)
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %151, i32 0, i32 45
  %153 = load ptr, ptr %152, align 8, !tbaa !31
  %154 = getelementptr inbounds i8, ptr %153, i64 9
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %155, i32 0, i32 45
  %157 = load ptr, ptr %156, align 8, !tbaa !31
  %158 = getelementptr inbounds i8, ptr %157, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %154, ptr align 1 %158, i64 3, i1 false)
  br label %159

159:                                              ; preds = %146, %56
  %160 = load i32, ptr %6, align 4, !tbaa !9
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %173

162:                                              ; preds = %159
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %163, i32 0, i32 15
  %165 = load ptr, ptr %164, align 8, !tbaa !17
  %166 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %165, i32 0, i32 27
  %167 = load ptr, ptr %166, align 8, !tbaa !34
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = load ptr, ptr %3, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %169, i32 0, i32 45
  %171 = load ptr, ptr %170, align 8, !tbaa !31
  %172 = load i64, ptr %7, align 8, !tbaa !15
  call void %167(ptr noundef %168, ptr noundef %171, i64 noundef %172)
  br label %173

173:                                              ; preds = %162, %159
  br label %174

174:                                              ; preds = %173, %35
  br label %175

175:                                              ; preds = %174, %34
  %176 = load ptr, ptr %3, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %176, i32 0, i32 0
  %178 = load ptr, ptr %177, align 8, !tbaa !16
  %179 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %178, i32 0, i32 46
  %180 = load i32, ptr %179, align 4
  %181 = lshr i32 %180, 1
  %182 = and i32 %181, 1
  %183 = icmp eq i32 %182, 1
  br i1 %183, label %184, label %216

184:                                              ; preds = %175
  %185 = load ptr, ptr %3, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %185, i32 0, i32 15
  %187 = load ptr, ptr %186, align 8, !tbaa !17
  %188 = icmp ne ptr %187, null
  br i1 %188, label %189, label %216

189:                                              ; preds = %184
  %190 = load ptr, ptr %3, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %190, i32 0, i32 15
  %192 = load ptr, ptr %191, align 8, !tbaa !17
  %193 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %192, i32 0, i32 17
  %194 = load i8, ptr %193, align 4, !tbaa !18
  %195 = zext i8 %194 to i32
  %196 = icmp ne i32 %195, 1
  br i1 %196, label %197, label %216

197:                                              ; preds = %189
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %198, i32 0, i32 46
  %200 = load i32, ptr %199, align 8, !tbaa !30
  %201 = icmp eq i32 %200, 20
  br i1 %201, label %207, label %202

202:                                              ; preds = %197
  %203 = load ptr, ptr %3, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %203, i32 0, i32 46
  %205 = load i32, ptr %204, align 8, !tbaa !30
  %206 = icmp eq i32 %205, 22
  br i1 %206, label %207, label %216

207:                                              ; preds = %202, %197
  %208 = load ptr, ptr %3, align 8, !tbaa !5
  %209 = call i32 @ssl_flight_append(ptr noundef %208)
  store i32 %209, ptr %4, align 4, !tbaa !9
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %215

211:                                              ; preds = %207
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = load i32, ptr %4, align 4, !tbaa !9
  call void @mbedtls_debug_print_ret(ptr noundef %212, i32 noundef 1, ptr noundef @.str, i32 noundef 2775, ptr noundef @.str.50, i32 noundef %213)
  %214 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %214, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %349

215:                                              ; preds = %207
  br label %216

216:                                              ; preds = %215, %202, %189, %184, %175
  %217 = load i32, ptr %5, align 4, !tbaa !9
  %218 = icmp ne i32 %217, 0
  br i1 %218, label %339, label %219

219:                                              ; preds = %216
  %220 = load ptr, ptr %3, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %220, i32 0, i32 46
  %222 = load i32, ptr %221, align 8, !tbaa !30
  %223 = trunc i32 %222 to i8
  %224 = load ptr, ptr %3, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %224, i32 0, i32 42
  %226 = load ptr, ptr %225, align 8, !tbaa !35
  %227 = getelementptr inbounds i8, ptr %226, i64 0
  store i8 %223, ptr %227, align 1, !tbaa !32
  %228 = load ptr, ptr %3, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %228, i32 0, i32 4
  %230 = load i32, ptr %229, align 4, !tbaa !36
  %231 = load ptr, ptr %3, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %231, i32 0, i32 5
  %233 = load i32, ptr %232, align 8, !tbaa !37
  %234 = load ptr, ptr %3, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %234, i32 0, i32 0
  %236 = load ptr, ptr %235, align 8, !tbaa !16
  %237 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %236, i32 0, i32 46
  %238 = load i32, ptr %237, align 4
  %239 = lshr i32 %238, 1
  %240 = and i32 %239, 1
  %241 = load ptr, ptr %3, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %241, i32 0, i32 42
  %243 = load ptr, ptr %242, align 8, !tbaa !35
  %244 = getelementptr inbounds i8, ptr %243, i64 1
  call void @mbedtls_ssl_write_version(i32 noundef %230, i32 noundef %233, i32 noundef %240, ptr noundef %244)
  %245 = load i64, ptr %7, align 8, !tbaa !15
  %246 = lshr i64 %245, 8
  %247 = trunc i64 %246 to i8
  %248 = load ptr, ptr %3, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %248, i32 0, i32 43
  %250 = load ptr, ptr %249, align 8, !tbaa !38
  %251 = getelementptr inbounds i8, ptr %250, i64 0
  store i8 %247, ptr %251, align 1, !tbaa !32
  %252 = load i64, ptr %7, align 8, !tbaa !15
  %253 = trunc i64 %252 to i8
  %254 = load ptr, ptr %3, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %254, i32 0, i32 43
  %256 = load ptr, ptr %255, align 8, !tbaa !38
  %257 = getelementptr inbounds i8, ptr %256, i64 1
  store i8 %253, ptr %257, align 1, !tbaa !32
  %258 = load ptr, ptr %3, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %258, i32 0, i32 17
  %260 = load ptr, ptr %259, align 8, !tbaa !39
  %261 = icmp ne ptr %260, null
  br i1 %261, label %262, label %287

262:                                              ; preds = %219
  %263 = load ptr, ptr %3, align 8, !tbaa !5
  %264 = call i32 @ssl_encrypt_buf(ptr noundef %263)
  store i32 %264, ptr %4, align 4, !tbaa !9
  %265 = icmp ne i32 %264, 0
  br i1 %265, label %266, label %270

266:                                              ; preds = %262
  %267 = load ptr, ptr %3, align 8, !tbaa !5
  %268 = load i32, ptr %4, align 4, !tbaa !9
  call void @mbedtls_debug_print_ret(ptr noundef %267, i32 noundef 1, ptr noundef @.str, i32 noundef 2824, ptr noundef @.str.51, i32 noundef %268)
  %269 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %269, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %349

270:                                              ; preds = %262
  %271 = load ptr, ptr %3, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %271, i32 0, i32 47
  %273 = load i64, ptr %272, align 8, !tbaa !11
  store i64 %273, ptr %7, align 8, !tbaa !15
  %274 = load i64, ptr %7, align 8, !tbaa !15
  %275 = lshr i64 %274, 8
  %276 = trunc i64 %275 to i8
  %277 = load ptr, ptr %3, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %277, i32 0, i32 43
  %279 = load ptr, ptr %278, align 8, !tbaa !38
  %280 = getelementptr inbounds i8, ptr %279, i64 0
  store i8 %276, ptr %280, align 1, !tbaa !32
  %281 = load i64, ptr %7, align 8, !tbaa !15
  %282 = trunc i64 %281 to i8
  %283 = load ptr, ptr %3, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %283, i32 0, i32 43
  %285 = load ptr, ptr %284, align 8, !tbaa !38
  %286 = getelementptr inbounds i8, ptr %285, i64 1
  store i8 %282, ptr %286, align 1, !tbaa !32
  br label %287

287:                                              ; preds = %270, %219
  %288 = load ptr, ptr %3, align 8, !tbaa !5
  %289 = call i64 @mbedtls_ssl_hdr_len(ptr noundef %288)
  %290 = load ptr, ptr %3, align 8, !tbaa !5
  %291 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %290, i32 0, i32 47
  %292 = load i64, ptr %291, align 8, !tbaa !11
  %293 = add i64 %289, %292
  %294 = load ptr, ptr %3, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %294, i32 0, i32 48
  store i64 %293, ptr %295, align 8, !tbaa !40
  %296 = load ptr, ptr %3, align 8, !tbaa !5
  %297 = load ptr, ptr %3, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %297, i32 0, i32 42
  %299 = load ptr, ptr %298, align 8, !tbaa !35
  %300 = getelementptr inbounds i8, ptr %299, i64 0
  %301 = load i8, ptr %300, align 1, !tbaa !32
  %302 = zext i8 %301 to i32
  %303 = load ptr, ptr %3, align 8, !tbaa !5
  %304 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %303, i32 0, i32 42
  %305 = load ptr, ptr %304, align 8, !tbaa !35
  %306 = getelementptr inbounds i8, ptr %305, i64 1
  %307 = load i8, ptr %306, align 1, !tbaa !32
  %308 = zext i8 %307 to i32
  %309 = load ptr, ptr %3, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %309, i32 0, i32 42
  %311 = load ptr, ptr %310, align 8, !tbaa !35
  %312 = getelementptr inbounds i8, ptr %311, i64 2
  %313 = load i8, ptr %312, align 1, !tbaa !32
  %314 = zext i8 %313 to i32
  %315 = load ptr, ptr %3, align 8, !tbaa !5
  %316 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %315, i32 0, i32 43
  %317 = load ptr, ptr %316, align 8, !tbaa !38
  %318 = getelementptr inbounds i8, ptr %317, i64 0
  %319 = load i8, ptr %318, align 1, !tbaa !32
  %320 = zext i8 %319 to i32
  %321 = shl i32 %320, 8
  %322 = load ptr, ptr %3, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %322, i32 0, i32 43
  %324 = load ptr, ptr %323, align 8, !tbaa !38
  %325 = getelementptr inbounds i8, ptr %324, i64 1
  %326 = load i8, ptr %325, align 1, !tbaa !32
  %327 = zext i8 %326 to i32
  %328 = or i32 %321, %327
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %296, i32 noundef 3, ptr noundef @.str, i32 noundef 2838, ptr noundef @.str.52, i32 noundef %302, i32 noundef %308, i32 noundef %314, i32 noundef %328)
  %329 = load ptr, ptr %3, align 8, !tbaa !5
  %330 = load ptr, ptr %3, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %330, i32 0, i32 42
  %332 = load ptr, ptr %331, align 8, !tbaa !35
  %333 = load ptr, ptr %3, align 8, !tbaa !5
  %334 = call i64 @mbedtls_ssl_hdr_len(ptr noundef %333)
  %335 = load ptr, ptr %3, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %335, i32 0, i32 47
  %337 = load i64, ptr %336, align 8, !tbaa !11
  %338 = add i64 %334, %337
  call void @mbedtls_debug_print_buf(ptr noundef %329, i32 noundef 4, ptr noundef @.str, i32 noundef 2841, ptr noundef @.str.53, ptr noundef %332, i64 noundef %338)
  br label %339

339:                                              ; preds = %287, %216
  %340 = load ptr, ptr %3, align 8, !tbaa !5
  %341 = call i32 @mbedtls_ssl_flush_output(ptr noundef %340)
  store i32 %341, ptr %4, align 4, !tbaa !9
  %342 = icmp ne i32 %341, 0
  br i1 %342, label %343, label %347

343:                                              ; preds = %339
  %344 = load ptr, ptr %3, align 8, !tbaa !5
  %345 = load i32, ptr %4, align 4, !tbaa !9
  call void @mbedtls_debug_print_ret(ptr noundef %344, i32 noundef 1, ptr noundef @.str, i32 noundef 2846, ptr noundef @.str.54, i32 noundef %345)
  %346 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %346, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %349

347:                                              ; preds = %339
  %348 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %348, i32 noundef 2, ptr noundef @.str, i32 noundef 2850, ptr noundef @.str.55)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %349

349:                                              ; preds = %347, %343, %266, %211, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %350 = load i32, ptr %2, align 4
  ret i32 %350
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_flight_append(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_ssl_write_version(i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_encrypt_buf(ptr noundef) #4

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 344}
!12 = !{!"mbedtls_ssl_context", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !10, i64 216, !13, i64 224, !13, i64 232, !14, i64 240, !13, i64 248, !13, i64 256, !13, i64 264, !13, i64 272, !10, i64 280, !10, i64 284, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !10, i64 336, !13, i64 344, !13, i64 352, !7, i64 360, !10, i64 364, !6, i64 368, !6, i64 376, !6, i64 384, !13, i64 392, !10, i64 400, !13, i64 408, !7, i64 416, !7, i64 428}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!12, !6, i64 0}
!17 = !{!12, !6, i64 96}
!18 = !{!19, !7, i64 972}
!19 = !{!"mbedtls_ssl_handshake_params", !20, i64 0, !21, i64 8, !23, i64 256, !6, i64 872, !6, i64 880, !13, i64 888, !6, i64 896, !10, i64 904, !6, i64 912, !6, i64 920, !6, i64 928, !10, i64 936, !10, i64 940, !6, i64 944, !7, i64 952, !6, i64 960, !10, i64 968, !7, i64 972, !6, i64 976, !6, i64 984, !10, i64 992, !6, i64 1000, !7, i64 1008, !26, i64 1016, !27, i64 1104, !28, i64 1196, !29, i64 1304, !6, i64 1520, !6, i64 1528, !6, i64 1536, !6, i64 1544, !13, i64 1552, !7, i64 1560, !7, i64 1624, !10, i64 2684, !10, i64 2688, !10, i64 2692, !10, i64 2696, !10, i64 2700, !10, i64 2704}
!20 = !{!"mbedtls_ssl_sig_hash_set_t", !10, i64 0, !10, i64 4}
!21 = !{!"", !13, i64 0, !22, i64 8, !22, i64 32, !22, i64 56, !22, i64 80, !22, i64 104, !22, i64 128, !22, i64 152, !22, i64 176, !22, i64 200, !22, i64 224}
!22 = !{!"", !10, i64 0, !13, i64 8, !6, i64 16}
!23 = !{!"", !24, i64 0, !22, i64 248, !25, i64 272, !25, i64 344, !22, i64 416, !10, i64 440, !25, i64 448, !25, i64 520, !22, i64 592}
!24 = !{!"", !10, i64 0, !22, i64 8, !22, i64 32, !22, i64 56, !25, i64 80, !22, i64 152, !13, i64 176, !13, i64 184, !10, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !13, i64 240}
!25 = !{!"", !22, i64 0, !22, i64 24, !22, i64 48}
!26 = !{!"", !7, i64 0, !7, i64 8, !7, i64 24}
!27 = !{!"", !7, i64 0, !7, i64 8, !7, i64 28}
!28 = !{!"", !7, i64 0, !7, i64 8, !7, i64 40, !10, i64 104}
!29 = !{!"", !7, i64 0, !7, i64 16, !7, i64 80, !10, i64 208}
!30 = !{!12, !10, i64 336}
!31 = !{!12, !6, i64 328}
!32 = !{!7, !7, i64 0}
!33 = !{!19, !10, i64 936}
!34 = !{!19, !6, i64 1520}
!35 = !{!12, !6, i64 304}
!36 = !{!12, !10, i64 20}
!37 = !{!12, !10, i64 24}
!38 = !{!12, !6, i64 312}
!39 = !{!12, !6, i64 112}
!40 = !{!12, !13, i64 352}


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

@.str = external hidden unnamed_addr constant [97 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [16 x i8], align 1

declare void @mbedtls_debug_print_msg(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

declare void @mbedtls_debug_print_buf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @mbedtls_debug_print_ret(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ssl_flush_output(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @mbedtls_ssl_hdr_len(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_write_record(ptr noundef %0) local_unnamed_addr #3 {
  %2 = getelementptr inbounds i8, ptr %0, i64 344
  %3 = load i64, ptr %2, align 8, !tbaa !5
  tail call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %0, i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 2701, ptr noundef nonnull @.str.49) #5
  %4 = load ptr, ptr %0, align 8, !tbaa !13
  %5 = getelementptr inbounds i8, ptr %4, i64 372
  %6 = load i32, ptr %5, align 4
  %7 = and i32 %6, 2
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %15, label %8

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %.not93 = icmp eq ptr %10, null
  br i1 %.not93, label %15, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %10, i64 972
  %13 = load i8, ptr %12, align 4, !tbaa !15
  %14 = icmp eq i8 %13, 1
  br i1 %14, label %88, label %15

15:                                               ; preds = %11, %8, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 336
  %17 = load i32, ptr %16, align 8, !tbaa !27
  %18 = icmp eq i32 %17, 22
  br i1 %18, label %19, label %88

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %0, i64 328
  %21 = load ptr, ptr %20, align 8, !tbaa !28
  %22 = load i8, ptr %21, align 1, !tbaa !29
  %.not94 = icmp eq i8 %22, 0
  br i1 %.not94, label %28, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %0, i64 96
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %23
  tail call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2719, ptr noundef nonnull @.str.4) #5
  br label %171

28:                                               ; preds = %23, %19
  %29 = add i64 %3, -4
  %30 = lshr i64 %29, 16
  %31 = trunc i64 %30 to i8
  %32 = getelementptr inbounds i8, ptr %21, i64 1
  store i8 %31, ptr %32, align 1, !tbaa !29
  %33 = lshr i64 %29, 8
  %34 = trunc i64 %33 to i8
  %35 = load ptr, ptr %20, align 8, !tbaa !28
  %36 = getelementptr inbounds i8, ptr %35, i64 2
  store i8 %34, ptr %36, align 1, !tbaa !29
  %37 = trunc i64 %29 to i8
  %38 = load ptr, ptr %20, align 8, !tbaa !28
  %39 = getelementptr inbounds i8, ptr %38, i64 3
  store i8 %37, ptr %39, align 1, !tbaa !29
  %40 = load ptr, ptr %0, align 8, !tbaa !13
  %41 = getelementptr inbounds i8, ptr %40, i64 372
  %42 = load i32, ptr %41, align 4
  %43 = and i32 %42, 2
  %.not95 = icmp eq i32 %43, 0
  br i1 %.not95, label %81, label %44

44:                                               ; preds = %28
  %45 = load ptr, ptr %20, align 8, !tbaa !28
  %46 = getelementptr inbounds i8, ptr %45, i64 12
  %47 = getelementptr inbounds i8, ptr %45, i64 4
  tail call void @llvm.memmove.p0.p0.i64(ptr nonnull align 1 %46, ptr nonnull align 1 %47, i64 %29, i1 false)
  %48 = load i64, ptr %2, align 8, !tbaa !5
  %49 = add i64 %48, 8
  store i64 %49, ptr %2, align 8, !tbaa !5
  %50 = add i64 %3, 8
  br i1 %.not94, label %70, label %51

51:                                               ; preds = %44
  %52 = getelementptr inbounds i8, ptr %0, i64 96
  %53 = load ptr, ptr %52, align 8, !tbaa !14
  %54 = getelementptr inbounds i8, ptr %53, i64 936
  %55 = load i32, ptr %54, align 8, !tbaa !30
  %56 = lshr i32 %55, 8
  %57 = trunc i32 %56 to i8
  %58 = load ptr, ptr %20, align 8, !tbaa !28
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  store i8 %57, ptr %59, align 1, !tbaa !29
  %60 = load ptr, ptr %52, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %60, i64 936
  %62 = load i32, ptr %61, align 8, !tbaa !30
  %63 = trunc i32 %62 to i8
  %64 = load ptr, ptr %20, align 8, !tbaa !28
  %65 = getelementptr inbounds i8, ptr %64, i64 5
  store i8 %63, ptr %65, align 1, !tbaa !29
  %66 = load ptr, ptr %52, align 8, !tbaa !14
  %67 = getelementptr inbounds i8, ptr %66, i64 936
  %68 = load i32, ptr %67, align 8, !tbaa !30
  %69 = add i32 %68, 1
  store i32 %69, ptr %67, align 8, !tbaa !30
  br label %75

70:                                               ; preds = %44
  %71 = load ptr, ptr %20, align 8, !tbaa !28
  %72 = getelementptr inbounds i8, ptr %71, i64 4
  store i8 0, ptr %72, align 1, !tbaa !29
  %73 = load ptr, ptr %20, align 8, !tbaa !28
  %74 = getelementptr inbounds i8, ptr %73, i64 5
  store i8 0, ptr %74, align 1, !tbaa !29
  br label %75

75:                                               ; preds = %70, %51
  %76 = load ptr, ptr %20, align 8, !tbaa !28
  %77 = getelementptr inbounds i8, ptr %76, i64 6
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %77, i8 0, i64 3, i1 false)
  %78 = load ptr, ptr %20, align 8, !tbaa !28
  %79 = getelementptr inbounds i8, ptr %78, i64 9
  %80 = getelementptr inbounds i8, ptr %78, i64 1
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %79, ptr noundef nonnull align 1 dereferenceable(3) %80, i64 3, i1 false)
  br label %81

81:                                               ; preds = %75, %28
  %.0 = phi i64 [ %50, %75 ], [ %3, %28 ]
  br i1 %.not94, label %88, label %82

82:                                               ; preds = %81
  %83 = getelementptr inbounds i8, ptr %0, i64 96
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = getelementptr inbounds i8, ptr %84, i64 1520
  %86 = load ptr, ptr %85, align 8, !tbaa !31
  %87 = load ptr, ptr %20, align 8, !tbaa !28
  tail call void %86(ptr noundef nonnull %0, ptr noundef %87, i64 noundef %.0) #5
  br label %88

88:                                               ; preds = %15, %82, %81, %11
  %.1 = phi i64 [ %3, %11 ], [ %.0, %82 ], [ %.0, %81 ], [ %3, %15 ]
  %89 = load ptr, ptr %0, align 8, !tbaa !13
  %90 = getelementptr inbounds i8, ptr %89, i64 372
  %91 = load i32, ptr %90, align 4
  %92 = and i32 %91, 2
  %.not96 = icmp eq i32 %92, 0
  br i1 %.not96, label %105, label %93

93:                                               ; preds = %88
  %94 = getelementptr inbounds i8, ptr %0, i64 96
  %95 = load ptr, ptr %94, align 8, !tbaa !14
  %.not97 = icmp eq ptr %95, null
  br i1 %.not97, label %105, label %96

96:                                               ; preds = %93
  %97 = getelementptr inbounds i8, ptr %95, i64 972
  %98 = load i8, ptr %97, align 4, !tbaa !15
  %.not98 = icmp eq i8 %98, 1
  br i1 %.not98, label %105, label %99

99:                                               ; preds = %96
  %100 = getelementptr inbounds i8, ptr %0, i64 336
  %101 = load i32, ptr %100, align 8, !tbaa !27
  switch i32 %101, label %105 [
    i32 20, label %102
    i32 22, label %102
  ]

102:                                              ; preds = %99, %99
  %103 = tail call i32 @ssl_flight_append(ptr noundef nonnull %0)
  %.not99 = icmp eq i32 %103, 0
  br i1 %.not99, label %105, label %104

104:                                              ; preds = %102
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2775, ptr noundef nonnull @.str.50, i32 noundef %103) #5
  br label %171

105:                                              ; preds = %88, %93, %96, %102, %99
  %106 = getelementptr inbounds i8, ptr %0, i64 336
  %107 = load i32, ptr %106, align 8, !tbaa !27
  %108 = trunc i32 %107 to i8
  %109 = getelementptr inbounds i8, ptr %0, i64 304
  %110 = load ptr, ptr %109, align 8, !tbaa !32
  store i8 %108, ptr %110, align 1, !tbaa !29
  %111 = getelementptr inbounds i8, ptr %0, i64 20
  %112 = load i32, ptr %111, align 4, !tbaa !33
  %113 = getelementptr inbounds i8, ptr %0, i64 24
  %114 = load i32, ptr %113, align 8, !tbaa !34
  %115 = load ptr, ptr %0, align 8, !tbaa !13
  %116 = getelementptr inbounds i8, ptr %115, i64 372
  %117 = load i32, ptr %116, align 4
  %118 = lshr i32 %117, 1
  %119 = and i32 %118, 1
  %120 = load ptr, ptr %109, align 8, !tbaa !32
  %121 = getelementptr inbounds i8, ptr %120, i64 1
  tail call void @mbedtls_ssl_write_version(i32 noundef %112, i32 noundef %114, i32 noundef %119, ptr noundef nonnull %121)
  %122 = lshr i64 %.1, 8
  %123 = trunc i64 %122 to i8
  %124 = getelementptr inbounds i8, ptr %0, i64 312
  %125 = load ptr, ptr %124, align 8, !tbaa !35
  store i8 %123, ptr %125, align 1, !tbaa !29
  %126 = trunc i64 %.1 to i8
  %127 = load ptr, ptr %124, align 8, !tbaa !35
  %128 = getelementptr inbounds i8, ptr %127, i64 1
  store i8 %126, ptr %128, align 1, !tbaa !29
  %129 = getelementptr inbounds i8, ptr %0, i64 112
  %130 = load ptr, ptr %129, align 8, !tbaa !36
  %.not100 = icmp eq ptr %130, null
  br i1 %.not100, label %142, label %131

131:                                              ; preds = %105
  %132 = tail call i32 @ssl_encrypt_buf(ptr noundef nonnull %0)
  %.not101 = icmp eq i32 %132, 0
  br i1 %.not101, label %134, label %133

133:                                              ; preds = %131
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2824, ptr noundef nonnull @.str.51, i32 noundef %132) #5
  br label %171

134:                                              ; preds = %131
  %135 = load i64, ptr %2, align 8, !tbaa !5
  %136 = lshr i64 %135, 8
  %137 = trunc i64 %136 to i8
  %138 = load ptr, ptr %124, align 8, !tbaa !35
  store i8 %137, ptr %138, align 1, !tbaa !29
  %139 = trunc i64 %135 to i8
  %140 = load ptr, ptr %124, align 8, !tbaa !35
  %141 = getelementptr inbounds i8, ptr %140, i64 1
  store i8 %139, ptr %141, align 1, !tbaa !29
  br label %142

142:                                              ; preds = %134, %105
  %143 = tail call i64 @mbedtls_ssl_hdr_len(ptr noundef nonnull %0)
  %144 = load i64, ptr %2, align 8, !tbaa !5
  %145 = add i64 %144, %143
  %146 = getelementptr inbounds i8, ptr %0, i64 352
  store i64 %145, ptr %146, align 8, !tbaa !37
  %147 = load ptr, ptr %109, align 8, !tbaa !32
  %148 = load i8, ptr %147, align 1, !tbaa !29
  %149 = zext i8 %148 to i32
  %150 = getelementptr inbounds i8, ptr %147, i64 1
  %151 = load i8, ptr %150, align 1, !tbaa !29
  %152 = zext i8 %151 to i32
  %153 = getelementptr inbounds i8, ptr %147, i64 2
  %154 = load i8, ptr %153, align 1, !tbaa !29
  %155 = zext i8 %154 to i32
  %156 = load ptr, ptr %124, align 8, !tbaa !35
  %157 = load i8, ptr %156, align 1, !tbaa !29
  %158 = zext i8 %157 to i32
  %159 = shl nuw nsw i32 %158, 8
  %160 = getelementptr inbounds i8, ptr %156, i64 1
  %161 = load i8, ptr %160, align 1, !tbaa !29
  %162 = zext i8 %161 to i32
  %163 = or disjoint i32 %159, %162
  tail call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef nonnull %0, i32 noundef 3, ptr noundef nonnull @.str, i32 noundef 2838, ptr noundef nonnull @.str.52, i32 noundef %149, i32 noundef %152, i32 noundef %155, i32 noundef %163) #5
  %164 = load ptr, ptr %109, align 8, !tbaa !32
  %165 = tail call i64 @mbedtls_ssl_hdr_len(ptr noundef nonnull %0)
  %166 = load i64, ptr %2, align 8, !tbaa !5
  %167 = add i64 %166, %165
  tail call void @mbedtls_debug_print_buf(ptr noundef nonnull %0, i32 noundef 4, ptr noundef nonnull @.str, i32 noundef 2841, ptr noundef nonnull @.str.53, ptr noundef %164, i64 noundef %167) #5
  %168 = tail call i32 @mbedtls_ssl_flush_output(ptr noundef nonnull %0)
  %.not102 = icmp eq i32 %168, 0
  br i1 %.not102, label %170, label %169

169:                                              ; preds = %142
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2846, ptr noundef nonnull @.str.54, i32 noundef %168) #5
  br label %171

170:                                              ; preds = %142
  tail call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef nonnull %0, i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 2850, ptr noundef nonnull @.str.55) #5
  br label %171

171:                                              ; preds = %170, %169, %133, %104, %27
  %.086 = phi i32 [ %103, %104 ], [ %168, %169 ], [ 0, %170 ], [ %132, %133 ], [ -27648, %27 ]
  ret i32 %.086
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_flight_append(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @mbedtls_ssl_write_version(i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_encrypt_buf(ptr noundef) local_unnamed_addr #3

attributes #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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 344}
!6 = !{!"mbedtls_ssl_context", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !10, i64 216, !11, i64 224, !11, i64 232, !12, i64 240, !11, i64 248, !11, i64 256, !11, i64 264, !11, i64 272, !10, i64 280, !10, i64 284, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !10, i64 336, !11, i64 344, !11, i64 352, !8, i64 360, !10, i64 364, !7, i64 368, !7, i64 376, !7, i64 384, !11, i64 392, !10, i64 400, !11, i64 408, !8, i64 416, !8, i64 428}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!6, !7, i64 96}
!15 = !{!16, !8, i64 972}
!16 = !{!"mbedtls_ssl_handshake_params", !17, i64 0, !18, i64 8, !20, i64 256, !7, i64 872, !7, i64 880, !11, i64 888, !7, i64 896, !10, i64 904, !7, i64 912, !7, i64 920, !7, i64 928, !10, i64 936, !10, i64 940, !7, i64 944, !8, i64 952, !7, i64 960, !10, i64 968, !8, i64 972, !7, i64 976, !7, i64 984, !10, i64 992, !7, i64 1000, !8, i64 1008, !23, i64 1016, !24, i64 1104, !25, i64 1196, !26, i64 1304, !7, i64 1520, !7, i64 1528, !7, i64 1536, !7, i64 1544, !11, i64 1552, !8, i64 1560, !8, i64 1624, !10, i64 2684, !10, i64 2688, !10, i64 2692, !10, i64 2696, !10, i64 2700, !10, i64 2704}
!17 = !{!"mbedtls_ssl_sig_hash_set_t", !10, i64 0, !10, i64 4}
!18 = !{!"", !11, i64 0, !19, i64 8, !19, i64 32, !19, i64 56, !19, i64 80, !19, i64 104, !19, i64 128, !19, i64 152, !19, i64 176, !19, i64 200, !19, i64 224}
!19 = !{!"", !10, i64 0, !11, i64 8, !7, i64 16}
!20 = !{!"", !21, i64 0, !19, i64 248, !22, i64 272, !22, i64 344, !19, i64 416, !10, i64 440, !22, i64 448, !22, i64 520, !19, i64 592}
!21 = !{!"", !10, i64 0, !19, i64 8, !19, i64 32, !19, i64 56, !22, i64 80, !19, i64 152, !11, i64 176, !11, i64 184, !10, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !11, i64 240}
!22 = !{!"", !19, i64 0, !19, i64 24, !19, i64 48}
!23 = !{!"", !8, i64 0, !8, i64 8, !8, i64 24}
!24 = !{!"", !8, i64 0, !8, i64 8, !8, i64 28}
!25 = !{!"", !8, i64 0, !8, i64 8, !8, i64 40, !10, i64 104}
!26 = !{!"", !8, i64 0, !8, i64 16, !8, i64 80, !10, i64 208}
!27 = !{!6, !10, i64 336}
!28 = !{!6, !7, i64 328}
!29 = !{!8, !8, i64 0}
!30 = !{!16, !10, i64 936}
!31 = !{!16, !7, i64 1520}
!32 = !{!6, !7, i64 304}
!33 = !{!6, !10, i64 20}
!34 = !{!6, !10, i64 24}
!35 = !{!6, !7, i64 312}
!36 = !{!6, !7, i64 112}
!37 = !{!6, !11, i64 352}


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