; 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_x509_crt_profile = type { i32, i32, i32, i32 }
%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 }

@.str.151 = external hidden unnamed_addr constant [513 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [513 x i8], align 1
@ssl_preset_suiteb_ciphersuites = external hidden global [3 x i32], align 4
@mbedtls_x509_crt_profile_suiteb = external constant %struct.mbedtls_x509_crt_profile, align 4
@ssl_preset_suiteb_hashes = external hidden global [3 x i32], align 4
@ssl_preset_suiteb_curves = external hidden global [3 x i32], align 4
@mbedtls_x509_crt_profile_default = external constant %struct.mbedtls_x509_crt_profile, align 4
@ssl_preset_default_hashes = external hidden global [6 x i32], align 16

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_config_defaults(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = load i32, ptr %7, align 4, !tbaa !9
  call void @mbedtls_ssl_conf_endpoint(ptr noundef %12, i32 noundef %13)
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = load i32, ptr %8, align 4, !tbaa !9
  call void @mbedtls_ssl_conf_transport(ptr noundef %14, i32 noundef %15)
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %29

18:                                               ; preds = %4
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %19, i32 0, i32 46
  %21 = load i32, ptr %20, align 4
  %22 = and i32 %21, -13
  %23 = or i32 %22, 8
  store i32 %23, ptr %20, align 4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %24, i32 0, i32 46
  %26 = load i32, ptr %25, align 4
  %27 = and i32 %26, -65537
  %28 = or i32 %27, 65536
  store i32 %28, ptr %25, align 4
  br label %29

29:                                               ; preds = %18, %4
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %30, i32 0, i32 46
  %32 = load i32, ptr %31, align 4
  %33 = and i32 %32, -65
  %34 = or i32 %33, 64
  store i32 %34, ptr %31, align 4
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %35, i32 0, i32 46
  %37 = load i32, ptr %36, align 4
  %38 = and i32 %37, -1025
  %39 = or i32 %38, 1024
  store i32 %39, ptr %36, align 4
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %40, i32 0, i32 46
  %42 = load i32, ptr %41, align 4
  %43 = and i32 %42, -2049
  %44 = or i32 %43, 2048
  store i32 %44, ptr %41, align 4
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %45, i32 0, i32 46
  %47 = load i32, ptr %46, align 4
  %48 = and i32 %47, -8193
  %49 = or i32 %48, 8192
  store i32 %49, ptr %46, align 4
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %50, i32 0, i32 14
  store ptr @ssl_cookie_write_dummy, ptr %51, align 8, !tbaa !11
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %52, i32 0, i32 15
  store ptr @ssl_cookie_check_dummy, ptr %53, align 8, !tbaa !15
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %54, i32 0, i32 46
  %56 = load i32, ptr %55, align 4
  %57 = and i32 %56, -4097
  %58 = or i32 %57, 4096
  store i32 %58, ptr %55, align 4
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %59, i32 0, i32 46
  %61 = load i32, ptr %60, align 4
  %62 = and i32 %61, -262145
  %63 = or i32 %62, 262144
  store i32 %63, ptr %60, align 4
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %64, i32 0, i32 36
  store i32 1000, ptr %65, align 4, !tbaa !16
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %66, i32 0, i32 37
  store i32 60000, ptr %67, align 8, !tbaa !17
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %68, i32 0, i32 38
  store i32 16, ptr %69, align 4, !tbaa !18
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %70, i32 0, i32 39
  %72 = getelementptr inbounds [8 x i8], ptr %71, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 8 %72, i8 0, i64 2, i1 false)
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %73, i32 0, i32 39
  %75 = getelementptr inbounds [8 x i8], ptr %74, i64 0, i64 0
  %76 = getelementptr inbounds i8, ptr %75, i64 2
  call void @llvm.memset.p0.i64(ptr align 1 %76, i8 -1, i64 6, i1 false)
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %86

79:                                               ; preds = %29
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = call i32 @mbedtls_ssl_conf_dh_param(ptr noundef %80, ptr noundef @.str.151, ptr noundef @.str.152)
  store i32 %81, ptr %10, align 4, !tbaa !9
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %85

83:                                               ; preds = %79
  %84 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %84, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %153

85:                                               ; preds = %79
  br label %86

86:                                               ; preds = %85, %29
  %87 = load i32, ptr %9, align 4, !tbaa !9
  switch i32 %87, label %115 [
    i32 2, label %88
  ]

88:                                               ; preds = %86
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %89, i32 0, i32 44
  store i8 3, ptr %90, align 2, !tbaa !19
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %91, i32 0, i32 45
  store i8 3, ptr %92, align 1, !tbaa !20
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %93, i32 0, i32 42
  store i8 3, ptr %94, align 8, !tbaa !21
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %95, i32 0, i32 43
  store i8 3, ptr %96, align 1, !tbaa !22
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %97, i32 0, i32 0
  %99 = getelementptr inbounds [4 x ptr], ptr %98, i64 0, i64 3
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %99, align 8, !tbaa !5
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds [4 x ptr], ptr %101, i64 0, i64 2
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %102, align 8, !tbaa !5
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %103, i32 0, i32 0
  %105 = getelementptr inbounds [4 x ptr], ptr %104, i64 0, i64 1
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %105, align 8, !tbaa !5
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds [4 x ptr], ptr %107, i64 0, i64 0
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %108, align 8, !tbaa !5
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %109, i32 0, i32 22
  store ptr @mbedtls_x509_crt_profile_suiteb, ptr %110, align 8, !tbaa !23
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %111, i32 0, i32 26
  store ptr @ssl_preset_suiteb_hashes, ptr %112, align 8, !tbaa !24
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %113, i32 0, i32 27
  store ptr @ssl_preset_suiteb_curves, ptr %114, align 8, !tbaa !25
  br label %152

115:                                              ; preds = %86
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %116, i32 0, i32 44
  store i8 3, ptr %117, align 2, !tbaa !19
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %118, i32 0, i32 45
  store i8 1, ptr %119, align 1, !tbaa !20
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %120, i32 0, i32 42
  store i8 3, ptr %121, align 8, !tbaa !21
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %122, i32 0, i32 43
  store i8 3, ptr %123, align 1, !tbaa !22
  %124 = load i32, ptr %8, align 4, !tbaa !9
  %125 = icmp eq i32 %124, 1
  br i1 %125, label %126, label %129

126:                                              ; preds = %115
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %127, i32 0, i32 45
  store i8 2, ptr %128, align 1, !tbaa !20
  br label %129

129:                                              ; preds = %126, %115
  %130 = call ptr @mbedtls_ssl_list_ciphersuites()
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %131, i32 0, i32 0
  %133 = getelementptr inbounds [4 x ptr], ptr %132, i64 0, i64 3
  store ptr %130, ptr %133, align 8, !tbaa !5
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %134, i32 0, i32 0
  %136 = getelementptr inbounds [4 x ptr], ptr %135, i64 0, i64 2
  store ptr %130, ptr %136, align 8, !tbaa !5
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %137, i32 0, i32 0
  %139 = getelementptr inbounds [4 x ptr], ptr %138, i64 0, i64 1
  store ptr %130, ptr %139, align 8, !tbaa !5
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %140, i32 0, i32 0
  %142 = getelementptr inbounds [4 x ptr], ptr %141, i64 0, i64 0
  store ptr %130, ptr %142, align 8, !tbaa !5
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %143, i32 0, i32 22
  store ptr @mbedtls_x509_crt_profile_default, ptr %144, align 8, !tbaa !23
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %145, i32 0, i32 26
  store ptr @ssl_preset_default_hashes, ptr %146, align 8, !tbaa !24
  %147 = call ptr @mbedtls_ecp_grp_id_list()
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %148, i32 0, i32 27
  store ptr %147, ptr %149, align 8, !tbaa !25
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.mbedtls_ssl_config, ptr %150, i32 0, i32 41
  store i32 1024, ptr %151, align 4, !tbaa !26
  br label %152

152:                                              ; preds = %129, %88
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %153

153:                                              ; preds = %152, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %154 = load i32, ptr %5, align 4
  ret i32 %154
}

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

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

declare ptr @mbedtls_ssl_list_ciphersuites() #3

declare ptr @mbedtls_ecp_grp_id_list() #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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, !6, i64 136}
!12 = !{!"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, !13, i64 248, !13, i64 272, !6, i64 296, !14, i64 304, !6, i64 312, !14, i64 320, !6, i64 328, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !7, i64 352, !10, i64 360, !10, i64 364, !7, i64 368, !7, i64 369, !7, i64 370, !7, 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}
!13 = !{!"", !10, i64 0, !14, i64 8, !6, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 144}
!16 = !{!12, !10, i64 340}
!17 = !{!12, !10, i64 344}
!18 = !{!12, !10, i64 348}
!19 = !{!12, !7, i64 370}
!20 = !{!12, !7, i64 371}
!21 = !{!12, !7, i64 368}
!22 = !{!12, !7, i64 369}
!23 = !{!12, !6, i64 200}
!24 = !{!12, !6, i64 232}
!25 = !{!12, !6, i64 240}
!26 = !{!12, !10, i64 364}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.mbedtls_x509_crt_profile = type { i32, i32, i32, i32 }

@.str.151 = external hidden unnamed_addr constant [513 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [513 x i8], align 1
@ssl_preset_suiteb_ciphersuites = external hidden global [3 x i32], align 4
@mbedtls_x509_crt_profile_suiteb = external constant %struct.mbedtls_x509_crt_profile, align 4
@ssl_preset_suiteb_hashes = external hidden global [3 x i32], align 4
@ssl_preset_suiteb_curves = external hidden global [3 x i32], align 4
@mbedtls_x509_crt_profile_default = external constant %struct.mbedtls_x509_crt_profile, align 4
@ssl_preset_default_hashes = external hidden global [6 x i32], align 16

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_ssl_config_defaults(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 {
._crit_edge:
  tail call void @mbedtls_ssl_conf_endpoint(ptr noundef %0, i32 noundef %1)
  tail call void @mbedtls_ssl_conf_transport(ptr noundef %0, i32 noundef %2)
  %4 = icmp eq i32 %1, 0
  %5 = getelementptr inbounds i8, ptr %0, i64 372
  %6 = load i32, ptr %5, align 4
  %7 = and i32 %6, -343117
  %8 = or disjoint i32 %7, 65544
  %9 = select i1 %4, i32 %8, i32 %6
  %10 = getelementptr inbounds i8, ptr %0, i64 372
  %11 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr @ssl_cookie_write_dummy, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 144
  store ptr @ssl_cookie_check_dummy, ptr %12, align 8, !tbaa !13
  %13 = or i32 %9, 277568
  store i32 %13, ptr %10, align 4
  %14 = getelementptr inbounds i8, ptr %0, i64 340
  store i32 1000, ptr %14, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %0, i64 344
  store i32 60000, ptr %15, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 348
  store i32 16, ptr %16, align 4, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 352
  store i16 0, ptr %17, align 8
  %18 = getelementptr inbounds i8, ptr %0, i64 354
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) %18, i8 -1, i64 6, i1 false)
  %19 = icmp eq i32 %1, 1
  br i1 %19, label %20, label %22

20:                                               ; preds = %._crit_edge
  %21 = tail call i32 @mbedtls_ssl_conf_dh_param(ptr noundef nonnull %0, ptr noundef nonnull @.str.151, ptr noundef nonnull @.str.152)
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %22, label %46

22:                                               ; preds = %20, %._crit_edge
  %cond = icmp eq i32 %3, 2
  br i1 %cond, label %23, label %31

23:                                               ; preds = %22
  %24 = getelementptr inbounds i8, ptr %0, i64 368
  %25 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 50529027, ptr %24, align 8
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %25, align 8, !tbaa !17
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %26, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %27, align 8, !tbaa !17
  store ptr @ssl_preset_suiteb_ciphersuites, ptr %0, align 8, !tbaa !17
  %28 = getelementptr inbounds i8, ptr %0, i64 200
  store ptr @mbedtls_x509_crt_profile_suiteb, ptr %28, align 8, !tbaa !18
  %29 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr @ssl_preset_suiteb_hashes, ptr %29, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %0, i64 240
  store ptr @ssl_preset_suiteb_curves, ptr %30, align 8, !tbaa !20
  br label %46

31:                                               ; preds = %22
  %32 = getelementptr inbounds i8, ptr %0, i64 368
  store <4 x i8> <i8 3, i8 3, i8 3, i8 1>, ptr %32, align 8, !tbaa !21
  %33 = icmp eq i32 %2, 1
  br i1 %33, label %34, label %36

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %0, i64 371
  store i8 2, ptr %35, align 1, !tbaa !22
  br label %36

36:                                               ; preds = %34, %31
  %37 = tail call ptr @mbedtls_ssl_list_ciphersuites() #3
  %38 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %37, ptr %38, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %37, ptr %39, align 8, !tbaa !17
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %37, ptr %40, align 8, !tbaa !17
  store ptr %37, ptr %0, align 8, !tbaa !17
  %41 = getelementptr inbounds i8, ptr %0, i64 200
  store ptr @mbedtls_x509_crt_profile_default, ptr %41, align 8, !tbaa !18
  %42 = getelementptr inbounds i8, ptr %0, i64 232
  store ptr @ssl_preset_default_hashes, ptr %42, align 8, !tbaa !19
  %43 = tail call ptr @mbedtls_ecp_grp_id_list() #3
  %44 = getelementptr inbounds i8, ptr %0, i64 240
  store ptr %43, ptr %44, align 8, !tbaa !20
  %45 = getelementptr inbounds i8, ptr %0, i64 364
  store i32 1024, ptr %45, align 4, !tbaa !23
  br label %46

46:                                               ; preds = %23, %36, %20
  %.0 = phi i32 [ %21, %20 ], [ 0, %36 ], [ 0, %23 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_cookie_write_dummy(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_cookie_check_dummy(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #1

declare ptr @mbedtls_ssl_list_ciphersuites() local_unnamed_addr #2

declare ptr @mbedtls_ecp_grp_id_list() local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 = { 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, !9, i64 136}
!6 = !{!"mbedtls_ssl_config", !7, i64 0, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !9, i64 88, !9, i64 96, !9, i64 104, !9, i64 112, !9, i64 120, !9, i64 128, !9, i64 136, !9, i64 144, !9, i64 152, !9, i64 160, !9, i64 168, !9, i64 176, !9, i64 184, !9, i64 192, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !10, i64 248, !10, i64 272, !9, i64 296, !12, i64 304, !9, i64 312, !12, i64 320, !9, i64 328, !11, i64 336, !11, i64 340, !11, i64 344, !11, i64 348, !7, i64 352, !11, i64 360, !11, i64 364, !7, i64 368, !7, i64 369, !7, i64 370, !7, i64 371, !11, i64 372, !11, i64 372, !11, i64 372, !11, i64 372, !11, i64 372, !11, i64 372, !11, i64 373, !11, i64 373, !11, i64 373, !11, i64 373, !11, i64 373, !11, i64 373, !11, i64 374, !11, i64 374, !11, i64 374}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 8, !9, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!6, !9, i64 144}
!14 = !{!6, !11, i64 340}
!15 = !{!6, !11, i64 344}
!16 = !{!6, !11, i64 348}
!17 = !{!9, !9, i64 0}
!18 = !{!6, !9, i64 200}
!19 = !{!6, !9, i64 232}
!20 = !{!6, !9, i64 240}
!21 = !{!7, !7, i64 0}
!22 = !{!6, !7, i64 371}
!23 = !{!6, !11, i64 364}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass