; LLVM IR from vergecurrency/verge :: src/secp256k1/examples (ecdsa)

; 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.secp256k1_pubkey = type { [64 x i8] }
%struct.secp256k1_ecdsa_signature = type { [64 x i8] }

@__const.main.msg_hash = external hidden unnamed_addr constant [32 x i8], align 16
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@secp256k1_context_static = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [32 x i8], align 16
  %3 = alloca [32 x i8], align 16
  %4 = alloca [32 x i8], align 16
  %5 = alloca [33 x i8], align 16
  %6 = alloca [64 x i8], align 16
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.secp256k1_pubkey, align 1
  %12 = alloca %struct.secp256k1_ecdsa_signature, align 1
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.main.msg_hash, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 33, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 64, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 64, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 64, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %15 = call ptr @secp256k1_context_create(i32 noundef 1)
  store ptr %15, ptr %13, align 8, !tbaa !5
  %16 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 0
  %17 = call i32 @fill_random(ptr noundef %16, i64 noundef 32)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %21, label %19

19:                                               ; preds = %0
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %122

21:                                               ; preds = %0
  %22 = load ptr, ptr %13, align 8, !tbaa !5
  %23 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 0
  %24 = call i32 @secp256k1_context_randomize(ptr noundef %22, ptr noundef %23)
  store i32 %24, ptr %10, align 4, !tbaa !9
  %25 = load i32, ptr %10, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %21
  br label %29

28:                                               ; preds = %21
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 49, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

29:                                               ; preds = %27
  br label %30

30:                                               ; preds = %43, %29
  br label %31

31:                                               ; preds = %30
  %32 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  %33 = call i32 @fill_random(ptr noundef %32, i64 noundef 32)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %37, label %35

35:                                               ; preds = %31
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %122

37:                                               ; preds = %31
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  %40 = call i32 @secp256k1_ec_seckey_verify(ptr noundef %38, ptr noundef %39)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %37
  br label %44

43:                                               ; preds = %37
  br label %30

44:                                               ; preds = %42
  %45 = load ptr, ptr %13, align 8, !tbaa !5
  %46 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  %47 = call i32 @secp256k1_ec_pubkey_create(ptr noundef %45, ptr noundef %11, ptr noundef %46)
  store i32 %47, ptr %10, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %44
  br label %52

51:                                               ; preds = %44
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 68, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

52:                                               ; preds = %50
  store i64 33, ptr %7, align 8, !tbaa !11
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = getelementptr inbounds [33 x i8], ptr %5, i64 0, i64 0
  %55 = call i32 @secp256k1_ec_pubkey_serialize(ptr noundef %53, ptr noundef %54, ptr noundef %7, ptr noundef %11, i32 noundef 258)
  store i32 %55, ptr %10, align 4, !tbaa !9
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %52
  br label %60

59:                                               ; preds = %52
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

60:                                               ; preds = %58
  %61 = load i64, ptr %7, align 8, !tbaa !11
  %62 = icmp eq i64 %61, 33
  br i1 %62, label %63, label %64

63:                                               ; preds = %60
  br label %65

64:                                               ; preds = %60
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 75, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

65:                                               ; preds = %63
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = getelementptr inbounds [32 x i8], ptr %2, i64 0, i64 0
  %68 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  %69 = call i32 @secp256k1_ecdsa_sign(ptr noundef %66, ptr noundef %12, ptr noundef %67, ptr noundef %68, ptr noundef null, ptr noundef null)
  store i32 %69, ptr %10, align 4, !tbaa !9
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  br label %74

73:                                               ; preds = %65
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 84, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

74:                                               ; preds = %72
  %75 = load ptr, ptr %13, align 8, !tbaa !5
  %76 = getelementptr inbounds [64 x i8], ptr %6, i64 0, i64 0
  %77 = call i32 @secp256k1_ecdsa_signature_serialize_compact(ptr noundef %75, ptr noundef %76, ptr noundef %12)
  store i32 %77, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !9
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

80:                                               ; preds = %74
  br label %82

81:                                               ; preds = %74
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 89, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

82:                                               ; preds = %80
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = getelementptr inbounds [64 x i8], ptr %6, i64 0, i64 0
  %85 = call i32 @secp256k1_ecdsa_signature_parse_compact(ptr noundef %83, ptr noundef %12, ptr noundef %84)
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %89, label %87

87:                                               ; preds = %82
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %122

89:                                               ; preds = %82
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = getelementptr inbounds [33 x i8], ptr %5, i64 0, i64 0
  %92 = call i32 @secp256k1_ec_pubkey_parse(ptr noundef %90, ptr noundef %11, ptr noundef %91, i64 noundef 33)
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %96, label %94

94:                                               ; preds = %89
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %122

96:                                               ; preds = %89
  %97 = load ptr, ptr %13, align 8, !tbaa !5
  %98 = getelementptr inbounds [32 x i8], ptr %2, i64 0, i64 0
  %99 = call i32 @secp256k1_ecdsa_verify(ptr noundef %97, ptr noundef %12, ptr noundef %98, ptr noundef %11)
  store i32 %99, ptr %8, align 4, !tbaa !9
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = icmp ne i32 %100, 0
  %102 = zext i1 %101 to i64
  %103 = select i1 %101, ptr @.str.7, ptr @.str.8
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %103)
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %106 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  call void @print_hex(ptr noundef %106, i64 noundef 32)
  %107 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %108 = getelementptr inbounds [33 x i8], ptr %5, i64 0, i64 0
  call void @print_hex(ptr noundef %108, i64 noundef 33)
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %110 = getelementptr inbounds [64 x i8], ptr %6, i64 0, i64 0
  call void @print_hex(ptr noundef %110, i64 noundef 64)
  %111 = load ptr, ptr %13, align 8, !tbaa !5
  call void @secp256k1_context_destroy(ptr noundef %111)
  %112 = load ptr, ptr @secp256k1_context_static, align 8, !tbaa !5
  %113 = getelementptr inbounds [32 x i8], ptr %2, i64 0, i64 0
  %114 = call i32 @secp256k1_ecdsa_verify(ptr noundef %112, ptr noundef %12, ptr noundef %113, ptr noundef %11)
  store i32 %114, ptr %9, align 4, !tbaa !9
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = load i32, ptr %8, align 4, !tbaa !9
  %117 = icmp eq i32 %115, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %96
  br label %120

119:                                              ; preds = %96
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.2, i32 noundef 127, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

120:                                              ; preds = %118
  %121 = getelementptr inbounds [32 x i8], ptr %3, i64 0, i64 0
  call void @secure_erase(ptr noundef %121, i64 noundef 32)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %14, align 4
  br label %122

122:                                              ; preds = %120, %94, %87, %35, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 33, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #6
  %123 = load i32, ptr %1, align 4
  ret i32 %123
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @secp256k1_context_create(i32 noundef) #3

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

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

declare i32 @secp256k1_context_randomize(ptr noundef, ptr noundef) #3

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

declare i32 @secp256k1_ec_seckey_verify(ptr noundef, ptr noundef) #3

declare i32 @secp256k1_ec_pubkey_create(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @secp256k1_ec_pubkey_serialize(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

declare i32 @secp256k1_ecdsa_sign(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @secp256k1_ecdsa_signature_serialize_compact(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @secp256k1_ecdsa_signature_parse_compact(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @secp256k1_ec_pubkey_parse(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @secp256k1_ecdsa_verify(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @print_hex(ptr noundef, i64 noundef) #0

declare void @secp256k1_context_destroy(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @secure_erase(ptr noundef, i64 noundef) #5

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #5 = { inlinehint 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 #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, !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, !12, i64 0}
!12 = !{!"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"

%struct.secp256k1_pubkey = type { [64 x i8] }
%struct.secp256k1_ecdsa_signature = type { [64 x i8] }

@__const.main.msg_hash = external hidden unnamed_addr constant [32 x i8], align 16
@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@secp256k1_context_static = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca [32 x i8], align 16
  %2 = alloca [32 x i8], align 16
  %3 = alloca [32 x i8], align 16
  %4 = alloca [33 x i8], align 16
  %5 = alloca [64 x i8], align 16
  %6 = alloca i64, align 8
  %7 = alloca %struct.secp256k1_pubkey, align 1
  %8 = alloca %struct.secp256k1_ecdsa_signature, align 1
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %1, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.msg_hash, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 33, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %8) #7
  %9 = tail call ptr @secp256k1_context_create(i32 noundef 1) #7
  %10 = call i32 @fill_random(ptr noundef nonnull %3, i64 noundef 32)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %11, label %13

11:                                               ; preds = %0
  %12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %57

13:                                               ; preds = %0
  %14 = call i32 @secp256k1_context_randomize(ptr noundef %9, ptr noundef nonnull %3) #7
  %.not18 = icmp eq i32 %14, 0
  br i1 %.not18, label %15, label %.preheader

15:                                               ; preds = %13
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 49, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.preheader:                                       ; preds = %13, %19
  %16 = call i32 @fill_random(ptr noundef nonnull %2, i64 noundef 32)
  %.not19 = icmp eq i32 %16, 0
  br i1 %.not19, label %17, label %19

17:                                               ; preds = %.preheader
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %57

19:                                               ; preds = %.preheader
  %20 = call i32 @secp256k1_ec_seckey_verify(ptr noundef %9, ptr noundef nonnull %2) #7
  %.not20 = icmp eq i32 %20, 0
  br i1 %.not20, label %.preheader, label %21

21:                                               ; preds = %19
  %22 = call i32 @secp256k1_ec_pubkey_create(ptr noundef %9, ptr noundef nonnull %7, ptr noundef nonnull %2) #7
  %.not21 = icmp eq i32 %22, 0
  br i1 %.not21, label %23, label %24

23:                                               ; preds = %21
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 68, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

24:                                               ; preds = %21
  store i64 33, ptr %6, align 8, !tbaa !5
  %25 = call i32 @secp256k1_ec_pubkey_serialize(ptr noundef %9, ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef 258) #7
  %.not22 = icmp eq i32 %25, 0
  br i1 %.not22, label %26, label %27

26:                                               ; preds = %24
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 73, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

27:                                               ; preds = %24
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = icmp eq i64 %28, 33
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 75, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

31:                                               ; preds = %27
  %32 = call i32 @secp256k1_ecdsa_sign(ptr noundef %9, ptr noundef nonnull %8, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef null, ptr noundef null) #7
  %.not23 = icmp eq i32 %32, 0
  br i1 %.not23, label %33, label %34

33:                                               ; preds = %31
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 84, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

34:                                               ; preds = %31
  %35 = call i32 @secp256k1_ecdsa_signature_serialize_compact(ptr noundef %9, ptr noundef nonnull %5, ptr noundef nonnull %8) #7
  %.not24 = icmp eq i32 %35, 0
  br i1 %.not24, label %36, label %37

36:                                               ; preds = %34
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 89, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

37:                                               ; preds = %34
  %38 = call i32 @secp256k1_ecdsa_signature_parse_compact(ptr noundef %9, ptr noundef nonnull %8, ptr noundef nonnull %5) #7
  %.not25 = icmp eq i32 %38, 0
  br i1 %.not25, label %39, label %41

39:                                               ; preds = %37
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %57

41:                                               ; preds = %37
  %42 = call i32 @secp256k1_ec_pubkey_parse(ptr noundef %9, ptr noundef nonnull %7, ptr noundef nonnull %4, i64 noundef 33) #7
  %.not26 = icmp eq i32 %42, 0
  br i1 %.not26, label %43, label %45

43:                                               ; preds = %41
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %57

45:                                               ; preds = %41
  %46 = call i32 @secp256k1_ecdsa_verify(ptr noundef %9, ptr noundef nonnull %8, ptr noundef nonnull %1, ptr noundef nonnull %7) #7
  %.not27 = icmp eq i32 %46, 0
  %47 = select i1 %.not27, ptr @.str.8, ptr @.str.7
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull %47)
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  call void @print_hex(ptr noundef nonnull %2, i64 noundef 32)
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  call void @print_hex(ptr noundef nonnull %4, i64 noundef 33)
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  call void @print_hex(ptr noundef nonnull %5, i64 noundef 64)
  call void @secp256k1_context_destroy(ptr noundef %9) #7
  %52 = load ptr, ptr @secp256k1_context_static, align 8, !tbaa !9
  %53 = call i32 @secp256k1_ecdsa_verify(ptr noundef %52, ptr noundef nonnull %8, ptr noundef nonnull %1, ptr noundef nonnull %7) #7
  %54 = icmp eq i32 %53, %46
  br i1 %54, label %56, label %55

55:                                               ; preds = %45
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.2, i32 noundef 127, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

56:                                               ; preds = %45
  call void @secure_erase(ptr noundef nonnull %2, i64 noundef 32)
  br label %57

57:                                               ; preds = %56, %43, %39, %17, %11
  %.0 = phi i32 [ 0, %56 ], [ 1, %43 ], [ 1, %39 ], [ 1, %17 ], [ 1, %11 ]
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 33, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  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: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @secp256k1_context_create(i32 noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @print_hex(ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @secp256k1_context_destroy(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @secure_erase(ptr noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { noreturn 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { 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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass