; LLVM IR from openssl/openssl :: crypto/slh_dsa (slh_dsa_key)

; 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 [78 x i8], align 1
@__func__.ossl_slh_dsa_key_to_text = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @ossl_slh_dsa_key_get_priv_len(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_pub(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @ossl_slh_dsa_key_get_pub_len(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_priv(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_name(ptr noundef) #1

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

12:                                               ; preds = %3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %12, %3
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 467, ptr noundef @__func__.ossl_slh_dsa_key_to_text)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 786690, ptr noundef null)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

16:                                               ; preds = %12
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = call ptr @ossl_slh_dsa_key_get_name(ptr noundef %17)
  store ptr %18, ptr %8, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call ptr @ossl_slh_dsa_key_get_pub(ptr noundef %19)
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %24

22:                                               ; preds = %16
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 473, ptr noundef @__func__.ossl_slh_dsa_key_to_text)
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 128, ptr noundef @.str.3, ptr noundef %23)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

24:                                               ; preds = %16
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = and i32 %25, 1
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %50

28:                                               ; preds = %24
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call ptr @ossl_slh_dsa_key_get_priv(ptr noundef %29)
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %34

32:                                               ; preds = %28
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 480, ptr noundef @__func__.ossl_slh_dsa_key_to_text)
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 128, ptr noundef @.str.3, ptr noundef %33)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

34:                                               ; preds = %28
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %35, ptr noundef @.str.4, ptr noundef %36)
  %38 = icmp sle i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

40:                                               ; preds = %34
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = call ptr @ossl_slh_dsa_key_get_priv(ptr noundef %42)
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call i64 @ossl_slh_dsa_key_get_priv_len(ptr noundef %44)
  %46 = call i32 @ossl_bio_print_labeled_buf(ptr noundef %41, ptr noundef @.str.5, ptr noundef %43, i64 noundef %45)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

49:                                               ; preds = %40
  br label %62

50:                                               ; preds = %24
  %51 = load i32, ptr %7, align 4, !tbaa !9
  %52 = and i32 %51, 2
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %61

54:                                               ; preds = %50
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef %55, ptr noundef @.str.6, ptr noundef %56)
  %58 = icmp sle i32 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %54
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

60:                                               ; preds = %54
  br label %61

61:                                               ; preds = %60, %50
  br label %62

62:                                               ; preds = %61, %49
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = call ptr @ossl_slh_dsa_key_get_pub(ptr noundef %64)
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = call i64 @ossl_slh_dsa_key_get_pub_len(ptr noundef %66)
  %68 = call i32 @ossl_bio_print_labeled_buf(ptr noundef %63, ptr noundef @.str.7, ptr noundef %65, i64 noundef %67)
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %71, label %70

70:                                               ; preds = %62
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

71:                                               ; preds = %62
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %72

72:                                               ; preds = %71, %70, %59, %48, %39, %32, %22, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %73 = load i32, ptr %4, align 4
  ret i32 %73
}

declare void @ERR_new() #2

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #2

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.ossl_slh_dsa_key_to_text = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @ossl_slh_dsa_key_get_priv_len(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_pub(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @ossl_slh_dsa_key_get_pub_len(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_priv(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @ossl_slh_dsa_key_get_name(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @ossl_slh_dsa_key_to_text(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %6, label %7

6:                                                ; preds = %3
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 467, ptr noundef nonnull @__func__.ossl_slh_dsa_key_to_text) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 786690, ptr noundef null) #2
  br label %34

7:                                                ; preds = %3
  %8 = tail call ptr @ossl_slh_dsa_key_get_name(ptr noundef nonnull %1)
  %9 = tail call ptr @ossl_slh_dsa_key_get_pub(ptr noundef nonnull %1)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %7
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 473, ptr noundef nonnull @__func__.ossl_slh_dsa_key_to_text) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 128, ptr noundef nonnull @.str.3, ptr noundef %8) #2
  br label %34

12:                                               ; preds = %7
  %13 = and i32 %2, 1
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %25, label %14

14:                                               ; preds = %12
  %15 = tail call ptr @ossl_slh_dsa_key_get_priv(ptr noundef nonnull %1)
  %16 = icmp eq ptr %15, null
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 480, ptr noundef nonnull @__func__.ossl_slh_dsa_key_to_text) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 57, i32 noundef 128, ptr noundef nonnull @.str.3, ptr noundef %8) #2
  br label %34

18:                                               ; preds = %14
  %19 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef nonnull %0, ptr noundef nonnull @.str.4, ptr noundef %8) #2
  %20 = icmp slt i32 %19, 1
  br i1 %20, label %34, label %21

21:                                               ; preds = %18
  %22 = tail call ptr @ossl_slh_dsa_key_get_priv(ptr noundef nonnull %1)
  %23 = tail call i64 @ossl_slh_dsa_key_get_priv_len(ptr noundef nonnull %1)
  %24 = tail call i32 @ossl_bio_print_labeled_buf(ptr noundef nonnull %0, ptr noundef nonnull @.str.5, ptr noundef %22, i64 noundef %23) #2
  %.not23 = icmp eq i32 %24, 0
  br i1 %.not23, label %34, label %30

25:                                               ; preds = %12
  %26 = and i32 %2, 2
  %.not22 = icmp eq i32 %26, 0
  br i1 %.not22, label %30, label %27

27:                                               ; preds = %25
  %28 = tail call i32 (ptr, ptr, ...) @BIO_printf(ptr noundef nonnull %0, ptr noundef nonnull @.str.6, ptr noundef %8) #2
  %29 = icmp slt i32 %28, 1
  br i1 %29, label %34, label %30

30:                                               ; preds = %25, %27, %21
  %31 = tail call ptr @ossl_slh_dsa_key_get_pub(ptr noundef nonnull %1)
  %32 = tail call i64 @ossl_slh_dsa_key_get_pub_len(ptr noundef nonnull %1)
  %33 = tail call i32 @ossl_bio_print_labeled_buf(ptr noundef nonnull %0, ptr noundef nonnull @.str.7, ptr noundef %31, i64 noundef %32) #2
  %.not24 = icmp ne i32 %33, 0
  %. = zext i1 %.not24 to i32
  br label %34

34:                                               ; preds = %30, %27, %21, %18, %17, %11, %6
  %.0 = phi i32 [ 0, %6 ], [ 0, %11 ], [ 0, %17 ], [ 0, %18 ], [ 0, %21 ], [ 0, %27 ], [ %., %30 ]
  ret i32 %.0
}

declare void @ERR_new() local_unnamed_addr #1

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

attributes #0 = { 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 #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 }

!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,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass