; LLVM IR from bitcoin-core/secp256k1 :: src (tests)

; 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_context_struct = type { %struct.secp256k1_ecmult_gen_context, %struct.secp256k1_callback, %struct.secp256k1_callback, i32 }
%struct.secp256k1_ecmult_gen_context = type { i32, %struct.secp256k1_scalar, %struct.secp256k1_ge, %struct.secp256k1_fe }
%struct.secp256k1_scalar = type { [4 x i64] }
%struct.secp256k1_ge = type { %struct.secp256k1_fe, %struct.secp256k1_fe, i32 }
%struct.secp256k1_fe = type { [5 x i64] }
%struct.secp256k1_callback = type { ptr, ptr }

@secp256k1_context_static_ = external hidden constant %struct.secp256k1_context_struct, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@COUNT = external hidden global i32, align 4
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [17 x i8], align 1
@CTX = external hidden global ptr, align 8
@.str.35 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [64 x i8], align 1
@STATIC_CTX = external hidden global ptr, align 8
@.str.38 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [19 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(none)
declare i64 @llvm.expect.i64(i64, i64) #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @secp256k1_context_is_proper(ptr noundef) #2

; 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) #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @secp256k1_context_create(i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @secp256k1_context_destroy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @secp256k1_context_randomize(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [32 x i8], align 16
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %8 = load ptr, ptr @stdout, align 8, !tbaa !9
  call void @setbuf(ptr noundef %8, ptr noundef null) #10
  %9 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @setbuf(ptr noundef %9, ptr noundef null) #10
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 1
  br i1 %11, label %12, label %18

12:                                               ; preds = %2
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 1
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = call i64 @strtol(ptr noundef %15, ptr noundef null, i32 noundef 0) #10
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr @COUNT, align 4, !tbaa !5
  br label %31

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #10
  %19 = call ptr @getenv(ptr noundef @.str.32) #10
  store ptr %19, ptr %6, align 8, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !9
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %30

22:                                               ; preds = %18
  %23 = load ptr, ptr %6, align 8, !tbaa !9
  %24 = call i64 @strlen(ptr noundef %23) #11
  %25 = icmp ugt i64 %24, 0
  br i1 %25, label %26, label %30

26:                                               ; preds = %22
  %27 = load ptr, ptr %6, align 8, !tbaa !9
  %28 = call i64 @strtol(ptr noundef %27, ptr noundef null, i32 noundef 0) #10
  %29 = trunc i64 %28 to i32
  store i32 %29, ptr @COUNT, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %26, %22, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  br label %31

31:                                               ; preds = %30, %12
  %32 = load i32, ptr @COUNT, align 4, !tbaa !5
  %33 = icmp sle i32 %32, 0
  br i1 %33, label %34, label %37

34:                                               ; preds = %31
  %35 = load ptr, ptr @stderr, align 8, !tbaa !9
  %36 = call i32 @fputs(ptr noundef @.str.33, ptr noundef %35)
  store i32 1, ptr %3, align 4
  br label %111

37:                                               ; preds = %31
  %38 = load i32, ptr @COUNT, align 4, !tbaa !5
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.34, i32 noundef %38)
  call void @run_xoshiro256pp_tests()
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 2
  br i1 %41, label %42, label %46

42:                                               ; preds = %37
  %43 = load ptr, ptr %5, align 8, !tbaa !9
  %44 = getelementptr inbounds ptr, ptr %43, i64 2
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  br label %47

46:                                               ; preds = %37
  br label %47

47:                                               ; preds = %46, %42
  %48 = phi ptr [ %45, %42 ], [ null, %46 ]
  call void @testrand_init(ptr noundef %48)
  %49 = call ptr @secp256k1_context_create(i32 noundef 1)
  store ptr %49, ptr @CTX, align 8, !tbaa !9
  %50 = call i64 @testrand_bits(i32 noundef 4)
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %52, label %73

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #10
  %53 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  call void @testrand256(ptr noundef %53)
  br label %54

54:                                               ; preds = %52
  %55 = load ptr, ptr @CTX, align 8, !tbaa !9
  %56 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %57 = call i32 @secp256k1_context_randomize(ptr noundef %55, ptr noundef %56)
  %58 = icmp ne i32 %57, 0
  %59 = xor i1 %58, true
  %60 = zext i1 %59 to i32
  %61 = sext i32 %60 to i64
  %62 = call i64 @llvm.expect.i64(i64 %61, i64 0)
  %63 = icmp ne i64 %62, 0
  br i1 %63, label %64, label %70

