; LLVM IR from openanolis/openssl :: fuzz (client)

; 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 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [57 x i8], align 1

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

declare void @ERR_clear_error() #1

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

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

14:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %93

15:                                               ; preds = %2
  %16 = call ptr @TLS_method()
  %17 = call ptr @SSL_CTX_new(ptr noundef %16)
  store ptr %17, ptr %9, align 8, !tbaa !5
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %15
  br label %90

21:                                               ; preds = %15
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = call ptr @SSL_new(ptr noundef %22)
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  br label %90

27:                                               ; preds = %21
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call i64 @SSL_ctrl(ptr noundef %28, i32 noundef 123, i64 noundef 0, ptr noundef null)
  %30 = icmp eq i64 %29, 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  br label %34

32:                                               ; preds = %27
  call void @OPENSSL_die(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 74) #5
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  %35 = phi i32 [ 0, %31 ], [ 1, %33 ]
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call i32 @SSL_set_cipher_list(ptr noundef %36, ptr noundef @.str.2)
  %38 = icmp eq i32 %37, 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  br label %42

40:                                               ; preds = %34
  call void @OPENSSL_die(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 75) #5
  unreachable

41:                                               ; No predecessors!
  br label %42

42:                                               ; preds = %41, %39
  %43 = phi i32 [ 0, %39 ], [ 1, %41 ]
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call i64 @SSL_ctrl(ptr noundef %44, i32 noundef 55, i64 noundef 0, ptr noundef @.str.4)
  %46 = call ptr @BIO_s_mem()
  %47 = call ptr @BIO_new(ptr noundef %46)
  store ptr %47, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  br label %90

51:                                               ; preds = %42
  %52 = call ptr @BIO_s_mem()
  %53 = call ptr @BIO_new(ptr noundef %52)
  store ptr %53, ptr %8, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %59

56:                                               ; preds = %51
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call i32 @BIO_free(ptr noundef %57)
  br label %90

59:                                               ; preds = %51
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  call void @SSL_set_bio(ptr noundef %60, ptr noundef %61, ptr noundef %62)
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  call void @SSL_set_connect_state(ptr noundef %63)
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i64, ptr %5, align 8, !tbaa !9
  %67 = trunc i64 %66 to i32
  %68 = call i32 @BIO_write(ptr noundef %64, ptr noundef %65, i32 noundef %67)
  %69 = sext i32 %68 to i64
  %70 = load i64, ptr %5, align 8, !tbaa !9
  %71 = icmp eq i64 %69, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %59
  br label %75

73:                                               ; preds = %59
  call void @OPENSSL_die(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 87) #5
  unreachable

74:                                               ; No predecessors!
  br label %75

75:                                               ; preds = %74, %72
  %76 = phi i32 [ 0, %72 ], [ 1, %74 ]
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = call i32 @SSL_do_handshake(ptr noundef %77)
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %89

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #4
  br label %81

81:                                               ; preds = %87, %80
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds [1024 x i8], ptr %11, i64 0, i64 0
  %84 = call i32 @SSL_read(ptr noundef %82, ptr noundef %83, i32 noundef 1024)
  %85 = icmp sle i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %81
  br label %88

87:                                               ; preds = %81
  br label %81

88:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #4
  br label %89

89:                                               ; preds = %88, %75
  br label %90

90:                                               ; preds = %89, %56, %50, %26, %20
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  call void @SSL_free(ptr noundef %91)
  call void @ERR_clear_error()
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  call void @SSL_CTX_free(ptr noundef %92)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %93

93:                                               ; preds = %90, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %94 = load i32, ptr %3, align 4
  ret i32 %94
}

declare ptr @SSL_CTX_new(ptr noundef) #1

declare ptr @TLS_method() #1

declare ptr @SSL_new(ptr noundef) #1

declare i64 @SSL_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) #1

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

declare i32 @SSL_set_cipher_list(ptr noundef, ptr noundef) #1

declare ptr @BIO_new(ptr noundef) #1

declare ptr @BIO_s_mem() #1

declare i32 @BIO_free(ptr noundef) #1

declare void @SSL_set_bio(ptr noundef, ptr noundef, ptr noundef) #1

declare void @SSL_set_connect_state(ptr noundef) #1

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

declare i32 @SSL_do_handshake(ptr noundef) #1

declare i32 @SSL_read(ptr noundef, ptr noundef, i32 noundef) #1

declare void @SSL_free(ptr noundef) #1

