; 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.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [25 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_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: nounwind uwtable
define dso_local i32 @mbedtls_ssl_fetch_input(ptr noundef %0, i64 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %10, i32 noundef 2, ptr noundef @.str, i32 noundef 2208, ptr noundef @.str.26)
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %11, i32 0, i32 8
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %22

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %16, i32 0, i32 9
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %22

20:                                               ; preds = %15
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %21, i32 noundef 1, ptr noundef @.str, i32 noundef 2213, ptr noundef @.str.27)
  store i32 -28928, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %350

22:                                               ; preds = %15, %2
  %23 = load i64, ptr %5, align 8, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %24, i32 0, i32 25
  %26 = load ptr, ptr %25, align 8, !tbaa !16
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %27, i32 0, i32 23
  %29 = load ptr, ptr %28, align 8, !tbaa !17
  %30 = ptrtoint ptr %26 to i64
  %31 = ptrtoint ptr %29 to i64
  %32 = sub i64 %30, %31
  %33 = sub i64 16717, %32
  %34 = icmp ugt i64 %23, %33
  br i1 %34, label %35, label %37

35:                                               ; preds = %22
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %36, i32 noundef 1, ptr noundef @.str, i32 noundef 2219, ptr noundef @.str.28)
  store i32 -28928, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %350

37:                                               ; preds = %22
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %41 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %40, i32 0, i32 46
  %42 = load i32, ptr %41, align 4
  %43 = lshr i32 %42, 1
  %44 = and i32 %43, 1
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %259

46:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %47, i32 0, i32 21
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = icmp eq ptr %49, null
  br i1 %50, label %56, label %51

51:                                               ; preds = %46
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %52, i32 0, i32 22
  %54 = load ptr, ptr %53, align 8, !tbaa !20
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %51, %46
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %57, i32 noundef 1, ptr noundef @.str, i32 noundef 2232, ptr noundef @.str.29)
  store i32 -28928, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

58:                                               ; preds = %51
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %59, i32 0, i32 34
  %61 = load i64, ptr %60, align 8, !tbaa !21
  %62 = icmp ne i64 %61, 0
  br i1 %62, label %63, label %106

63:                                               ; preds = %58
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %64, i32 0, i32 32
  %66 = load i64, ptr %65, align 8, !tbaa !22
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %67, i32 0, i32 34
  %69 = load i64, ptr %68, align 8, !tbaa !21
  %70 = icmp ult i64 %66, %69
  br i1 %70, label %71, label %73

71:                                               ; preds = %63
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %72, i32 noundef 1, ptr noundef @.str, i32 noundef 2250, ptr noundef @.str.4)
  store i32 -27648, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

73:                                               ; preds = %63
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %74, i32 0, i32 34
  %76 = load i64, ptr %75, align 8, !tbaa !21
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %77, i32 0, i32 32
  %79 = load i64, ptr %78, align 8, !tbaa !22
  %80 = sub i64 %79, %76
  store i64 %80, ptr %78, align 8, !tbaa !22
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %81, i32 0, i32 32
  %83 = load i64, ptr %82, align 8, !tbaa !22
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %85, label %103

85:                                               ; preds = %73
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %87, i32 0, i32 34
  %89 = load i64, ptr %88, align 8, !tbaa !21
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %86, i32 noundef 2, ptr noundef @.str, i32 noundef 2259, ptr noundef @.str.30, i64 noundef %89)
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %90, i32 0, i32 25
  %92 = load ptr, ptr %91, align 8, !tbaa !16
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %93, i32 0, i32 25
  %95 = load ptr, ptr %94, align 8, !tbaa !16
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %96, i32 0, i32 34
  %98 = load i64, ptr %97, align 8, !tbaa !21
  %99 = getelementptr inbounds i8, ptr %95, i64 %98
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %100, i32 0, i32 32
  %102 = load i64, ptr %101, align 8, !tbaa !22
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %92, ptr align 1 %99, i64 %102, i1 false)
  br label %103

103:                                              ; preds = %85, %73
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %104, i32 0, i32 34
  store i64 0, ptr %105, align 8, !tbaa !21
  br label %106

106:                                              ; preds = %103, %58
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %108, i32 0, i32 32
  %110 = load i64, ptr %109, align 8, !tbaa !22
  %111 = load i64, ptr %5, align 8, !tbaa !9
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %107, i32 noundef 2, ptr noundef @.str, i32 noundef 2269, ptr noundef @.str.31, i64 noundef %110, i64 noundef %111)
  %112 = load i64, ptr %5, align 8, !tbaa !9
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %113, i32 0, i32 32
  %115 = load i64, ptr %114, align 8, !tbaa !22
  %116 = icmp ule i64 %112, %115
  br i1 %116, label %117, label %119

117:                                              ; preds = %106
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %118, i32 noundef 2, ptr noundef @.str, i32 noundef 2276, ptr noundef @.str.32)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

119:                                              ; preds = %106
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %120, i32 0, i32 32
  %122 = load i64, ptr %121, align 8, !tbaa !22
  %123 = icmp ne i64 %122, 0
  br i1 %123, label %124, label %126

124:                                              ; preds = %119
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %125, i32 noundef 1, ptr noundef @.str, i32 noundef 2287, ptr noundef @.str.4)
  store i32 -27648, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

126:                                              ; preds = %119
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = call i32 @ssl_check_timer(ptr noundef %127)
  %129 = icmp ne i32 %128, 0
  br i1 %129, label %130, label %131

130:                                              ; preds = %126
  store i32 -26624, ptr %6, align 4, !tbaa !23
  br label %197

131:                                              ; preds = %126
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %132, i32 0, i32 25
  %134 = load ptr, ptr %133, align 8, !tbaa !16
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %135, i32 0, i32 23
  %137 = load ptr, ptr %136, align 8, !tbaa !17
  %138 = ptrtoint ptr %134 to i64
  %139 = ptrtoint ptr %137 to i64
  %140 = sub i64 %138, %139
  %141 = sub nsw i64 16717, %140
  store i64 %141, ptr %7, align 8, !tbaa !9
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %142, i32 0, i32 1
  %144 = load i32, ptr %143, align 8, !tbaa !24
  %145 = icmp ne i32 %144, 16
  br i1 %145, label %146, label %152

146:                                              ; preds = %131
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %147, i32 0, i32 15
  %149 = load ptr, ptr %148, align 8, !tbaa !25
  %150 = getelementptr inbounds %struct.mbedtls_ssl_handshake_params, ptr %149, i32 0, i32 16
  %151 = load i32, ptr %150, align 8, !tbaa !26
  store i32 %151, ptr %9, align 4, !tbaa !23
  br label %158

152:                                              ; preds = %131
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !18
  %156 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %155, i32 0, i32 35
  %157 = load i32, ptr %156, align 8, !tbaa !38
  store i32 %157, ptr %9, align 4, !tbaa !23
  br label %158

158:                                              ; preds = %152, %146
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = load i32, ptr %9, align 4, !tbaa !23
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %159, i32 noundef 3, ptr noundef @.str, i32 noundef 2307, ptr noundef @.str.33, i32 noundef %160)
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %161, i32 0, i32 9
  %163 = load ptr, ptr %162, align 8, !tbaa !15
  %164 = icmp ne ptr %163, null
  br i1 %164, label %165, label %178

165:                                              ; preds = %158
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %166, i32 0, i32 9
  %168 = load ptr, ptr %167, align 8, !tbaa !15
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %169, i32 0, i32 10
  %171 = load ptr, ptr %170, align 8, !tbaa !40
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %172, i32 0, i32 25
  %174 = load ptr, ptr %173, align 8, !tbaa !16
  %175 = load i64, ptr %7, align 8, !tbaa !9
  %176 = load i32, ptr %9, align 4, !tbaa !23
  %177 = call i32 %168(ptr noundef %171, ptr noundef %174, i64 noundef %175, i32 noundef %176)
  store i32 %177, ptr %6, align 4, !tbaa !23
  br label %190

178:                                              ; preds = %158
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %179, i32 0, i32 8
  %181 = load ptr, ptr %180, align 8, !tbaa !11
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %182, i32 0, i32 10
  %184 = load ptr, ptr %183, align 8, !tbaa !40
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %185, i32 0, i32 25
  %187 = load ptr, ptr %186, align 8, !tbaa !16
  %188 = load i64, ptr %7, align 8, !tbaa !9
  %189 = call i32 %181(ptr noundef %184, ptr noundef %187, i64 noundef %188)
  store i32 %189, ptr %6, align 4, !tbaa !23
  br label %190

190:                                              ; preds = %178, %165
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = load i32, ptr %6, align 4, !tbaa !23
  call void @mbedtls_debug_print_ret(ptr noundef %191, i32 noundef 2, ptr noundef @.str, i32 noundef 2315, ptr noundef @.str.34, i32 noundef %192)
  %193 = load i32, ptr %6, align 4, !tbaa !23
  %194 = icmp eq i32 %193, 0
  br i1 %194, label %195, label %196

195:                                              ; preds = %190
  store i32 -29312, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

196:                                              ; preds = %190
  br label %197

197:                                              ; preds = %196, %130
  %198 = load i32, ptr %6, align 4, !tbaa !23
  %199 = icmp eq i32 %198, -26624
  br i1 %199, label %200, label %246

200:                                              ; preds = %197
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %201, i32 noundef 2, ptr noundef @.str, i32 noundef 2323, ptr noundef @.str.35)
  %202 = load ptr, ptr %4, align 8, !tbaa !5
  call void @ssl_set_timer(ptr noundef %202, i32 noundef 0)
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %203, i32 0, i32 1
  %205 = load i32, ptr %204, align 8, !tbaa !24
  %206 = icmp ne i32 %205, 16
  br i1 %206, label %207, label %222

207:                                              ; preds = %200
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = call i32 @ssl_double_retransmit_timeout(ptr noundef %208)
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %213

211:                                              ; preds = %207
  %212 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %212, i32 noundef 1, ptr noundef @.str, i32 noundef 2330, ptr noundef @.str.36)
  store i32 -26624, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

213:                                              ; preds = %207
  %214 = load ptr, ptr %4, align 8, !tbaa !5
  %215 = call i32 @mbedtls_ssl_resend(ptr noundef %214)
  store i32 %215, ptr %6, align 4, !tbaa !23
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %221

217:                                              ; preds = %213
  %218 = load ptr, ptr %4, align 8, !tbaa !5
  %219 = load i32, ptr %6, align 4, !tbaa !23
  call void @mbedtls_debug_print_ret(ptr noundef %218, i32 noundef 1, ptr noundef @.str, i32 noundef 2336, ptr noundef @.str.37, i32 noundef %219)
  %220 = load i32, ptr %6, align 4, !tbaa !23
  store i32 %220, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

221:                                              ; preds = %213
  store i32 -26880, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

222:                                              ; preds = %200
  %223 = load ptr, ptr %4, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %223, i32 0, i32 0
  %225 = load ptr, ptr %224, align 8, !tbaa !18
  %226 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %225, i32 0, i32 46
  %227 = load i32, ptr %226, align 4
  %228 = and i32 %227, 1
  %229 = icmp eq i32 %228, 1
  br i1 %229, label %230, label %244

230:                                              ; preds = %222
  %231 = load ptr, ptr %4, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %231, i32 0, i32 2
  %233 = load i32, ptr %232, align 4, !tbaa !41
  %234 = icmp eq i32 %233, 3
  br i1 %234, label %235, label %244

235:                                              ; preds = %230
  %236 = load ptr, ptr %4, align 8, !tbaa !5
  %237 = call i32 @ssl_resend_hello_request(ptr noundef %236)
  store i32 %237, ptr %6, align 4, !tbaa !23
  %238 = icmp ne i32 %237, 0
  br i1 %238, label %239, label %243

239:                                              ; preds = %235
  %240 = load ptr, ptr %4, align 8, !tbaa !5
  %241 = load i32, ptr %6, align 4, !tbaa !23
  call void @mbedtls_debug_print_ret(ptr noundef %240, i32 noundef 1, ptr noundef @.str, i32 noundef 2348, ptr noundef @.str.38, i32 noundef %241)
  %242 = load i32, ptr %6, align 4, !tbaa !23
  store i32 %242, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

243:                                              ; preds = %235
  store i32 -26880, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

244:                                              ; preds = %230, %222
  br label %245

245:                                              ; preds = %244
  br label %246

246:                                              ; preds = %245, %197
  %247 = load i32, ptr %6, align 4, !tbaa !23
  %248 = icmp slt i32 %247, 0
  br i1 %248, label %249, label %251

249:                                              ; preds = %246
  %250 = load i32, ptr %6, align 4, !tbaa !23
  store i32 %250, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %256

251:                                              ; preds = %246
  %252 = load i32, ptr %6, align 4, !tbaa !23
  %253 = sext i32 %252 to i64
  %254 = load ptr, ptr %4, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %254, i32 0, i32 32
  store i64 %253, ptr %255, align 8, !tbaa !22
  store i32 0, ptr %8, align 4
  br label %256

256:                                              ; preds = %251, %249, %243, %239, %221, %217, %211, %195, %124, %117, %71, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %257 = load i32, ptr %8, align 4
  switch i32 %257, label %350 [
    i32 0, label %258
  ]

258:                                              ; preds = %256
  br label %348

259:                                              ; preds = %37
  %260 = load ptr, ptr %4, align 8, !tbaa !5
  %261 = load ptr, ptr %4, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %261, i32 0, i32 32
  %263 = load i64, ptr %262, align 8, !tbaa !22
  %264 = load i64, ptr %5, align 8, !tbaa !9
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %260, i32 noundef 2, ptr noundef @.str, i32 noundef 2366, ptr noundef @.str.31, i64 noundef %263, i64 noundef %264)
  br label %265

265:                                              ; preds = %340, %259
  %266 = load ptr, ptr %4, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %266, i32 0, i32 32
  %268 = load i64, ptr %267, align 8, !tbaa !22
  %269 = load i64, ptr %5, align 8, !tbaa !9
  %270 = icmp ult i64 %268, %269
  br i1 %270, label %271, label %347

271:                                              ; preds = %265
  %272 = load i64, ptr %5, align 8, !tbaa !9
  %273 = load ptr, ptr %4, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %273, i32 0, i32 32
  %275 = load i64, ptr %274, align 8, !tbaa !22
  %276 = sub i64 %272, %275
  store i64 %276, ptr %7, align 8, !tbaa !9
  %277 = load ptr, ptr %4, align 8, !tbaa !5
  %278 = call i32 @ssl_check_timer(ptr noundef %277)
  %279 = icmp ne i32 %278, 0
  br i1 %279, label %280, label %281

280:                                              ; preds = %271
  store i32 -26624, ptr %6, align 4, !tbaa !23
  br label %324

281:                                              ; preds = %271
  %282 = load ptr, ptr %4, align 8, !tbaa !5
  %283 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %282, i32 0, i32 9
  %284 = load ptr, ptr %283, align 8, !tbaa !15
  %285 = icmp ne ptr %284, null
  br i1 %285, label %286, label %307

286:                                              ; preds = %281
  %287 = load ptr, ptr %4, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %287, i32 0, i32 9
  %289 = load ptr, ptr %288, align 8, !tbaa !15
  %290 = load ptr, ptr %4, align 8, !tbaa !5
  %291 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %290, i32 0, i32 10
  %292 = load ptr, ptr %291, align 8, !tbaa !40
  %293 = load ptr, ptr %4, align 8, !tbaa !5
  %294 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %293, i32 0, i32 25
  %295 = load ptr, ptr %294, align 8, !tbaa !16
  %296 = load ptr, ptr %4, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %296, i32 0, i32 32
  %298 = load i64, ptr %297, align 8, !tbaa !22
  %299 = getelementptr inbounds i8, ptr %295, i64 %298
  %300 = load i64, ptr %7, align 8, !tbaa !9
  %301 = load ptr, ptr %4, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %301, i32 0, i32 0
  %303 = load ptr, ptr %302, align 8, !tbaa !18
  %304 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %303, i32 0, i32 35
  %305 = load i32, ptr %304, align 8, !tbaa !38
  %306 = call i32 %289(ptr noundef %292, ptr noundef %299, i64 noundef %300, i32 noundef %305)
  store i32 %306, ptr %6, align 4, !tbaa !23
  br label %323

307:                                              ; preds = %281
  %308 = load ptr, ptr %4, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %308, i32 0, i32 8
  %310 = load ptr, ptr %309, align 8, !tbaa !11
  %311 = load ptr, ptr %4, align 8, !tbaa !5
  %312 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %311, i32 0, i32 10
  %313 = load ptr, ptr %312, align 8, !tbaa !40
  %314 = load ptr, ptr %4, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %314, i32 0, i32 25
  %316 = load ptr, ptr %315, align 8, !tbaa !16
  %317 = load ptr, ptr %4, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %317, i32 0, i32 32
  %319 = load i64, ptr %318, align 8, !tbaa !22
  %320 = getelementptr inbounds i8, ptr %316, i64 %319
  %321 = load i64, ptr %7, align 8, !tbaa !9
  %322 = call i32 %310(ptr noundef %313, ptr noundef %320, i64 noundef %321)
  store i32 %322, ptr %6, align 4, !tbaa !23
  br label %323

323:                                              ; preds = %307, %286
  br label %324

324:                                              ; preds = %323, %280
  %325 = load ptr, ptr %4, align 8, !tbaa !5
  %326 = load ptr, ptr %4, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %326, i32 0, i32 32
  %328 = load i64, ptr %327, align 8, !tbaa !22
  %329 = load i64, ptr %5, align 8, !tbaa !9
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %325, i32 noundef 2, ptr noundef @.str, i32 noundef 2390, ptr noundef @.str.31, i64 noundef %328, i64 noundef %329)
  %330 = load ptr, ptr %4, align 8, !tbaa !5
  %331 = load i32, ptr %6, align 4, !tbaa !23
  call void @mbedtls_debug_print_ret(ptr noundef %330, i32 noundef 2, ptr noundef @.str, i32 noundef 2391, ptr noundef @.str.34, i32 noundef %331)
  %332 = load i32, ptr %6, align 4, !tbaa !23
  %333 = icmp eq i32 %332, 0
  br i1 %333, label %334, label %335

334:                                              ; preds = %324
  store i32 -29312, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %350

335:                                              ; preds = %324
  %336 = load i32, ptr %6, align 4, !tbaa !23
  %337 = icmp slt i32 %336, 0
  br i1 %337, label %338, label %340

338:                                              ; preds = %335
  %339 = load i32, ptr %6, align 4, !tbaa !23
  store i32 %339, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %350

340:                                              ; preds = %335
  %341 = load i32, ptr %6, align 4, !tbaa !23
  %342 = sext i32 %341 to i64
  %343 = load ptr, ptr %4, align 8, !tbaa !5
  %344 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %343, i32 0, i32 32
  %345 = load i64, ptr %344, align 8, !tbaa !22
  %346 = add i64 %345, %342
  store i64 %346, ptr %344, align 8, !tbaa !22
  br label %265, !llvm.loop !42

347:                                              ; preds = %265
  br label %348

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

350:                                              ; preds = %348, %338, %334, %256, %35, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %351 = load i32, ptr %3, align 4
  ret i32 %351
}

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

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_check_timer(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @ssl_set_timer(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_double_retransmit_timeout(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ssl_resend(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_resend_hello_request(ptr noundef) #2

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 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 40}
!12 = !{!"mbedtls_ssl_context", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, 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, !13, i64 216, !10, i64 224, !10, i64 232, !14, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !13, i64 280, !13, i64 284, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !13, i64 336, !10, i64 344, !10, i64 352, !7, i64 360, !13, i64 364, !6, i64 368, !6, i64 376, !6, i64 384, !10, i64 392, !13, i64 400, !10, i64 408, !7, i64 416, !7, i64 428}
!13 = !{!"int", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !6, i64 48}
!16 = !{!12, !6, i64 176}
!17 = !{!12, !6, i64 160}
!18 = !{!12, !6, i64 0}
!19 = !{!12, !6, i64 144}
!20 = !{!12, !6, i64 152}
!21 = !{!12, !10, i64 248}
!22 = !{!12, !10, i64 232}
!23 = !{!13, !13, i64 0}
!24 = !{!12, !13, i64 8}
!25 = !{!12, !6, i64 96}
!26 = !{!27, !13, i64 968}
!27 = !{!"mbedtls_ssl_handshake_params", !28, i64 0, !29, i64 8, !31, i64 256, !6, i64 872, !6, i64 880, !10, i64 888, !6, i64 896, !13, i64 904, !6, i64 912, !6, i64 920, !6, i64 928, !13, i64 936, !13, i64 940, !6, i64 944, !7, i64 952, !6, i64 960, !13, i64 968, !7, i64 972, !6, i64 976, !6, i64 984, !13, i64 992, !6, i64 1000, !7, i64 1008, !34, i64 1016, !35, i64 1104, !36, i64 1196, !37, i64 1304, !6, i64 1520, !6, i64 1528, !6, i64 1536, !6, i64 1544, !10, i64 1552, !7, i64 1560, !7, i64 1624, !13, i64 2684, !13, i64 2688, !13, i64 2692, !13, i64 2696, !13, i64 2700, !13, i64 2704}
!28 = !{!"mbedtls_ssl_sig_hash_set_t", !13, i64 0, !13, i64 4}
!29 = !{!"", !10, i64 0, !30, i64 8, !30, i64 32, !30, i64 56, !30, i64 80, !30, i64 104, !30, i64 128, !30, i64 152, !30, i64 176, !30, i64 200, !30, i64 224}
!30 = !{!"", !13, i64 0, !10, i64 8, !6, i64 16}
!31 = !{!"", !32, i64 0, !30, i64 248, !33, i64 272, !33, i64 344, !30, i64 416, !13, i64 440, !33, i64 448, !33, i64 520, !30, i64 592}
!32 = !{!"", !13, i64 0, !30, i64 8, !30, i64 32, !30, i64 56, !33, i64 80, !30, i64 152, !10, i64 176, !10, i64 184, !13, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !10, i64 240}
!33 = !{!"", !30, i64 0, !30, i64 24, !30, i64 48}
!34 = !{!"", !7, i64 0, !7, i64 8, !7, i64 24}
!35 = !{!"", !7, i64 0, !7, i64 8, !7, i64 28}
!36 = !{!"", !7, i64 0, !7, i64 8, !7, i64 40, !13, i64 104}
!37 = !{!"", !7, i64 0, !7, i64 16, !7, i64 80, !13, i64 208}
!38 = !{!39, !13, i64 336}
!39 = !{!"mbedtls_ssl_config", !7, i64 0, !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, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !30, i64 248, !30, i64 272, !6, i64 296, !10, i64 304, !6, i64 312, !10, i64 320, !6, i64 328, !13, i64 336, !13, i64 340, !13, i64 344, !13, i64 348, !7, i64 352, !13, i64 360, !13, i64 364, !7, i64 368, !7, i64 369, !7, i64 370, !7, i64 371, !13, i64 372, !13, i64 372, !13, i64 372, !13, i64 372, !13, i64 372, !13, i64 372, !13, i64 373, !13, i64 373, !13, i64 373, !13, i64 373, !13, i64 373, !13, i64 373, !13, i64 374, !13, i64 374, !13, i64 374}
!40 = !{!12, !6, i64 56}
!41 = !{!12, !13, i64 12}
!42 = distinct !{!42, !43}
!43 = !{!"llvm.loop.mustprogress"}


; 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.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [25 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_ret(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_fetch_input(ptr noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  tail call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %0, i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 2208, ptr noundef nonnull @.str.26) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %6, label %11

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %6
  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 2213, ptr noundef nonnull @.str.27) #3
  br label %.thread141

11:                                               ; preds = %6, %2
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 160
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = ptrtoint ptr %13 to i64
  %17 = ptrtoint ptr %15 to i64
  %reass.sub = sub i64 %17, %16
  %18 = add i64 %reass.sub, 16717
  %19 = icmp ult i64 %18, %1
  br i1 %19, label %20, label %21

20:                                               ; preds = %11
  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 2219, ptr noundef nonnull @.str.28) #3
  br label %.thread141

21:                                               ; preds = %11
  %22 = load ptr, ptr %0, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %22, i64 372
  %24 = load i32, ptr %23, align 4
  %25 = and i32 %24, 2
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %108, label %26

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %0, i64 144
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = icmp eq ptr %28, null
  br i1 %29, label %34, label %30

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %0, i64 152
  %32 = load ptr, ptr %31, align 8, !tbaa !18
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %30, %26
  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 2232, ptr noundef nonnull @.str.29) #3
  br label %.thread141

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %0, i64 248
  %37 = load i64, ptr %36, align 8, !tbaa !19
  %.not122 = icmp eq i64 %37, 0
  br i1 %.not122, label %51, label %38

38:                                               ; preds = %35
  %39 = getelementptr inbounds i8, ptr %0, i64 232
  %40 = load i64, ptr %39, align 8, !tbaa !20
  %41 = icmp ult i64 %40, %37
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  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 2250, ptr noundef nonnull @.str.4) #3
  br label %.thread141

43:                                               ; preds = %38
  %44 = sub i64 %40, %37
  store i64 %44, ptr %39, align 8, !tbaa !20
  %.not123 = icmp eq i64 %40, %37
  br i1 %.not123, label %50, label %45

45:                                               ; preds = %43
  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 2259, ptr noundef nonnull @.str.30, i64 noundef %37) #3
  %46 = load ptr, ptr %12, align 8, !tbaa !14
  %47 = load i64, ptr %36, align 8, !tbaa !19
  %48 = getelementptr inbounds i8, ptr %46, i64 %47
  %49 = load i64, ptr %39, align 8, !tbaa !20
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %46, ptr align 1 %48, i64 %49, i1 false)
  br label %50

50:                                               ; preds = %45, %43
  store i64 0, ptr %36, align 8, !tbaa !19
  br label %51

51:                                               ; preds = %50, %35
  %52 = getelementptr inbounds i8, ptr %0, i64 232
  %53 = load i64, ptr %52, align 8, !tbaa !20
  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 2269, ptr noundef nonnull @.str.31, i64 noundef %53, i64 noundef %1) #3
  %54 = load i64, ptr %52, align 8, !tbaa !20
  %.not124 = icmp ult i64 %54, %1
  br i1 %.not124, label %56, label %55

55:                                               ; preds = %51
  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 2276, ptr noundef nonnull @.str.32) #3
  br label %.thread141

56:                                               ; preds = %51
  %.not125 = icmp eq i64 %54, 0
  br i1 %.not125, label %58, label %57

57:                                               ; preds = %56
  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 2287, ptr noundef nonnull @.str.4) #3
  br label %.thread141

58:                                               ; preds = %56
  %59 = tail call i32 @ssl_check_timer(ptr noundef nonnull %0)
  %.not126 = icmp eq i32 %59, 0
  br i1 %.not126, label %60, label %.thread

60:                                               ; preds = %58
  %61 = load ptr, ptr %12, align 8, !tbaa !14
  %62 = load ptr, ptr %14, align 8, !tbaa !15
  %63 = ptrtoint ptr %61 to i64
  %64 = ptrtoint ptr %62 to i64
  %.neg127 = sub i64 %64, %63
  %65 = add i64 %.neg127, 16717
  %66 = getelementptr inbounds i8, ptr %0, i64 8
  %67 = load i32, ptr %66, align 8, !tbaa !21
  %.not128 = icmp eq i32 %67, 16
  %.sink146.idx = select i1 %.not128, i64 0, i64 96
  %.sink146 = getelementptr inbounds i8, ptr %0, i64 %.sink146.idx
  %.sink145 = select i1 %.not128, i64 336, i64 968
  %68 = load ptr, ptr %.sink146, align 8, !tbaa !22
  %69 = getelementptr inbounds i8, ptr %68, i64 %.sink145
  %.0 = load i32, ptr %69, align 8, !tbaa !23
  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 2307, ptr noundef nonnull @.str.33, i32 noundef %.0) #3
  %70 = getelementptr inbounds i8, ptr %0, i64 48
  %71 = load ptr, ptr %70, align 8, !tbaa !13
  %.not129 = icmp eq ptr %71, null
  br i1 %.not129, label %77, label %72

72:                                               ; preds = %60
  %73 = getelementptr inbounds i8, ptr %0, i64 56
  %74 = load ptr, ptr %73, align 8, !tbaa !24
  %75 = load ptr, ptr %12, align 8, !tbaa !14
  %76 = tail call i32 %71(ptr noundef %74, ptr noundef %75, i64 noundef %65, i32 noundef %.0) #3
  br label %83

77:                                               ; preds = %60
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %0, i64 56
  %80 = load ptr, ptr %79, align 8, !tbaa !24
  %81 = load ptr, ptr %12, align 8, !tbaa !14
  %82 = tail call i32 %78(ptr noundef %80, ptr noundef %81, i64 noundef %65) #3
  br label %83

83:                                               ; preds = %77, %72
  %.0108 = phi i32 [ %76, %72 ], [ %82, %77 ]
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 2315, ptr noundef nonnull @.str.34, i32 noundef %.0108) #3
  switch i32 %.0108, label %104 [
    i32 0, label %.thread141
    i32 -26624, label %.thread
  ]

.thread:                                          ; preds = %83, %58
  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 2323, ptr noundef nonnull @.str.35) #3
  tail call void @ssl_set_timer(ptr noundef nonnull %0, i32 noundef 0)
  %84 = getelementptr inbounds i8, ptr %0, i64 8
  %85 = load i32, ptr %84, align 8, !tbaa !21
  %.not130 = icmp eq i32 %85, 16
  br i1 %.not130, label %92, label %86

86:                                               ; preds = %.thread
  %87 = tail call i32 @ssl_double_retransmit_timeout(ptr noundef nonnull %0)
  %.not133 = icmp eq i32 %87, 0
  br i1 %.not133, label %89, label %88

88:                                               ; preds = %86
  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 2330, ptr noundef nonnull @.str.36) #3
  br label %.thread141

89:                                               ; preds = %86
  %90 = tail call i32 @mbedtls_ssl_resend(ptr noundef nonnull %0)
  %.not134 = icmp eq i32 %90, 0
  br i1 %.not134, label %.thread141, label %91

91:                                               ; preds = %89
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2336, ptr noundef nonnull @.str.37, i32 noundef %90) #3
  br label %.thread141

92:                                               ; preds = %.thread
  %93 = load ptr, ptr %0, align 8, !tbaa !16
  %94 = getelementptr inbounds i8, ptr %93, i64 372
  %95 = load i32, ptr %94, align 4
  %96 = and i32 %95, 1
  %.not131 = icmp eq i32 %96, 0
  br i1 %.not131, label %.thread141, label %97

97:                                               ; preds = %92
  %98 = getelementptr inbounds i8, ptr %0, i64 12
  %99 = load i32, ptr %98, align 4, !tbaa !25
  %100 = icmp eq i32 %99, 3
  br i1 %100, label %101, label %.thread141

101:                                              ; preds = %97
  %102 = tail call i32 @ssl_resend_hello_request(ptr noundef nonnull %0)
  %.not132 = icmp eq i32 %102, 0
  br i1 %.not132, label %.thread141, label %103

103:                                              ; preds = %101
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 2348, ptr noundef nonnull @.str.38, i32 noundef %102) #3
  br label %.thread141

104:                                              ; preds = %83
  %105 = icmp slt i32 %.0108, 0
  br i1 %105, label %.thread141, label %106

106:                                              ; preds = %104
  %107 = zext nneg i32 %.0108 to i64
  store i64 %107, ptr %52, align 8, !tbaa !20
  br label %.loopexit

108:                                              ; preds = %21
  %109 = getelementptr inbounds i8, ptr %0, i64 232
  %110 = load i64, ptr %109, align 8, !tbaa !20
  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 2366, ptr noundef nonnull @.str.31, i64 noundef %110, i64 noundef %1) #3
  %111 = load i64, ptr %109, align 8, !tbaa !20
  %112 = icmp ult i64 %111, %1
  br i1 %112, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %108
  %113 = getelementptr inbounds i8, ptr %0, i64 48
  %114 = getelementptr inbounds i8, ptr %0, i64 56
  br label %115

115:                                              ; preds = %.lr.ph, %142
  %116 = phi i64 [ %111, %.lr.ph ], [ %145, %142 ]
  %117 = sub i64 %1, %116
  %118 = tail call i32 @ssl_check_timer(ptr noundef nonnull %0)
  %.not120 = icmp eq i32 %118, 0
  br i1 %.not120, label %119, label %137

119:                                              ; preds = %115
  %120 = load ptr, ptr %113, align 8, !tbaa !13
  %.not121 = icmp eq ptr %120, null
  br i1 %.not121, label %130, label %121

121:                                              ; preds = %119
  %122 = load ptr, ptr %114, align 8, !tbaa !24
  %123 = load ptr, ptr %12, align 8, !tbaa !14
  %124 = load i64, ptr %109, align 8, !tbaa !20
  %125 = getelementptr inbounds i8, ptr %123, i64 %124
  %126 = load ptr, ptr %0, align 8, !tbaa !16
  %127 = getelementptr inbounds i8, ptr %126, i64 336
  %128 = load i32, ptr %127, align 8, !tbaa !26
  %129 = tail call i32 %120(ptr noundef %122, ptr noundef %125, i64 noundef %117, i32 noundef %128) #3
  br label %137

130:                                              ; preds = %119
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = load ptr, ptr %114, align 8, !tbaa !24
  %133 = load ptr, ptr %12, align 8, !tbaa !14
  %134 = load i64, ptr %109, align 8, !tbaa !20
  %135 = getelementptr inbounds i8, ptr %133, i64 %134
  %136 = tail call i32 %131(ptr noundef %132, ptr noundef %135, i64 noundef %117) #3
  br label %137

137:                                              ; preds = %115, %121, %130
  %.2 = phi i32 [ %129, %121 ], [ %136, %130 ], [ -26624, %115 ]
  %138 = load i64, ptr %109, align 8, !tbaa !20
  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 2390, ptr noundef nonnull @.str.31, i64 noundef %138, i64 noundef %1) #3
  tail call void @mbedtls_debug_print_ret(ptr noundef nonnull %0, i32 noundef 2, ptr noundef nonnull @.str, i32 noundef 2391, ptr noundef nonnull @.str.34, i32 noundef %.2) #3
  %139 = icmp eq i32 %.2, 0
  br i1 %139, label %.thread141, label %140

140:                                              ; preds = %137
  %141 = icmp slt i32 %.2, 0
  br i1 %141, label %.thread141, label %142

142:                                              ; preds = %140
  %143 = zext nneg i32 %.2 to i64
  %144 = load i64, ptr %109, align 8, !tbaa !20
  %145 = add i64 %144, %143
  store i64 %145, ptr %109, align 8, !tbaa !20
  %146 = icmp ult i64 %145, %1
  br i1 %146, label %115, label %.loopexit, !llvm.loop !29

.loopexit:                                        ; preds = %142, %108, %106
  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 2403, ptr noundef nonnull @.str.32) #3
  br label %.thread141

.thread141:                                       ; preds = %140, %137, %83, %92, %97, %104, %101, %89, %103, %91, %88, %57, %55, %42, %34, %.loopexit, %20, %10
  %.1110 = phi i32 [ -28928, %10 ], [ -28928, %20 ], [ 0, %.loopexit ], [ %.0108, %104 ], [ -26880, %101 ], [ -26880, %89 ], [ -29312, %83 ], [ %102, %103 ], [ %90, %91 ], [ -26624, %88 ], [ -27648, %57 ], [ 0, %55 ], [ -27648, %42 ], [ -28928, %34 ], [ -26624, %97 ], [ -26624, %92 ], [ %.2, %140 ], [ -29312, %137 ]
  ret i32 %.1110
}

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

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

; Function Attrs: nounwind uwtable
declare hidden void @ssl_set_timer(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 40}
!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 48}
!14 = !{!6, !7, i64 176}
!15 = !{!6, !7, i64 160}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !7, i64 144}
!18 = !{!6, !7, i64 152}
!19 = !{!6, !11, i64 248}
!20 = !{!6, !11, i64 232}
!21 = !{!6, !10, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!10, !10, i64 0}
!24 = !{!6, !7, i64 56}
!25 = !{!6, !10, i64 12}
!26 = !{!27, !10, i64 336}
!27 = !{!"mbedtls_ssl_config", !8, i64 0, !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, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !28, i64 248, !28, i64 272, !7, i64 296, !11, i64 304, !7, i64 312, !11, i64 320, !7, i64 328, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !8, i64 352, !10, i64 360, !10, i64 364, !8, i64 368, !8, i64 369, !8, i64 370, !8, i64 371, !10, i64 372, !10, i64 372, !10, i64 372, !10, i64 372, !10, i64 372, !10, i64 372, !10, i64 373, !10, i64 373, !10, i64 373, !10, i64 373, !10, i64 373, !10, i64 373, !10, i64 374, !10, i64 374, !10, i64 374}
!28 = !{!"", !10, i64 0, !11, i64 8, !7, i64 16}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass