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

; 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.bignum256 = type { [9 x i32] }
%struct._HMAC_SHA512_CTX = type { [128 x i8], %struct._SHA512_CTX }
%struct._SHA512_CTX = type { [8 x i64], [2 x i64], [16 x i64] }
%struct.HDNode = type { i32, i32, [32 x i8], [32 x i8], [32 x i8], [33 x i8], ptr }
%struct.curve_info = type { ptr, ptr, i32, i32, i32, i32 }
%struct.ecdsa_curve = type { %struct.bignum256, %struct.curve_point, %struct.bignum256, %struct.bignum256, i32, %struct.bignum256, [64 x [8 x %struct.curve_point]] }
%struct.curve_point = type { %struct.bignum256, %struct.bignum256 }

@hdnode_private_ckd.data = external hidden global [37 x i8], align 16
@hdnode_private_ckd.I = external hidden global [64 x i8], align 16
@hdnode_private_ckd.a = external hidden global %struct.bignum256, align 4
@hdnode_private_ckd.b = external hidden global %struct.bignum256, align 4
@hdnode_private_ckd.ctx = external hidden global %struct._HMAC_SHA512_CTX, align 8

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

declare i32 @bn_is_zero(ptr noundef) #2

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

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

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

declare void @hmac_sha512_Final(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @hdnode_fill_public_key(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @hdnode_private_ckd(ptr noundef %0, i32 noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = and i32 %8, -2147483648
  %10 = icmp ne i32 %9, 0
  br i1 %10, label %11, label %15

11:                                               ; preds = %2
  store i8 0, ptr @hdnode_private_ckd.data, align 16, !tbaa !11
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.HDNode, ptr %12, i32 0, i32 3
  %14 = getelementptr inbounds [32 x i8], ptr %13, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 1), ptr align 8 %14, i64 32, i1 false)
  br label %28

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.HDNode, ptr %16, i32 0, i32 6
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = getelementptr inbounds %struct.curve_info, ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = icmp ne ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %15
  store i32 0, ptr %3, align 4
  br label %97

23:                                               ; preds = %15
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  call void @hdnode_fill_public_key(ptr noundef %24)
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.HDNode, ptr %25, i32 0, i32 5
  %27 = getelementptr inbounds [33 x i8], ptr %26, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @hdnode_private_ckd.data, ptr align 8 %27, i64 33, i1 false)
  br label %28

28:                                               ; preds = %23, %11
  %29 = load i32, ptr %5, align 4, !tbaa !9
  call void @write_be(ptr noundef getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 33), i32 noundef %29)
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.HDNode, ptr %30, i32 0, i32 3
  %32 = getelementptr inbounds [32 x i8], ptr %31, i64 0, i64 0
  call void @bn_read_be(ptr noundef %32, ptr noundef @hdnode_private_ckd.a)
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.HDNode, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds [32 x i8], ptr %34, i64 0, i64 0
  call void @hmac_sha512_Init(ptr noundef @hdnode_private_ckd.ctx, ptr noundef %35, i32 noundef 32)
  call void @hmac_sha512_Update(ptr noundef @hdnode_private_ckd.ctx, ptr noundef @hdnode_private_ckd.data, i32 noundef 37)
  call void @hmac_sha512_Final(ptr noundef @hdnode_private_ckd.ctx, ptr noundef @hdnode_private_ckd.I)
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.HDNode, ptr %36, i32 0, i32 6
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  %39 = getelementptr inbounds %struct.curve_info, ptr %38, i32 0, i32 1
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %79

42:                                               ; preds = %28
  br label %43

43:                                               ; preds = %77, %42
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 0, ptr %6, align 1, !tbaa !16
  call void @bn_read_be(ptr noundef @hdnode_private_ckd.I, ptr noundef @hdnode_private_ckd.b)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.HDNode, ptr %44, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !12
  %47 = getelementptr inbounds %struct.curve_info, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = getelementptr inbounds %struct.ecdsa_curve, ptr %48, i32 0, i32 2
  %50 = call i32 @bn_is_less(ptr noundef @hdnode_private_ckd.b, ptr noundef %49)
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %43
  store i8 1, ptr %6, align 1, !tbaa !16
  br label %64

53:                                               ; preds = %43
  call void @bn_add(ptr noundef @hdnode_private_ckd.b, ptr noundef @hdnode_private_ckd.a)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.HDNode, ptr %54, i32 0, i32 6
  %56 = load ptr, ptr %55, align 8, !tbaa !12
  %57 = getelementptr inbounds %struct.curve_info, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !14
  %59 = getelementptr inbounds %struct.ecdsa_curve, ptr %58, i32 0, i32 2
  call void @bn_mod(ptr noundef @hdnode_private_ckd.b, ptr noundef %59)
  %60 = call i32 @bn_is_zero(ptr noundef @hdnode_private_ckd.b)
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %53
  store i8 1, ptr %6, align 1, !tbaa !16
  br label %63

63:                                               ; preds = %62, %53
  br label %64

64:                                               ; preds = %63, %52
  %65 = load i8, ptr %6, align 1, !tbaa !16, !range !18, !noundef !19
  %66 = trunc i8 %65 to i1
  br i1 %66, label %71, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.HDNode, ptr %68, i32 0, i32 3
  %70 = getelementptr inbounds [32 x i8], ptr %69, i64 0, i64 0
  call void @bn_write_be(ptr noundef @hdnode_private_ckd.b, ptr noundef %70)
  store i32 3, ptr %7, align 4
  br label %75

71:                                               ; preds = %64
  store i8 1, ptr @hdnode_private_ckd.data, align 16, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 1), ptr align 1 getelementptr inbounds (i8, ptr @hdnode_private_ckd.I, i64 32), i64 32, i1 false)
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.HDNode, ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds [32 x i8], ptr %73, i64 0, i64 0
  call void @hmac_sha512_Init(ptr noundef @hdnode_private_ckd.ctx, ptr noundef %74, i32 noundef 32)
  call void @hmac_sha512_Update(ptr noundef @hdnode_private_ckd.ctx, ptr noundef @hdnode_private_ckd.data, i32 noundef 37)
  call void @hmac_sha512_Final(ptr noundef @hdnode_private_ckd.ctx, ptr noundef @hdnode_private_ckd.I)
  store i32 0, ptr %7, align 4
  br label %75

75:                                               ; preds = %71, %67
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  %76 = load i32, ptr %7, align 4
  switch i32 %76, label %99 [
    i32 0, label %77
    i32 3, label %78
  ]

77:                                               ; preds = %75
  br label %43

78:                                               ; preds = %75
  br label %83

79:                                               ; preds = %28
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.HDNode, ptr %80, i32 0, i32 3
  %82 = getelementptr inbounds [32 x i8], ptr %81, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %82, ptr align 16 @hdnode_private_ckd.I, i64 32, i1 false)
  br label %83

83:                                               ; preds = %79, %78
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.HDNode, ptr %84, i32 0, i32 2
  %86 = getelementptr inbounds [32 x i8], ptr %85, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %86, ptr align 1 getelementptr inbounds (i8, ptr @hdnode_private_ckd.I, i64 32), i64 32, i1 false)
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.HDNode, ptr %87, i32 0, i32 0
  %89 = load i32, ptr %88, align 8, !tbaa !20
  %90 = add i32 %89, 1
  store i32 %90, ptr %88, align 8, !tbaa !20
  %91 = load i32, ptr %5, align 4, !tbaa !9
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.HDNode, ptr %92, i32 0, i32 1
  store i32 %91, ptr %93, align 4, !tbaa !21
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.HDNode, ptr %94, i32 0, i32 5
  %96 = getelementptr inbounds [33 x i8], ptr %95, i64 0, i64 0
  call void @memzero(ptr noundef %96, i64 noundef 33)
  call void @memzero(ptr noundef @hdnode_private_ckd.a, i64 noundef 36)
  call void @memzero(ptr noundef @hdnode_private_ckd.b, i64 noundef 36)
  call void @memzero(ptr noundef @hdnode_private_ckd.I, i64 noundef 64)
  call void @memzero(ptr noundef @hdnode_private_ckd.data, i64 noundef 37)
  store i32 1, ptr %3, align 4
  br label %97

97:                                               ; preds = %83, %22
  %98 = load i32, ptr %3, align 4
  ret i32 %98

99:                                               ; preds = %75
  unreachable
}

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 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 #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 = !{!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 = !{!13, !6, i64 144}
!13 = !{!"", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 40, !7, i64 72, !7, i64 104, !6, i64 144}
!14 = !{!15, !6, i64 8}
!15 = !{!"", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!16 = !{!17, !17, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!13, !10, i64 0}
!21 = !{!13, !10, i64 4}


; 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.bignum256 = type { [9 x i32] }
%struct._HMAC_SHA512_CTX = type { [128 x i8], %struct._SHA512_CTX }
%struct._SHA512_CTX = type { [8 x i64], [2 x i64], [16 x i64] }

@hdnode_private_ckd.data = external hidden global [37 x i8], align 16
@hdnode_private_ckd.I = external hidden global [64 x i8], align 16
@hdnode_private_ckd.a = external hidden global %struct.bignum256, align 4
@hdnode_private_ckd.b = external hidden global %struct.bignum256, align 4
@hdnode_private_ckd.ctx = external hidden global %struct._HMAC_SHA512_CTX, align 8

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

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

declare i32 @bn_is_zero(ptr noundef) local_unnamed_addr #1

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

declare void @hmac_sha512_Init(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @hmac_sha512_Update(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @hdnode_private_ckd(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %.not = icmp sgt i32 %1, -1
  br i1 %.not, label %5, label %3

3:                                                ; preds = %2
  store i8 0, ptr @hdnode_private_ckd.data, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 1), ptr noundef nonnull align 8 dereferenceable(32) %4, i64 32, i1 false)
  br label %12

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 144
  %7 = load ptr, ptr %6, align 8, !tbaa !8
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %.not23 = icmp eq ptr %9, null
  br i1 %.not23, label %37, label %10

10:                                               ; preds = %5
  tail call void @hdnode_fill_public_key(ptr noundef nonnull %0)
  %11 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(33) @hdnode_private_ckd.data, ptr noundef nonnull align 8 dereferenceable(33) %11, i64 33, i1 false)
  br label %12

12:                                               ; preds = %10, %3
  tail call void @write_be(ptr noundef nonnull getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 33), i32 noundef %1) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @bn_read_be(ptr noundef nonnull %13, ptr noundef nonnull @hdnode_private_ckd.a) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @hmac_sha512_Init(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull %14, i32 noundef 32) #3
  tail call void @hmac_sha512_Update(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull @hdnode_private_ckd.data, i32 noundef 37) #3
  tail call void @hmac_sha512_Final(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull @hdnode_private_ckd.I) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 144
  %16 = load ptr, ptr %15, align 8, !tbaa !8
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %.not24 = icmp eq ptr %18, null
  br i1 %.not24, label %31, label %.preheader

.preheader:                                       ; preds = %12, %30
  tail call void @bn_read_be(ptr noundef nonnull @hdnode_private_ckd.I, ptr noundef nonnull @hdnode_private_ckd.b) #3
  %19 = load ptr, ptr %15, align 8, !tbaa !8
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %21, i64 108
  %23 = tail call i32 @bn_is_less(ptr noundef nonnull @hdnode_private_ckd.b, ptr noundef nonnull %22) #3
  %.not25 = icmp eq i32 %23, 0
  br i1 %.not25, label %30, label %24

24:                                               ; preds = %.preheader
  tail call void @bn_add(ptr noundef nonnull @hdnode_private_ckd.b, ptr noundef nonnull @hdnode_private_ckd.a) #3
  %25 = load ptr, ptr %15, align 8, !tbaa !8
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %27, i64 108
  tail call void @bn_mod(ptr noundef nonnull @hdnode_private_ckd.b, ptr noundef nonnull %28) #3
  %29 = tail call i32 @bn_is_zero(ptr noundef nonnull @hdnode_private_ckd.b) #3
  %.not26.not = icmp eq i32 %29, 0
  br i1 %.not26.not, label %.thread, label %30

.thread:                                          ; preds = %24
  tail call void @bn_write_be(ptr noundef nonnull @hdnode_private_ckd.b, ptr noundef nonnull %13) #3
  br label %32

30:                                               ; preds = %24, %.preheader
  store i8 1, ptr @hdnode_private_ckd.data, align 16, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(32) getelementptr inbounds (i8, ptr @hdnode_private_ckd.data, i64 1), ptr noundef nonnull align 16 dereferenceable(32) getelementptr inbounds (i8, ptr @hdnode_private_ckd.I, i64 32), i64 32, i1 false)
  tail call void @hmac_sha512_Init(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull %14, i32 noundef 32) #3
  tail call void @hmac_sha512_Update(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull @hdnode_private_ckd.data, i32 noundef 37) #3
  tail call void @hmac_sha512_Final(ptr noundef nonnull @hdnode_private_ckd.ctx, ptr noundef nonnull @hdnode_private_ckd.I) #3
  br label %.preheader

31:                                               ; preds = %12
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %13, ptr noundef nonnull align 16 dereferenceable(32) @hdnode_private_ckd.I, i64 32, i1 false)
  br label %32

32:                                               ; preds = %.thread, %31
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 16 dereferenceable(32) getelementptr inbounds (i8, ptr @hdnode_private_ckd.I, i64 32), i64 32, i1 false)
  %33 = load i32, ptr %0, align 8, !tbaa !14
  %34 = add i32 %33, 1
  store i32 %34, ptr %0, align 8, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %1, ptr %35, align 4, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @memzero(ptr noundef nonnull %36, i64 noundef 33) #3
  tail call void @memzero(ptr noundef nonnull @hdnode_private_ckd.a, i64 noundef 36) #3
  tail call void @memzero(ptr noundef nonnull @hdnode_private_ckd.b, i64 noundef 36) #3
  tail call void @memzero(ptr noundef nonnull @hdnode_private_ckd.I, i64 noundef 64) #3
  tail call void @memzero(ptr noundef nonnull @hdnode_private_ckd.data, i64 noundef 37) #3
  br label %37

37:                                               ; preds = %5, %32
  %.022 = phi i32 [ 1, %32 ], [ 0, %5 ]
  ret i32 %.022
}

declare void @write_be(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

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

attributes #0 = { mustprogress nocallback nofree 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !11, i64 144}
!9 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 40, !6, i64 72, !6, i64 104, !11, i64 144}
!10 = !{!"int", !6, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"", !11, i64 0, !11, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!14 = !{!9, !10, i64 0}
!15 = !{!9, !10, i64 4}


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