; LLVM IR from machinefi/psa-crypto-esp32 :: crypto (ecc_dsa)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @uECC_sign_with_k(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca [8 x i32], align 16
  %15 = alloca [8 x i32], align 16
  %16 = alloca [2 x ptr], align 16
  %17 = alloca [16 x i32], align 16
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i16, align 2
  %22 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #3
  %23 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  store ptr %23, ptr %16, align 8, !tbaa !5
  %24 = getelementptr inbounds ptr, ptr %16, i64 1
  %25 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  store ptr %25, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #3
  %26 = load ptr, ptr %13, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.uECC_Curve_t, ptr %26, i32 0, i32 0
  %28 = load i8, ptr %27, align 8, !tbaa !11
  store i8 %28, ptr %19, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #3
  %29 = load ptr, ptr %13, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.uECC_Curve_t, ptr %29, i32 0, i32 2
  %31 = load i16, ptr %30, align 2, !tbaa !15
  %32 = sext i16 %31 to i32
  %33 = add nsw i32 %32, 31
  %34 = sdiv i32 %33, 32
  %35 = trunc i32 %34 to i8
  store i8 %35, ptr %20, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %21) #3
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.uECC_Curve_t, ptr %36, i32 0, i32 2
  %38 = load i16, ptr %37, align 2, !tbaa !15
  store i16 %38, ptr %21, align 2, !tbaa !16
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = load i8, ptr %19, align 1, !tbaa !14
  %41 = call i32 @uECC_vli_isZero(ptr noundef %39, i8 noundef signext %40)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %52, label %43

43:                                               ; preds = %6
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.uECC_Curve_t, ptr %44, i32 0, i32 4
  %46 = getelementptr inbounds [8 x i32], ptr %45, i64 0, i64 0
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = load i8, ptr %20, align 1, !tbaa !14
  %49 = call signext i8 @uECC_vli_cmp(ptr noundef %46, ptr noundef %47, i8 noundef signext %48)
  %50 = sext i8 %49 to i32
  %51 = icmp ne i32 %50, 1
  br i1 %51, label %52, label %53

52:                                               ; preds = %43, %6
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %190

53:                                               ; preds = %43
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %56 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = call i32 @regularize_k(ptr noundef %54, ptr noundef %55, ptr noundef %56, ptr noundef %57)
  store i32 %58, ptr %18, align 4, !tbaa !9
  %59 = getelementptr inbounds [16 x i32], ptr %17, i64 0, i64 0
  %60 = load ptr, ptr %13, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.uECC_Curve_t, ptr %60, i32 0, i32 5
  %62 = getelementptr inbounds [16 x i32], ptr %61, i64 0, i64 0
  %63 = load i32, ptr %18, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  %65 = xor i1 %64, true
  %66 = zext i1 %65 to i32
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [2 x ptr], ptr %16, i64 0, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = load i16, ptr %21, align 2, !tbaa !16
  %71 = sext i16 %70 to i32
  %72 = add nsw i32 %71, 1
  %73 = trunc i32 %72 to i16
  %74 = load ptr, ptr %13, align 8, !tbaa !5
  call void @EccPoint_mult(ptr noundef %59, ptr noundef %62, ptr noundef %69, ptr noundef null, i16 noundef signext %73, ptr noundef %74)
  %75 = getelementptr inbounds [16 x i32], ptr %17, i64 0, i64 0
  %76 = load i8, ptr %19, align 1, !tbaa !14
  %77 = call i32 @uECC_vli_isZero(ptr noundef %75, i8 noundef signext %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %53
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %190

80:                                               ; preds = %53
  %81 = call ptr @uECC_get_rng()
  %82 = icmp ne ptr %81, null
  br i1 %82, label %87, label %83

83:                                               ; preds = %80
  %84 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %85 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_clear(ptr noundef %84, i8 noundef signext %85)
  %86 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  store i32 1, ptr %86, align 16, !tbaa !9
  br label %97

87:                                               ; preds = %80
  %88 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.uECC_Curve_t, ptr %89, i32 0, i32 4
  %91 = getelementptr inbounds [8 x i32], ptr %90, i64 0, i64 0
  %92 = load i8, ptr %20, align 1, !tbaa !14
  %93 = call i32 @uECC_generate_random_int(ptr noundef %88, ptr noundef %91, i8 noundef signext %92)
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %96, label %95

95:                                               ; preds = %87
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %190

96:                                               ; preds = %87
  br label %97

97:                                               ; preds = %96, %83
  %98 = load ptr, ptr %11, align 8, !tbaa !5
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.uECC_Curve_t, ptr %101, i32 0, i32 4
  %103 = getelementptr inbounds [8 x i32], ptr %102, i64 0, i64 0
  %104 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modMult(ptr noundef %98, ptr noundef %99, ptr noundef %100, ptr noundef %103, i8 noundef signext %104)
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.uECC_Curve_t, ptr %107, i32 0, i32 4
  %109 = getelementptr inbounds [8 x i32], ptr %108, i64 0, i64 0
  %110 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modInv(ptr noundef %105, ptr noundef %106, ptr noundef %109, i8 noundef signext %110)
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.uECC_Curve_t, ptr %114, i32 0, i32 4
  %116 = getelementptr inbounds [8 x i32], ptr %115, i64 0, i64 0
  %117 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modMult(ptr noundef %111, ptr noundef %112, ptr noundef %113, ptr noundef %116, i8 noundef signext %117)
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = load ptr, ptr %13, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.uECC_Curve_t, ptr %119, i32 0, i32 1
  %121 = load i8, ptr %120, align 1, !tbaa !17
  %122 = sext i8 %121 to i32
  %123 = getelementptr inbounds [16 x i32], ptr %17, i64 0, i64 0
  call void @uECC_vli_nativeToBytes(ptr noundef %118, i32 noundef %122, ptr noundef %123)
  %124 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.uECC_Curve_t, ptr %126, i32 0, i32 2
  %128 = load i16, ptr %127, align 2, !tbaa !15
  %129 = sext i16 %128 to i32
  %130 = add nsw i32 %129, 7
  %131 = sdiv i32 %130, 8
  call void @uECC_vli_bytesToNative(ptr noundef %124, ptr noundef %125, i32 noundef %131)
  %132 = load i8, ptr %20, align 1, !tbaa !14
  %133 = sext i8 %132 to i32
  %134 = sub nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 %135
  store i32 0, ptr %136, align 4, !tbaa !9
  %137 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %138 = getelementptr inbounds [16 x i32], ptr %17, i64 0, i64 0
  %139 = load i8, ptr %19, align 1, !tbaa !14
  call void @uECC_vli_set(ptr noundef %137, ptr noundef %138, i8 noundef signext %139)
  %140 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %141 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %142 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %143 = load ptr, ptr %13, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.uECC_Curve_t, ptr %143, i32 0, i32 4
  %145 = getelementptr inbounds [8 x i32], ptr %144, i64 0, i64 0
  %146 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modMult(ptr noundef %140, ptr noundef %141, ptr noundef %142, ptr noundef %145, i8 noundef signext %146)
  %147 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  %149 = load i32, ptr %10, align 4, !tbaa !9
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  call void @bits2int(ptr noundef %147, ptr noundef %148, i32 noundef %149, ptr noundef %150)
  %151 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %152 = getelementptr inbounds [8 x i32], ptr %14, i64 0, i64 0
  %153 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.uECC_Curve_t, ptr %154, i32 0, i32 4
  %156 = getelementptr inbounds [8 x i32], ptr %155, i64 0, i64 0
  %157 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modAdd(ptr noundef %151, ptr noundef %152, ptr noundef %153, ptr noundef %156, i8 noundef signext %157)
  %158 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %159 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.uECC_Curve_t, ptr %161, i32 0, i32 4
  %163 = getelementptr inbounds [8 x i32], ptr %162, i64 0, i64 0
  %164 = load i8, ptr %20, align 1, !tbaa !14
  call void @uECC_vli_modMult(ptr noundef %158, ptr noundef %159, ptr noundef %160, ptr noundef %163, i8 noundef signext %164)
  %165 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  %166 = load i8, ptr %20, align 1, !tbaa !14
  %167 = call signext i16 @uECC_vli_numBits(ptr noundef %165, i8 noundef signext %166)
  %168 = sext i16 %167 to i32
  %169 = load ptr, ptr %13, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.uECC_Curve_t, ptr %169, i32 0, i32 1
  %171 = load i8, ptr %170, align 1, !tbaa !17
  %172 = sext i8 %171 to i16
  %173 = sext i16 %172 to i32
  %174 = mul nsw i32 %173, 8
  %175 = icmp sgt i32 %168, %174
  br i1 %175, label %176, label %177

176:                                              ; preds = %97
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %190

177:                                              ; preds = %97
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.uECC_Curve_t, ptr %179, i32 0, i32 1
  %181 = load i8, ptr %180, align 1, !tbaa !17
  %182 = sext i8 %181 to i32
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds i8, ptr %178, i64 %183
  %185 = load ptr, ptr %13, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.uECC_Curve_t, ptr %185, i32 0, i32 1
  %187 = load i8, ptr %186, align 1, !tbaa !17
  %188 = sext i8 %187 to i32
  %189 = getelementptr inbounds [8 x i32], ptr %15, i64 0, i64 0
  call void @uECC_vli_nativeToBytes(ptr noundef %184, i32 noundef %188, ptr noundef %189)
  store i32 1, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %190

190:                                              ; preds = %177, %176, %95, %79, %52
  call void @llvm.lifetime.end.p0(i64 2, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #3
  %191 = load i32, ptr %7, align 4
  ret i32 %191
}

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

declare i32 @uECC_vli_isZero(ptr noundef, i8 noundef signext) #2

declare signext i8 @uECC_vli_cmp(ptr noundef, ptr noundef, i8 noundef signext) #2

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

declare void @EccPoint_mult(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16 noundef signext, ptr noundef) #2

declare ptr @uECC_get_rng() #2

declare void @uECC_vli_clear(ptr noundef, i8 noundef signext) #2

declare i32 @uECC_generate_random_int(ptr noundef, ptr noundef, i8 noundef signext) #2

declare void @uECC_vli_modMult(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) #2

declare void @uECC_vli_modInv(ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) #2

declare void @uECC_vli_nativeToBytes(ptr noundef, i32 noundef, ptr noundef) #2

declare void @uECC_vli_bytesToNative(ptr noundef, ptr noundef, i32 noundef) #2

declare void @uECC_vli_set(ptr noundef, ptr noundef, i8 noundef signext) #2

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

declare void @uECC_vli_modAdd(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) #2

declare signext i16 @uECC_vli_numBits(ptr noundef, i8 noundef signext) #2

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !7, i64 0}
!12 = !{!"uECC_Curve_t", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4, !7, i64 36, !7, i64 68, !7, i64 132, !6, i64 168, !6, i64 176, !6, i64 184}
!13 = !{!"short", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!12, !13, i64 2}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !7, i64 1}


; 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"

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @uECC_sign_with_k(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = alloca [8 x i32], align 16
  %8 = alloca [8 x i32], align 16
  %9 = alloca [2 x ptr], align 16
  %10 = alloca [16 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #3
  store ptr %7, ptr %9, align 16, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %8, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %10) #3
  %12 = load i8, ptr %5, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %5, i64 2
  %14 = load i16, ptr %13, align 2, !tbaa !12
  %15 = sext i16 %14 to i32
  %16 = add nsw i32 %15, 31
  %17 = sdiv i32 %16, 32
  %18 = trunc i32 %17 to i8
  %19 = call i32 @uECC_vli_isZero(ptr noundef %3, i8 noundef signext %12) #3
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %20, label %57

20:                                               ; preds = %6
  %21 = getelementptr inbounds i8, ptr %5, i64 36
  %22 = call signext i8 @uECC_vli_cmp(ptr noundef nonnull %21, ptr noundef %3, i8 noundef signext %18) #3
  %.not51 = icmp eq i8 %22, 1
  br i1 %.not51, label %23, label %57

23:                                               ; preds = %20
  %24 = call i32 @regularize_k(ptr noundef %3, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %5) #3
  %25 = getelementptr inbounds i8, ptr %5, i64 68
  %.not52 = icmp eq i32 %24, 0
  %26 = zext i1 %.not52 to i64
  %27 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = add i16 %14, 1
  call void @EccPoint_mult(ptr noundef nonnull %10, ptr noundef nonnull %25, ptr noundef %28, ptr noundef null, i16 noundef signext %29, ptr noundef nonnull %5) #3
  %30 = call i32 @uECC_vli_isZero(ptr noundef nonnull %10, i8 noundef signext %12) #3
  %.not53 = icmp eq i32 %30, 0
  br i1 %.not53, label %31, label %57

31:                                               ; preds = %23
  %32 = call ptr @uECC_get_rng() #3
  %.not54 = icmp eq ptr %32, null
  br i1 %.not54, label %33, label %34

33:                                               ; preds = %31
  call void @uECC_vli_clear(ptr noundef nonnull %7, i8 noundef signext %18) #3
  store i32 1, ptr %7, align 16, !tbaa !13
  br label %36

34:                                               ; preds = %31
  %35 = call i32 @uECC_generate_random_int(ptr noundef nonnull %7, ptr noundef nonnull %21, i8 noundef signext %18) #3
  %.not55 = icmp eq i32 %35, 0
  br i1 %.not55, label %57, label %36

36:                                               ; preds = %34, %33
  call void @uECC_vli_modMult(ptr noundef %3, ptr noundef %3, ptr noundef nonnull %7, ptr noundef nonnull %21, i8 noundef signext %18) #3
  call void @uECC_vli_modInv(ptr noundef %3, ptr noundef %3, ptr noundef nonnull %21, i8 noundef signext %18) #3
  call void @uECC_vli_modMult(ptr noundef %3, ptr noundef %3, ptr noundef nonnull %7, ptr noundef nonnull %21, i8 noundef signext %18) #3
  %37 = getelementptr inbounds i8, ptr %5, i64 1
  %38 = load i8, ptr %37, align 1, !tbaa !15
  %39 = sext i8 %38 to i32
  call void @uECC_vli_nativeToBytes(ptr noundef %4, i32 noundef %39, ptr noundef nonnull %10) #3
  %40 = load i16, ptr %13, align 2, !tbaa !12
  %41 = sext i16 %40 to i32
  %42 = add nsw i32 %41, 7
  %43 = sdiv i32 %42, 8
  call void @uECC_vli_bytesToNative(ptr noundef nonnull %7, ptr noundef %0, i32 noundef %43) #3
  %sext = shl i32 %17, 24
  %44 = ashr exact i32 %sext, 24
  %45 = add nsw i32 %44, -1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [8 x i32], ptr %8, i64 0, i64 %46
  store i32 0, ptr %47, align 4, !tbaa !13
  call void @uECC_vli_set(ptr noundef nonnull %8, ptr noundef nonnull %10, i8 noundef signext %12) #3
  call void @uECC_vli_modMult(ptr noundef nonnull %8, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %21, i8 noundef signext %18) #3
  call void @bits2int(ptr noundef nonnull %7, ptr noundef %1, i32 noundef %2, ptr noundef nonnull %5)
  call void @uECC_vli_modAdd(ptr noundef nonnull %8, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %21, i8 noundef signext %18) #3
  call void @uECC_vli_modMult(ptr noundef nonnull %8, ptr noundef nonnull %8, ptr noundef %3, ptr noundef nonnull %21, i8 noundef signext %18) #3
  %48 = call signext i16 @uECC_vli_numBits(ptr noundef nonnull %8, i8 noundef signext %18) #3
  %49 = sext i16 %48 to i32
  %50 = load i8, ptr %37, align 1, !tbaa !15
  %51 = sext i8 %50 to i32
  %52 = shl nsw i32 %51, 3
  %53 = icmp slt i32 %52, %49
  br i1 %53, label %57, label %54

54:                                               ; preds = %36
  %55 = sext i8 %50 to i64
  %56 = getelementptr inbounds i8, ptr %4, i64 %55
  call void @uECC_vli_nativeToBytes(ptr noundef %56, i32 noundef %51, ptr noundef nonnull %8) #3
  br label %57

57:                                               ; preds = %36, %34, %23, %6, %20, %54
  %.0 = phi i32 [ 1, %54 ], [ 0, %20 ], [ 0, %6 ], [ 0, %23 ], [ 0, %34 ], [ 0, %36 ]
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #3
  ret i32 %.0
}

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

declare i32 @uECC_vli_isZero(ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare signext i8 @uECC_vli_cmp(ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

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

declare void @EccPoint_mult(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16 noundef signext, ptr noundef) local_unnamed_addr #2

declare ptr @uECC_get_rng() local_unnamed_addr #2

declare void @uECC_vli_clear(ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare i32 @uECC_generate_random_int(ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare void @uECC_vli_modMult(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare void @uECC_vli_modInv(ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare void @uECC_vli_nativeToBytes(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @uECC_vli_bytesToNative(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @uECC_vli_set(ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

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

declare void @uECC_vli_modAdd(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) local_unnamed_addr #2

declare signext i16 @uECC_vli_numBits(ptr noundef, i8 noundef signext) 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

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 = { 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, !7, i64 0}
!10 = !{!"uECC_Curve_t", !7, i64 0, !7, i64 1, !11, i64 2, !7, i64 4, !7, i64 36, !7, i64 68, !7, i64 132, !6, i64 168, !6, i64 176, !6, i64 184}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !11, i64 2}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!10, !7, i64 1}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass