; LLVM IR from openanolis/openssl :: apps/lib (tlssrp_depr)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.srpsrvparm_st = type { ptr, ptr, ptr }

@bio_err = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1

declare i32 @BIO_printf(ptr noundef, ptr noundef, ...) #0

declare i32 @SSL_CTX_set_srp_cb_arg(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @set_up_srp_verifier_file(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %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 i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %12 = load ptr, ptr %8, align 8, !tbaa !5
  %13 = call ptr @SRP_VBASE_new(ptr noundef %12)
  %14 = load ptr, ptr %7, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.srpsrvparm_st, ptr %14, i32 0, i32 1
  store ptr %13, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.srpsrvparm_st, ptr %16, i32 0, i32 2
  store ptr null, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.srpsrvparm_st, ptr %18, i32 0, i32 0
  store ptr null, ptr %19, align 8, !tbaa !12
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.srpsrvparm_st, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %27

24:                                               ; preds = %4
  %25 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %25, ptr noundef @.str.1)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %45

27:                                               ; preds = %4
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.srpsrvparm_st, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = call i32 @SRP_VBASE_init(ptr noundef %30, ptr noundef %31)
  store i32 %32, ptr %10, align 4, !tbaa !13
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %27
  %35 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = load i32, ptr %10, align 4, !tbaa !13
  %38 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %35, ptr noundef @.str.2, ptr noundef %36, i32 noundef %37)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %45

39:                                               ; preds = %27
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  call void @SSL_CTX_set_verify(ptr noundef %40, i32 noundef 0, ptr noundef @verify_callback)
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = call i32 @SSL_CTX_set_srp_cb_arg(ptr noundef %41, ptr noundef %7)
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call i32 @SSL_CTX_set_srp_username_callback(ptr noundef %43, ptr noundef @ssl_srp_server_param_cb)
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %45

45:                                               ; preds = %39, %34, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %46 = load i32, ptr %5, align 4
  ret i32 %46
}

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

declare ptr @SRP_VBASE_new(ptr noundef) #0

declare i32 @SRP_VBASE_init(ptr noundef, ptr noundef) #0

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

declare i32 @verify_callback(i32 noundef, ptr noundef) #0

declare i32 @SSL_CTX_set_srp_username_callback(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @ssl_srp_server_param_cb(ptr noundef, 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) #2

attributes #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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"srpsrvparm_st", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!10, !6, i64 16}
!12 = !{!10, !6, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"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"

@bio_err = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1

declare i32 @BIO_printf(ptr noundef, ptr noundef, ...) local_unnamed_addr #0

declare i32 @SSL_CTX_set_srp_cb_arg(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @set_up_srp_verifier_file(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = alloca ptr, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = tail call ptr @SRP_VBASE_new(ptr noundef %2) #2
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr %6, ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr null, ptr %8, align 8, !tbaa !11
  store ptr null, ptr %1, align 8, !tbaa !12
  %9 = icmp eq ptr %6, null
  br i1 %9, label %10, label %13

10:                                               ; preds = %4
  %11 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %12 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %11, ptr noundef nonnull @.str.1) #2
  br label %21

13:                                               ; preds = %4
  %14 = tail call i32 @SRP_VBASE_init(ptr noundef nonnull %6, ptr noundef %3) #2
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %18, label %15

15:                                               ; preds = %13
  %16 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %16, ptr noundef nonnull @.str.2, ptr noundef %3, i32 noundef %14) #2
  br label %21

18:                                               ; preds = %13
  tail call void @SSL_CTX_set_verify(ptr noundef %0, i32 noundef 0, ptr noundef nonnull @verify_callback) #2
  %19 = call i32 @SSL_CTX_set_srp_cb_arg(ptr noundef %0, ptr noundef nonnull %5) #2
  %20 = call i32 @SSL_CTX_set_srp_username_callback(ptr noundef %0, ptr noundef nonnull @ssl_srp_server_param_cb) #2
  br label %21

21:                                               ; preds = %18, %15, %10
  %.0 = phi i32 [ 0, %10 ], [ 0, %15 ], [ 1, %18 ]
  ret i32 %.0
}

declare ptr @SRP_VBASE_new(ptr noundef) local_unnamed_addr #0

declare i32 @SRP_VBASE_init(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare i32 @verify_callback(i32 noundef, ptr noundef) #0

declare i32 @SSL_CTX_set_srp_username_callback(ptr noundef, ptr noundef) local_unnamed_addr #0

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

attributes #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 #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 = { 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, !6, i64 8}
!10 = !{!"srpsrvparm_st", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!10, !6, i64 16}
!12 = !{!10, !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass