; 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_transform = type { ptr, i32, i64, i64, i64, i64, [16 x i8], [16 x i8], %struct.mbedtls_md_context_t, %struct.mbedtls_md_context_t, %struct.mbedtls_cipher_context_t, %struct.mbedtls_cipher_context_t }
%struct.mbedtls_md_context_t = type { ptr, ptr, ptr }
%struct.mbedtls_cipher_context_t = type { ptr, i32, i32, ptr, ptr, [16 x i8], i64, [16 x i8], i64, ptr }

@.str = external hidden unnamed_addr constant [97 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [28 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ssl_send_alert_message(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_parse_change_cipher_spec(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %6, i32 noundef 2, ptr noundef @.str, i32 noundef 4723, ptr noundef @.str.107)
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call i32 @mbedtls_ssl_read_record(ptr noundef %7)
  store i32 %8, ptr %4, align 4, !tbaa !9
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %14

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load i32, ptr %4, align 4, !tbaa !9
  call void @mbedtls_debug_print_ret(ptr noundef %11, i32 noundef 1, ptr noundef @.str, i32 noundef 4727, ptr noundef @.str.90, i32 noundef %12)
  %13 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %13, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %111

14:                                               ; preds = %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %15, i32 0, i32 30
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp ne i32 %17, 20
  br i1 %18, label %19, label %23

19:                                               ; preds = %14
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %20, i32 noundef 1, ptr noundef @.str, i32 noundef 4733, ptr noundef @.str.108)
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call i32 @mbedtls_ssl_send_alert_message(ptr noundef %21, i8 noundef zeroext 2, i8 noundef zeroext 10)
  store i32 -30464, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %111

23:                                               ; preds = %14
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %24, i32 0, i32 31
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = icmp ne i64 %26, 1
  br i1 %27, label %36, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %29, i32 0, i32 28
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = getelementptr inbounds i8, ptr %31, i64 0
  %33 = load i8, ptr %32, align 1, !tbaa !17
  %34 = zext i8 %33 to i32
  %35 = icmp ne i32 %34, 1
  br i1 %35, label %36, label %40

36:                                               ; preds = %28, %23
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %37, i32 noundef 1, ptr noundef @.str, i32 noundef 4741, ptr noundef @.str.108)
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call i32 @mbedtls_ssl_send_alert_message(ptr noundef %38, i8 noundef zeroext 2, i8 noundef zeroext 50)
  store i32 -32256, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %111

40:                                               ; preds = %28
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %41, i32 noundef 3, ptr noundef @.str, i32 noundef 4751, ptr noundef @.str.109)
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %42, i32 0, i32 19
  %44 = load ptr, ptr %43, align 8, !tbaa !18
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %45, i32 0, i32 16
  store ptr %44, ptr %46, align 8, !tbaa !19
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %47, i32 0, i32 14
  %49 = load ptr, ptr %48, align 8, !tbaa !20
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %50, i32 0, i32 11
  store ptr %49, ptr %51, align 8, !tbaa !21
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %54, i32 0, i32 46
  %56 = load i32, ptr %55, align 4
  %57 = lshr i32 %56, 1
  %58 = and i32 %57, 1
  %59 = icmp eq i32 %58, 1
  br i1 %59, label %60, label %71

60:                                               ; preds = %40
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ssl_dtls_replay_reset(ptr noundef %61)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %62, i32 0, i32 33
  %64 = load i16, ptr %63, align 8, !tbaa !23
  %65 = add i16 %64, 1
  store i16 %65, ptr %63, align 8, !tbaa !23
  %66 = zext i16 %65 to i32
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %60
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %69, i32 noundef 1, ptr noundef @.str, i32 noundef 4765, ptr noundef @.str.110)
  store i32 -27520, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %111

70:                                               ; preds = %60
  br label %75

71:                                               ; preds = %40
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %72, i32 0, i32 24
  %74 = load ptr, ptr %73, align 8, !tbaa !24
  call void @llvm.memset.p0.i64(ptr align 1 %74, i8 0, i64 8, i1 false)
  br label %75

75:                                               ; preds = %71, %70
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %76, i32 0, i32 5
  %78 = load i32, ptr %77, align 8, !tbaa !25
  %79 = icmp sge i32 %78, 2
  br i1 %79, label %80, label %99

80:                                               ; preds = %75
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %81, i32 0, i32 27
  %83 = load ptr, ptr %82, align 8, !tbaa !26
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %84, i32 0, i32 19
  %86 = load ptr, ptr %85, align 8, !tbaa !18
  %87 = getelementptr inbounds %struct.mbedtls_ssl_transform, ptr %86, i32 0, i32 3
  %88 = load i64, ptr %87, align 8, !tbaa !27
  %89 = getelementptr inbounds i8, ptr %83, i64 %88
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %90, i32 0, i32 19
  %92 = load ptr, ptr %91, align 8, !tbaa !18
  %93 = getelementptr inbounds %struct.mbedtls_ssl_transform, ptr %92, i32 0, i32 4
  %94 = load i64, ptr %93, align 8, !tbaa !31
  %95 = sub i64 0, %94
  %96 = getelementptr inbounds i8, ptr %89, i64 %95
  %97 = load ptr, ptr %3, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %97, i32 0, i32 28
  store ptr %96, ptr %98, align 8, !tbaa !16
  br label %105

99:                                               ; preds = %75
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %100, i32 0, i32 27
  %102 = load ptr, ptr %101, align 8, !tbaa !26
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %103, i32 0, i32 28
  store ptr %102, ptr %104, align 8, !tbaa !16
  br label %105

105:                                              ; preds = %99, %80
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.mbedtls_ssl_context, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %107, align 8, !tbaa !32
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %107, align 8, !tbaa !32
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, i32, ptr, i32, ptr, ...) @mbedtls_debug_print_msg(ptr noundef %110, i32 noundef 2, ptr noundef @.str, i32 noundef 4801, ptr noundef @.str.111)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %111

111:                                              ; preds = %105, %68, %36, %19, %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %112 = load i32, ptr %2, align 4
  ret i32 %112
}

; Function Attrs: nounwind uwtable
declare hidden void @ssl_dtls_replay_reset(ptr noundef) #3

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: 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 = { 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, !10, i64 216}
!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 = !{!12, !13, i64 224}
!16 = !{!12, !6, i64 200}
!17 = !{!7, !7, i64 0}
!18 = !{!12, !6, i64 128}
!19 = !{!12, !6, i64 104}
!20 = !{!12, !6, i64 88}
!21 = !{!12, !6, i64 64}
!22 = !{!12, !6, i64 0}
!23 = !{!12, !14, i64 240}
!24 = !{!12, !6, i64 168}
!25 = !{!12, !10, i64 24}
!26 = !{!12, !6, i64 192}
!27 = !{!28, !13, i64 24}
!28 = !{!"mbedtls_ssl_transform", !6, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !7, i64 48, !7, i64 64, !29, i64 80, !29, i64 104, !30, i64 128, !30, i64 216}
!29 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"", !6, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !7, i64 32, !13, i64 48, !7, i64 56, !13, i64 72, !6, i64 80}
!31 = !{!28, !13, i64 32}
!32 = !{!12, !10, i64 8}


; 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.90 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.107 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.108 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [28 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
declare dso_local i32 @mbedtls_ssl_read_record(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mbedtls_ssl_send_alert_message(ptr noundef, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_parse_change_cipher_spec(ptr noundef %0) 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 4723, ptr noundef nonnull @.str.107) #2
  %2 = tail call i32 @mbedtls_ssl_read_record(ptr noundef %0)
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %4, label %3

3:                                                ; preds = %1
  tail call void @mbedtls_debug_print_ret(ptr noundef %0, i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 4727, ptr noundef nonnull @.str.90, i32 noundef %2) #2
  br label %57

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 216
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %.not32 = icmp eq i32 %6, 20
  br i1 %.not32, label %9, label %7

7:                                                ; preds = %4
  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 4733, ptr noundef nonnull @.str.108) #2
  %8 = tail call i32 @mbedtls_ssl_send_alert_message(ptr noundef nonnull %0, i8 noundef zeroext 2, i8 noundef zeroext 10)
  br label %57

9:                                                ; preds = %4
  %10 = getelementptr inbounds i8, ptr %0, i64 224
  %11 = load i64, ptr %10, align 8, !tbaa !13
  %.not33 = icmp eq i64 %11, 1
  br i1 %.not33, label %12, label %16

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 200
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = load i8, ptr %14, align 1, !tbaa !15
  %.not34 = icmp eq i8 %15, 1
  br i1 %.not34, label %18, label %16

16:                                               ; preds = %12, %9
  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 4741, ptr noundef nonnull @.str.108) #2
  %17 = tail call i32 @mbedtls_ssl_send_alert_message(ptr noundef nonnull %0, i8 noundef zeroext 2, i8 noundef zeroext 50)
  br label %57

18:                                               ; preds = %12
  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 4751, ptr noundef nonnull @.str.109) #2
  %19 = getelementptr inbounds i8, ptr %0, i64 128
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %21 = getelementptr inbounds i8, ptr %0, i64 104
  store ptr %20, ptr %21, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 88
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %23, ptr %24, align 8, !tbaa !19
  %25 = load ptr, ptr %0, align 8, !tbaa !20
  %26 = getelementptr inbounds i8, ptr %25, i64 372
  %27 = load i32, ptr %26, align 4
  %28 = and i32 %27, 2
  %.not35 = icmp eq i32 %28, 0
  br i1 %.not35, label %35, label %29

29:                                               ; preds = %18
  tail call void @ssl_dtls_replay_reset(ptr noundef nonnull %0)
  %30 = getelementptr inbounds i8, ptr %0, i64 240
  %31 = load i16, ptr %30, align 8, !tbaa !21
  %32 = add i16 %31, 1
  store i16 %32, ptr %30, align 8, !tbaa !21
  %33 = icmp eq i16 %32, 0
  br i1 %33, label %34, label %38

34:                                               ; preds = %29
  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 4765, ptr noundef nonnull @.str.110) #2
  br label %57

35:                                               ; preds = %18
  %36 = getelementptr inbounds i8, ptr %0, i64 168
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  store i64 0, ptr %37, align 1
  br label %38

38:                                               ; preds = %29, %35
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = load i32, ptr %39, align 8, !tbaa !23
  %41 = icmp sgt i32 %40, 1
  %42 = getelementptr inbounds i8, ptr %0, i64 192
  %43 = load ptr, ptr %42, align 8, !tbaa !24
  br i1 %41, label %44, label %53

44:                                               ; preds = %38
  %45 = load ptr, ptr %19, align 8, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %45, i64 24
  %47 = load i64, ptr %46, align 8, !tbaa !25
  %48 = getelementptr inbounds i8, ptr %43, i64 %47
  %49 = getelementptr inbounds i8, ptr %45, i64 32
  %50 = load i64, ptr %49, align 8, !tbaa !29
  %51 = sub i64 0, %50
  %52 = getelementptr inbounds i8, ptr %48, i64 %51
  br label %53

53:                                               ; preds = %38, %44
  %storemerge = phi ptr [ %52, %44 ], [ %43, %38 ]
  store ptr %storemerge, ptr %13, align 8, !tbaa !14
  %54 = getelementptr inbounds i8, ptr %0, i64 8
  %55 = load i32, ptr %54, align 8, !tbaa !30
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %54, align 8, !tbaa !30
  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 4801, ptr noundef nonnull @.str.111) #2
  br label %57

57:                                               ; preds = %53, %34, %16, %7, %3
  %.0 = phi i32 [ %2, %3 ], [ -30464, %7 ], [ -32256, %16 ], [ -27520, %34 ], [ 0, %53 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @ssl_dtls_replay_reset(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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 216}
!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, !11, i64 224}
!14 = !{!6, !7, i64 200}
!15 = !{!8, !8, i64 0}
!16 = !{!6, !7, i64 128}
!17 = !{!6, !7, i64 104}
!18 = !{!6, !7, i64 88}
!19 = !{!6, !7, i64 64}
!20 = !{!6, !7, i64 0}
!21 = !{!6, !12, i64 240}
!22 = !{!6, !7, i64 168}
!23 = !{!6, !10, i64 24}
!24 = !{!6, !7, i64 192}
!25 = !{!26, !11, i64 24}
!26 = !{!"mbedtls_ssl_transform", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !8, i64 48, !8, i64 64, !27, i64 80, !27, i64 104, !28, i64 128, !28, i64 216}
!27 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16}
!28 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24, !8, i64 32, !11, i64 48, !8, i64 56, !11, i64 72, !7, i64 80}
!29 = !{!26, !11, i64 32}
!30 = !{!6, !10, i64 8}


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