; 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.4 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.handle_accepted_connection = external hidden unnamed_addr constant [46 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@stdout = external global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [120 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [36 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @ERR_clear_error() #2

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

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

declare i64 @ERR_peek_error() #2

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

declare void @ERR_print_errors_fp(ptr noundef) #2

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

20:                                               ; preds = %2
  br label %22

21:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.4, i32 noundef 153, ptr noundef @__PRETTY_FUNCTION__.handle_accepted_connection) #9
  unreachable

22:                                               ; preds = %20
  call void @ERR_clear_error()
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call i64 @BIO_ctrl(ptr noundef %23, i32 noundef 101, i64 noundef 0, ptr noundef null)
  %25 = trunc i64 %24 to i32
  store i32 %25, ptr %7, align 4, !tbaa !9
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = icmp sle i32 %26, 0
  br i1 %27, label %28, label %35

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

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

34:                                               ; preds = %31, %28
  br label %120

35:                                               ; preds = %22
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call i64 @BIO_ctrl(ptr noundef %36, i32 noundef 110, i64 noundef 0, ptr noundef %8)
  %38 = trunc i64 %37 to i32
  store i32 %38, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %42

41:                                               ; preds = %35
  br label %43

42:                                               ; preds = %35
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.4, i32 noundef 165, ptr noundef @__PRETTY_FUNCTION__.handle_accepted_connection) #9
  unreachable

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

46:                                               ; preds = %43
  br label %48

47:                                               ; preds = %43
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.4, i32 noundef 166, ptr noundef @__PRETTY_FUNCTION__.handle_accepted_connection) #9
  unreachable

48:                                               ; preds = %46
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  br label %50

50:                                               ; preds = %94, %48
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = call i32 @SSL_get_shutdown(ptr noundef %51)
  %53 = and i32 %52, 2
  %54 = icmp ne i32 %53, 2
  br i1 %54, label %55, label %95

55:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = call i32 @BIO_get_line(ptr noundef %56, ptr noundef %57, i32 noundef 16384)
  store i32 %58, ptr %11, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = icmp sle i32 %59, 0
  br i1 %60, label %61, label %77

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = call i32 @SSL_get_error(ptr noundef %62, i32 noundef %63)
  store i32 %64, ptr %12, align 4, !tbaa !9
  %65 = load i32, ptr %12, align 4, !tbaa !9
  %66 = icmp eq i32 %65, 6
  br i1 %66, label %67, label %68

67:                                               ; preds = %61
  store i32 4, ptr %13, align 4
  br label %76

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

71:                                               ; preds = %68
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load i32, ptr %12, align 4, !tbaa !9
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.22, i32 noundef %73) #7
  br label %75

75:                                               ; preds = %71, %68
  store i32 2, ptr %13, align 4
  br label %76

76:                                               ; preds = %75, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %92

77:                                               ; preds = %55
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = load ptr, ptr @stdout, align 8, !tbaa !5
  %82 = call i64 @fwrite(ptr noundef %78, i64 noundef 1, i64 noundef %80, ptr noundef %81)
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = call i32 @strcmp(ptr noundef %83, ptr noundef @.str.23) #10
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %77
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = call i32 @strcmp(ptr noundef %87, ptr noundef @.str.11) #10
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %91, label %90

90:                                               ; preds = %86, %77
  store i32 4, ptr %13, align 4
  br label %92

91:                                               ; preds = %86
  store i32 0, ptr %13, align 4
  br label %92

92:                                               ; preds = %91, %90, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %93 = load i32, ptr %13, align 4
  switch i32 %93, label %140 [
    i32 0, label %94
    i32 4, label %95
    i32 2, label %120
  ]

94:                                               ; preds = %92
  br label %50, !llvm.loop !13

95:                                               ; preds = %92, %50
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.24)
  store ptr @.str.25, ptr %14, align 8, !tbaa !5
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = call i64 @strlen(ptr noundef %97) #10
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %15, align 4, !tbaa !9
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.26)
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.27, ptr noundef %101)
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  %105 = load i32, ptr %15, align 4, !tbaa !9
  %106 = call i32 @BIO_write(ptr noundef %103, ptr noundef %104, i32 noundef %105)
  store i32 %106, ptr %16, align 4, !tbaa !9
  %107 = load i32, ptr %16, align 4, !tbaa !9
  %108 = load i32, ptr %15, align 4, !tbaa !9
  %109 = icmp ne i32 %107, %108
  br i1 %109, label %110, label %117

110:                                              ; preds = %95
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = icmp ne ptr %111, null
  br i1 %112, label %113, label %116

113:                                              ; preds = %110
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.28) #7
  br label %116

116:                                              ; preds = %113, %110
  br label %120

117:                                              ; preds = %95
  %118 = call i32 (ptr, ...) @printf(ptr noundef @.str.29)
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  call void @BIO_ssl_shutdown(ptr noundef %119)
  br label %121

120:                                              ; preds = %116, %92, %34
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %120, %117
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = icmp ne ptr %122, null
  br i1 %123, label %124, label %126

124:                                              ; preds = %121
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  call void @BIO_free_all(ptr noundef %125)
  br label %126

126:                                              ; preds = %124, %121
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %127) #7
  %128 = call i64 @ERR_peek_error()
  %129 = icmp ne i64 %128, 0
  br i1 %129, label %130, label %138

130:                                              ; preds = %126
  store i32 1, ptr %6, align 4, !tbaa !9
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %137

133:                                              ; preds = %130
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %134, ptr noundef @.str.14) #7
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %136)
  br label %137

137:                                              ; preds = %133, %130
  call void @ERR_clear_error()
  br label %138

138:                                              ; preds = %137, %126
  %139 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %139, ptr %3, align 4
  store i32 1, ptr %13, align 4
  br label %140

140:                                              ; preds = %138, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %141 = load i32, ptr %3, align 4
  ret i32 %141
}

declare void @BIO_free_all(ptr noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

declare i32 @SSL_get_shutdown(ptr noundef) #2

declare i32 @BIO_get_line(ptr noundef, ptr noundef, i32 noundef) #2

declare i32 @SSL_get_error(ptr noundef, i32 noundef) #2

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

declare i32 @BIO_write(ptr noundef, ptr noundef, i32 noundef) #2

declare void @BIO_ssl_shutdown(ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

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 = { "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 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 #5 = { nounwind allocsize(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 #6 = { nounwind willreturn memory(read) "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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind willreturn memory(read) }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

@.str.4 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__.handle_accepted_connection = external hidden unnamed_addr constant [46 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [45 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [120 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [36 x i8], align 1

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

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

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

declare void @ERR_clear_error() 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 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 #1

declare void @ERR_print_errors_fp(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @handle_accepted_connection(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store ptr null, ptr %3, align 8, !tbaa !5
  %4 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #9
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.4, i32 noundef 153, ptr noundef nonnull @__PRETTY_FUNCTION__.handle_accepted_connection) #10
  unreachable

6:                                                ; preds = %2
  tail call void @ERR_clear_error() #8
  %7 = tail call i64 @BIO_ctrl(ptr noundef %0, i32 noundef 101, i64 noundef 0, ptr noundef null) #8
  %8 = trunc i64 %7 to i32
  %9 = icmp slt i32 %8, 1
  br i1 %9, label %10, label %13

10:                                               ; preds = %6
  %.not54 = icmp eq ptr %1, null
  br i1 %.not54, label %.thread60, label %11

11:                                               ; preds = %10
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %1, ptr noundef nonnull @.str.18) #8
  br label %.thread60

13:                                               ; preds = %6
  %14 = call i64 @BIO_ctrl(ptr noundef %0, i32 noundef 110, i64 noundef 0, ptr noundef nonnull %3) #8
  %15 = and i64 %14, 4294967295
  %16 = icmp eq i64 %15, 1
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.4, i32 noundef 165, ptr noundef nonnull @__PRETTY_FUNCTION__.handle_accepted_connection) #10
  unreachable

18:                                               ; preds = %13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %.not47 = icmp eq ptr %19, null
  br i1 %.not47, label %20, label %21

20:                                               ; preds = %18
  call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.4, i32 noundef 166, ptr noundef nonnull @__PRETTY_FUNCTION__.handle_accepted_connection) #10
  unreachable

21:                                               ; preds = %18
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21)
  br label %23

23:                                               ; preds = %42, %21
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call i32 @SSL_get_shutdown(ptr noundef %24) #8
  %26 = and i32 %25, 2
  %.not48.not = icmp eq i32 %26, 0
  br i1 %.not48.not, label %27, label %.thread

27:                                               ; preds = %23
  %28 = call i32 @BIO_get_line(ptr noundef %0, ptr noundef nonnull %4, i32 noundef 16384) #8
  %29 = icmp slt i32 %28, 1
  br i1 %29, label %30, label %37

30:                                               ; preds = %27
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = call i32 @SSL_get_error(ptr noundef %31, i32 noundef %28) #8
  %33 = icmp eq i32 %32, 6
  br i1 %33, label %.thread, label %34

34:                                               ; preds = %30
  %.not51 = icmp eq ptr %1, null
  br i1 %.not51, label %.thread60, label %35

35:                                               ; preds = %34
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %1, ptr noundef nonnull @.str.22, i32 noundef %32) #8
  br label %.thread60

37:                                               ; preds = %27
  %38 = zext nneg i32 %28 to i64
  %39 = load ptr, ptr @stdout, align 8, !tbaa !5
  %40 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %38, ptr noundef %39)
  %41 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.23) #11
  %.not49 = icmp eq i32 %41, 0
  br i1 %.not49, label %.thread, label %42

42:                                               ; preds = %37
  %43 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str.11) #11
  %.not50 = icmp eq i32 %43, 0
  br i1 %.not50, label %.thread, label %23

.thread:                                          ; preds = %42, %37, %23, %30
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24)
  %45 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.25) #11
  %46 = trunc i64 %45 to i32
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.26)
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27, ptr noundef nonnull @.str.25)
  %49 = call i32 @BIO_write(ptr noundef %0, ptr noundef nonnull @.str.25, i32 noundef %46) #8
  %.not52 = icmp eq i32 %49, %46
  br i1 %.not52, label %53, label %50

50:                                               ; preds = %.thread
  %.not53 = icmp eq ptr %1, null
  br i1 %.not53, label %.thread60, label %51

51:                                               ; preds = %50
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %1, ptr noundef nonnull @.str.28) #8
  br label %.thread60

53:                                               ; preds = %.thread
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.29)
  call void @BIO_ssl_shutdown(ptr noundef %0) #8
  br label %.thread60

.thread60:                                        ; preds = %34, %35, %11, %10, %51, %50, %53
  %.037 = phi i32 [ 0, %53 ], [ 1, %50 ], [ 1, %51 ], [ 1, %10 ], [ 1, %11 ], [ 1, %35 ], [ 1, %34 ]
  %.not55 = icmp eq ptr %0, null
  br i1 %.not55, label %56, label %55

55:                                               ; preds = %.thread60
  call void @BIO_free_all(ptr noundef nonnull %0) #8
  br label %56

56:                                               ; preds = %55, %.thread60
  call void @free(ptr noundef %4) #8
  %57 = call i64 @ERR_peek_error() #8
  %.not56 = icmp eq i64 %57, 0
  br i1 %.not56, label %62, label %58

58:                                               ; preds = %56
  %.not57 = icmp eq ptr %1, null
  br i1 %.not57, label %61, label %59

59:                                               ; preds = %58
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %1, ptr noundef nonnull @.str.14) #8
  call void @ERR_print_errors_fp(ptr noundef nonnull %1) #8
  br label %61

61:                                               ; preds = %59, %58
  call void @ERR_clear_error() #8
  br label %62

62:                                               ; preds = %56, %61
  %.0 = phi i32 [ 1, %61 ], [ %.037, %56 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  ret i32 %.0
}

declare void @BIO_free_all(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #5

declare i32 @SSL_get_shutdown(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

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

declare void @BIO_ssl_shutdown(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #5 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #6 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #7 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind willreturn memory(read) }

!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"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass