; LLVM IR from square/subzero :: core/trezor-crypto (ecdsa)

; 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.curve_point = type { %struct.bignum256, %struct.bignum256 }
%struct.bignum256 = type { [9 x i32] }
%struct.rfc6979_state = type { [32 x i8], [32 x i8] }
%struct.ecdsa_curve = type { %struct.bignum256, %struct.curve_point, %struct.bignum256, %struct.bignum256, i32, %struct.bignum256, [64 x [8 x %struct.curve_point]] }

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

declare void @bn_inverse(ptr noundef, ptr noundef) #1

declare void @bn_multiply(ptr noundef, ptr noundef, ptr noundef) #1

declare void @bn_mod(ptr noundef, ptr noundef) #1

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

declare i32 @bn_is_zero(ptr noundef) #1

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

declare void @bn_add(ptr noundef, ptr noundef) #1

declare i32 @bn_is_less(ptr noundef, ptr noundef) #1

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

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

declare void @bn_read_be(ptr noundef, ptr noundef) #1

declare void @bn_write_be(ptr noundef, ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @ecdsa_sign_digest(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %struct.curve_point, align 4
  %16 = alloca %struct.bignum256, align 4
  %17 = alloca %struct.bignum256, align 4
  %18 = alloca %struct.bignum256, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i8, align 1
  %21 = alloca %struct.rfc6979_state, align 1
  %22 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  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 4, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %23 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 1
  store ptr %23, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 64, ptr %21) #3
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  call void @init_rfc6979(ptr noundef %24, ptr noundef %25, ptr noundef %21)
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  call void @bn_read_be(ptr noundef %26, ptr noundef %17)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %130, %6
  %28 = load i32, ptr %14, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 10000
  br i1 %29, label %30, label %133

30:                                               ; preds = %27
  call void @generate_k_rfc6979(ptr noundef %16, ptr noundef %21)
  %31 = call i32 @bn_is_zero(ptr noundef %16)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %38, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ecdsa_curve, ptr %34, i32 0, i32 2
  %36 = call i32 @bn_is_less(ptr noundef %16, ptr noundef %35)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %39, label %38

38:                                               ; preds = %33, %30
  br label %130

39:                                               ; preds = %33
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @scalar_multiply(ptr noundef %40, ptr noundef %16, ptr noundef %15)
  %41 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 1
  %42 = getelementptr inbounds %struct.bignum256, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds [9 x i32], ptr %42, i64 0, i64 0
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = and i32 %44, 1
  %46 = trunc i32 %45 to i8
  store i8 %46, ptr %20, align 1, !tbaa !11
  %47 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ecdsa_curve, ptr %48, i32 0, i32 2
  %50 = call i32 @bn_is_less(ptr noundef %47, ptr noundef %49)
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %61, label %52

52:                                               ; preds = %39
  %53 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ecdsa_curve, ptr %54, i32 0, i32 2
  %56 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  call void @bn_subtract(ptr noundef %53, ptr noundef %55, ptr noundef %56)
  %57 = load i8, ptr %20, align 1, !tbaa !11
  %58 = zext i8 %57 to i32
  %59 = or i32 %58, 2
  %60 = trunc i32 %59 to i8
  store i8 %60, ptr %20, align 1, !tbaa !11
  br label %61

61:                                               ; preds = %52, %39
  %62 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  %63 = call i32 @bn_is_zero(ptr noundef %62)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %61
  br label %130

66:                                               ; preds = %61
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.ecdsa_curve, ptr %67, i32 0, i32 2
  call void @generate_k_random(ptr noundef %18, ptr noundef %68)
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ecdsa_curve, ptr %69, i32 0, i32 2
  call void @bn_multiply(ptr noundef %18, ptr noundef %16, ptr noundef %70)
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ecdsa_curve, ptr %71, i32 0, i32 2
  call void @bn_inverse(ptr noundef %16, ptr noundef %72)
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load ptr, ptr %19, align 8, !tbaa !5
  call void @bn_read_be(ptr noundef %73, ptr noundef %74)
  %75 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  %76 = load ptr, ptr %19, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.ecdsa_curve, ptr %77, i32 0, i32 2
  call void @bn_multiply(ptr noundef %75, ptr noundef %76, ptr noundef %78)
  %79 = load ptr, ptr %19, align 8, !tbaa !5
  call void @bn_add(ptr noundef %79, ptr noundef %17)
  %80 = load ptr, ptr %19, align 8, !tbaa !5
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.ecdsa_curve, ptr %81, i32 0, i32 2
  call void @bn_multiply(ptr noundef %16, ptr noundef %80, ptr noundef %82)
  %83 = load ptr, ptr %19, align 8, !tbaa !5
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ecdsa_curve, ptr %84, i32 0, i32 2
  call void @bn_multiply(ptr noundef %18, ptr noundef %83, ptr noundef %85)
  %86 = load ptr, ptr %19, align 8, !tbaa !5
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ecdsa_curve, ptr %87, i32 0, i32 2
  call void @bn_mod(ptr noundef %86, ptr noundef %88)
  %89 = load ptr, ptr %19, align 8, !tbaa !5
  %90 = call i32 @bn_is_zero(ptr noundef %89)
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %66
  br label %130

93:                                               ; preds = %66
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ecdsa_curve, ptr %94, i32 0, i32 3
  %96 = load ptr, ptr %19, align 8, !tbaa !5
  %97 = call i32 @bn_is_less(ptr noundef %95, ptr noundef %96)
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %108

99:                                               ; preds = %93
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ecdsa_curve, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %19, align 8, !tbaa !5
  %103 = load ptr, ptr %19, align 8, !tbaa !5
  call void @bn_subtract(ptr noundef %101, ptr noundef %102, ptr noundef %103)
  %104 = load i8, ptr %20, align 1, !tbaa !11
  %105 = zext i8 %104 to i32
  %106 = xor i32 %105, 1
  %107 = trunc i32 %106 to i8
  store i8 %107, ptr %20, align 1, !tbaa !11
  br label %108

108:                                              ; preds = %99, %93
  %109 = getelementptr inbounds %struct.curve_point, ptr %15, i32 0, i32 0
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  call void @bn_write_be(ptr noundef %109, ptr noundef %110)
  %111 = load ptr, ptr %19, align 8, !tbaa !5
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds i8, ptr %112, i64 32
  call void @bn_write_be(ptr noundef %111, ptr noundef %113)
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  %115 = icmp ne ptr %114, null
  br i1 %115, label %116, label %123

116:                                              ; preds = %108
  %117 = load ptr, ptr %13, align 8, !tbaa !5
  %118 = load i8, ptr %20, align 1, !tbaa !11
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = call i32 %117(i8 noundef zeroext %118, ptr noundef %119)
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %123, label %122

122:                                              ; preds = %116
  br label %130

123:                                              ; preds = %116, %108
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = icmp ne ptr %124, null
  br i1 %125, label %126, label %129

126:                                              ; preds = %123
  %127 = load i8, ptr %20, align 1, !tbaa !11
  %128 = load ptr, ptr %12, align 8, !tbaa !5
  store i8 %127, ptr %128, align 1, !tbaa !11
  br label %129

129:                                              ; preds = %126, %123
  call void @memzero(ptr noundef %16, i64 noundef 36)
  call void @memzero(ptr noundef %18, i64 noundef 36)
  call void @memzero(ptr noundef %21, i64 noundef 64)
  store i32 0, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %134

130:                                              ; preds = %122, %92, %65, %38
  %131 = load i32, ptr %14, align 4, !tbaa !9
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %14, align 4, !tbaa !9
  br label %27, !llvm.loop !12

133:                                              ; preds = %27
  call void @memzero(ptr noundef %16, i64 noundef 36)
  call void @memzero(ptr noundef %18, i64 noundef 36)
  call void @memzero(ptr noundef %21, i64 noundef 64)
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %22, align 4
  br label %134

134:                                              ; preds = %133, %129
  call void @llvm.lifetime.end.p0(i64 64, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %135 = load i32, ptr %7, align 4
  ret i32 %135
}

declare void @bn_subtract(ptr noundef, ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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.curve_point = type { %struct.bignum256, %struct.bignum256 }
%struct.bignum256 = type { [9 x i32] }
%struct.rfc6979_state = type { [32 x i8], [32 x i8] }

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

declare void @bn_inverse(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @bn_multiply(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @bn_mod(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare i32 @bn_is_zero(ptr noundef) local_unnamed_addr #1

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

declare void @bn_add(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @bn_is_less(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare void @bn_read_be(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @bn_write_be(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @ecdsa_sign_digest(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef writeonly %4, ptr noundef readonly %5) local_unnamed_addr #2 {
  %7 = alloca %struct.curve_point, align 4
  %8 = alloca %struct.bignum256, align 4
  %9 = alloca %struct.bignum256, align 4
  %10 = alloca %struct.bignum256, align 4
  %11 = alloca %struct.rfc6979_state, align 1
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %10) #3
  %12 = getelementptr inbounds i8, ptr %7, i64 36
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %11) #3
  call void @init_rfc6979(ptr noundef %1, ptr noundef %2, ptr noundef nonnull %11)
  call void @bn_read_be(ptr noundef %2, ptr noundef nonnull %9) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 108
  %14 = getelementptr inbounds i8, ptr %0, i64 144
  %15 = getelementptr inbounds i8, ptr %3, i64 32
  %.not50 = icmp eq ptr %5, null
  br label %16

16:                                               ; preds = %6, %40
  %.04253 = phi i32 [ 0, %6 ], [ %41, %40 ]
  call void @generate_k_rfc6979(ptr noundef nonnull %8, ptr noundef nonnull %11)
  %17 = call i32 @bn_is_zero(ptr noundef nonnull %8) #3
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %40

18:                                               ; preds = %16
  %19 = call i32 @bn_is_less(ptr noundef nonnull %8, ptr noundef nonnull %13) #3
  %.not45 = icmp eq i32 %19, 0
  br i1 %.not45, label %40, label %20

20:                                               ; preds = %18
  call void @scalar_multiply(ptr noundef %0, ptr noundef nonnull %8, ptr noundef nonnull %7)
  %21 = load i32, ptr %12, align 4, !tbaa !5
  %22 = trunc i32 %21 to i8
  %23 = and i8 %22, 1
  %24 = call i32 @bn_is_less(ptr noundef nonnull %7, ptr noundef nonnull %13) #3
  %.not46 = icmp eq i32 %24, 0
  br i1 %.not46, label %25, label %27

25:                                               ; preds = %20
  call void @bn_subtract(ptr noundef nonnull %7, ptr noundef nonnull %13, ptr noundef nonnull %7) #3
  %26 = or disjoint i8 %23, 2
  br label %27

27:                                               ; preds = %25, %20
  %.0 = phi i8 [ %23, %20 ], [ %26, %25 ]
  %28 = call i32 @bn_is_zero(ptr noundef nonnull %7) #3
  %.not47 = icmp eq i32 %28, 0
  br i1 %.not47, label %29, label %40

29:                                               ; preds = %27
  call void @generate_k_random(ptr noundef nonnull %10, ptr noundef nonnull %13)
  call void @bn_multiply(ptr noundef nonnull %10, ptr noundef nonnull %8, ptr noundef nonnull %13) #3
  call void @bn_inverse(ptr noundef nonnull %8, ptr noundef nonnull %13) #3
  call void @bn_read_be(ptr noundef %1, ptr noundef nonnull %12) #3
  call void @bn_multiply(ptr noundef nonnull %7, ptr noundef nonnull %12, ptr noundef nonnull %13) #3
  call void @bn_add(ptr noundef nonnull %12, ptr noundef nonnull %9) #3
  call void @bn_multiply(ptr noundef nonnull %8, ptr noundef nonnull %12, ptr noundef nonnull %13) #3
  call void @bn_multiply(ptr noundef nonnull %10, ptr noundef nonnull %12, ptr noundef nonnull %13) #3
  call void @bn_mod(ptr noundef nonnull %12, ptr noundef nonnull %13) #3
  %30 = call i32 @bn_is_zero(ptr noundef nonnull %12) #3
  %.not48 = icmp eq i32 %30, 0
  br i1 %.not48, label %31, label %40

31:                                               ; preds = %29
  %32 = call i32 @bn_is_less(ptr noundef nonnull %14, ptr noundef nonnull %12) #3
  %.not49 = icmp eq i32 %32, 0
  br i1 %.not49, label %35, label %33

33:                                               ; preds = %31
  call void @bn_subtract(ptr noundef nonnull %13, ptr noundef nonnull %12, ptr noundef nonnull %12) #3
  %34 = xor i8 %.0, 1
  br label %35

35:                                               ; preds = %33, %31
  %.1 = phi i8 [ %34, %33 ], [ %.0, %31 ]
  call void @bn_write_be(ptr noundef nonnull %7, ptr noundef %3) #3
  call void @bn_write_be(ptr noundef nonnull %12, ptr noundef nonnull %15) #3
  br i1 %.not50, label %38, label %36

36:                                               ; preds = %35
  %37 = call i32 %5(i8 noundef zeroext %.1, ptr noundef %3) #3
  %.not51 = icmp eq i32 %37, 0
  br i1 %.not51, label %40, label %38

38:                                               ; preds = %36, %35
  %.not52 = icmp eq ptr %4, null
  br i1 %.not52, label %.loopexit, label %39

39:                                               ; preds = %38
  store i8 %.1, ptr %4, align 1, !tbaa !9
  br label %.loopexit

40:                                               ; preds = %36, %29, %27, %16, %18
  %41 = add nuw nsw i32 %.04253, 1
  %exitcond.not = icmp eq i32 %41, 10000
  br i1 %exitcond.not, label %.loopexit, label %16, !llvm.loop !10

.loopexit:                                        ; preds = %40, %38, %39
  %.041 = phi i32 [ 0, %39 ], [ 0, %38 ], [ -1, %40 ]
  call void @memzero(ptr noundef nonnull %8, i64 noundef 36) #3
  call void @memzero(ptr noundef nonnull %10, i64 noundef 36) #3
  call void @memzero(ptr noundef nonnull %11, i64 noundef 64) #3
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %7) #3
  ret i32 %.041
}

declare void @bn_subtract(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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