64:                                               ; preds = %54
  br label %65

65:                                               ; preds = %64
  %66 = load ptr, ptr @stderr, align 8, !tbaa !9
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.35, ptr noundef @.str.36, i32 noundef 7702, ptr noundef @.str.37) #10
  call void @abort() #12
  unreachable

68:                                               ; No predecessors!
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69, %54
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #10
  br label %73

73:                                               ; preds = %72, %47
  %74 = call noalias ptr @malloc(i64 noundef 208) #13
  store ptr %74, ptr @STATIC_CTX, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %73
  %76 = load ptr, ptr @STATIC_CTX, align 8, !tbaa !9
  %77 = icmp ne ptr %76, null
  %78 = xor i1 %77, true
  %79 = zext i1 %78 to i32
  %80 = sext i32 %79 to i64
  %81 = call i64 @llvm.expect.i64(i64 %80, i64 0)
  %82 = icmp ne i64 %81, 0
  br i1 %82, label %83, label %88

83:                                               ; preds = %75
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr @stderr, align 8, !tbaa !9
  %86 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.35, ptr noundef @.str.36, i32 noundef 7709, ptr noundef @.str.38) #10
  call void @abort() #12
  unreachable

87:                                               ; No predecessors!
  br label %88

88:                                               ; preds = %87, %75
  br label %89

89:                                               ; preds = %88
  %90 = load ptr, ptr @STATIC_CTX, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %90, ptr align 8 @secp256k1_context_static_, i64 208, i1 false)
  br label %91

91:                                               ; preds = %89
  %92 = load ptr, ptr @STATIC_CTX, align 8, !tbaa !9
  %93 = call i32 @secp256k1_context_is_proper(ptr noundef %92)
  %94 = icmp ne i32 %93, 0
  %95 = xor i1 %94, true
  %96 = xor i1 %95, true
  %97 = zext i1 %96 to i32
  %98 = sext i32 %97 to i64
  %99 = call i64 @llvm.expect.i64(i64 %98, i64 0)
  %100 = icmp ne i64 %99, 0
  br i1 %100, label %101, label %106

101:                                              ; preds = %91
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr @stderr, align 8, !tbaa !9
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef @.str.35, ptr noundef @.str.36, i32 noundef 7711, ptr noundef @.str.39) #10
  call void @abort() #12
  unreachable

105:                                              ; No predecessors!
  br label %106

106:                                              ; preds = %105, %91
  br label %107

107:                                              ; preds = %106
  call void @run_selftest_tests()
  call void @run_proper_context_tests(i32 noundef 0)
  call void @run_proper_context_tests(i32 noundef 1)
  call void @run_static_context_tests(i32 noundef 0)
  call void @run_static_context_tests(i32 noundef 1)
  call void @run_deprecated_context_flags_test()
  call void @run_scratch_tests()
  call void @run_int128_tests()
  call void @run_ctz_tests()
  call void @run_modinv_tests()
  call void @run_inverse_tests()
  call void @run_hsort_tests()
  call void @run_sha256_known_output_tests()
  call void @run_sha256_counter_tests()
  call void @run_hmac_sha256_tests()
  call void @run_rfc6979_hmac_sha256_tests()
  call void @run_tagged_sha256_tests()
  call void @run_scalar_tests()
  call void @run_field_half()
  call void @run_field_misc()
  call void @run_field_convert()
  call void @run_field_be32_overflow()
  call void @run_fe_mul()
  call void @run_sqr()
  call void @run_sqrt()
  call void @run_ge()
  call void @run_gej()
  call void @run_group_decompress()
  call void @run_ecmult_pre_g()
  call void @run_wnaf()
  call void @run_point_times_order()
  call void @run_ecmult_near_split_bound()
  call void @run_ecmult_chain()
  call void @run_ecmult_constants()
  call void @run_ecmult_gen_blind()
  call void @run_ecmult_const_tests()
  call void @run_ecmult_multi_tests()
  call void @run_ec_combine()
  call void @run_endomorphism_tests()
  call void @run_ec_pubkey_parse_test()
  call void @run_eckey_edge_case_test()
  call void @run_eckey_negate_test()
  call void @run_ec_illegal_argument_tests()
  call void @run_pubkey_comparison()
  call void @run_pubkey_sort()
  call void @run_random_pubkeys()
  call void @run_ecdsa_der_parse()
  call void @run_ecdsa_sign_verify()
  call void @run_ecdsa_end_to_end()
  call void @run_ecdsa_edge_cases()
  call void @run_ecdsa_wycheproof()
  call void @run_secp256k1_memczero_test()
  call void @run_secp256k1_is_zero_array_test()
  call void @run_secp256k1_byteorder_tests()
  call void @run_cmov_tests()
  %108 = load ptr, ptr @STATIC_CTX, align 8, !tbaa !9
  call void @free(ptr noundef %108) #10
  %109 = load ptr, ptr @CTX, align 8, !tbaa !9
  call void @secp256k1_context_destroy(ptr noundef %109)
  call void @testrand_finish()
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.40)
  store i32 0, ptr %3, align 4
  br label %111

111:                                              ; preds = %107, %34
  %112 = load i32, ptr %3, align 4
  ret i32 %112
}

; Function Attrs: nounwind
declare void @setbuf(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #4

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

declare i32 @fputs(ptr noundef, ptr noundef) #6

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

; Function Attrs: nounwind uwtable
declare hidden void @run_xoshiro256pp_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @testrand_init(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @testrand_bits(i32 noundef) #7

; Function Attrs: nounwind uwtable
declare hidden void @testrand256(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: noreturn nounwind
declare void @abort() #8

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #9

; Function Attrs: nounwind uwtable
declare hidden void @run_selftest_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_proper_context_tests(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @run_static_context_tests(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @run_deprecated_context_flags_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_scratch_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_int128_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ctz_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_modinv_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_inverse_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_hsort_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_sha256_known_output_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_sha256_counter_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_hmac_sha256_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_rfc6979_hmac_sha256_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_tagged_sha256_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_scalar_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_field_half() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_field_misc() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_field_convert() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_field_be32_overflow() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_fe_mul() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_sqr() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_sqrt() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ge() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_gej() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_group_decompress() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_pre_g() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_wnaf() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_point_times_order() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_near_split_bound() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_chain() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_constants() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_gen_blind() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_const_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_multi_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_combine() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_endomorphism_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_pubkey_parse_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_eckey_edge_case_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_eckey_negate_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_illegal_argument_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_pubkey_comparison() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_pubkey_sort() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_random_pubkeys() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_der_parse() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_sign_verify() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_end_to_end() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_edge_cases() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_wycheproof() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_memczero_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_is_zero_array_test() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_byteorder_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @run_cmov_tests() #2

; Function Attrs: nounwind uwtable
declare hidden void @testrand_finish() #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 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 #6 = { "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 = { 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 #8 = { 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 #9 = { nounwind allocsize(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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { noreturn nounwind }
attributes #13 = { nounwind allocsize(0) }

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


; 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_context_struct = type { %struct.secp256k1_ecmult_gen_context, %struct.secp256k1_callback, %struct.secp256k1_callback, i32 }
%struct.secp256k1_ecmult_gen_context = type { i32, %struct.secp256k1_scalar, %struct.secp256k1_ge, %struct.secp256k1_fe }
%struct.secp256k1_scalar = type { [4 x i64] }
%struct.secp256k1_ge = type { %struct.secp256k1_fe, %struct.secp256k1_fe, i32 }
%struct.secp256k1_fe = type { [5 x i64] }
%struct.secp256k1_callback = type { ptr, ptr }

@secp256k1_context_static_ = external hidden local_unnamed_addr constant %struct.secp256k1_context_struct, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@COUNT = external hidden local_unnamed_addr global i32, align 4
@.str.32 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [17 x i8], align 1
@CTX = external hidden local_unnamed_addr global ptr, align 8
@.str.35 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [64 x i8], align 1
@STATIC_CTX = external hidden local_unnamed_addr global ptr, align 8
@.str.38 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [19 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @secp256k1_context_is_proper(ptr noundef) local_unnamed_addr #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

; Function Attrs: nounwind uwtable
declare dso_local ptr @secp256k1_context_create(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @secp256k1_context_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @secp256k1_context_randomize(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 {
  %3 = alloca [32 x i8], align 16
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  tail call void @setbuf(ptr noundef %4, ptr noundef null) #10
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  tail call void @setbuf(ptr noundef %5, ptr noundef null) #10
  %6 = icmp sgt i32 %0, 1
  br i1 %6, label %7, label %12

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i64 @strtol(ptr nocapture noundef %9, ptr noundef null, i32 noundef 0) #10
  %11 = trunc i64 %10 to i32
  store i32 %11, ptr @COUNT, align 4, !tbaa !9
  br label %18

12:                                               ; preds = %2
  %13 = tail call ptr @getenv(ptr noundef nonnull @.str.32) #10
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %thread-pre-split, label %14

14:                                               ; preds = %12
  %char0 = load i8, ptr %13, align 1
  %.not9 = icmp eq i8 %char0, 0
  br i1 %.not9, label %thread-pre-split, label %15

15:                                               ; preds = %14
  %16 = tail call i64 @strtol(ptr nocapture noundef nonnull %13, ptr noundef null, i32 noundef 0) #10
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr @COUNT, align 4, !tbaa !9
  br label %18

thread-pre-split:                                 ; preds = %14, %12
  %.pr = load i32, ptr @COUNT, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %thread-pre-split, %15, %7
  %19 = phi i32 [ %.pr, %thread-pre-split ], [ %17, %15 ], [ %11, %7 ]
  %20 = icmp slt i32 %19, 1
  br i1 %20, label %21, label %24

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 @fputs(ptr noundef nonnull @.str.33, ptr noundef %22) #11
  br label %55

24:                                               ; preds = %18
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, i32 noundef %19)
  tail call void @run_xoshiro256pp_tests()
  %26 = icmp sgt i32 %0, 2
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %1, i64 16
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %24, %27
  %31 = phi ptr [ %29, %27 ], [ null, %24 ]
  tail call void @testrand_init(ptr noundef %31)
  %32 = tail call ptr @secp256k1_context_create(i32 noundef 1)
  store ptr %32, ptr @CTX, align 8, !tbaa !5
  %33 = tail call i64 @testrand_bits(i32 noundef 4)
  %.not10 = icmp eq i64 %33, 0
  br i1 %.not10, label %41, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #10
  call void @testrand256(ptr noundef nonnull %3)
  %35 = load ptr, ptr @CTX, align 8, !tbaa !5
  %36 = call i32 @secp256k1_context_randomize(ptr noundef %35, ptr noundef nonnull %3)
  %.not11 = icmp eq i32 %36, 0
  br i1 %.not11, label %37, label %40, !prof !11

37:                                               ; preds = %34
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.36, i32 noundef 7702, ptr noundef nonnull @.str.37) #12
  call void @abort() #13
  unreachable

40:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #10
  br label %41

41:                                               ; preds = %40, %30
  %42 = call noalias dereferenceable_or_null(208) ptr @malloc(i64 noundef 208) #14
  store ptr %42, ptr @STATIC_CTX, align 8, !tbaa !5
  %.not12 = icmp eq ptr %42, null
  br i1 %.not12, label %43, label %46, !prof !11

43:                                               ; preds = %41
  %44 = load ptr, ptr @stderr, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.36, i32 noundef 7709, ptr noundef nonnull @.str.38) #12
  call void @abort() #13
  unreachable

46:                                               ; preds = %41
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(208) %42, ptr noundef nonnull align 8 dereferenceable(208) @secp256k1_context_static_, i64 208, i1 false)
  %47 = call i32 @secp256k1_context_is_proper(ptr noundef nonnull %42)
  %.not13 = icmp eq i32 %47, 0
  br i1 %.not13, label %51, label %48, !prof !12

48:                                               ; preds = %46
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.35, ptr noundef nonnull @.str.36, i32 noundef 7711, ptr noundef nonnull @.str.39) #12
  call void @abort() #13
  unreachable

51:                                               ; preds = %46
  call void @run_selftest_tests()
  call void @run_proper_context_tests(i32 noundef 0)
  call void @run_proper_context_tests(i32 noundef 1)
  call void @run_static_context_tests(i32 noundef 0)
  call void @run_static_context_tests(i32 noundef 1)
  call void @run_deprecated_context_flags_test()
  call void @run_scratch_tests()
  call void @run_int128_tests()
  call void @run_ctz_tests()
  call void @run_modinv_tests()
  call void @run_inverse_tests()
  call void @run_hsort_tests()
  call void @run_sha256_known_output_tests()
  call void @run_sha256_counter_tests()
  call void @run_hmac_sha256_tests()
  call void @run_rfc6979_hmac_sha256_tests()
  call void @run_tagged_sha256_tests()
  call void @run_scalar_tests()
  call void @run_field_half()
  call void @run_field_misc()
  call void @run_field_convert()
  call void @run_field_be32_overflow()
  call void @run_fe_mul()
  call void @run_sqr()
  call void @run_sqrt()
  call void @run_ge()
  call void @run_gej()
  call void @run_group_decompress()
  call void @run_ecmult_pre_g()
  call void @run_wnaf()
  call void @run_point_times_order()
  call void @run_ecmult_near_split_bound()
  call void @run_ecmult_chain()
  call void @run_ecmult_constants()
  call void @run_ecmult_gen_blind()
  call void @run_ecmult_const_tests()
  call void @run_ecmult_multi_tests()
  call void @run_ec_combine()
  call void @run_endomorphism_tests()
  call void @run_ec_pubkey_parse_test()
  call void @run_eckey_edge_case_test()
  call void @run_eckey_negate_test()
  call void @run_ec_illegal_argument_tests()
  call void @run_pubkey_comparison()
  call void @run_pubkey_sort()
  call void @run_random_pubkeys()
  call void @run_ecdsa_der_parse()
  call void @run_ecdsa_sign_verify()
  call void @run_ecdsa_end_to_end()
  call void @run_ecdsa_edge_cases()
  call void @run_ecdsa_wycheproof()
  call void @run_secp256k1_memczero_test()
  call void @run_secp256k1_is_zero_array_test()
  call void @run_secp256k1_byteorder_tests()
  call void @run_cmov_tests()
  %52 = load ptr, ptr @STATIC_CTX, align 8, !tbaa !5
  call void @free(ptr noundef %52) #10
  %53 = load ptr, ptr @CTX, align 8, !tbaa !5
  call void @secp256k1_context_destroy(ptr noundef %53)
  call void @testrand_finish()
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.40)
  br label %55

55:                                               ; preds = %51, %21
  %.0 = phi i32 [ 1, %21 ], [ 0, %51 ]
  ret i32 %.0
}

; Function Attrs: nofree nounwind
declare void @setbuf(ptr nocapture noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #6

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

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

; Function Attrs: nounwind uwtable
declare hidden void @run_xoshiro256pp_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @testrand_init(ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @testrand_bits(i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind uwtable
declare hidden void @testrand256(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #8

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #9

; Function Attrs: nounwind uwtable
declare hidden void @run_selftest_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_proper_context_tests(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_static_context_tests(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_deprecated_context_flags_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_scratch_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_int128_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ctz_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_modinv_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_inverse_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_hsort_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_sha256_known_output_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_sha256_counter_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_hmac_sha256_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_rfc6979_hmac_sha256_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_tagged_sha256_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_scalar_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_field_half() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_field_misc() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_field_convert() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_field_be32_overflow() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_fe_mul() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_sqr() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_sqrt() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ge() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_gej() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_group_decompress() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_pre_g() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_wnaf() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_point_times_order() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_near_split_bound() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_chain() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_constants() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_gen_blind() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_const_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecmult_multi_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_combine() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_endomorphism_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_pubkey_parse_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_eckey_edge_case_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_eckey_negate_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ec_illegal_argument_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_pubkey_comparison() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_pubkey_sort() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_random_pubkeys() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_der_parse() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_sign_verify() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_end_to_end() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_edge_cases() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_ecdsa_wycheproof() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_memczero_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_is_zero_array_test() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_secp256k1_byteorder_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @run_cmov_tests() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @testrand_finish() local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn "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 = { nofree nounwind 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 #7 = { 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 #8 = { 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 #9 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #10 = { nounwind }
attributes #11 = { cold }
attributes #12 = { cold nounwind }
attributes #13 = { noreturn nounwind }
attributes #14 = { nounwind allocsize(0) }

!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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!12 = !{!"branch_weights", !"expected", i32 2000, i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass