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

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

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

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

declare void @stacktrace_create(ptr noundef, i64 noundef, i32 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

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

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

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @asn_get_oid_arcs(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 8, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %3
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %16, label %14

14:                                               ; preds = %11
  store i32 2, ptr %10, align 4, !tbaa !9
  %15 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 717, i32 noundef %15, ptr noundef null)
  br label %114

16:                                               ; preds = %11
  br label %17

17:                                               ; preds = %16
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %24, label %22

22:                                               ; preds = %19
  store i32 2, ptr %10, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 718, i32 noundef %23, ptr noundef null)
  br label %114

24:                                               ; preds = %19
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  br label %27

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

30:                                               ; preds = %27
  store i32 2, ptr %10, align 4, !tbaa !9
  %31 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 719, i32 noundef %31, ptr noundef null)
  br label %114

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = mul i64 %37, %39
  %41 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %40) #6
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %41, ptr %42, align 8, !tbaa !5
  %43 = icmp eq ptr null, %41
  br i1 %43, label %44, label %46

44:                                               ; preds = %35
  store i32 1, ptr %10, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 721, i32 noundef %45, ptr noundef null)
  br label %114

46:                                               ; preds = %35
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = load i32, ptr %8, align 4, !tbaa !9
  %54 = call i32 @OBJECT_IDENTIFIER_get_arcs(ptr noundef %49, ptr noundef %51, i32 noundef %52, i32 noundef %53)
  store i32 %54, ptr %9, align 4, !tbaa !9
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = icmp sgt i32 %55, %56
  br i1 %57, label %58, label %98

58:                                               ; preds = %48
  %59 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %59, ptr %8, align 4, !tbaa !9
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  call void @free(ptr noundef %61) #5
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr null, ptr %62, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %58
  %64 = load i32, ptr %7, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = mul i64 %65, %67
  %69 = call noalias ptr @calloc(i64 noundef 1, i64 noundef %68) #6
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %69, ptr %70, align 8, !tbaa !5
  %71 = icmp eq ptr null, %69
  br i1 %71, label %72, label %74

72:                                               ; preds = %63
  store i32 1, ptr %10, align 4, !tbaa !9
  %73 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 728, i32 noundef %73, ptr noundef null)
  br label %114

74:                                               ; preds = %63
  br label %75

75:                                               ; preds = %74
  br label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = call i32 @OBJECT_IDENTIFIER_get_arcs(ptr noundef %77, ptr noundef %79, i32 noundef %80, i32 noundef %81)
  store i32 %82, ptr %9, align 4, !tbaa !9
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = icmp sle i32 %83, 0
  br i1 %84, label %89, label %85

85:                                               ; preds = %76
  %86 = load i32, ptr %9, align 4, !tbaa !9
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = icmp ne i32 %86, %87
  br i1 %88, label %89, label %97

89:                                               ; preds = %85, %76
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  call void @free(ptr noundef %91) #5
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr null, ptr %92, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %89
  store i32 100, ptr %10, align 4, !tbaa !9
  %94 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 734, i32 noundef %94, ptr noundef null)
  br label %114

95:                                               ; No predecessors!
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96, %85
  br label %110

98:                                               ; preds = %48
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = icmp sle i32 %99, 0
  br i1 %100, label %101, label %109

101:                                              ; preds = %98
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = load ptr, ptr %102, align 8, !tbaa !5
  call void @free(ptr noundef %103) #5
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr null, ptr %104, align 8, !tbaa !5
  br label %105

105:                                              ; preds = %101
  store i32 100, ptr %10, align 4, !tbaa !9
  %106 = load i32, ptr %10, align 4, !tbaa !9
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 740, i32 noundef %106, ptr noundef null)
  br label %114

107:                                              ; No predecessors!
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108, %98
  br label %110

110:                                              ; preds = %109, %97
  %111 = load i32, ptr %8, align 4, !tbaa !9
  %112 = zext i32 %111 to i64
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  store i64 %112, ptr %113, align 8, !tbaa !11
  br label %114

114:                                              ; preds = %110, %105, %93, %72, %44, %30, %22, %14
  %115 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret i32 %115
}

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 "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 allocsize(0,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 #4 = { 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }

!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, !12, i64 0}
!12 = !{!"long", !7, 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"

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

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

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

declare i32 @OBJECT_IDENTIFIER_get_arcs(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 101) i32 @asn_get_oid_arcs(ptr noundef %0, ptr noundef %1, ptr noundef writeonly %2) local_unnamed_addr #3 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 717, i32 noundef 2, ptr noundef null) #4
  br label %30

5:                                                ; preds = %3
  %.not47 = icmp eq ptr %1, null
  br i1 %.not47, label %6, label %7

6:                                                ; preds = %5
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 718, i32 noundef 2, ptr noundef null) #4
  br label %30

7:                                                ; preds = %5
  %.not48 = icmp eq ptr %2, null
  br i1 %.not48, label %8, label %9

8:                                                ; preds = %7
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 719, i32 noundef 2, ptr noundef null) #4
  br label %30

9:                                                ; preds = %7
  %10 = tail call noalias dereferenceable_or_null(8) ptr @calloc(i64 noundef 1, i64 noundef 8) #5
  store ptr %10, ptr %1, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 721, i32 noundef 1, ptr noundef null) #4
  br label %30

13:                                               ; preds = %9
  %14 = tail call i32 @OBJECT_IDENTIFIER_get_arcs(ptr noundef nonnull %0, ptr noundef nonnull %10, i32 noundef 8, i32 noundef 1) #4
  %15 = icmp sgt i32 %14, 1
  br i1 %15, label %16, label %27

16:                                               ; preds = %13
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @free(ptr noundef %17) #4
  %18 = zext nneg i32 %14 to i64
  %19 = shl nuw nsw i64 %18, 3
  %20 = tail call noalias ptr @calloc(i64 noundef 1, i64 noundef %19) #5
  store ptr %20, ptr %1, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %16
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 728, i32 noundef 1, ptr noundef null) #4
  br label %30

23:                                               ; preds = %16
  %24 = tail call i32 @OBJECT_IDENTIFIER_get_arcs(ptr noundef nonnull %0, ptr noundef nonnull %20, i32 noundef 8, i32 noundef %14) #4
  %.not50 = icmp eq i32 %24, %14
  br i1 %.not50, label %._crit_edge, label %25

25:                                               ; preds = %23
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @free(ptr noundef %26) #4
  store ptr null, ptr %1, align 8, !tbaa !5
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 734, i32 noundef 100, ptr noundef null) #4
  br label %30

27:                                               ; preds = %13
  %.not49 = icmp eq i32 %14, 1
  br i1 %.not49, label %._crit_edge, label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @free(ptr noundef %29) #4
  store ptr null, ptr %1, align 8, !tbaa !5
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 740, i32 noundef 100, ptr noundef null) #4
  br label %30

._crit_edge:                                      ; preds = %27, %23
  %.pre-phi = phi i64 [ %18, %23 ], [ 1, %27 ]
  store i64 %.pre-phi, ptr %2, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %._crit_edge, %28, %25, %22, %12, %8, %6, %4
  %.0 = phi i32 [ 1, %12 ], [ 1, %22 ], [ 100, %25 ], [ 0, %._crit_edge ], [ 100, %28 ], [ 2, %8 ], [ 2, %6 ], [ 2, %4 ]
  ret i32 %.0
}

attributes #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 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(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 #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 }
attributes #5 = { nounwind allocsize(0,1) }

!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 = !{!"long", !7, i64 0}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass