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

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

@bio_err = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 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 i32 @BIO_printf(ptr noundef, ptr noundef, ...) #1

declare ptr @ENGINE_get_id(ptr noundef) #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 ptr @make_engine_uri(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store ptr null, ptr %7, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %16

12:                                               ; preds = %3
  %13 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %13, ptr noundef @.str.6, ptr noundef %14)
  br label %55

16:                                               ; preds = %3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %23

19:                                               ; preds = %16
  %20 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %20, ptr noundef @.str.7, ptr noundef %21)
  br label %54

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call ptr @ENGINE_get_id(ptr noundef %24)
  store ptr %25, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call i64 @strlen(ptr noundef %26) #5
  %28 = add i64 19, %27
  %29 = add i64 %28, 1
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call i64 @strlen(ptr noundef %30) #5
  %32 = add i64 %29, %31
  %33 = add i64 %32, 1
  store i64 %33, ptr %9, align 8, !tbaa !9
  %34 = load i64, ptr %9, align 8, !tbaa !9
  %35 = call ptr @CRYPTO_malloc(i64 noundef %34, ptr noundef @.str.8, i32 noundef 124)
  store ptr %35, ptr %7, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %53

38:                                               ; preds = %23
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load i64, ptr %9, align 8, !tbaa !9
  %41 = call i64 @OPENSSL_strlcpy(ptr noundef %39, ptr noundef @.str.9, i64 noundef %40)
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i64, ptr %9, align 8, !tbaa !9
  %45 = call i64 @OPENSSL_strlcat(ptr noundef %42, ptr noundef %43, i64 noundef %44)
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i64, ptr %9, align 8, !tbaa !9
  %48 = call i64 @OPENSSL_strlcat(ptr noundef %46, ptr noundef @.str.10, i64 noundef %47)
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = call i64 @OPENSSL_strlcat(ptr noundef %49, ptr noundef %50, i64 noundef %51)
  br label %53

53:                                               ; preds = %38, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %54

54:                                               ; preds = %53, %19
  br label %55

55:                                               ; preds = %54, %12
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret ptr %56
}

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

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

declare i64 @OPENSSL_strlcpy(ptr noundef, ptr noundef, i64 noundef) #1

declare i64 @OPENSSL_strlcat(ptr noundef, ptr noundef, i64 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 = { 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 #4 = { nounwind }
attributes #5 = { 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 = !{!"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"

@bio_err = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1

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

declare ptr @ENGINE_get_id(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @make_engine_uri(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %5, label %8

5:                                                ; preds = %3
  %6 = load ptr, ptr @bio_err, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %6, ptr noundef nonnull @.str.6, ptr noundef %2) #3
  br label %25

8:                                                ; preds = %3
  %9 = icmp eq ptr %1, null
  br i1 %9, label %10, label %13

10:                                               ; preds = %8
  %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.7, ptr noundef %2) #3
  br label %25

13:                                               ; preds = %8
  %14 = tail call ptr @ENGINE_get_id(ptr noundef nonnull %0) #3
  %15 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %14) #4
  %16 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #4
  %17 = add i64 %15, 21
  %18 = add i64 %17, %16
  %19 = tail call ptr @CRYPTO_malloc(i64 noundef %18, ptr noundef nonnull @.str.8, i32 noundef 124) #3
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %25, label %20

20:                                               ; preds = %13
  %21 = tail call i64 @OPENSSL_strlcpy(ptr noundef nonnull %19, ptr noundef nonnull @.str.9, i64 noundef %18) #3
  %22 = tail call i64 @OPENSSL_strlcat(ptr noundef nonnull %19, ptr noundef %14, i64 noundef %18) #3
  %23 = tail call i64 @OPENSSL_strlcat(ptr noundef nonnull %19, ptr noundef nonnull @.str.10, i64 noundef %18) #3
  %24 = tail call i64 @OPENSSL_strlcat(ptr noundef nonnull %19, ptr noundef nonnull %1, i64 noundef %18) #3
  br label %25

25:                                               ; preds = %13, %20, %10, %5
  %.0 = phi ptr [ null, %5 ], [ null, %10 ], [ %19, %20 ], [ null, %13 ]
  ret ptr %.0
}

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

declare ptr @CRYPTO_malloc(i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare i64 @OPENSSL_strlcpy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare i64 @OPENSSL_strlcat(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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 = { 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 #3 = { nounwind }
attributes #4 = { 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: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass