; LLVM IR from PacktPublishing/Demystifying-Cryptography-with-OpenSSL-3 :: Chapter10 (tls-server2)

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

@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [114 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_server = external hidden unnamed_addr constant [83 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @run_tls_server(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr null, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @ERR_clear_error()
  %17 = call ptr @TLS_server_method()
  %18 = call ptr @SSL_CTX_new(ptr noundef %17)
  store ptr %18, ptr %13, align 8, !tbaa !5
  %19 = load ptr, ptr %13, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %5
  br label %23

22:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 68, ptr noundef @__PRETTY_FUNCTION__.run_tls_server) #6
  unreachable

23:                                               ; preds = %21
  %24 = load ptr, ptr %13, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = call i32 @SSL_CTX_use_PrivateKey_file(ptr noundef %24, ptr noundef %25, i32 noundef 1)
  store i32 %26, ptr %12, align 4, !tbaa !9
  %27 = load i32, ptr %12, align 4, !tbaa !9
  %28 = icmp sle i32 %27, 0
  br i1 %28, label %29, label %37

29:                                               ; preds = %23
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %36

32:                                               ; preds = %29
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.5, ptr noundef %34) #5
  br label %36

36:                                               ; preds = %32, %29
  br label %161

37:                                               ; preds = %23
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = call i32 @SSL_CTX_use_certificate_chain_file(ptr noundef %38, ptr noundef %39)
  store i32 %40, ptr %12, align 4, !tbaa !9
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = icmp sle i32 %41, 0
  br i1 %42, label %43, label %51

43:                                               ; preds = %37
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %50

46:                                               ; preds = %43
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.6, ptr noundef %48) #5
  br label %50

50:                                               ; preds = %46, %43
  br label %161

51:                                               ; preds = %37
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  %53 = call i32 @SSL_CTX_check_private_key(ptr noundef %52)
  store i32 %53, ptr %12, align 4, !tbaa !9
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = icmp sle i32 %54, 0
  br i1 %55, label %56, label %63

56:                                               ; preds = %51
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %62

59:                                               ; preds = %56
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.7) #5
  br label %62

62:                                               ; preds = %59, %56
  br label %161

63:                                               ; preds = %51
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = call i32 @SSL_CTX_load_verify_locations(ptr noundef %64, ptr noundef %65, ptr noundef null)
  store i32 %66, ptr %12, align 4, !tbaa !9
  %67 = load i32, ptr %12, align 4, !tbaa !9
  %68 = icmp sle i32 %67, 0
  br i1 %68, label %69, label %76

69:                                               ; preds = %63
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef @.str.8) #5
  br label %75

75:                                               ; preds = %72, %69
  br label %161

76:                                               ; preds = %63
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  call void @SSL_CTX_set_verify(ptr noundef %77, i32 noundef 1, ptr noundef null)
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = call i64 @SSL_CTX_ctrl(ptr noundef %78, i32 noundef 33, i64 noundef 4, ptr noundef null)
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = call ptr @BIO_new_accept(ptr noundef %80)
  store ptr %81, ptr %14, align 8, !tbaa !5
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %85

84:                                               ; preds = %76
  br label %86

85:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 102, ptr noundef @__PRETTY_FUNCTION__.run_tls_server) #6
  unreachable

86:                                               ; preds = %84
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = call i64 @BIO_ctrl(ptr noundef %87, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %89 = trunc i64 %88 to i32
  store i32 %89, ptr %12, align 4, !tbaa !9
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = icmp sle i32 %90, 0
  br i1 %91, label %92, label %100

92:                                               ; preds = %86
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %99

95:                                               ; preds = %92
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.10, ptr noundef %97) #5
  br label %99

99:                                               ; preds = %95, %92
  br label %161

100:                                              ; preds = %86
  %101 = call i64 @ERR_peek_error()
  %102 = icmp ne i64 %101, 0
  br i1 %102, label %103, label %110

103:                                              ; preds = %100
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %109

106:                                              ; preds = %103
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef @.str.11) #5
  br label %109

109:                                              ; preds = %106, %103
  br label %161

110:                                              ; preds = %100
  br label %111

111:                                              ; preds = %154, %139, %110
  br label %112

112:                                              ; preds = %111
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, ptr noundef %114)
  %116 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = call i64 @BIO_ctrl(ptr noundef %117, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %119 = trunc i64 %118 to i32
  store i32 %119, ptr %12, align 4, !tbaa !9
  %120 = load i32, ptr %12, align 4, !tbaa !9
  %121 = icmp sle i32 %120, 0
  br i1 %121, label %122, label %140

122:                                              ; preds = %112
  %123 = load ptr, ptr %10, align 8, !tbaa !5
  %124 = icmp ne ptr %123, null
  br i1 %124, label %125, label %128

125:                                              ; preds = %122
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.14) #5
  br label %128

128:                                              ; preds = %125, %122
  %129 = call i64 @ERR_peek_error()
  %130 = icmp ne i64 %129, 0
  br i1 %130, label %131, label %139

131:                                              ; preds = %128
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = icmp ne ptr %132, null
  br i1 %133, label %134, label %138

134:                                              ; preds = %131
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.15) #5
  %137 = load ptr, ptr %10, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %137)
  br label %138

138:                                              ; preds = %134, %131
  call void @ERR_clear_error()
  br label %139

139:                                              ; preds = %138, %128
  br label %111

140:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  %142 = call ptr @BIO_pop(ptr noundef %141)
  store ptr %142, ptr %15, align 8, !tbaa !5
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %146

145:                                              ; preds = %140
  br label %147

146:                                              ; preds = %140
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.4, i32 noundef 138, ptr noundef @__PRETTY_FUNCTION__.run_tls_server) #6
  unreachable

147:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = call ptr @BIO_new_ssl(ptr noundef %148, i32 noundef 0)
  store ptr %149, ptr %16, align 8, !tbaa !5
  %150 = load ptr, ptr %16, align 8, !tbaa !5
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %153

152:                                              ; preds = %147
  br label %154

153:                                              ; preds = %147
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.4, i32 noundef 141, ptr noundef @__PRETTY_FUNCTION__.run_tls_server) #6
  unreachable

154:                                              ; preds = %152
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = call ptr @BIO_push(ptr noundef %155, ptr noundef %156)
  %158 = load ptr, ptr %16, align 8, !tbaa !5
  %159 = load ptr, ptr %10, align 8, !tbaa !5
  %160 = call i32 @handle_accepted_connection(ptr noundef %158, ptr noundef %159)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %111

161:                                              ; preds = %109, %99, %75, %62, %50, %36
  store i32 1, ptr %11, align 4, !tbaa !9
  br label %162

162:                                              ; preds = %161
  %163 = load ptr, ptr %14, align 8, !tbaa !5
  %164 = icmp ne ptr %163, null
  br i1 %164, label %165, label %167

165:                                              ; preds = %162
  %166 = load ptr, ptr %14, align 8, !tbaa !5
  call void @BIO_free_all(ptr noundef %166)
  br label %167

167:                                              ; preds = %165, %162
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = icmp ne ptr %168, null
  br i1 %169, label %170, label %172

170:                                              ; preds = %167
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  call void @SSL_CTX_free(ptr noundef %171)
  br label %172

172:                                              ; preds = %170, %167
  %173 = call i64 @ERR_peek_error()
  %174 = icmp ne i64 %173, 0
  br i1 %174, label %175, label %183

175:                                              ; preds = %172
  store i32 1, ptr %11, align 4, !tbaa !9
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %178, label %182

178:                                              ; preds = %175
  %179 = load ptr, ptr %10, align 8, !tbaa !5
  %180 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %179, ptr noundef @.str.15) #5
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %181)
  br label %182

182:                                              ; preds = %178, %175
  call void @ERR_clear_error()
  br label %183

183:                                              ; preds = %182, %172
  %184 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  ret i32 %184
}

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

declare void @ERR_clear_error() #3

declare ptr @SSL_CTX_new(ptr noundef) #3

declare ptr @TLS_server_method() #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare i32 @SSL_CTX_use_PrivateKey_file(ptr noundef, ptr noundef, i32 noundef) #3

declare i32 @SSL_CTX_use_certificate_chain_file(ptr noundef, ptr noundef) #3

declare i32 @SSL_CTX_check_private_key(ptr noundef) #3

declare i32 @SSL_CTX_load_verify_locations(ptr noundef, ptr noundef, ptr noundef) #3

declare void @SSL_CTX_set_verify(ptr noundef, i32 noundef, ptr noundef) #3

declare i64 @SSL_CTX_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) #3

declare ptr @BIO_new_accept(ptr noundef) #3

declare i64 @BIO_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) #3

declare i64 @ERR_peek_error() #3

declare i32 @printf(ptr noundef, ...) #3

declare void @ERR_print_errors_fp(ptr noundef) #3

declare ptr @BIO_pop(ptr noundef) #3

declare ptr @BIO_new_ssl(ptr noundef, i32 noundef) #3

declare ptr @BIO_push(ptr noundef, ptr noundef) #3

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

declare void @BIO_free_all(ptr noundef) #3

declare void @SSL_CTX_free(ptr noundef) #3

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


; 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.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [114 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_server = external hidden unnamed_addr constant [83 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @run_tls_server(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  tail call void @ERR_clear_error() #4
  %6 = tail call ptr @TLS_server_method() #4
  %7 = tail call ptr @SSL_CTX_new(ptr noundef %6) #4
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %8, label %9

8:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 68, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

9:                                                ; preds = %5
  %10 = tail call i32 @SSL_CTX_use_PrivateKey_file(ptr noundef nonnull %7, ptr noundef %1, i32 noundef 1) #4
  %11 = icmp slt i32 %10, 1
  br i1 %11, label %12, label %15

12:                                               ; preds = %9
  %.not72 = icmp eq ptr %4, null
  br i1 %.not72, label %.thread78, label %13

13:                                               ; preds = %12
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.5, ptr noundef %1) #4
  br label %.thread78

15:                                               ; preds = %9
  %16 = tail call i32 @SSL_CTX_use_certificate_chain_file(ptr noundef nonnull %7, ptr noundef %2) #4
  %17 = icmp slt i32 %16, 1
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  %.not71 = icmp eq ptr %4, null
  br i1 %.not71, label %.thread78, label %19

19:                                               ; preds = %18
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.6, ptr noundef %2) #4
  br label %.thread78

21:                                               ; preds = %15
  %22 = tail call i32 @SSL_CTX_check_private_key(ptr noundef nonnull %7) #4
  %23 = icmp slt i32 %22, 1
  br i1 %23, label %24, label %27

24:                                               ; preds = %21
  %.not70 = icmp eq ptr %4, null
  br i1 %.not70, label %.thread78, label %25

25:                                               ; preds = %24
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.7) #4
  br label %.thread78

27:                                               ; preds = %21
  %28 = tail call i32 @SSL_CTX_load_verify_locations(ptr noundef nonnull %7, ptr noundef %3, ptr noundef null) #4
  %29 = icmp slt i32 %28, 1
  br i1 %29, label %30, label %33

30:                                               ; preds = %27
  %.not69 = icmp eq ptr %4, null
  br i1 %.not69, label %.thread78, label %31

31:                                               ; preds = %30
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.8) #4
  br label %.thread78

33:                                               ; preds = %27
  tail call void @SSL_CTX_set_verify(ptr noundef nonnull %7, i32 noundef 1, ptr noundef null) #4
  %34 = tail call i64 @SSL_CTX_ctrl(ptr noundef nonnull %7, i32 noundef 33, i64 noundef 4, ptr noundef null) #4
  %35 = tail call ptr @BIO_new_accept(ptr noundef %0) #4
  %.not61 = icmp eq ptr %35, null
  br i1 %.not61, label %36, label %37

36:                                               ; preds = %33
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 102, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

37:                                               ; preds = %33
  %38 = tail call i64 @BIO_ctrl(ptr noundef nonnull %35, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %39 = trunc i64 %38 to i32
  %40 = icmp slt i32 %39, 1
  br i1 %40, label %41, label %44

41:                                               ; preds = %37
  %.not68 = icmp eq ptr %4, null
  br i1 %.not68, label %82, label %42

42:                                               ; preds = %41
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.10, ptr noundef %0) #4
  br label %82

44:                                               ; preds = %37
  %45 = tail call i64 @ERR_peek_error() #4
  %.not62 = icmp eq i64 %45, 0
  %.not65 = icmp eq ptr %4, null
  br i1 %.not62, label %.preheader, label %62

.preheader:                                       ; preds = %44
  br i1 %.not65, label %.preheader.split.us, label %.preheader.split

.preheader.split.us:                              ; preds = %.preheader, %.preheader.split.us.backedge
  %46 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %0)
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %49 = tail call i64 @BIO_ctrl(ptr noundef nonnull %35, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %50 = trunc i64 %49 to i32
  %51 = icmp slt i32 %50, 1
  br i1 %51, label %59, label %52

52:                                               ; preds = %.preheader.split.us
  %53 = tail call ptr @BIO_pop(ptr noundef nonnull %35) #4
  %.not63.us = icmp eq ptr %53, null
  br i1 %.not63.us, label %.split.us, label %54

54:                                               ; preds = %52
  %55 = tail call ptr @BIO_new_ssl(ptr noundef nonnull %7, i32 noundef 0) #4
  %.not64.us = icmp eq ptr %55, null
  br i1 %.not64.us, label %.split82.us, label %56

56:                                               ; preds = %54
  %57 = tail call ptr @BIO_push(ptr noundef nonnull %55, ptr noundef nonnull %53) #4
  %58 = tail call i32 @handle_accepted_connection(ptr noundef nonnull %55, ptr noundef null)
  br label %.preheader.split.us.backedge

59:                                               ; preds = %.preheader.split.us
  %60 = tail call i64 @ERR_peek_error() #4
  %.not66.us = icmp eq i64 %60, 0
  br i1 %.not66.us, label %.preheader.split.us.backedge, label %61

.preheader.split.us.backedge:                     ; preds = %59, %61, %56
  br label %.preheader.split.us

61:                                               ; preds = %59
  tail call void @ERR_clear_error() #4
  br label %.preheader.split.us.backedge

62:                                               ; preds = %44
  br i1 %.not65, label %82, label %63

63:                                               ; preds = %62
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.11) #4
  br label %82

.preheader.split:                                 ; preds = %.preheader, %.preheader.split.backedge
  %65 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %66 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %0)
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %68 = tail call i64 @BIO_ctrl(ptr noundef nonnull %35, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %69 = trunc i64 %68 to i32
  %70 = icmp slt i32 %69, 1
  br i1 %70, label %.thread, label %75

.thread:                                          ; preds = %.preheader.split
  %71 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.14) #4
  %72 = tail call i64 @ERR_peek_error() #4
  %.not6676 = icmp eq i64 %72, 0
  br i1 %.not6676, label %.preheader.split.backedge, label %73

73:                                               ; preds = %.thread
  %74 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.15) #4
  tail call void @ERR_print_errors_fp(ptr noundef nonnull %4) #4
  tail call void @ERR_clear_error() #4
  br label %.preheader.split.backedge

.preheader.split.backedge:                        ; preds = %73, %.thread, %79
  br label %.preheader.split

75:                                               ; preds = %.preheader.split
  %76 = tail call ptr @BIO_pop(ptr noundef nonnull %35) #4
  %.not63 = icmp eq ptr %76, null
  br i1 %.not63, label %.split.us, label %77

.split.us:                                        ; preds = %75, %52
  tail call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.4, i32 noundef 138, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

77:                                               ; preds = %75
  %78 = tail call ptr @BIO_new_ssl(ptr noundef nonnull %7, i32 noundef 0) #4
  %.not64 = icmp eq ptr %78, null
  br i1 %.not64, label %.split82.us, label %79

.split82.us:                                      ; preds = %77, %54
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.4, i32 noundef 141, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

79:                                               ; preds = %77
  %80 = tail call ptr @BIO_push(ptr noundef nonnull %78, ptr noundef nonnull %76) #4
  %81 = tail call i32 @handle_accepted_connection(ptr noundef nonnull %78, ptr noundef nonnull %4)
  br label %.preheader.split.backedge

82:                                               ; preds = %42, %41, %63, %62
  tail call void @BIO_free_all(ptr noundef nonnull %35) #4
  br label %.thread78

.thread78:                                        ; preds = %30, %31, %24, %25, %18, %19, %12, %13, %82
  tail call void @SSL_CTX_free(ptr noundef nonnull %7) #4
  %83 = tail call i64 @ERR_peek_error() #4
  %.not74 = icmp eq i64 %83, 0
  br i1 %.not74, label %88, label %84

84:                                               ; preds = %.thread78
  %.not75 = icmp eq ptr %4, null
  br i1 %.not75, label %87, label %85

85:                                               ; preds = %84
  %86 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.15) #4
  tail call void @ERR_print_errors_fp(ptr noundef nonnull %4) #4
  br label %87

87:                                               ; preds = %85, %84
  tail call void @ERR_clear_error() #4
  br label %88

88:                                               ; preds = %87, %.thread78
  ret i32 1
}

declare void @ERR_clear_error() local_unnamed_addr #2

declare ptr @SSL_CTX_new(ptr noundef) local_unnamed_addr #2

declare ptr @TLS_server_method() local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @SSL_CTX_use_PrivateKey_file(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @SSL_CTX_use_certificate_chain_file(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @SSL_CTX_check_private_key(ptr noundef) local_unnamed_addr #2

declare i32 @SSL_CTX_load_verify_locations(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @SSL_CTX_set_verify(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i64 @SSL_CTX_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @BIO_new_accept(ptr noundef) local_unnamed_addr #2

declare i64 @BIO_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare i64 @ERR_peek_error() local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

declare void @ERR_print_errors_fp(ptr noundef) local_unnamed_addr #2

declare ptr @BIO_pop(ptr noundef) local_unnamed_addr #2

declare ptr @BIO_new_ssl(ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @BIO_push(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare void @BIO_free_all(ptr noundef) local_unnamed_addr #2

declare void @SSL_CTX_free(ptr noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind "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 = { "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 = { noreturn nounwind "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 }
attributes #5 = { noreturn 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)"}


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