; LLVM IR from trustwallet/wallet-core :: trezor-crypto/crypto/tests (test_openssl)

; 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.SHA256state_st = type { [8 x i32], i32, i32, [16 x i32], i32, i32 }

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @openssl_check(i32 noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca [64 x i8], align 16
  %8 = alloca [33 x i8], align 16
  %9 = alloca [65 x i8], align 16
  %10 = alloca [32 x i8], align 16
  %11 = alloca [256 x i8], align 16
  %12 = alloca [32 x i8], align 16
  %13 = alloca %struct.SHA256state_st, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 33, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 65, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 256, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 112, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = call ptr @EC_GROUP_new_by_curve_name(i32 noundef %25)
  store ptr %26, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %151, %3
  %28 = load i32, ptr %15, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = icmp ult i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 2, ptr %16, align 4
  br label %154

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %33 = call i32 @random32()
  %34 = and i32 %33, 255
  %35 = add i32 %34, 1
  store i32 %35, ptr %17, align 4, !tbaa !5
  %36 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %37 = load i32, ptr %17, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  call void @random_buffer(ptr noundef %36, i64 noundef %38)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %39 = call ptr @EC_KEY_new()
  store ptr %39, ptr %18, align 8, !tbaa !9
  %40 = load ptr, ptr %18, align 8, !tbaa !9
  %41 = load ptr, ptr %14, align 8, !tbaa !9
  %42 = call i32 @EC_KEY_set_group(ptr noundef %40, ptr noundef %41)
  %43 = load ptr, ptr %18, align 8, !tbaa !9
  %44 = call i32 @EC_KEY_generate_key(ptr noundef %43)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %45 = load ptr, ptr %18, align 8, !tbaa !9
  %46 = call ptr @EC_KEY_get0_private_key(ptr noundef %45)
  store ptr %46, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %47 = load ptr, ptr %19, align 8, !tbaa !9
  %48 = call i32 @BN_num_bits(ptr noundef %47)
  %49 = add nsw i32 %48, 7
  %50 = sdiv i32 %49, 8
  %51 = sext i32 %50 to i64
  %52 = sub i64 32, %51
  %53 = trunc i64 %52 to i32
  store i32 %53, ptr %20, align 4, !tbaa !5
  %54 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %55 = load i32, ptr %20, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  call void @memzero(ptr noundef %54, i64 noundef %56)
  %57 = load ptr, ptr %19, align 8, !tbaa !9
  %58 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %59 = load i32, ptr %20, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  %62 = call i32 @BN_bn2bin(ptr noundef %57, ptr noundef %61)
  %63 = load ptr, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %65 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %66 = load i32, ptr %17, align 4, !tbaa !5
  %67 = getelementptr inbounds [64 x i8], ptr %7, i64 0, i64 0
  %68 = call i32 @ecdsa_sign(ptr noundef %63, i32 noundef 0, ptr noundef %64, ptr noundef %65, i32 noundef %66, ptr noundef %67, ptr noundef null, ptr noundef null)
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %32
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %16, align 4
  br label %148

72:                                               ; preds = %32
  %73 = load ptr, ptr %6, align 8, !tbaa !9
  %74 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %75 = getelementptr inbounds [33 x i8], ptr %8, i64 0, i64 0
  %76 = call i32 @ecdsa_get_public_key33(ptr noundef %73, ptr noundef %74, ptr noundef %75)
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %80

78:                                               ; preds = %72
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 1, ptr %16, align 4
  br label %148

80:                                               ; preds = %72
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %83 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  %84 = call i32 @ecdsa_get_public_key65(ptr noundef %81, ptr noundef %82, ptr noundef %83)
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %80
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 1, ptr %16, align 4
  br label %148

88:                                               ; preds = %80
  %89 = load ptr, ptr %6, align 8, !tbaa !9
  %90 = getelementptr inbounds [65 x i8], ptr %9, i64 0, i64 0
  %91 = getelementptr inbounds [64 x i8], ptr %7, i64 0, i64 0
  %92 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %93 = load i32, ptr %17, align 4, !tbaa !5
  %94 = call i32 @ecdsa_verify(ptr noundef %89, i32 noundef 0, ptr noundef %90, ptr noundef %91, ptr noundef %92, i32 noundef %93)
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %88
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 1, ptr %16, align 4
  br label %148

98:                                               ; preds = %88
  %99 = load ptr, ptr %6, align 8, !tbaa !9
  %100 = getelementptr inbounds [33 x i8], ptr %8, i64 0, i64 0
  %101 = getelementptr inbounds [64 x i8], ptr %7, i64 0, i64 0
  %102 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %103 = load i32, ptr %17, align 4, !tbaa !5
  %104 = call i32 @ecdsa_verify(ptr noundef %99, i32 noundef 0, ptr noundef %100, ptr noundef %101, ptr noundef %102, i32 noundef %103)
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %108

106:                                              ; preds = %98
  %107 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 1, ptr %16, align 4
  br label %148

108:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %109 = call ptr @ECDSA_SIG_new()
  store ptr %109, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %110 = getelementptr inbounds [64 x i8], ptr %7, i64 0, i64 0
  %111 = call ptr @BN_bin2bn(ptr noundef %110, i32 noundef 32, ptr noundef null)
  store ptr %111, ptr %22, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %112 = getelementptr inbounds [64 x i8], ptr %7, i64 0, i64 0
  %113 = getelementptr inbounds i8, ptr %112, i64 32
  %114 = call ptr @BN_bin2bn(ptr noundef %113, i32 noundef 32, ptr noundef null)
  store ptr %114, ptr %23, align 8, !tbaa !9
  %115 = load ptr, ptr %21, align 8, !tbaa !9
  %116 = load ptr, ptr %22, align 8, !tbaa !9
  %117 = load ptr, ptr %23, align 8, !tbaa !9
  %118 = call i32 @ECDSA_SIG_set0(ptr noundef %115, ptr noundef %116, ptr noundef %117)
  %119 = call i32 @SHA256_Init(ptr noundef %13)
  %120 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %121 = load i32, ptr %17, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = call i32 @SHA256_Update(ptr noundef %13, ptr noundef %120, i64 noundef %122)
  %124 = getelementptr inbounds [32 x i8], ptr %12, i64 0, i64 0
  %125 = call i32 @SHA256_Final(ptr noundef %124, ptr noundef %13)
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %126 = getelementptr inbounds [32 x i8], ptr %12, i64 0, i64 0
  %127 = load ptr, ptr %21, align 8, !tbaa !9
  %128 = load ptr, ptr %18, align 8, !tbaa !9
  %129 = call i32 @ECDSA_do_verify(ptr noundef %126, i32 noundef 32, ptr noundef %127, ptr noundef %128)
  store i32 %129, ptr %24, align 4, !tbaa !5
  %130 = load i32, ptr %24, align 4, !tbaa !5
  %131 = icmp ne i32 %130, 1
  br i1 %131, label %132, label %135

132:                                              ; preds = %108
  %133 = load i32, ptr %24, align 4, !tbaa !5
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %133)
  store i32 1, ptr %16, align 4
  br label %147

135:                                              ; preds = %108
  %136 = load ptr, ptr %21, align 8, !tbaa !9
  call void @ECDSA_SIG_free(ptr noundef %136)
  %137 = load ptr, ptr %18, align 8, !tbaa !9
  call void @EC_KEY_free(ptr noundef %137)
  %138 = load i32, ptr %15, align 4, !tbaa !5
  %139 = add i32 %138, 1
  %140 = urem i32 %139, 100
  %141 = icmp eq i32 %140, 0
  br i1 %141, label %142, label %146

142:                                              ; preds = %135
  %143 = load i32, ptr %15, align 4, !tbaa !5
  %144 = add i32 %143, 1
  %145 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %144)
  br label %146

146:                                              ; preds = %142, %135
  store i32 0, ptr %16, align 4
  br label %147

147:                                              ; preds = %146, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  br label %148

148:                                              ; preds = %147, %106, %96, %86, %78, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  %149 = load i32, ptr %16, align 4
  switch i32 %149, label %154 [
    i32 0, label %150
  ]

150:                                              ; preds = %148
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %15, align 4, !tbaa !5
  %153 = add i32 %152, 1
  store i32 %153, ptr %15, align 4, !tbaa !5
  br label %27, !llvm.loop !11

154:                                              ; preds = %148, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %155 = load i32, ptr %16, align 4
  switch i32 %155, label %159 [
    i32 2, label %156
  ]

156:                                              ; preds = %154
  %157 = load ptr, ptr %14, align 8, !tbaa !9
  call void @EC_GROUP_free(ptr noundef %157)
  %158 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  store i32 0, ptr %16, align 4
  br label %159

159:                                              ; preds = %156, %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 112, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 256, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 65, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 33, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #3
  %160 = load i32, ptr %16, align 4
  switch i32 %160, label %162 [
    i32 0, label %161
    i32 1, label %161
  ]

161:                                              ; preds = %159, %159
  ret void

162:                                              ; preds = %159
  unreachable
}

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

declare ptr @EC_GROUP_new_by_curve_name(i32 noundef) #2

declare i32 @random32() #2

declare void @random_buffer(ptr noundef, i64 noundef) #2

declare ptr @EC_KEY_new() #2

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

declare i32 @EC_KEY_generate_key(ptr noundef) #2

declare ptr @EC_KEY_get0_private_key(ptr noundef) #2

declare i32 @BN_num_bits(ptr noundef) #2

declare void @memzero(ptr noundef, i64 noundef) #2

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

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

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

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

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

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

declare ptr @ECDSA_SIG_new() #2

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

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

declare i32 @SHA256_Init(ptr noundef) #2

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

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

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

declare void @ECDSA_SIG_free(ptr noundef) #2

declare void @EC_KEY_free(ptr noundef) #2

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

declare void @EC_GROUP_free(ptr noundef) #2

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


; 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.SHA256state_st = type { [8 x i32], i32, i32, [16 x i32], i32, i32 }

@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @openssl_check(i32 noundef %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [64 x i8], align 16
  %5 = alloca [33 x i8], align 16
  %6 = alloca [65 x i8], align 16
  %7 = alloca [32 x i8], align 16
  %8 = alloca [256 x i8], align 16
  %9 = alloca [32 x i8], align 16
  %10 = alloca %struct.SHA256state_st, align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 33, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 65, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 112, ptr nonnull %10) #4
  %11 = tail call ptr @EC_GROUP_new_by_curve_name(i32 noundef %1) #4
  %.not4346.not = icmp eq i32 %0, 0
  br i1 %.not4346.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %12 = getelementptr inbounds i8, ptr %4, i64 32
  br label %13

13:                                               ; preds = %.lr.ph, %63
  %.047 = phi i32 [ 0, %.lr.ph ], [ %58, %63 ]
  %14 = call i32 @random32() #4
  %15 = and i32 %14, 255
  %16 = add nuw nsw i32 %15, 1
  %17 = zext nneg i32 %16 to i64
  call void @random_buffer(ptr noundef nonnull %8, i64 noundef %17) #4
  %18 = call ptr @EC_KEY_new() #4
  %19 = call i32 @EC_KEY_set_group(ptr noundef %18, ptr noundef %11) #4
  %20 = call i32 @EC_KEY_generate_key(ptr noundef %18) #4
  %21 = call ptr @EC_KEY_get0_private_key(ptr noundef %18) #4
  %22 = call i32 @BN_num_bits(ptr noundef %21) #4
  %23 = add nsw i32 %22, 7
  %.neg = sdiv i32 %23, -8
  %narrow = add nsw i32 %.neg, 32
  %24 = sext i32 %narrow to i64
  call void @memzero(ptr noundef nonnull %7, i64 noundef %24) #4
  %25 = getelementptr inbounds i8, ptr %7, i64 %24
  %26 = call i32 @BN_bn2bin(ptr noundef %21, ptr noundef nonnull %25) #4
  %27 = call i32 @ecdsa_sign(ptr noundef %2, i32 noundef 0, ptr noundef nonnull %7, ptr noundef nonnull %8, i32 noundef %16, ptr noundef nonnull %4, ptr noundef null, ptr noundef null) #4
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %30, label %28

28:                                               ; preds = %13
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %65

30:                                               ; preds = %13
  %31 = call i32 @ecdsa_get_public_key33(ptr noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %5) #4
  %.not38 = icmp eq i32 %31, 0
  br i1 %.not38, label %34, label %32

32:                                               ; preds = %30
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %65

34:                                               ; preds = %30
  %35 = call i32 @ecdsa_get_public_key65(ptr noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %6) #4
  %.not39 = icmp eq i32 %35, 0
  br i1 %.not39, label %38, label %36

36:                                               ; preds = %34
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %65

38:                                               ; preds = %34
  %39 = call i32 @ecdsa_verify(ptr noundef %2, i32 noundef 0, ptr noundef nonnull %6, ptr noundef nonnull %4, ptr noundef nonnull %8, i32 noundef %16) #4
  %.not40 = icmp eq i32 %39, 0
  br i1 %.not40, label %42, label %40

40:                                               ; preds = %38
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %65

42:                                               ; preds = %38
  %43 = call i32 @ecdsa_verify(ptr noundef %2, i32 noundef 0, ptr noundef nonnull %5, ptr noundef nonnull %4, ptr noundef nonnull %8, i32 noundef %16) #4
  %.not41 = icmp eq i32 %43, 0
  br i1 %.not41, label %46, label %44

44:                                               ; preds = %42
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %65

46:                                               ; preds = %42
  %47 = call ptr @ECDSA_SIG_new() #4
  %48 = call ptr @BN_bin2bn(ptr noundef nonnull %4, i32 noundef 32, ptr noundef null) #4
  %49 = call ptr @BN_bin2bn(ptr noundef nonnull %12, i32 noundef 32, ptr noundef null) #4
  %50 = call i32 @ECDSA_SIG_set0(ptr noundef %47, ptr noundef %48, ptr noundef %49) #4
  %51 = call i32 @SHA256_Init(ptr noundef nonnull %10) #4
  %52 = call i32 @SHA256_Update(ptr noundef nonnull %10, ptr noundef nonnull %8, i64 noundef %17) #4
  %53 = call i32 @SHA256_Final(ptr noundef nonnull %9, ptr noundef nonnull %10) #4
  %54 = call i32 @ECDSA_do_verify(ptr noundef nonnull %9, i32 noundef 32, ptr noundef %47, ptr noundef %18) #4
  %.not42 = icmp eq i32 %54, 1
  br i1 %.not42, label %57, label %55

55:                                               ; preds = %46
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %54)
  br label %65

57:                                               ; preds = %46
  call void @ECDSA_SIG_free(ptr noundef %47) #4
  call void @EC_KEY_free(ptr noundef %18) #4
  %58 = add nuw i32 %.047, 1
  %59 = urem i32 %58, 100
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %58)
  br label %63

63:                                               ; preds = %57, %61
  %exitcond.not = icmp eq i32 %58, %0
  br i1 %exitcond.not, label %.critedge, label %13, !llvm.loop !5

.critedge:                                        ; preds = %63, %3
  call void @EC_GROUP_free(ptr noundef %11) #4
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %65

65:                                               ; preds = %55, %44, %40, %36, %32, %28, %.critedge
  call void @llvm.lifetime.end.p0(i64 112, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 65, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 33, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #4
  ret void
}

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

declare ptr @EC_GROUP_new_by_curve_name(i32 noundef) local_unnamed_addr #2

declare i32 @random32() local_unnamed_addr #2

declare void @random_buffer(ptr noundef, i64 noundef) local_unnamed_addr #2

declare ptr @EC_KEY_new() local_unnamed_addr #2

declare i32 @EC_KEY_set_group(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @EC_KEY_generate_key(ptr noundef) local_unnamed_addr #2

declare ptr @EC_KEY_get0_private_key(ptr noundef) local_unnamed_addr #2

declare i32 @BN_num_bits(ptr noundef) local_unnamed_addr #2

declare void @memzero(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @BN_bn2bin(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ecdsa_sign(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @ecdsa_get_public_key33(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ecdsa_get_public_key65(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ecdsa_verify(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @ECDSA_SIG_new() local_unnamed_addr #2

declare ptr @BN_bin2bn(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ECDSA_SIG_set0(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @SHA256_Init(ptr noundef) local_unnamed_addr #2

declare i32 @SHA256_Update(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @SHA256_Final(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ECDSA_do_verify(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @ECDSA_SIG_free(ptr noundef) local_unnamed_addr #2

declare void @EC_KEY_free(ptr noundef) local_unnamed_addr #2

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

declare void @EC_GROUP_free(ptr noundef) local_unnamed_addr #2

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 = { "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 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass