; LLVM IR from gost-engine/engine :: test_derive (test_derive)

; 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.test_derive = type { ptr, i32, i32, i32, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32 }

@.str.5 = external hidden unnamed_addr constant [26 x i8], align 1
@stderr = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test_derive(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.test_derive, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %13, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.test_derive, ptr %16, i32 0, i32 2
  %18 = load i32, ptr %17, align 4, !tbaa !13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.test_derive, ptr %19, i32 0, i32 3
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.test_derive, ptr %22, i32 0, i32 6
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.test_derive, ptr %25, i32 0, i32 7
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = call ptr @load_private_key(i32 noundef %18, i32 noundef %21, ptr noundef %24, ptr noundef %27)
  store ptr %28, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.test_derive, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.test_derive, ptr %32, i32 0, i32 3
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.test_derive, ptr %35, i32 0, i32 9
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = call ptr @load_private_key(i32 noundef %31, i32 noundef %34, ptr noundef null, ptr noundef %37)
  store ptr %38, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call ptr @EVP_PKEY_CTX_new(ptr noundef %39, ptr noundef null)
  store ptr %40, ptr %8, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %44, label %42

42:                                               ; preds = %2
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %43)
  call void @OPENSSL_die(ptr noundef @.str.6, ptr noundef @.str.7, i32 noundef 216) #6
  unreachable

44:                                               ; preds = %2
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call i32 @EVP_PKEY_derive_init(ptr noundef %45)
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %50, label %48

48:                                               ; preds = %44
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %49)
  call void @OPENSSL_die(ptr noundef @.str.8, ptr noundef @.str.7, i32 noundef 217) #6
  unreachable

50:                                               ; preds = %44
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = call i32 @EVP_PKEY_derive_set_peer(ptr noundef %51, ptr noundef %52)
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %57, label %55

55:                                               ; preds = %50
  %56 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %56)
  call void @OPENSSL_die(ptr noundef @.str.9, ptr noundef @.str.7, i32 noundef 218) #6
  unreachable

57:                                               ; preds = %50
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.test_derive, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !18
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %72

62:                                               ; preds = %57
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.test_derive, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 8, !tbaa !18
  %67 = call i32 @EVP_PKEY_CTX_ctrl(ptr noundef %63, i32 noundef -1, i32 noundef -1, i32 noundef 4107, i32 noundef %66, ptr noundef null)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %71, label %69

69:                                               ; preds = %62
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %70)
  call void @OPENSSL_die(ptr noundef @.str.10, ptr noundef @.str.7, i32 noundef 221) #6
  unreachable

71:                                               ; preds = %62
  br label %72

72:                                               ; preds = %71, %57
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.test_derive, ptr %74, i32 0, i32 5
  %76 = load i32, ptr %75, align 8, !tbaa !19
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.test_derive, ptr %77, i32 0, i32 4
  %79 = load ptr, ptr %78, align 8, !tbaa !20
  %80 = call i32 @EVP_PKEY_CTX_ctrl(ptr noundef %73, i32 noundef -1, i32 noundef -1, i32 noundef 8, i32 noundef %76, ptr noundef %79)
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %84, label %82

82:                                               ; preds = %72
  %83 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %83)
  call void @OPENSSL_die(ptr noundef @.str.11, ptr noundef @.str.7, i32 noundef 223) #6
  unreachable

84:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = call i32 @EVP_PKEY_derive(ptr noundef %85, ptr noundef null, ptr noundef %9)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %90, label %88

88:                                               ; preds = %84
  %89 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %89)
  call void @OPENSSL_die(ptr noundef @.str.12, ptr noundef @.str.7, i32 noundef 227) #6
  unreachable

90:                                               ; preds = %84
  %91 = load i64, ptr %9, align 8, !tbaa !21
  %92 = call ptr @CRYPTO_malloc(i64 noundef %91, ptr noundef @.str.7, i32 noundef 228)
  store ptr %92, ptr %10, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %96, label %94

94:                                               ; preds = %90
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %95)
  call void @OPENSSL_die(ptr noundef @.str.13, ptr noundef @.str.7, i32 noundef 228) #6
  unreachable

96:                                               ; preds = %90
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = call i32 @EVP_PKEY_derive(ptr noundef %97, ptr noundef %98, ptr noundef %9)
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %103, label %101

101:                                              ; preds = %96
  %102 = load ptr, ptr @stderr, align 8, !tbaa !5
  call void @ERR_print_errors_fp(ptr noundef %102)
  call void @OPENSSL_die(ptr noundef @.str.14, ptr noundef @.str.7, i32 noundef 230) #6
  unreachable

103:                                              ; preds = %96
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  call void @EVP_PKEY_CTX_free(ptr noundef %104)
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  call void @EVP_PKEY_free(ptr noundef %105)
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  call void @EVP_PKEY_free(ptr noundef %106)
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.test_derive, ptr %107, i32 0, i32 11
  %109 = load i32, ptr %108, align 8, !tbaa !23
  %110 = sext i32 %109 to i64
  %111 = load i64, ptr %9, align 8, !tbaa !21
  %112 = icmp eq i64 %110, %111
  br i1 %112, label %113, label %123

113:                                              ; preds = %103
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.test_derive, ptr %114, i32 0, i32 10
  %116 = load ptr, ptr %115, align 8, !tbaa !24
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  %118 = load i64, ptr %9, align 8, !tbaa !21
  %119 = call i32 @memcmp(ptr noundef %116, ptr noundef %117, i64 noundef %118) #7
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %121, label %123

121:                                              ; preds = %113
  %122 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  br label %125

123:                                              ; preds = %113, %103
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %123, %121
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  call void @CRYPTO_free(ptr noundef %126, ptr noundef @.str.7, i32 noundef 245)
  %127 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %127
}

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

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

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

declare ptr @EVP_PKEY_CTX_new(ptr noundef, ptr noundef) #2

declare void @ERR_print_errors_fp(ptr noundef) #2

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

declare i32 @EVP_PKEY_derive_init(ptr noundef) #2

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

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

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

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

declare void @EVP_PKEY_CTX_free(ptr noundef) #2

declare void @EVP_PKEY_free(ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #4

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 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 #5 = { nounwind }
attributes #6 = { noreturn }
attributes #7 = { 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, !6, i64 0}
!12 = !{!"test_derive", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !10, i64 80}
!13 = !{!12, !10, i64 12}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !6, i64 40}
!16 = !{!12, !6, i64 48}
!17 = !{!12, !6, i64 64}
!18 = !{!12, !10, i64 8}
!19 = !{!12, !10, i64 32}
!20 = !{!12, !6, i64 24}
!21 = !{!22, !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!12, !10, i64 80}
!24 = !{!12, !6, i64 72}


; 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.5 = external hidden unnamed_addr constant [26 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @test_derive(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %4, ptr noundef %1)
  %6 = getelementptr inbounds i8, ptr %0, i64 12
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = tail call ptr @load_private_key(i32 noundef %7, i32 noundef %9, ptr noundef %11, ptr noundef %13)
  %15 = load i32, ptr %6, align 4, !tbaa !11
  %16 = load i32, ptr %8, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = tail call ptr @load_private_key(i32 noundef %15, i32 noundef %16, ptr noundef null, ptr noundef %18)
  %20 = tail call ptr @EVP_PKEY_CTX_new(ptr noundef %14, ptr noundef null) #6
  %.not = icmp eq ptr %20, null
  br i1 %.not, label %21, label %23

21:                                               ; preds = %2
  %22 = load ptr, ptr @stderr, align 8, !tbaa !16
  tail call void @ERR_print_errors_fp(ptr noundef %22) #6
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, i32 noundef 216) #7
  unreachable

23:                                               ; preds = %2
  %24 = tail call i32 @EVP_PKEY_derive_init(ptr noundef nonnull %20) #6
  %.not33 = icmp eq i32 %24, 0
  br i1 %.not33, label %25, label %27

25:                                               ; preds = %23
  %26 = load ptr, ptr @stderr, align 8, !tbaa !16
  tail call void @ERR_print_errors_fp(ptr noundef %26) #6
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.7, i32 noundef 217) #7
  unreachable

27:                                               ; preds = %23
  %28 = tail call i32 @EVP_PKEY_derive_set_peer(ptr noundef nonnull %20, ptr noundef %19) #6
  %.not34 = icmp eq i32 %28, 0
  br i1 %.not34, label %29, label %31

29:                                               ; preds = %27
  %30 = load ptr, ptr @stderr, align 8, !tbaa !16
  tail call void @ERR_print_errors_fp(ptr noundef %30) #6
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, i32 noundef 218) #7
  unreachable

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %0, i64 8
  %33 = load i32, ptr %32, align 8, !tbaa !17
  %.not35 = icmp eq i32 %33, 0
  br i1 %.not35, label %38, label %34

34:                                               ; preds = %31
  %35 = tail call i32 @EVP_PKEY_CTX_ctrl(ptr noundef nonnull %20, i32 noundef -1, i32 noundef -1, i32 noundef 4107, i32 noundef %33, ptr noundef null) #6
  %.not36 = icmp eq i32 %35, 0
  br i1 %.not36, label %36, label %38

36:                                               ; preds = %34
  %37 = load ptr, ptr @stderr, align 8, !tbaa !16
  tail call void @ERR_print_errors_fp(ptr noundef %37) #6
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.7, i32 noundef 221) #7
  unreachable

38:                                               ; preds = %34, %31
  %39 = getelementptr inbounds i8, ptr %0, i64 32
  %40 = load i32, ptr %39, align 8, !tbaa !18
  %41 = getelementptr inbounds i8, ptr %0, i64 24
  %42 = load ptr, ptr %41, align 8, !tbaa !19
  %43 = tail call i32 @EVP_PKEY_CTX_ctrl(ptr noundef nonnull %20, i32 noundef -1, i32 noundef -1, i32 noundef 8, i32 noundef %40, ptr noundef %42) #6
  %.not37 = icmp eq i32 %43, 0
  br i1 %.not37, label %44, label %46

44:                                               ; preds = %38
  %45 = load ptr, ptr @stderr, align 8, !tbaa !16
  tail call void @ERR_print_errors_fp(ptr noundef %45) #6
  tail call void @OPENSSL_die(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.7, i32 noundef 223) #7
  unreachable

46:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %47 = call i32 @EVP_PKEY_derive(ptr noundef nonnull %20, ptr noundef null, ptr noundef nonnull %3) #6
  %.not38 = icmp eq i32 %47, 0
  br i1 %.not38, label %48, label %50

48:                                               ; preds = %46
  %49 = load ptr, ptr @stderr, align 8, !tbaa !16
  call void @ERR_print_errors_fp(ptr noundef %49) #6
  call void @OPENSSL_die(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.7, i32 noundef 227) #7
  unreachable

50:                                               ; preds = %46
  %51 = load i64, ptr %3, align 8, !tbaa !20
  %52 = call ptr @CRYPTO_malloc(i64 noundef %51, ptr noundef nonnull @.str.7, i32 noundef 228) #6
  %.not39 = icmp eq ptr %52, null
  br i1 %.not39, label %53, label %55

53:                                               ; preds = %50
  %54 = load ptr, ptr @stderr, align 8, !tbaa !16
  call void @ERR_print_errors_fp(ptr noundef %54) #6
  call void @OPENSSL_die(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.7, i32 noundef 228) #7
  unreachable

55:                                               ; preds = %50
  %56 = call i32 @EVP_PKEY_derive(ptr noundef nonnull %20, ptr noundef nonnull %52, ptr noundef nonnull %3) #6
  %.not40 = icmp eq i32 %56, 0
  br i1 %.not40, label %57, label %59

57:                                               ; preds = %55
  %58 = load ptr, ptr @stderr, align 8, !tbaa !16
  call void @ERR_print_errors_fp(ptr noundef %58) #6
  call void @OPENSSL_die(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.7, i32 noundef 230) #7
  unreachable

59:                                               ; preds = %55
  call void @EVP_PKEY_CTX_free(ptr noundef nonnull %20) #6
  call void @EVP_PKEY_free(ptr noundef %14) #6
  call void @EVP_PKEY_free(ptr noundef %19) #6
  %60 = getelementptr inbounds i8, ptr %0, i64 80
  %61 = load i32, ptr %60, align 8, !tbaa !22
  %62 = sext i32 %61 to i64
  %63 = load i64, ptr %3, align 8, !tbaa !20
  %64 = icmp eq i64 %63, %62
  br i1 %64, label %65, label %69

65:                                               ; preds = %59
  %66 = getelementptr inbounds i8, ptr %0, i64 72
  %67 = load ptr, ptr %66, align 8, !tbaa !23
  %bcmp = call i32 @bcmp(ptr %67, ptr nonnull %52, i64 %62)
  %68 = icmp eq i32 %bcmp, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %65, %59
  br label %70

70:                                               ; preds = %65, %69
  %.str.16.sink = phi ptr [ @.str.16, %69 ], [ @.str.15, %65 ]
  %.0 = phi i32 [ 1, %69 ], [ 0, %65 ]
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.16.sink)
  call void @CRYPTO_free(ptr noundef nonnull %52, ptr noundef nonnull @.str.7, i32 noundef 245) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  ret i32 %.0
}

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @load_private_key(i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @EVP_PKEY_CTX_new(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @ERR_print_errors_fp(ptr noundef) local_unnamed_addr #3

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

declare i32 @EVP_PKEY_derive_init(ptr noundef) local_unnamed_addr #3

declare i32 @EVP_PKEY_derive_set_peer(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @EVP_PKEY_CTX_ctrl(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @EVP_PKEY_derive(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

declare void @EVP_PKEY_CTX_free(ptr noundef) local_unnamed_addr #3

declare void @EVP_PKEY_free(ptr noundef) local_unnamed_addr #3

declare void @CRYPTO_free(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #5

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 #5 = { nofree nounwind willreturn memory(argmem: read) }
attributes #6 = { nounwind }
attributes #7 = { 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)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"test_derive", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 12}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !7, i64 40}
!14 = !{!6, !7, i64 48}
!15 = !{!6, !7, i64 64}
!16 = !{!7, !7, i64 0}
!17 = !{!6, !10, i64 8}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !7, i64 24}
!20 = !{!21, !21, i64 0}
!21 = !{!"long", !8, i64 0}
!22 = !{!6, !10, i64 80}
!23 = !{!6, !7, i64 72}


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