; LLVM IR from specinfo-ua/UAPKI :: library/uapkif/src/asn1 (OCTET_STRING)

; 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.asn_OCTET_STRING_specifics_s = type { i32, i32, i32 }
%struct.asn_enc_rval_s = type { i64, ptr, ptr }
%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 }
%struct.BIT_STRING_s = type { ptr, i32, i32, %struct.asn_struct_ctx_s }
%struct.asn_struct_ctx_s = type { i16, i16, i32, ptr, i64 }

@asn_DEF_OCTET_STRING_specs = external hidden constant %struct.asn_OCTET_STRING_specifics_s, align 4
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @OCTET_STRING_encode_der(ptr dead_on_unwind noalias writable sret(%struct.asn_enc_rval_s) align 8 %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca %struct.asn_enc_rval_s, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !5
  store ptr %6, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.asn_TYPE_descriptor_s, ptr %22, i32 0, i32 19
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %30

26:                                               ; preds = %7
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.asn_TYPE_descriptor_s, ptr %27, i32 0, i32 19
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  br label %31

30:                                               ; preds = %7
  br label %31

31:                                               ; preds = %30, %26
  %32 = phi ptr [ %29, %26 ], [ @asn_DEF_OCTET_STRING_specs, %30 ]
  store ptr %32, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %33, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %34 = load ptr, ptr %15, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.asn_OCTET_STRING_specifics_s, ptr %34, i32 0, i32 2
  %36 = load i32, ptr %35, align 4, !tbaa !13
  store i32 %36, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  %37 = load i32, ptr %17, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %42, label %39

39:                                               ; preds = %31
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %42, label %71

42:                                               ; preds = %39, %31
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i32, ptr %17, align 4, !tbaa !9
  %45 = icmp eq i32 %44, 1
  %46 = zext i1 %45 to i32
  %47 = sext i32 %46 to i64
  %48 = load ptr, ptr %16, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.BIT_STRING_s, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 8, !tbaa !15
  %51 = sext i32 %50 to i64
  %52 = add i64 %47, %51
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load i32, ptr %17, align 4, !tbaa !9
  %55 = icmp eq i32 %54, 0
  %56 = zext i1 %55 to i32
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = call i64 @der_write_tags(ptr noundef %43, i64 noundef %52, i32 noundef %53, i32 noundef %56, i32 noundef %57, ptr noundef %58, ptr noundef %59)
  %61 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  store i64 %60, ptr %61, align 8, !tbaa !20
  %62 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  %63 = load i64, ptr %62, align 8, !tbaa !20
  %64 = icmp eq i64 %63, -1
  br i1 %64, label %65, label %70

65:                                               ; preds = %42
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 1
  store ptr %66, ptr %67, align 8, !tbaa !22
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 2
  store ptr %68, ptr %69, align 8, !tbaa !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !24
  store i32 1, ptr %19, align 4
  br label %202

70:                                               ; preds = %42
  br label %73

71:                                               ; preds = %39
  %72 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  store i64 0, ptr %72, align 8, !tbaa !20
  br label %73

73:                                               ; preds = %71, %70
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %94, label %76

76:                                               ; preds = %73
  %77 = load i32, ptr %17, align 4, !tbaa !9
  %78 = icmp eq i32 %77, 1
  %79 = zext i1 %78 to i32
  %80 = sext i32 %79 to i64
  %81 = load ptr, ptr %16, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.BIT_STRING_s, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !15
  %84 = sext i32 %83 to i64
  %85 = add nsw i64 %80, %84
  %86 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  %87 = load i64, ptr %86, align 8, !tbaa !20
  %88 = add nsw i64 %87, %85
  store i64 %88, ptr %86, align 8, !tbaa !20
  br label %89

89:                                               ; preds = %76
  %90 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 2
  store ptr null, ptr %90, align 8, !tbaa !23
  %91 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 1
  store ptr null, ptr %91, align 8, !tbaa !22
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !24
  store i32 1, ptr %19, align 4
  br label %202

92:                                               ; No predecessors!
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93, %73
  %95 = load i32, ptr %17, align 4, !tbaa !9
  %96 = icmp eq i32 %95, 1
  br i1 %96, label %97, label %128

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  %98 = load ptr, ptr %16, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.BIT_STRING_s, ptr %98, i32 0, i32 2
  %100 = load i32, ptr %99, align 4, !tbaa !26
  %101 = and i32 %100, 7
  %102 = trunc i32 %101 to i8
  store i8 %102, ptr %20, align 1, !tbaa !27
  %103 = load i8, ptr %20, align 1, !tbaa !27
  %104 = zext i8 %103 to i32
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %112

106:                                              ; preds = %97
  %107 = load ptr, ptr %16, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.BIT_STRING_s, ptr %107, i32 0, i32 1
  %109 = load i32, ptr %108, align 8, !tbaa !15
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %106
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %111, %106, %97
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = load ptr, ptr %13, align 8, !tbaa !5
  %116 = call i32 %114(ptr noundef %20, i64 noundef 1, ptr noundef %115)
  %117 = icmp slt i32 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %113
  store i32 6, ptr %19, align 4
  br label %125

119:                                              ; preds = %113
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  %123 = load i64, ptr %122, align 8, !tbaa !20
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %122, align 8, !tbaa !20
  store i32 0, ptr %19, align 4
  br label %125

125:                                              ; preds = %121, %118
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  %126 = load i32, ptr %19, align 4
  switch i32 %126, label %202 [
    i32 0, label %127
    i32 6, label %193
  ]

127:                                              ; preds = %125
  br label %128

128:                                              ; preds = %127, %94
  br label %129

129:                                              ; preds = %128
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load ptr, ptr %16, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.BIT_STRING_s, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !28
  %134 = load ptr, ptr %16, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.BIT_STRING_s, ptr %134, i32 0, i32 1
  %136 = load i32, ptr %135, align 8, !tbaa !15
  %137 = sext i32 %136 to i64
  %138 = load i32, ptr %18, align 4, !tbaa !9
  %139 = sext i32 %138 to i64
  %140 = sub i64 %137, %139
  %141 = load ptr, ptr %13, align 8, !tbaa !5
  %142 = call i32 %130(ptr noundef %133, i64 noundef %140, ptr noundef %141)
  %143 = icmp slt i32 %142, 0
  br i1 %143, label %144, label %145

144:                                              ; preds = %129
  br label %193

145:                                              ; preds = %129
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %18, align 4, !tbaa !9
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %150, label %180

150:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #4
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.BIT_STRING_s, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !28
  %154 = load ptr, ptr %16, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.BIT_STRING_s, ptr %154, i32 0, i32 1
  %156 = load i32, ptr %155, align 8, !tbaa !15
  %157 = sub nsw i32 %156, 1
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i8, ptr %153, i64 %158
  %160 = load i8, ptr %159, align 1, !tbaa !27
  %161 = zext i8 %160 to i32
  %162 = load ptr, ptr %16, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.BIT_STRING_s, ptr %162, i32 0, i32 2
  %164 = load i32, ptr %163, align 4, !tbaa !26
  %165 = shl i32 255, %164
  %166 = and i32 %161, %165
  %167 = trunc i32 %166 to i8
  store i8 %167, ptr %21, align 1, !tbaa !27
  br label %168

168:                                              ; preds = %150
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = load ptr, ptr %13, align 8, !tbaa !5
  %171 = call i32 %169(ptr noundef %21, i64 noundef 1, ptr noundef %170)
  %172 = icmp slt i32 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %168
  store i32 6, ptr %19, align 4
  br label %177

174:                                              ; preds = %168
  br label %175

175:                                              ; preds = %174
  br label %176

176:                                              ; preds = %175
  store i32 0, ptr %19, align 4
  br label %177

177:                                              ; preds = %176, %173
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #4
  %178 = load i32, ptr %19, align 4
  switch i32 %178, label %202 [
    i32 0, label %179
    i32 6, label %193
  ]

179:                                              ; preds = %177
  br label %180

180:                                              ; preds = %179, %147
  %181 = load ptr, ptr %16, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.BIT_STRING_s, ptr %181, i32 0, i32 1
  %183 = load i32, ptr %182, align 8, !tbaa !15
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 0
  %186 = load i64, ptr %185, align 8, !tbaa !20
  %187 = add nsw i64 %186, %184
  store i64 %187, ptr %185, align 8, !tbaa !20
  br label %188

188:                                              ; preds = %180
  %189 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 2
  store ptr null, ptr %189, align 8, !tbaa !23
  %190 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %14, i32 0, i32 1
  store ptr null, ptr %190, align 8, !tbaa !22
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %0, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !24
  store i32 1, ptr %19, align 4
  br label %202

191:                                              ; No predecessors!
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192, %177, %144, %125
  br label %194

194:                                              ; preds = %193
  %195 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %0, i32 0, i32 0
  store i64 -1, ptr %195, align 8, !tbaa !20
  %196 = load ptr, ptr %8, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %0, i32 0, i32 1
  store ptr %196, ptr %197, align 8, !tbaa !22
  %198 = load ptr, ptr %9, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.asn_enc_rval_s, ptr %0, i32 0, i32 2
  store ptr %198, ptr %199, align 8, !tbaa !23
  call void @stacktrace_create(ptr noundef @.str.3, i64 noundef 630, i32 noundef 101, ptr noundef null)
  store i32 1, ptr %19, align 4
  br label %202

200:                                              ; No predecessors!
  br label %201

201:                                              ; preds = %200
  store i32 0, ptr %19, align 4
  br label %202

202:                                              ; preds = %201, %194, %188, %177, %125, %89, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #4
  %203 = load i32, ptr %19, align 4
  switch i32 %203, label %205 [
    i32 0, label %204
    i32 1, label %204
  ]

204:                                              ; preds = %202, %202
  ret void

205:                                              ; preds = %202
  unreachable
}

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

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

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

declare i64 @der_write_tags(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = !{!12, !6, i64 152}
!12 = !{!"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}
!13 = !{!14, !10, i64 8}
!14 = !{!"asn_OCTET_STRING_specifics_s", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!16, !10, i64 8}
!16 = !{!"BIT_STRING_s", !6, i64 0, !10, i64 8, !10, i64 12, !17, i64 16}
!17 = !{!"asn_struct_ctx_s", !18, i64 0, !18, i64 2, !10, i64 4, !6, i64 8, !19, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!21, !19, i64 0}
!21 = !{!"asn_enc_rval_s", !19, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 16}
!24 = !{i64 0, i64 8, !25, i64 8, i64 8, !5, i64 16, i64 8, !5}
!25 = !{!19, !19, i64 0}
!26 = !{!16, !10, i64 12}
!27 = !{!7, !7, i64 0}
!28 = !{!16, !6, i64 0}


; 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.asn_OCTET_STRING_specifics_s = type { i32, i32, i32 }
%struct.asn_enc_rval_s = type { i64, ptr, ptr }

@asn_DEF_OCTET_STRING_specs = external hidden local_unnamed_addr constant %struct.asn_OCTET_STRING_specifics_s, align 4
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @OCTET_STRING_encode_der(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.asn_enc_rval_s) align 8 %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = getelementptr inbounds i8, ptr %1, i64 152
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not = icmp eq ptr %11, null
  %spec.select = select i1 %.not, ptr @asn_DEF_OCTET_STRING_specs, ptr %11
  %12 = getelementptr inbounds i8, ptr %spec.select, i64 8
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp ne i32 %13, 0
  %15 = icmp eq i32 %3, 1
  %or.cond = or i1 %15, %14
  br i1 %or.cond, label %16, label %.thread

16:                                               ; preds = %7
  %17 = icmp eq i32 %13, 1
  %18 = zext i1 %17 to i64
  %19 = getelementptr inbounds i8, ptr %2, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = sext i32 %20 to i64
  %22 = add nsw i64 %21, %18
  %23 = icmp eq i32 %13, 0
  %24 = zext i1 %23 to i32
  %25 = tail call i64 @der_write_tags(ptr noundef nonnull %1, i64 noundef %22, i32 noundef %3, i32 noundef %24, i32 noundef %4, ptr noundef %5, ptr noundef %6) #4
  %26 = icmp eq i64 %25, -1
  br i1 %26, label %27, label %28

27:                                               ; preds = %16
  store i64 -1, ptr %0, align 8, !tbaa !18
  %.sroa.14.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %.sroa.14.0..sroa_idx, align 8, !tbaa !19
  %.sroa.17.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %.sroa.17.0..sroa_idx, align 8, !tbaa !19
  br label %79

28:                                               ; preds = %16
  %.not59 = icmp eq ptr %5, null
  br i1 %.not59, label %.thread._crit_edge, label %36

.thread:                                          ; preds = %7
  %.not5965 = icmp eq ptr %5, null
  br i1 %.not5965, label %.thread._crit_edge, label %.thread68

.thread._crit_edge:                               ; preds = %.thread, %28
  %.sroa.0.067 = phi i64 [ %25, %28 ], [ 0, %.thread ]
  %29 = icmp eq i32 %13, 1
  %30 = zext i1 %29 to i64
  %31 = getelementptr inbounds i8, ptr %2, i64 8
  %32 = load i32, ptr %31, align 8, !tbaa !13
  %33 = sext i32 %32 to i64
  %34 = add nuw i64 %.sroa.0.067, %30
  %35 = add i64 %34, %33
  store i64 %35, ptr %0, align 8, !tbaa !18
  %.sroa.14.0..sroa_idx25 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %.sroa.14.0..sroa_idx25, i8 0, i64 16, i1 false)
  br label %79

36:                                               ; preds = %28
  br i1 %17, label %37, label %.thread68

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #4
  %38 = getelementptr inbounds i8, ptr %2, i64 12
  %39 = load i32, ptr %38, align 4, !tbaa !20
  %40 = trunc i32 %39 to i8
  %41 = and i8 %40, 7
  store i8 %41, ptr %8, align 1, !tbaa !21
  %42 = and i32 %39, 7
  %.not60 = icmp eq i32 %42, 0
  br i1 %.not60, label %45, label %43

43:                                               ; preds = %37
  %44 = load i32, ptr %19, align 8, !tbaa !13
  %.not61 = icmp ne i32 %44, 0
  %spec.select63 = zext i1 %.not61 to i32
  br label %45

45:                                               ; preds = %43, %37
  %.053 = phi i32 [ 0, %37 ], [ %spec.select63, %43 ]
  %46 = call i32 %5(ptr noundef nonnull %8, i64 noundef 1, ptr noundef %6) #4
  %47 = icmp slt i32 %46, 0
  %48 = add nuw nsw i64 %25, 1
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  br i1 %47, label %76, label %.thread68

.thread68:                                        ; preds = %.thread, %45, %36
  %.sroa.0.2 = phi i64 [ %48, %45 ], [ %25, %36 ], [ 0, %.thread ]
  %.154 = phi i32 [ %.053, %45 ], [ 0, %36 ], [ 0, %.thread ]
  %49 = load ptr, ptr %2, align 8, !tbaa !22
  %50 = getelementptr inbounds i8, ptr %2, i64 8
  %51 = load i32, ptr %50, align 8, !tbaa !13
  %52 = sext i32 %51 to i64
  %53 = zext nneg i32 %.154 to i64
  %54 = sub nsw i64 %52, %53
  %55 = call i32 %5(ptr noundef %49, i64 noundef %54, ptr noundef %6) #4
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %76, label %57

57:                                               ; preds = %.thread68
  %.not62 = icmp eq i32 %.154, 0
  br i1 %.not62, label %72, label %58

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #4
  %59 = load ptr, ptr %2, align 8, !tbaa !22
  %60 = load i32, ptr %50, align 8, !tbaa !13
  %61 = sext i32 %60 to i64
  %62 = getelementptr i8, ptr %59, i64 %61
  %63 = getelementptr i8, ptr %62, i64 -1
  %64 = load i8, ptr %63, align 1, !tbaa !21
  %65 = getelementptr inbounds i8, ptr %2, i64 12
  %66 = load i32, ptr %65, align 4, !tbaa !20
  %67 = shl i32 255, %66
  %68 = trunc i32 %67 to i8
  %69 = and i8 %64, %68
  store i8 %69, ptr %9, align 1, !tbaa !21
  %70 = call i32 %5(ptr noundef nonnull %9, i64 noundef 1, ptr noundef %6) #4
  %71 = icmp slt i32 %70, 0
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #4
  br i1 %71, label %76, label %72

72:                                               ; preds = %58, %57
  %73 = load i32, ptr %50, align 8, !tbaa !13
  %74 = sext i32 %73 to i64
  %75 = add nsw i64 %.sroa.0.2, %74
  store i64 %75, ptr %0, align 8, !tbaa !18
  %.sroa.14.0..sroa_idx27 = getelementptr inbounds i8, ptr %0, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %.sroa.14.0..sroa_idx27, i8 0, i64 16, i1 false)
  br label %79

76:                                               ; preds = %45, %58, %.thread68
  store i64 -1, ptr %0, align 8, !tbaa !23
  %77 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %77, align 8, !tbaa !25
  %78 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %78, align 8, !tbaa !26
  call void @stacktrace_create(ptr noundef nonnull @.str.3, i64 noundef 630, i32 noundef 101, ptr noundef null) #4
  br label %79

79:                                               ; preds = %76, %72, %.thread._crit_edge, %27
  ret void
}

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

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

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

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 152}
!6 = !{!"asn_TYPE_descriptor_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !10, i64 104, !7, i64 112, !10, i64 120, !7, i64 128, !7, i64 136, !10, i64 144, !7, i64 152}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"asn_OCTET_STRING_specifics_s", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!14, !10, i64 8}
!14 = !{!"BIT_STRING_s", !7, i64 0, !10, i64 8, !10, i64 12, !15, i64 16}
!15 = !{!"asn_struct_ctx_s", !16, i64 0, !16, i64 2, !10, i64 4, !7, i64 8, !17, i64 16}
!16 = !{!"short", !8, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!17, !17, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!14, !10, i64 12}
!21 = !{!8, !8, i64 0}
!22 = !{!14, !7, i64 0}
!23 = !{!24, !17, i64 0}
!24 = !{!"asn_enc_rval_s", !17, i64 0, !7, i64 8, !7, i64 16}
!25 = !{!24, !7, i64 8}
!26 = !{!24, !7, i64 16}


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