; LLVM IR from specinfo-ua/UAPKI :: library/common/pkix (aid)

; 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.AlgorithmIdentifier = type { %struct.ASN__PRIMITIVE_TYPE_s, ptr, %struct.asn_struct_ctx_s }
%struct.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }
%struct.GOST28147ParamsOptionalDke = type { %struct.OCTET_STRING, ptr, %struct.asn_struct_ctx_s }
%struct.OCTET_STRING = type { ptr, i32, %struct.asn_struct_ctx_s }
%struct.asn_TYPE_descriptor_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, i32, ptr, ptr, i32, ptr }

@.str = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 noundef, ptr noundef) #2

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @aid_gost28147_get_iv_and_sbox(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca [128 x i8], align 16
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store ptr null, ptr %10, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.AlgorithmIdentifier, ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = call ptr @get_GOST28147ParamsOptionalDke_desc()
  %22 = call ptr @asn_any2type(ptr noundef %20, ptr noundef %21)
  store ptr %22, ptr %10, align 8, !tbaa !5
  %23 = icmp eq ptr null, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %17
  store i32 2, ptr %8, align 4, !tbaa !9
  %25 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 115, i32 noundef %25)
  br label %124

26:                                               ; preds = %17
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %44

31:                                               ; preds = %28
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.GOST28147ParamsOptionalDke, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call i32 @asn_OCTSTRING2ba(ptr noundef %34, ptr noundef %35)
  store i32 %36, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %32
  %40 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 117, i32 noundef %40)
  br label %124

41:                                               ; preds = %32
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43, %28
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %123

47:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr %15) #5
  call void @llvm.memset.p0.i64(ptr align 16 %15, i8 0, i64 128, i1 false)
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.GOST28147ParamsOptionalDke, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !17
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %119

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.GOST28147ParamsOptionalDke, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !17
  %57 = call i32 @asn_OCTSTRING2bytes(ptr noundef %56, ptr noundef %9, ptr noundef %14)
  store i32 %57, ptr %8, align 4, !tbaa !9
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %53
  %61 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 125, i32 noundef %61)
  store i32 4, ptr %16, align 4
  br label %120

62:                                               ; preds = %53
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %14, align 8, !tbaa !20
  %66 = icmp ne i64 %65, 64
  br i1 %66, label %67, label %72

67:                                               ; preds = %64
  br label %68

68:                                               ; preds = %67
  store i32 2, ptr %8, align 4, !tbaa !9
  %69 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 127, i32 noundef %69, ptr noundef null)
  store i32 4, ptr %16, align 4
  br label %120

70:                                               ; No predecessors!
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71, %64
  store i64 0, ptr %13, align 8, !tbaa !20
  store i64 0, ptr %11, align 8, !tbaa !20
  br label %73

73:                                               ; preds = %105, %72
  %74 = load i64, ptr %11, align 8, !tbaa !20
  %75 = icmp ult i64 %74, 8
  br i1 %75, label %76, label %108

76:                                               ; preds = %73
  store i64 0, ptr %12, align 8, !tbaa !20
  br label %77

77:                                               ; preds = %101, %76
  %78 = load i64, ptr %12, align 8, !tbaa !20
  %79 = icmp ult i64 %78, 16
  br i1 %79, label %80, label %104

80:                                               ; preds = %77
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = load i64, ptr %11, align 8, !tbaa !20
  %83 = shl i64 %82, 3
  %84 = load i64, ptr %12, align 8, !tbaa !20
  %85 = lshr i64 %84, 1
  %86 = add i64 %83, %85
  %87 = getelementptr inbounds i8, ptr %81, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !21
  %89 = zext i8 %88 to i32
  %90 = load i64, ptr %12, align 8, !tbaa !20
  %91 = xor i64 %90, -1
  %92 = and i64 %91, 1
  %93 = shl i64 %92, 2
  %94 = trunc i64 %93 to i32
  %95 = ashr i32 %89, %94
  %96 = and i32 %95, 15
  %97 = trunc i32 %96 to i8
  %98 = load i64, ptr %13, align 8, !tbaa !20
  %99 = add i64 %98, 1
  store i64 %99, ptr %13, align 8, !tbaa !20
  %100 = getelementptr inbounds [128 x i8], ptr %15, i64 0, i64 %98
  store i8 %97, ptr %100, align 1, !tbaa !21
  br label %101

101:                                              ; preds = %80
  %102 = load i64, ptr %12, align 8, !tbaa !20
  %103 = add i64 %102, 1
  store i64 %103, ptr %12, align 8, !tbaa !20
  br label %77, !llvm.loop !22

104:                                              ; preds = %77
  br label %105

105:                                              ; preds = %104
  %106 = load i64, ptr %11, align 8, !tbaa !20
  %107 = add i64 %106, 1
  store i64 %107, ptr %11, align 8, !tbaa !20
  br label %73, !llvm.loop !24

108:                                              ; preds = %73
  br label %109

109:                                              ; preds = %108
  %110 = getelementptr inbounds [128 x i8], ptr %15, i64 0, i64 0
  %111 = call ptr @ba_alloc_from_uint8(ptr noundef %110, i64 noundef 128)
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %111, ptr %112, align 8, !tbaa !5
  %113 = icmp eq ptr null, %111
  br i1 %113, label %114, label %116

114:                                              ; preds = %109
  store i32 2, ptr %8, align 4, !tbaa !9
  %115 = load i32, ptr %8, align 4, !tbaa !9
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 137, i32 noundef %115)
  store i32 4, ptr %16, align 4
  br label %120

116:                                              ; preds = %109
  br label %117

117:                                              ; preds = %116
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118, %47
  store i32 0, ptr %16, align 4
  br label %120

120:                                              ; preds = %119, %114, %68, %60
  call void @llvm.lifetime.end.p0(i64 128, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %121 = load i32, ptr %16, align 4
  switch i32 %121, label %132 [
    i32 0, label %122
    i32 4, label %124
  ]

122:                                              ; preds = %120
  br label %123

123:                                              ; preds = %122, %44
  br label %124

124:                                              ; preds = %123, %120, %39, %24
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %125) #5
  %126 = call ptr @get_GOST28147ParamsOptionalDke_desc()
  %127 = getelementptr inbounds %struct.asn_TYPE_descriptor_s, ptr %126, i32 0, i32 2
  %128 = load ptr, ptr %127, align 8, !tbaa !25
  %129 = call ptr @get_GOST28147ParamsOptionalDke_desc()
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  call void %128(ptr noundef %129, ptr noundef %130, i32 noundef 0)
  %131 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %131, ptr %4, align 4
  store i32 1, ptr %16, align 4
  br label %132

132:                                              ; preds = %124, %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %133 = load i32, ptr %4, align 4
  ret i32 %133
}

declare ptr @asn_any2type(ptr noundef, ptr noundef) #2

declare ptr @get_GOST28147ParamsOptionalDke_desc() #2

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

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

declare ptr @ba_alloc_from_uint8(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 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 "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 #5 = { 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 16}
!12 = !{!"AlgorithmIdentifier", !13, i64 0, !6, i64 16, !14, i64 24}
!13 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !10, i64 8}
!14 = !{!"asn_struct_ctx_s", !15, i64 0, !15, i64 2, !10, i64 4, !6, i64 8, !16, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !6, i64 40}
!18 = !{!"GOST28147ParamsOptionalDke", !19, i64 0, !6, i64 40, !14, i64 48}
!19 = !{!"OCTET_STRING", !6, i64 0, !10, i64 8, !14, i64 16}
!20 = !{!16, !16, i64 0}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!26, !6, i64 16}
!26 = !{!"asn_TYPE_descriptor_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !10, i64 104, !6, i64 112, !10, i64 120, !6, i64 128, !6, i64 136, !10, i64 144, !6, i64 152}


; 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 [18 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @aid_gost28147_get_iv_and_sbox(ptr nocapture noundef readonly %0, ptr noundef %1, ptr noundef writeonly %2) local_unnamed_addr #3 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca [128 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store ptr null, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = tail call ptr @get_GOST28147ParamsOptionalDke_desc() #5
  %10 = tail call ptr @asn_any2type(ptr noundef %8, ptr noundef %9) #5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 115, i32 noundef 2) #5
  br label %106

13:                                               ; preds = %3
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %17, label %14

14:                                               ; preds = %13
  %15 = tail call i32 @asn_OCTSTRING2ba(ptr noundef nonnull %10, ptr noundef nonnull %1) #5
  %.not40 = icmp eq i32 %15, 0
  br i1 %.not40, label %17, label %16

16:                                               ; preds = %14
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 117, i32 noundef %15) #5
  br label %106

17:                                               ; preds = %14, %13
  %.not41 = icmp eq ptr %2, null
  br i1 %.not41, label %106, label %18

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(128) %6, i8 0, i64 128, i1 false)
  %19 = getelementptr inbounds i8, ptr %10, i64 40
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %.not42 = icmp eq ptr %20, null
  br i1 %.not42, label %105, label %21

21:                                               ; preds = %18
  %22 = call i32 @asn_OCTSTRING2bytes(ptr noundef nonnull %20, ptr noundef nonnull %4, ptr noundef nonnull %5) #5
  %.not43 = icmp eq i32 %22, 0
  br i1 %.not43, label %24, label %23

23:                                               ; preds = %21
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 125, i32 noundef %22) #5
  br label %105

24:                                               ; preds = %21
  %25 = load i64, ptr %5, align 8, !tbaa !19
  %.not44 = icmp eq i64 %25, 64
  br i1 %.not44, label %.preheader45, label %34

.preheader45:                                     ; preds = %24
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 1
  %28 = getelementptr inbounds i8, ptr %26, i64 2
  %29 = getelementptr inbounds i8, ptr %26, i64 3
  %30 = getelementptr inbounds i8, ptr %26, i64 4
  %31 = getelementptr inbounds i8, ptr %26, i64 5
  %32 = getelementptr inbounds i8, ptr %26, i64 6
  %33 = getelementptr inbounds i8, ptr %26, i64 7
  br label %.preheader

34:                                               ; preds = %24
  call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 127, i32 noundef 2, ptr noundef null) #5
  br label %105

.preheader:                                       ; preds = %.preheader45, %.preheader
  %.02649 = phi i64 [ 0, %.preheader45 ], [ %98, %.preheader ]
  %.02848 = phi i64 [ 0, %.preheader45 ], [ %100, %.preheader ]
  %35 = shl nuw nsw i64 %.02848, 3
  %36 = getelementptr inbounds i8, ptr %26, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !20
  %38 = lshr i8 %37, 4
  %39 = or disjoint i64 %.02649, 1
  %40 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %.02649
  store i8 %38, ptr %40, align 16, !tbaa !20
  %41 = and i8 %37, 15
  %42 = or disjoint i64 %.02649, 2
  %43 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %39
  store i8 %41, ptr %43, align 1, !tbaa !20
  %44 = getelementptr inbounds i8, ptr %27, i64 %35
  %45 = load i8, ptr %44, align 1, !tbaa !20
  %46 = lshr i8 %45, 4
  %47 = or disjoint i64 %.02649, 3
  %48 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %42
  store i8 %46, ptr %48, align 2, !tbaa !20
  %49 = and i8 %45, 15
  %50 = or disjoint i64 %.02649, 4
  %51 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %47
  store i8 %49, ptr %51, align 1, !tbaa !20
  %52 = getelementptr inbounds i8, ptr %28, i64 %35
  %53 = load i8, ptr %52, align 1, !tbaa !20
  %54 = lshr i8 %53, 4
  %55 = or disjoint i64 %.02649, 5
  %56 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %50
  store i8 %54, ptr %56, align 4, !tbaa !20
  %57 = and i8 %53, 15
  %58 = or disjoint i64 %.02649, 6
  %59 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %55
  store i8 %57, ptr %59, align 1, !tbaa !20
  %60 = getelementptr inbounds i8, ptr %29, i64 %35
  %61 = load i8, ptr %60, align 1, !tbaa !20
  %62 = lshr i8 %61, 4
  %63 = or disjoint i64 %.02649, 7
  %64 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %58
  store i8 %62, ptr %64, align 2, !tbaa !20
  %65 = and i8 %61, 15
  %66 = or disjoint i64 %.02649, 8
  %67 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %63
  store i8 %65, ptr %67, align 1, !tbaa !20
  %68 = getelementptr inbounds i8, ptr %30, i64 %35
  %69 = load i8, ptr %68, align 1, !tbaa !20
  %70 = lshr i8 %69, 4
  %71 = or disjoint i64 %.02649, 9
  %72 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %66
  store i8 %70, ptr %72, align 8, !tbaa !20
  %73 = and i8 %69, 15
  %74 = or disjoint i64 %.02649, 10
  %75 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %71
  store i8 %73, ptr %75, align 1, !tbaa !20
  %76 = getelementptr inbounds i8, ptr %31, i64 %35
  %77 = load i8, ptr %76, align 1, !tbaa !20
  %78 = lshr i8 %77, 4
  %79 = or disjoint i64 %.02649, 11
  %80 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %74
  store i8 %78, ptr %80, align 2, !tbaa !20
  %81 = and i8 %77, 15
  %82 = or disjoint i64 %.02649, 12
  %83 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %79
  store i8 %81, ptr %83, align 1, !tbaa !20
  %84 = getelementptr inbounds i8, ptr %32, i64 %35
  %85 = load i8, ptr %84, align 1, !tbaa !20
  %86 = lshr i8 %85, 4
  %87 = or disjoint i64 %.02649, 13
  %88 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %82
  store i8 %86, ptr %88, align 4, !tbaa !20
  %89 = and i8 %85, 15
  %90 = or disjoint i64 %.02649, 14
  %91 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %87
  store i8 %89, ptr %91, align 1, !tbaa !20
  %92 = getelementptr inbounds i8, ptr %33, i64 %35
  %93 = load i8, ptr %92, align 1, !tbaa !20
  %94 = lshr i8 %93, 4
  %95 = or disjoint i64 %.02649, 15
  %96 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %90
  store i8 %94, ptr %96, align 2, !tbaa !20
  %97 = and i8 %93, 15
  %98 = add nuw nsw i64 %.02649, 16
  %99 = getelementptr inbounds [128 x i8], ptr %6, i64 0, i64 %95
  store i8 %97, ptr %99, align 1, !tbaa !20
  %100 = add nuw nsw i64 %.02848, 1
  %exitcond.not = icmp eq i64 %100, 8
  br i1 %exitcond.not, label %101, label %.preheader, !llvm.loop !21

101:                                              ; preds = %.preheader
  %102 = call ptr @ba_alloc_from_uint8(ptr noundef nonnull %6, i64 noundef 128) #5
  store ptr %102, ptr %2, align 8, !tbaa !5
  %103 = icmp eq ptr %102, null
  br i1 %103, label %104, label %105

104:                                              ; preds = %101
  call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 137, i32 noundef 2) #5
  br label %105

105:                                              ; preds = %18, %101, %104, %34, %23
  %.2 = phi i32 [ %22, %23 ], [ 2, %34 ], [ 2, %104 ], [ 0, %101 ], [ 0, %18 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  br label %106

106:                                              ; preds = %105, %17, %16, %12
  %107 = phi ptr [ null, %12 ], [ null, %16 ], [ %.pre, %105 ], [ null, %17 ]
  %.3 = phi i32 [ 2, %12 ], [ %15, %16 ], [ %.2, %105 ], [ 0, %17 ]
  call void @free(ptr noundef %107) #5
  %108 = call ptr @get_GOST28147ParamsOptionalDke_desc() #5
  %109 = getelementptr inbounds i8, ptr %108, i64 16
  %110 = load ptr, ptr %109, align 8, !tbaa !23
  %111 = call ptr @get_GOST28147ParamsOptionalDke_desc() #5
  call void %110(ptr noundef %111, ptr noundef %10, i32 noundef 0) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  ret i32 %.3
}

declare ptr @asn_any2type(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @get_GOST28147ParamsOptionalDke_desc() local_unnamed_addr #2

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

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

declare ptr @ba_alloc_from_uint8(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { 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, !6, i64 16}
!10 = !{!"AlgorithmIdentifier", !11, i64 0, !6, i64 16, !13, i64 24}
!11 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"asn_struct_ctx_s", !14, i64 0, !14, i64 2, !12, i64 4, !6, i64 8, !15, i64 16}
!14 = !{!"short", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !6, i64 40}
!17 = !{!"GOST28147ParamsOptionalDke", !18, i64 0, !6, i64 40, !13, i64 48}
!18 = !{!"OCTET_STRING", !6, i64 0, !12, i64 8, !13, i64 16}
!19 = !{!15, !15, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !6, i64 16}
!24 = !{!"asn_TYPE_descriptor_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104, !6, i64 112, !12, i64 120, !6, i64 128, !6, i64 136, !12, i64 144, !6, i64 152}


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