; LLVM IR from bitcoin-core/secp256k1 :: examples (musig)

; 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.signer_secrets = type { %struct.secp256k1_keypair, %struct.secp256k1_musig_secnonce }
%struct.secp256k1_keypair = type { [96 x i8] }
%struct.secp256k1_musig_secnonce = type { [132 x i8] }
%struct.signer = type { %struct.secp256k1_pubkey, %struct.secp256k1_musig_pubnonce, %struct.secp256k1_musig_partial_sig }
%struct.secp256k1_pubkey = type { [64 x i8] }
%struct.secp256k1_musig_pubnonce = type { [132 x i8] }
%struct.secp256k1_musig_partial_sig = type { [36 x i8] }
%struct.secp256k1_xonly_pubkey = type { [64 x i8] }
%struct.secp256k1_musig_keyagg_cache = type { [197 x i8] }

@__const.main.msg = external hidden unnamed_addr constant [32 x i8], align 16
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca [3 x %struct.signer_secrets], align 16
  %5 = alloca [3 x %struct.signer], align 16
  %6 = alloca [3 x ptr], align 16
  %7 = alloca %struct.secp256k1_xonly_pubkey, align 1
  %8 = alloca %struct.secp256k1_musig_keyagg_cache, align 1
  %9 = alloca [32 x i8], align 16
  %10 = alloca [64 x i8], align 16
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 684, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 696, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 197, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 @__const.main.msg, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #4
  %12 = call ptr @secp256k1_context_create(i32 noundef 1)
  store ptr %12, ptr %2, align 8, !tbaa !5
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = call i32 @fflush(ptr noundef %14)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %39, %0
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 3
  br i1 %18, label %19, label %42

19:                                               ; preds = %16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [3 x %struct.signer_secrets], ptr %4, i64 0, i64 %22
  %24 = load i32, ptr %3, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [3 x %struct.signer], ptr %5, i64 0, i64 %25
  %27 = call i32 @create_keypair(ptr noundef %20, ptr noundef %23, ptr noundef %26)
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %31, label %29

29:                                               ; preds = %19
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

31:                                               ; preds = %19
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [3 x %struct.signer], ptr %5, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.signer, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [3 x ptr], ptr %6, i64 0, i64 %37
  store ptr %35, ptr %38, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %31
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !9
  br label %16, !llvm.loop !11

42:                                               ; preds = %16
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %45 = load ptr, ptr @stdout, align 8, !tbaa !5
  %46 = call i32 @fflush(ptr noundef %45)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds [3 x ptr], ptr %6, i64 0, i64 0
  %49 = call i32 @secp256k1_ec_pubkey_sort(ptr noundef %47, ptr noundef %48, i64 noundef 3)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %53, label %51

51:                                               ; preds = %42
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

53:                                               ; preds = %42
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %56 = load ptr, ptr @stdout, align 8, !tbaa !5
  %57 = call i32 @fflush(ptr noundef %56)
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds [3 x ptr], ptr %6, i64 0, i64 0
  %60 = call i32 @secp256k1_musig_pubkey_agg(ptr noundef %58, ptr noundef null, ptr noundef %8, ptr noundef %59, i64 noundef 3)
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %64, label %62

62:                                               ; preds = %53
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

64:                                               ; preds = %53
  %65 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %67 = load ptr, ptr @stdout, align 8, !tbaa !5
  %68 = call i32 @fflush(ptr noundef %67)
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = call i32 @tweak(ptr noundef %69, ptr noundef %7, ptr noundef %8)
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %74, label %72

72:                                               ; preds = %64
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

74:                                               ; preds = %64
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %77 = load ptr, ptr @stdout, align 8, !tbaa !5
  %78 = call i32 @fflush(ptr noundef %77)
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds [3 x %struct.signer_secrets], ptr %4, i64 0, i64 0
  %81 = getelementptr inbounds [3 x %struct.signer], ptr %5, i64 0, i64 0
  %82 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %83 = getelementptr inbounds [64 x i8], ptr %10, i64 0, i64 0
  %84 = call i32 @sign(ptr noundef %79, ptr noundef %80, ptr noundef %81, ptr noundef %8, ptr noundef %82, ptr noundef %83)
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %88, label %86

86:                                               ; preds = %74
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

88:                                               ; preds = %74
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %91 = load ptr, ptr @stdout, align 8, !tbaa !5
  %92 = call i32 @fflush(ptr noundef %91)
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds [64 x i8], ptr %10, i64 0, i64 0
  %95 = getelementptr inbounds [32 x i8], ptr %9, i64 0, i64 0
  %96 = call i32 @secp256k1_schnorrsig_verify(ptr noundef %93, ptr noundef %94, ptr noundef %95, i64 noundef 32, ptr noundef %7)
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %100, label %98

98:                                               ; preds = %88
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

100:                                              ; preds = %88
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %109, %100
  %103 = load i32, ptr %3, align 4, !tbaa !9
  %104 = icmp slt i32 %103, 3
  br i1 %104, label %105, label %112

105:                                              ; preds = %102
  %106 = load i32, ptr %3, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [3 x %struct.signer_secrets], ptr %4, i64 0, i64 %107
  call void @secure_erase(ptr noundef %108, i64 noundef 228)
  br label %109

109:                                              ; preds = %105
  %110 = load i32, ptr %3, align 4, !tbaa !9
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %3, align 4, !tbaa !9
  br label %102, !llvm.loop !13

112:                                              ; preds = %102
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  call void @secp256k1_context_destroy(ptr noundef %113)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %114

114:                                              ; preds = %112, %98, %86, %72, %62, %51, %29
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 197, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 696, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 684, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  %115 = load i32, ptr %1, align 4
  ret i32 %115
}

; 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

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

declare i32 @fflush(ptr noundef) #3

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

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

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

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

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

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

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

declare void @secp256k1_context_destroy(ptr noundef) #3

; 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 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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.signer_secrets = type { %struct.secp256k1_keypair, %struct.secp256k1_musig_secnonce }
%struct.secp256k1_keypair = type { [96 x i8] }
%struct.secp256k1_musig_secnonce = type { [132 x i8] }
%struct.signer = type { %struct.secp256k1_pubkey, %struct.secp256k1_musig_pubnonce, %struct.secp256k1_musig_partial_sig }
%struct.secp256k1_pubkey = type { [64 x i8] }
%struct.secp256k1_musig_pubnonce = type { [132 x i8] }
%struct.secp256k1_musig_partial_sig = type { [36 x i8] }
%struct.secp256k1_xonly_pubkey = type { [64 x i8] }
%struct.secp256k1_musig_keyagg_cache = type { [197 x i8] }

@__const.main.msg = external hidden unnamed_addr constant [32 x i8], align 16
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca [3 x %struct.signer_secrets], align 16
  %2 = alloca [3 x %struct.signer], align 16
  %3 = alloca [3 x ptr], align 16
  %4 = alloca %struct.secp256k1_xonly_pubkey, align 1
  %5 = alloca %struct.secp256k1_musig_keyagg_cache, align 1
  %6 = alloca [32 x i8], align 16
  %7 = alloca [64 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 684, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 696, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 197, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %6, ptr noundef nonnull align 16 dereferenceable(32) @__const.main.msg, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %7) #5
  %8 = tail call ptr @secp256k1_context_create(i32 noundef 1) #5
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %10 = load ptr, ptr @stdout, align 8, !tbaa !5
  %11 = tail call i32 @fflush(ptr noundef %10)
  %12 = call i32 @create_keypair(ptr noundef %8, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not21 = icmp eq i32 %12, 0
  br i1 %.not21, label %13, label %15

13:                                               ; preds = %19, %15, %0
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %67

15:                                               ; preds = %0
  store ptr %2, ptr %3, align 16, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 228
  %17 = getelementptr inbounds i8, ptr %2, i64 232
  %18 = call i32 @create_keypair(ptr noundef %8, ptr noundef nonnull %16, ptr noundef nonnull %17)
  %.not21.1 = icmp eq i32 %18, 0
  br i1 %.not21.1, label %13, label %19

19:                                               ; preds = %15
  %20 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %17, ptr %20, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %1, i64 456
  %22 = getelementptr inbounds i8, ptr %2, i64 464
  %23 = call i32 @create_keypair(ptr noundef %8, ptr noundef nonnull %21, ptr noundef nonnull %22)
  %.not21.2 = icmp eq i32 %23, 0
  br i1 %.not21.2, label %13, label %24

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %22, ptr %25, align 16, !tbaa !5
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %27 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %28 = load ptr, ptr @stdout, align 8, !tbaa !5
  %29 = call i32 @fflush(ptr noundef %28)
  %30 = call i32 @secp256k1_ec_pubkey_sort(ptr noundef %8, ptr noundef nonnull %3, i64 noundef 3) #5
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %31, label %33

31:                                               ; preds = %24
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %67

33:                                               ; preds = %24
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %36 = load ptr, ptr @stdout, align 8, !tbaa !5
  %37 = call i32 @fflush(ptr noundef %36)
  %38 = call i32 @secp256k1_musig_pubkey_agg(ptr noundef %8, ptr noundef null, ptr noundef nonnull %5, ptr noundef nonnull %3, i64 noundef 3) #5
  %.not17 = icmp eq i32 %38, 0
  br i1 %.not17, label %39, label %41

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

41:                                               ; preds = %33
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %44 = load ptr, ptr @stdout, align 8, !tbaa !5
  %45 = call i32 @fflush(ptr noundef %44)
  %46 = call i32 @tweak(ptr noundef %8, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %.not18 = icmp eq i32 %46, 0
  br i1 %.not18, label %47, label %49

47:                                               ; preds = %41
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %67

49:                                               ; preds = %41
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %52 = load ptr, ptr @stdout, align 8, !tbaa !5
  %53 = call i32 @fflush(ptr noundef %52)
  %54 = call i32 @sign(ptr noundef %8, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %.not19 = icmp eq i32 %54, 0
  br i1 %.not19, label %55, label %57

55:                                               ; preds = %49
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %67

57:                                               ; preds = %49
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %60 = load ptr, ptr @stdout, align 8, !tbaa !5
  %61 = call i32 @fflush(ptr noundef %60)
  %62 = call i32 @secp256k1_schnorrsig_verify(ptr noundef %8, ptr noundef nonnull %7, ptr noundef nonnull %6, i64 noundef 32, ptr noundef nonnull %4) #5
  %.not20 = icmp eq i32 %62, 0
  br i1 %.not20, label %63, label %65

63:                                               ; preds = %57
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %67

65:                                               ; preds = %57
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @secure_erase(ptr noundef nonnull %1, i64 noundef 228)
  call void @secure_erase(ptr noundef nonnull %16, i64 noundef 228)
  call void @secure_erase(ptr noundef nonnull %21, i64 noundef 228)
  call void @secp256k1_context_destroy(ptr noundef %8) #5
  br label %67

67:                                               ; preds = %65, %63, %55, %47, %39, %31, %13
  %.016 = phi i32 [ 1, %13 ], [ 0, %65 ], [ 1, %63 ], [ 1, %55 ], [ 1, %47 ], [ 1, %39 ], [ 1, %31 ]
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 197, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 696, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 684, ptr nonnull %1) #5
  ret i32 %.016
}

; 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

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

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

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

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

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

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

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

declare void @secp256k1_context_destroy(ptr 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

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 = { 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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass