; LLVM IR from openssl/openssl :: crypto/ec (ecdsa_ossl)

; 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.ec_key_st = type { ptr, ptr, i32, ptr, ptr, ptr, i32, i32, %struct.CRYPTO_REF_COUNT, i32, %struct.crypto_ex_data_st, ptr, ptr, i64 }
%struct.CRYPTO_REF_COUNT = type { i32 }
%struct.crypto_ex_data_st = type { ptr, ptr }
%struct.ECDSA_SIG_st = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.ossl_ecdsa_simple_verify_sig = external hidden unnamed_addr constant [29 x i8], align 1

declare void @ERR_new() #0

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) #0

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) #0

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

declare ptr @EC_KEY_get0_group(ptr noundef) #0

declare i32 @EC_KEY_can_sign(ptr noundef) #0

declare ptr @BN_CTX_new_ex(ptr noundef) #0

declare ptr @EC_GROUP_get0_order(ptr noundef) #0

declare i32 @BN_num_bits(ptr noundef) #0

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

declare i32 @BN_rshift(ptr noundef, ptr noundef, i32 noundef) #0

declare i32 @BN_is_zero(ptr noundef) #0

declare void @BN_CTX_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @ossl_ecdsa_simple_verify_sig(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 -1, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  store ptr null, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %35, label %24

24:                                               ; preds = %4
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = call ptr @EC_KEY_get0_group(ptr noundef %25)
  store ptr %26, ptr %19, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %35, label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call ptr @EC_KEY_get0_public_key(ptr noundef %29)
  store ptr %30, ptr %20, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %35, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %36

35:                                               ; preds = %32, %28, %24, %4
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 458, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 124, ptr noundef null)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %213

36:                                               ; preds = %32
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = call i32 @EC_KEY_can_sign(ptr noundef %37)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 463, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 159, ptr noundef null)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %213

41:                                               ; preds = %36
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ec_key_st, ptr %42, i32 0, i32 11
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = call ptr @BN_CTX_new_ex(ptr noundef %44)
  store ptr %45, ptr %12, align 8, !tbaa !5
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = icmp eq ptr %46, null
  br i1 %47, label %48, label %49

48:                                               ; preds = %41
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 469, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %213

49:                                               ; preds = %41
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_start(ptr noundef %50)
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = call ptr @BN_CTX_get(ptr noundef %51)
  store ptr %52, ptr %14, align 8, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = call ptr @BN_CTX_get(ptr noundef %53)
  store ptr %54, ptr %15, align 8, !tbaa !5
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = call ptr @BN_CTX_get(ptr noundef %55)
  store ptr %56, ptr %16, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = call ptr @BN_CTX_get(ptr noundef %57)
  store ptr %58, ptr %17, align 8, !tbaa !5
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  %60 = icmp eq ptr %59, null
  br i1 %60, label %61, label %62

61:                                               ; preds = %49
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 478, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

62:                                               ; preds = %49
  %63 = load ptr, ptr %19, align 8, !tbaa !5
  %64 = call ptr @EC_GROUP_get0_order(ptr noundef %63)
  store ptr %64, ptr %13, align 8, !tbaa !5
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %68

67:                                               ; preds = %62
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 484, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %208

68:                                               ; preds = %62
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !16
  %72 = call i32 @BN_is_zero(ptr noundef %71)
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %106, label %74

74:                                               ; preds = %68
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = call i32 @BN_is_negative(ptr noundef %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %106, label %80

80:                                               ; preds = %74
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !16
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = call i32 @BN_ucmp(ptr noundef %83, ptr noundef %84)
  %86 = icmp sge i32 %85, 0
  br i1 %86, label %106, label %87

87:                                               ; preds = %80
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !18
  %91 = call i32 @BN_is_zero(ptr noundef %90)
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %106, label %93

93:                                               ; preds = %87
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !18
  %97 = call i32 @BN_is_negative(ptr noundef %96)
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %106, label %99

99:                                               ; preds = %93
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !18
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = call i32 @BN_ucmp(ptr noundef %102, ptr noundef %103)
  %105 = icmp sge i32 %104, 0
  br i1 %105, label %106, label %107

106:                                              ; preds = %99, %93, %87, %80, %74, %68
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 491, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 156, ptr noundef null)
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %208

107:                                              ; preds = %99
  %108 = load ptr, ptr %19, align 8, !tbaa !5
  %109 = load ptr, ptr %15, align 8, !tbaa !5
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %110, i32 0, i32 1
  %112 = load ptr, ptr %111, align 8, !tbaa !18
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = call i32 @ossl_ec_group_do_inverse_ord(ptr noundef %108, ptr noundef %109, ptr noundef %112, ptr noundef %113)
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %117, label %116

116:                                              ; preds = %107
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 497, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

117:                                              ; preds = %107
  %118 = load ptr, ptr %13, align 8, !tbaa !5
  %119 = call i32 @BN_num_bits(ptr noundef %118)
  store i32 %119, ptr %11, align 4, !tbaa !9
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = mul nsw i32 8, %120
  %122 = load i32, ptr %11, align 4, !tbaa !9
  %123 = icmp sgt i32 %121, %122
  br i1 %123, label %124, label %128

124:                                              ; preds = %117
  %125 = load i32, ptr %11, align 4, !tbaa !9
  %126 = add nsw i32 %125, 7
  %127 = sdiv i32 %126, 8
  store i32 %127, ptr %7, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %124, %117
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = load i32, ptr %7, align 4, !tbaa !9
  %131 = load ptr, ptr %16, align 8, !tbaa !5
  %132 = call ptr @BN_bin2bn(ptr noundef %129, i32 noundef %130, ptr noundef %131)
  %133 = icmp ne ptr %132, null
  br i1 %133, label %135, label %134

134:                                              ; preds = %128
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 508, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

135:                                              ; preds = %128
  %136 = load i32, ptr %7, align 4, !tbaa !9
  %137 = mul nsw i32 8, %136
  %138 = load i32, ptr %11, align 4, !tbaa !9
  %139 = icmp sgt i32 %137, %138
  br i1 %139, label %140, label %149

140:                                              ; preds = %135
  %141 = load ptr, ptr %16, align 8, !tbaa !5
  %142 = load ptr, ptr %16, align 8, !tbaa !5
  %143 = load i32, ptr %11, align 4, !tbaa !9
  %144 = and i32 %143, 7
  %145 = sub nsw i32 8, %144
  %146 = call i32 @BN_rshift(ptr noundef %141, ptr noundef %142, i32 noundef %145)
  %147 = icmp ne i32 %146, 0
  br i1 %147, label %149, label %148

148:                                              ; preds = %140
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 513, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

149:                                              ; preds = %140, %135
  %150 = load ptr, ptr %14, align 8, !tbaa !5
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = load ptr, ptr %15, align 8, !tbaa !5
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = load ptr, ptr %12, align 8, !tbaa !5
  %155 = call i32 @BN_mod_mul(ptr noundef %150, ptr noundef %151, ptr noundef %152, ptr noundef %153, ptr noundef %154)
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %158, label %157

157:                                              ; preds = %149
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 518, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

158:                                              ; preds = %149
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8, !tbaa !16
  %163 = load ptr, ptr %15, align 8, !tbaa !5
  %164 = load ptr, ptr %13, align 8, !tbaa !5
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  %166 = call i32 @BN_mod_mul(ptr noundef %159, ptr noundef %162, ptr noundef %163, ptr noundef %164, ptr noundef %165)
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %169, label %168

168:                                              ; preds = %158
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 523, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

169:                                              ; preds = %158
  %170 = load ptr, ptr %19, align 8, !tbaa !5
  %171 = call ptr @EC_POINT_new(ptr noundef %170)
  store ptr %171, ptr %18, align 8, !tbaa !5
  %172 = icmp eq ptr %171, null
  br i1 %172, label %173, label %174

173:                                              ; preds = %169
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 528, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %208

174:                                              ; preds = %169
  %175 = load ptr, ptr %19, align 8, !tbaa !5
  %176 = load ptr, ptr %18, align 8, !tbaa !5
  %177 = load ptr, ptr %14, align 8, !tbaa !5
  %178 = load ptr, ptr %20, align 8, !tbaa !5
  %179 = load ptr, ptr %15, align 8, !tbaa !5
  %180 = load ptr, ptr %12, align 8, !tbaa !5
  %181 = call i32 @EC_POINT_mul(ptr noundef %175, ptr noundef %176, ptr noundef %177, ptr noundef %178, ptr noundef %179, ptr noundef %180)
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %184, label %183

183:                                              ; preds = %174
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 532, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %208

184:                                              ; preds = %174
  %185 = load ptr, ptr %19, align 8, !tbaa !5
  %186 = load ptr, ptr %18, align 8, !tbaa !5
  %187 = load ptr, ptr %17, align 8, !tbaa !5
  %188 = load ptr, ptr %12, align 8, !tbaa !5
  %189 = call i32 @EC_POINT_get_affine_coordinates(ptr noundef %185, ptr noundef %186, ptr noundef %187, ptr noundef null, ptr noundef %188)
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %192, label %191

191:                                              ; preds = %184
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 537, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null)
  br label %208

192:                                              ; preds = %184
  %193 = load ptr, ptr %14, align 8, !tbaa !5
  %194 = load ptr, ptr %17, align 8, !tbaa !5
  %195 = load ptr, ptr %13, align 8, !tbaa !5
  %196 = load ptr, ptr %12, align 8, !tbaa !5
  %197 = call i32 @BN_nnmod(ptr noundef %193, ptr noundef %194, ptr noundef %195, ptr noundef %196)
  %198 = icmp ne i32 %197, 0
  br i1 %198, label %200, label %199

199:                                              ; preds = %192
  call void @ERR_new()
  call void @ERR_set_debug(ptr noundef @.str, i32 noundef 542, ptr noundef @__func__.ossl_ecdsa_simple_verify_sig)
  call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null)
  br label %208

200:                                              ; preds = %192
  %201 = load ptr, ptr %14, align 8, !tbaa !5
  %202 = load ptr, ptr %8, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.ECDSA_SIG_st, ptr %202, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !16
  %205 = call i32 @BN_ucmp(ptr noundef %201, ptr noundef %204)
  %206 = icmp eq i32 %205, 0
  %207 = zext i1 %206 to i32
  store i32 %207, ptr %10, align 4, !tbaa !9
  br label %208

208:                                              ; preds = %200, %199, %191, %183, %173, %168, %157, %148, %134, %116, %106, %67, %61
  %209 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_end(ptr noundef %209)
  %210 = load ptr, ptr %12, align 8, !tbaa !5
  call void @BN_CTX_free(ptr noundef %210)
  %211 = load ptr, ptr %18, align 8, !tbaa !5
  call void @EC_POINT_free(ptr noundef %211)
  %212 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %212, ptr %5, align 4
  store i32 1, ptr %21, align 4
  br label %213

213:                                              ; preds = %208, %48, %40, %35
  call void @llvm.lifetime.end.p0(i64 8, 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 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %214 = load i32, ptr %5, align 4
  ret i32 %214
}

declare ptr @EC_KEY_get0_public_key(ptr noundef) #0

declare void @BN_CTX_start(ptr noundef) #0

declare ptr @BN_CTX_get(ptr noundef) #0

declare i32 @BN_is_negative(ptr noundef) #0

declare i32 @BN_ucmp(ptr noundef, ptr noundef) #0

declare i32 @ossl_ec_group_do_inverse_ord(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare i32 @BN_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare ptr @EC_POINT_new(ptr noundef) #0

declare i32 @EC_POINT_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare i32 @EC_POINT_get_affine_coordinates(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare i32 @BN_nnmod(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare void @BN_CTX_end(ptr noundef) #0

declare void @EC_POINT_free(ptr noundef) #0

attributes #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 = { 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 80}
!12 = !{!"ec_key_st", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !13, i64 56, !10, i64 60, !14, i64 64, !6, i64 80, !6, i64 88, !15, i64 96}
!13 = !{!"", !7, i64 0}
!14 = !{!"crypto_ex_data_st", !6, i64 0, !6, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 0}
!17 = !{!"ECDSA_SIG_st", !6, i64 0, !6, i64 8}
!18 = !{!17, !6, i64 8}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.ossl_ecdsa_simple_verify_sig = external hidden unnamed_addr constant [29 x i8], align 1

declare void @ERR_new() local_unnamed_addr #0

declare void @ERR_set_debug(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @ERR_set_error(i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

declare ptr @EC_KEY_get0_group(ptr noundef) local_unnamed_addr #0

declare i32 @EC_KEY_can_sign(ptr noundef) local_unnamed_addr #0

declare ptr @BN_CTX_new_ex(ptr noundef) local_unnamed_addr #0

declare ptr @EC_GROUP_get0_order(ptr noundef) local_unnamed_addr #0

declare i32 @BN_num_bits(ptr noundef) local_unnamed_addr #0

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

declare i32 @BN_rshift(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare i32 @BN_is_zero(ptr noundef) local_unnamed_addr #0

declare void @BN_CTX_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @ossl_ecdsa_simple_verify_sig(ptr noundef %0, i32 noundef %1, ptr noundef readonly %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = icmp eq ptr %3, null
  br i1 %5, label %13, label %6

6:                                                ; preds = %4
  %7 = tail call ptr @EC_KEY_get0_group(ptr noundef nonnull %3) #2
  %8 = icmp eq ptr %7, null
  br i1 %8, label %13, label %9

9:                                                ; preds = %6
  %10 = tail call ptr @EC_KEY_get0_public_key(ptr noundef nonnull %3) #2
  %11 = icmp eq ptr %10, null
  %12 = icmp eq ptr %2, null
  %or.cond = or i1 %12, %11
  br i1 %or.cond, label %13, label %14

13:                                               ; preds = %9, %6, %4
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 458, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 124, ptr noundef null) #2
  br label %104

14:                                               ; preds = %9
  %15 = tail call i32 @EC_KEY_can_sign(ptr noundef nonnull %3) #2
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %16, label %17

16:                                               ; preds = %14
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 463, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 159, ptr noundef null) #2
  br label %104

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %3, i64 80
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = tail call ptr @BN_CTX_new_ex(ptr noundef %19) #2
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 469, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %104

23:                                               ; preds = %17
  tail call void @BN_CTX_start(ptr noundef nonnull %20) #2
  %24 = tail call ptr @BN_CTX_get(ptr noundef nonnull %20) #2
  %25 = tail call ptr @BN_CTX_get(ptr noundef nonnull %20) #2
  %26 = tail call ptr @BN_CTX_get(ptr noundef nonnull %20) #2
  %27 = tail call ptr @BN_CTX_get(ptr noundef nonnull %20) #2
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %23
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 478, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

30:                                               ; preds = %23
  %31 = tail call ptr @EC_GROUP_get0_order(ptr noundef nonnull %7) #2
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 484, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #2
  br label %103

34:                                               ; preds = %30
  %35 = load ptr, ptr %2, align 8, !tbaa !14
  %36 = tail call i32 @BN_is_zero(ptr noundef %35) #2
  %.not84 = icmp eq i32 %36, 0
  br i1 %.not84, label %37, label %55

37:                                               ; preds = %34
  %38 = load ptr, ptr %2, align 8, !tbaa !14
  %39 = tail call i32 @BN_is_negative(ptr noundef %38) #2
  %.not85 = icmp eq i32 %39, 0
  br i1 %.not85, label %40, label %55

40:                                               ; preds = %37
  %41 = load ptr, ptr %2, align 8, !tbaa !14
  %42 = tail call i32 @BN_ucmp(ptr noundef %41, ptr noundef nonnull %31) #2
  %43 = icmp sgt i32 %42, -1
  br i1 %43, label %55, label %44

44:                                               ; preds = %40
  %45 = getelementptr inbounds i8, ptr %2, i64 8
  %46 = load ptr, ptr %45, align 8, !tbaa !16
  %47 = tail call i32 @BN_is_zero(ptr noundef %46) #2
  %.not86 = icmp eq i32 %47, 0
  br i1 %.not86, label %48, label %55

48:                                               ; preds = %44
  %49 = load ptr, ptr %45, align 8, !tbaa !16
  %50 = tail call i32 @BN_is_negative(ptr noundef %49) #2
  %.not87 = icmp eq i32 %50, 0
  br i1 %.not87, label %51, label %55

51:                                               ; preds = %48
  %52 = load ptr, ptr %45, align 8, !tbaa !16
  %53 = tail call i32 @BN_ucmp(ptr noundef %52, ptr noundef nonnull %31) #2
  %54 = icmp sgt i32 %53, -1
  br i1 %54, label %55, label %56

55:                                               ; preds = %51, %48, %44, %40, %37, %34
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 491, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 156, ptr noundef null) #2
  br label %103

56:                                               ; preds = %51
  %57 = load ptr, ptr %45, align 8, !tbaa !16
  %58 = tail call i32 @ossl_ec_group_do_inverse_ord(ptr noundef nonnull %7, ptr noundef %25, ptr noundef %57, ptr noundef nonnull %20) #2
  %.not88 = icmp eq i32 %58, 0
  br i1 %.not88, label %59, label %60

59:                                               ; preds = %56
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 497, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

60:                                               ; preds = %56
  %61 = tail call i32 @BN_num_bits(ptr noundef nonnull %31) #2
  %62 = shl nsw i32 %1, 3
  %63 = icmp sgt i32 %62, %61
  br i1 %63, label %64, label %67

64:                                               ; preds = %60
  %65 = add nsw i32 %61, 7
  %66 = sdiv i32 %65, 8
  br label %67

67:                                               ; preds = %64, %60
  %.071 = phi i32 [ %66, %64 ], [ %1, %60 ]
  %68 = tail call ptr @BN_bin2bn(ptr noundef %0, i32 noundef %.071, ptr noundef %26) #2
  %.not89 = icmp eq ptr %68, null
  br i1 %.not89, label %69, label %70

69:                                               ; preds = %67
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 508, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

70:                                               ; preds = %67
  %71 = shl nsw i32 %.071, 3
  %72 = icmp sgt i32 %71, %61
  br i1 %72, label %73, label %78

73:                                               ; preds = %70
  %74 = and i32 %61, 7
  %75 = sub nuw nsw i32 8, %74
  %76 = tail call i32 @BN_rshift(ptr noundef %26, ptr noundef %26, i32 noundef %75) #2
  %.not90 = icmp eq i32 %76, 0
  br i1 %.not90, label %77, label %78

77:                                               ; preds = %73
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 513, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

78:                                               ; preds = %73, %70
  %79 = tail call i32 @BN_mod_mul(ptr noundef %24, ptr noundef %26, ptr noundef %25, ptr noundef nonnull %31, ptr noundef nonnull %20) #2
  %.not91 = icmp eq i32 %79, 0
  br i1 %.not91, label %80, label %81

80:                                               ; preds = %78
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 518, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

81:                                               ; preds = %78
  %82 = load ptr, ptr %2, align 8, !tbaa !14
  %83 = tail call i32 @BN_mod_mul(ptr noundef %25, ptr noundef %82, ptr noundef %25, ptr noundef nonnull %31, ptr noundef nonnull %20) #2
  %.not92 = icmp eq i32 %83, 0
  br i1 %.not92, label %84, label %85

84:                                               ; preds = %81
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 523, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

85:                                               ; preds = %81
  %86 = tail call ptr @EC_POINT_new(ptr noundef nonnull %7) #2
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %85
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 528, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #2
  br label %103

89:                                               ; preds = %85
  %90 = tail call i32 @EC_POINT_mul(ptr noundef nonnull %7, ptr noundef nonnull %86, ptr noundef %24, ptr noundef nonnull %10, ptr noundef %25, ptr noundef nonnull %20) #2
  %.not93 = icmp eq i32 %90, 0
  br i1 %.not93, label %91, label %92

91:                                               ; preds = %89
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 532, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #2
  br label %103

92:                                               ; preds = %89
  %93 = tail call i32 @EC_POINT_get_affine_coordinates(ptr noundef nonnull %7, ptr noundef nonnull %86, ptr noundef nonnull %27, ptr noundef null, ptr noundef nonnull %20) #2
  %.not94 = icmp eq i32 %93, 0
  br i1 %.not94, label %94, label %95

94:                                               ; preds = %92
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 537, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524304, ptr noundef null) #2
  br label %103

95:                                               ; preds = %92
  %96 = tail call i32 @BN_nnmod(ptr noundef %24, ptr noundef nonnull %27, ptr noundef nonnull %31, ptr noundef nonnull %20) #2
  %.not95 = icmp eq i32 %96, 0
  br i1 %.not95, label %97, label %98

97:                                               ; preds = %95
  tail call void @ERR_new() #2
  tail call void @ERR_set_debug(ptr noundef nonnull @.str, i32 noundef 542, ptr noundef nonnull @__func__.ossl_ecdsa_simple_verify_sig) #2
  tail call void (i32, i32, ptr, ...) @ERR_set_error(i32 noundef 16, i32 noundef 524291, ptr noundef null) #2
  br label %103

98:                                               ; preds = %95
  %99 = load ptr, ptr %2, align 8, !tbaa !14
  %100 = tail call i32 @BN_ucmp(ptr noundef %24, ptr noundef %99) #2
  %101 = icmp eq i32 %100, 0
  %102 = zext i1 %101 to i32
  br label %103

103:                                              ; preds = %98, %97, %94, %91, %88, %84, %80, %77, %69, %59, %55, %33, %29
  %.073 = phi i32 [ -1, %29 ], [ -1, %33 ], [ 0, %55 ], [ -1, %88 ], [ %102, %98 ], [ -1, %97 ], [ -1, %94 ], [ -1, %91 ], [ -1, %84 ], [ -1, %80 ], [ -1, %77 ], [ -1, %69 ], [ -1, %59 ]
  %.072 = phi ptr [ null, %29 ], [ null, %33 ], [ null, %55 ], [ null, %88 ], [ %86, %98 ], [ %86, %97 ], [ %86, %94 ], [ %86, %91 ], [ null, %84 ], [ null, %80 ], [ null, %77 ], [ null, %69 ], [ null, %59 ]
  tail call void @BN_CTX_end(ptr noundef nonnull %20) #2
  tail call void @BN_CTX_free(ptr noundef nonnull %20) #2
  tail call void @EC_POINT_free(ptr noundef %.072) #2
  br label %104

104:                                              ; preds = %103, %22, %16, %13
  %.0 = phi i32 [ -1, %13 ], [ -1, %22 ], [ %.073, %103 ], [ -1, %16 ]
  ret i32 %.0
}

declare ptr @EC_KEY_get0_public_key(ptr noundef) local_unnamed_addr #0

declare void @BN_CTX_start(ptr noundef) local_unnamed_addr #0

declare ptr @BN_CTX_get(ptr noundef) local_unnamed_addr #0

declare i32 @BN_is_negative(ptr noundef) local_unnamed_addr #0

declare i32 @BN_ucmp(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @ossl_ec_group_do_inverse_ord(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @BN_mod_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @EC_POINT_new(ptr noundef) local_unnamed_addr #0

declare i32 @EC_POINT_mul(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @EC_POINT_get_affine_coordinates(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @BN_nnmod(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @BN_CTX_end(ptr noundef) local_unnamed_addr #0

declare void @EC_POINT_free(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 80}
!6 = !{!"ec_key_st", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !11, i64 56, !10, i64 60, !12, i64 64, !7, i64 80, !7, i64 88, !13, i64 96}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"", !8, i64 0}
!12 = !{!"crypto_ex_data_st", !7, i64 0, !7, i64 8}
!13 = !{!"long", !8, i64 0}
!14 = !{!15, !7, i64 0}
!15 = !{!"ECDSA_SIG_st", !7, i64 0, !7, i64 8}
!16 = !{!15, !7, i64 8}


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