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

; 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 [113 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_server = external hidden unnamed_addr constant [69 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 [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = 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) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @ERR_clear_error()
  %15 = call ptr @TLS_server_method()
  %16 = call ptr @SSL_CTX_new(ptr noundef %15)
  store ptr %16, ptr %11, align 8, !tbaa !5
  %17 = load ptr, ptr %11, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %4
  br label %21

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

21:                                               ; preds = %19
  %22 = load ptr, ptr %11, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call i32 @SSL_CTX_use_PrivateKey_file(ptr noundef %22, ptr noundef %23, i32 noundef 1)
  store i32 %24, ptr %10, align 4, !tbaa !9
  %25 = load i32, ptr %10, align 4, !tbaa !9
  %26 = icmp sle i32 %25, 0
  br i1 %26, label %27, label %35

27:                                               ; preds = %21
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %34

30:                                               ; preds = %27
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.5, ptr noundef %32) #5
  br label %34

34:                                               ; preds = %30, %27
  br label %145

35:                                               ; preds = %21
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call i32 @SSL_CTX_use_certificate_chain_file(ptr noundef %36, ptr noundef %37)
  store i32 %38, ptr %10, align 4, !tbaa !9
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = icmp sle i32 %39, 0
  br i1 %40, label %41, label %49

41:                                               ; preds = %35
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %48

44:                                               ; preds = %41
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.6, ptr noundef %46) #5
  br label %48

48:                                               ; preds = %44, %41
  br label %145

49:                                               ; preds = %35
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = call i32 @SSL_CTX_check_private_key(ptr noundef %50)
  store i32 %51, ptr %10, align 4, !tbaa !9
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = icmp sle i32 %52, 0
  br i1 %53, label %54, label %61

54:                                               ; preds = %49
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %60

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

60:                                               ; preds = %57, %54
  br label %145

61:                                               ; preds = %49
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = call i64 @SSL_CTX_ctrl(ptr noundef %62, i32 noundef 33, i64 noundef 4, ptr noundef null)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = call ptr @BIO_new_accept(ptr noundef %64)
  store ptr %65, ptr %12, align 8, !tbaa !5
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %69

68:                                               ; preds = %61
  br label %70

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

70:                                               ; preds = %68
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = call i64 @BIO_ctrl(ptr noundef %71, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %10, align 4, !tbaa !9
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = icmp sle i32 %74, 0
  br i1 %75, label %76, label %84

76:                                               ; preds = %70
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %83

79:                                               ; preds = %76
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.9, ptr noundef %81) #5
  br label %83

83:                                               ; preds = %79, %76
  br label %145

84:                                               ; preds = %70
  %85 = call i64 @ERR_peek_error()
  %86 = icmp ne i64 %85, 0
  br i1 %86, label %87, label %94

87:                                               ; preds = %84
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %93

90:                                               ; preds = %87
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.10) #5
  br label %93

93:                                               ; preds = %90, %87
  br label %145

94:                                               ; preds = %84
  br label %95

95:                                               ; preds = %138, %123, %94
  br label %96

96:                                               ; preds = %95
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, ptr noundef %98)
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = call i64 @BIO_ctrl(ptr noundef %101, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %103 = trunc i64 %102 to i32
  store i32 %103, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %10, align 4, !tbaa !9
  %105 = icmp sle i32 %104, 0
  br i1 %105, label %106, label %124

106:                                              ; preds = %96
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %112

109:                                              ; preds = %106
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef @.str.13) #5
  br label %112

112:                                              ; preds = %109, %106
  %113 = call i64 @ERR_peek_error()
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %123

115:                                              ; preds = %112
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %122

118:                                              ; preds = %115
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %119, ptr noundef @.str.14) #5
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %121)
  br label %122

122:                                              ; preds = %118, %115
  call void @ERR_clear_error()
  br label %123

123:                                              ; preds = %122, %112
  br label %95

124:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %125 = load ptr, ptr %12, align 8, !tbaa !5
  %126 = call ptr @BIO_pop(ptr noundef %125)
  store ptr %126, ptr %13, align 8, !tbaa !5
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %130

129:                                              ; preds = %124
  br label %131

130:                                              ; preds = %124
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.4, i32 noundef 112, ptr noundef @__PRETTY_FUNCTION__.run_tls_server) #6
  unreachable

131:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = call ptr @BIO_new_ssl(ptr noundef %132, i32 noundef 0)
  store ptr %133, ptr %14, align 8, !tbaa !5
  %134 = load ptr, ptr %14, align 8, !tbaa !5
  %135 = icmp ne ptr %134, null
  br i1 %135, label %136, label %137

136:                                              ; preds = %131
  br label %138

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

138:                                              ; preds = %136
  %139 = load ptr, ptr %14, align 8, !tbaa !5
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = call ptr @BIO_push(ptr noundef %139, ptr noundef %140)
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = call i32 @handle_accepted_connection(ptr noundef %142, ptr noundef %143)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %95

145:                                              ; preds = %93, %83, %60, %48, %34
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %146

146:                                              ; preds = %145
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %151

149:                                              ; preds = %146
  %150 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BIO_free_all(ptr noundef %150)
  br label %151

151:                                              ; preds = %149, %146
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  %153 = icmp ne ptr %152, null
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  %155 = load ptr, ptr %11, align 8, !tbaa !5
  call void @SSL_CTX_free(ptr noundef %155)
  br label %156

156:                                              ; preds = %154, %151
  %157 = call i64 @ERR_peek_error()
  %158 = icmp ne i64 %157, 0
  br i1 %158, label %159, label %167

159:                                              ; preds = %156
  store i32 1, ptr %9, align 4, !tbaa !9
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = icmp ne ptr %160, null
  br i1 %161, label %162, label %166

162:                                              ; preds = %159
  %163 = load ptr, ptr %8, align 8, !tbaa !5
  %164 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %163, ptr noundef @.str.14) #5
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %165)
  br label %166

166:                                              ; preds = %162, %159
  call void @ERR_clear_error()
  br label %167

167:                                              ; preds = %166, %156
  %168 = load i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i32 %168
}

; 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 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 [113 x i8], align 1
@__PRETTY_FUNCTION__.run_tls_server = external hidden unnamed_addr constant [69 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 [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = 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) local_unnamed_addr #1 {
  tail call void @ERR_clear_error() #4
  %5 = tail call ptr @TLS_server_method() #4
  %6 = tail call ptr @SSL_CTX_new(ptr noundef %5) #4
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %8

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

8:                                                ; preds = %4
  %9 = tail call i32 @SSL_CTX_use_PrivateKey_file(ptr noundef nonnull %6, ptr noundef %1, i32 noundef 1) #4
  %10 = icmp slt i32 %9, 1
  br i1 %10, label %11, label %14

11:                                               ; preds = %8
  %.not65 = icmp eq ptr %3, null
  br i1 %.not65, label %.thread71, label %12

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

14:                                               ; preds = %8
  %15 = tail call i32 @SSL_CTX_use_certificate_chain_file(ptr noundef nonnull %6, ptr noundef %2) #4
  %16 = icmp slt i32 %15, 1
  br i1 %16, label %17, label %20

17:                                               ; preds = %14
  %.not64 = icmp eq ptr %3, null
  br i1 %.not64, label %.thread71, label %18

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

20:                                               ; preds = %14
  %21 = tail call i32 @SSL_CTX_check_private_key(ptr noundef nonnull %6) #4
  %22 = icmp slt i32 %21, 1
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %.not63 = icmp eq ptr %3, null
  br i1 %.not63, label %.thread71, label %24

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

26:                                               ; preds = %20
  %27 = tail call i64 @SSL_CTX_ctrl(ptr noundef nonnull %6, i32 noundef 33, i64 noundef 4, ptr noundef null) #4
  %28 = tail call ptr @BIO_new_accept(ptr noundef %0) #4
  %.not55 = icmp eq ptr %28, null
  br i1 %.not55, label %29, label %30

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

30:                                               ; preds = %26
  %31 = tail call i64 @BIO_ctrl(ptr noundef nonnull %28, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %32 = trunc i64 %31 to i32
  %33 = icmp slt i32 %32, 1
  br i1 %33, label %34, label %37

34:                                               ; preds = %30
  %.not62 = icmp eq ptr %3, null
  br i1 %.not62, label %75, label %35

35:                                               ; preds = %34
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.9, ptr noundef %0) #4
  br label %75

37:                                               ; preds = %30
  %38 = tail call i64 @ERR_peek_error() #4
  %.not56 = icmp eq i64 %38, 0
  %.not59 = icmp eq ptr %3, null
  br i1 %.not56, label %.preheader, label %55

.preheader:                                       ; preds = %37
  br i1 %.not59, label %.preheader.split.us, label %.preheader.split

.preheader.split.us:                              ; preds = %.preheader, %.preheader.split.us.backedge
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %0)
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %42 = tail call i64 @BIO_ctrl(ptr noundef nonnull %28, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %43 = trunc i64 %42 to i32
  %44 = icmp slt i32 %43, 1
  br i1 %44, label %52, label %45

45:                                               ; preds = %.preheader.split.us
  %46 = tail call ptr @BIO_pop(ptr noundef nonnull %28) #4
  %.not57.us = icmp eq ptr %46, null
  br i1 %.not57.us, label %.split.us, label %47

47:                                               ; preds = %45
  %48 = tail call ptr @BIO_new_ssl(ptr noundef nonnull %6, i32 noundef 0) #4
  %.not58.us = icmp eq ptr %48, null
  br i1 %.not58.us, label %.split75.us, label %49

49:                                               ; preds = %47
  %50 = tail call ptr @BIO_push(ptr noundef nonnull %48, ptr noundef nonnull %46) #4
  %51 = tail call i32 @handle_accepted_connection(ptr noundef nonnull %48, ptr noundef null)
  br label %.preheader.split.us.backedge

52:                                               ; preds = %.preheader.split.us
  %53 = tail call i64 @ERR_peek_error() #4
  %.not60.us = icmp eq i64 %53, 0
  br i1 %.not60.us, label %.preheader.split.us.backedge, label %54

.preheader.split.us.backedge:                     ; preds = %52, %54, %49
  br label %.preheader.split.us

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

55:                                               ; preds = %37
  br i1 %.not59, label %75, label %56

56:                                               ; preds = %55
  %57 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.10) #4
  br label %75

.preheader.split:                                 ; preds = %.preheader, %.preheader.split.backedge
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef %0)
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %61 = tail call i64 @BIO_ctrl(ptr noundef nonnull %28, i32 noundef 101, i64 noundef 0, ptr noundef null) #4
  %62 = trunc i64 %61 to i32
  %63 = icmp slt i32 %62, 1
  br i1 %63, label %.thread, label %68

.thread:                                          ; preds = %.preheader.split
  %64 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.13) #4
  %65 = tail call i64 @ERR_peek_error() #4
  %.not6069 = icmp eq i64 %65, 0
  br i1 %.not6069, label %.preheader.split.backedge, label %66

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

.preheader.split.backedge:                        ; preds = %66, %.thread, %72
  br label %.preheader.split

68:                                               ; preds = %.preheader.split
  %69 = tail call ptr @BIO_pop(ptr noundef nonnull %28) #4
  %.not57 = icmp eq ptr %69, null
  br i1 %.not57, label %.split.us, label %70

.split.us:                                        ; preds = %68, %45
  tail call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.4, i32 noundef 112, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

70:                                               ; preds = %68
  %71 = tail call ptr @BIO_new_ssl(ptr noundef nonnull %6, i32 noundef 0) #4
  %.not58 = icmp eq ptr %71, null
  br i1 %.not58, label %.split75.us, label %72

.split75.us:                                      ; preds = %70, %47
  tail call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.4, i32 noundef 115, ptr noundef nonnull @__PRETTY_FUNCTION__.run_tls_server) #5
  unreachable

72:                                               ; preds = %70
  %73 = tail call ptr @BIO_push(ptr noundef nonnull %71, ptr noundef nonnull %69) #4
  %74 = tail call i32 @handle_accepted_connection(ptr noundef nonnull %71, ptr noundef nonnull %3)
  br label %.preheader.split.backedge

75:                                               ; preds = %35, %34, %56, %55
  tail call void @BIO_free_all(ptr noundef nonnull %28) #4
  br label %.thread71

.thread71:                                        ; preds = %23, %24, %17, %18, %11, %12, %75
  tail call void @SSL_CTX_free(ptr noundef nonnull %6) #4
  %76 = tail call i64 @ERR_peek_error() #4
  %.not67 = icmp eq i64 %76, 0
  br i1 %.not67, label %81, label %77

77:                                               ; preds = %.thread71
  %.not68 = icmp eq ptr %3, null
  br i1 %.not68, label %80, label %78

78:                                               ; preds = %77
  %79 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.14) #4
  tail call void @ERR_print_errors_fp(ptr noundef nonnull %3) #4
  br label %80

80:                                               ; preds = %78, %77
  tail call void @ERR_clear_error() #4
  br label %81

81:                                               ; preds = %80, %.thread71
  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 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