declare void @SSL_CTX_free(ptr noundef) #1

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

!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 = !{!"long", !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 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [57 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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @FuzzerTestOneInput(ptr noundef %0, i64 noundef %1) local_unnamed_addr #2 {
  %3 = alloca [1024 x i8], align 16
  %4 = icmp eq i64 %1, 0
  br i1 %4, label %46, label %5

5:                                                ; preds = %2
  %6 = tail call ptr @TLS_method() #4
  %7 = tail call ptr @SSL_CTX_new(ptr noundef %6) #4
  %8 = icmp eq ptr %7, null
  br i1 %8, label %45, label %9

9:                                                ; preds = %5
  %10 = tail call ptr @SSL_new(ptr noundef nonnull %7) #4
  %11 = icmp eq ptr %10, null
  br i1 %11, label %45, label %12

12:                                               ; preds = %9
  %13 = tail call i64 @SSL_ctrl(ptr noundef nonnull %10, i32 noundef 123, i64 noundef 0, ptr noundef null) #4
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  tail call void @OPENSSL_die(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 74) #5
  unreachable

16:                                               ; preds = %12
  %17 = tail call i32 @SSL_set_cipher_list(ptr noundef nonnull %10, ptr noundef nonnull @.str.2) #4
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 75) #5
  unreachable

20:                                               ; preds = %16
  %21 = tail call i64 @SSL_ctrl(ptr noundef nonnull %10, i32 noundef 55, i64 noundef 0, ptr noundef nonnull @.str.4) #4
  %22 = tail call ptr @BIO_s_mem() #4
  %23 = tail call ptr @BIO_new(ptr noundef %22) #4
  %24 = icmp eq ptr %23, null
  br i1 %24, label %45, label %25

25:                                               ; preds = %20
  %26 = tail call ptr @BIO_s_mem() #4
  %27 = tail call ptr @BIO_new(ptr noundef %26) #4
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %25
  %30 = tail call i32 @BIO_free(ptr noundef nonnull %23) #4
  br label %45

31:                                               ; preds = %25
  tail call void @SSL_set_bio(ptr noundef nonnull %10, ptr noundef nonnull %23, ptr noundef nonnull %27) #4
  tail call void @SSL_set_connect_state(ptr noundef nonnull %10) #4
  %32 = trunc i64 %1 to i32
  %33 = tail call i32 @BIO_write(ptr noundef nonnull %23, ptr noundef %0, i32 noundef %32) #4
  %34 = sext i32 %33 to i64
  %35 = icmp eq i64 %34, %1
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 87) #5
  unreachable

37:                                               ; preds = %31
  %38 = tail call i32 @SSL_do_handshake(ptr noundef nonnull %10) #4
  %39 = icmp eq i32 %38, 1
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #4
  br label %41

41:                                               ; preds = %41, %40
  %42 = call i32 @SSL_read(ptr noundef nonnull %10, ptr noundef nonnull %3, i32 noundef 1024) #4
  %43 = icmp slt i32 %42, 1
  br i1 %43, label %44, label %41

44:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #4
  br label %45

45:                                               ; preds = %37, %44, %20, %9, %5, %29
  %.022 = phi ptr [ null, %5 ], [ null, %9 ], [ %10, %20 ], [ %10, %29 ], [ %10, %44 ], [ %10, %37 ]
  call void @SSL_free(ptr noundef %.022) #4
  call void @ERR_clear_error() #4
  call void @SSL_CTX_free(ptr noundef %7) #4
  br label %46

46:                                               ; preds = %2, %45
  ret i32 0
}

declare ptr @SSL_CTX_new(ptr noundef) local_unnamed_addr #1

declare ptr @TLS_method() local_unnamed_addr #1

declare ptr @SSL_new(ptr noundef) local_unnamed_addr #1

declare i64 @SSL_ctrl(ptr noundef, i32 noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @SSL_set_cipher_list(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @BIO_new(ptr noundef) local_unnamed_addr #1

declare ptr @BIO_s_mem() local_unnamed_addr #1

declare i32 @BIO_free(ptr noundef) local_unnamed_addr #1

declare void @SSL_set_bio(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @SSL_set_connect_state(ptr noundef) local_unnamed_addr #1

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

declare i32 @SSL_do_handshake(ptr noundef) local_unnamed_addr #1

declare i32 @SSL_read(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @SSL_free(ptr noundef) local_unnamed_addr #1

declare void @SSL_CTX_free(ptr noundef) local_unnamed_addr #1

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