; LLVM IR from guanzhi/GmSSL :: src (asn1)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [58 x i8], align 1
@__FUNCTION__.asn1_tag_name = external hidden unnamed_addr constant [14 x i8], align 1
@asn1_tag_index = external hidden global [32 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @asn1_tag_name(i32 noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = icmp slt i32 %4, 0
  br i1 %5, label %9, label %6

6:                                                ; preds = %1
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 255
  br i1 %8, label %9, label %14

9:                                                ; preds = %6, %1
  br label %10

10:                                               ; preds = %9
  %11 = load ptr, ptr @stderr, align 8, !tbaa !9
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 36, ptr noundef @__FUNCTION__.asn1_tag_name) #2
  br label %13

13:                                               ; preds = %10
  store ptr null, ptr %2, align 8
  br label %61

14:                                               ; preds = %6
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = and i32 %15, 192
  switch i32 %16, label %25 [
    i32 128, label %17
    i32 64, label %23
    i32 192, label %24
  ]

17:                                               ; preds = %14
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = and i32 %18, 224
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [32 x ptr], ptr @asn1_tag_index, i64 0, i64 %20
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %2, align 8
  br label %61

23:                                               ; preds = %14
  store ptr @.str.2, ptr %2, align 8
  br label %61

24:                                               ; preds = %14
  store ptr @.str.3, ptr %2, align 8
  br label %61

25:                                               ; preds = %14
  %26 = load i32, ptr %3, align 4, !tbaa !5
  switch i32 %26, label %56 [
    i32 1, label %27
    i32 2, label %28
    i32 3, label %29
    i32 4, label %30
    i32 5, label %31
    i32 6, label %32
    i32 7, label %33
    i32 8, label %34
    i32 9, label %35
    i32 10, label %36
    i32 11, label %37
    i32 12, label %38
    i32 13, label %39
    i32 18, label %40
    i32 19, label %41
    i32 20, label %42
    i32 21, label %43
    i32 22, label %44
    i32 23, label %45
    i32 24, label %46
    i32 25, label %47
    i32 26, label %48
    i32 27, label %49
    i32 28, label %50
    i32 29, label %51
    i32 30, label %52
    i32 48, label %53
    i32 49, label %54
    i32 160, label %55
  ]

27:                                               ; preds = %25
  store ptr @.str.4, ptr %2, align 8
  br label %61

28:                                               ; preds = %25
  store ptr @.str.5, ptr %2, align 8
  br label %61

29:                                               ; preds = %25
  store ptr @.str.6, ptr %2, align 8
  br label %61

30:                                               ; preds = %25
  store ptr @.str.7, ptr %2, align 8
  br label %61

31:                                               ; preds = %25
  store ptr @.str.8, ptr %2, align 8
  br label %61

32:                                               ; preds = %25
  store ptr @.str.9, ptr %2, align 8
  br label %61

33:                                               ; preds = %25
  store ptr @.str.10, ptr %2, align 8
  br label %61

34:                                               ; preds = %25
  store ptr @.str.11, ptr %2, align 8
  br label %61

35:                                               ; preds = %25
  store ptr @.str.12, ptr %2, align 8
  br label %61

36:                                               ; preds = %25
  store ptr @.str.13, ptr %2, align 8
  br label %61

37:                                               ; preds = %25
  store ptr @.str.14, ptr %2, align 8
  br label %61

38:                                               ; preds = %25
  store ptr @.str.15, ptr %2, align 8
  br label %61

39:                                               ; preds = %25
  store ptr @.str.16, ptr %2, align 8
  br label %61

40:                                               ; preds = %25
  store ptr @.str.17, ptr %2, align 8
  br label %61

41:                                               ; preds = %25
  store ptr @.str.18, ptr %2, align 8
  br label %61

42:                                               ; preds = %25
  store ptr @.str.19, ptr %2, align 8
  br label %61

43:                                               ; preds = %25
  store ptr @.str.20, ptr %2, align 8
  br label %61

44:                                               ; preds = %25
  store ptr @.str.21, ptr %2, align 8
  br label %61

45:                                               ; preds = %25
  store ptr @.str.22, ptr %2, align 8
  br label %61

46:                                               ; preds = %25
  store ptr @.str.23, ptr %2, align 8
  br label %61

47:                                               ; preds = %25
  store ptr @.str.24, ptr %2, align 8
  br label %61

48:                                               ; preds = %25
  store ptr @.str.25, ptr %2, align 8
  br label %61

49:                                               ; preds = %25
  store ptr @.str.26, ptr %2, align 8
  br label %61

50:                                               ; preds = %25
  store ptr @.str.27, ptr %2, align 8
  br label %61

51:                                               ; preds = %25
  store ptr @.str.28, ptr %2, align 8
  br label %61

52:                                               ; preds = %25
  store ptr @.str.29, ptr %2, align 8
  br label %61

53:                                               ; preds = %25
  store ptr @.str.30, ptr %2, align 8
  br label %61

54:                                               ; preds = %25
  store ptr @.str.31, ptr %2, align 8
  br label %61

55:                                               ; preds = %25
  store ptr @.str.32, ptr %2, align 8
  br label %61

56:                                               ; preds = %25
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr @stderr, align 8, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 78, ptr noundef @__FUNCTION__.asn1_tag_name) #2
  br label %60

60:                                               ; preds = %57
  store ptr null, ptr %2, align 8
  br label %61

61:                                               ; preds = %60, %55, %54, %53, %52, %51, %50, %49, %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %24, %23, %17, %13
  %62 = load ptr, ptr %2, align 8
  ret ptr %62
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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 = { 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 #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [58 x i8], align 1
@__FUNCTION__.asn1_tag_name = external hidden unnamed_addr constant [14 x i8], align 1
@asn1_tag_index = external hidden local_unnamed_addr global [32 x ptr], align 16
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local ptr @asn1_tag_name(i32 noundef %0) local_unnamed_addr #0 {
  %or.cond = icmp ugt i32 %0, 255
  br i1 %or.cond, label %2, label %5

2:                                                ; preds = %1
  %3 = load ptr, ptr @stderr, align 8, !tbaa !5
  %4 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 36, ptr noundef nonnull @__FUNCTION__.asn1_tag_name) #2
  br label %45

5:                                                ; preds = %1
  %6 = lshr i32 %0, 6
  switch i32 %6, label %.unreachabledefault [
    i32 2, label %7
    i32 1, label %45
    i32 3, label %12
    i32 0, label %13
  ]

7:                                                ; preds = %5
  %8 = and i32 %0, 224
  %9 = zext nneg i32 %8 to i64
  %10 = getelementptr inbounds [32 x ptr], ptr @asn1_tag_index, i64 0, i64 %9
  %11 = load ptr, ptr %10, align 16, !tbaa !5
  br label %45

12:                                               ; preds = %5
  br label %45

.unreachabledefault:                              ; preds = %5
  unreachable

13:                                               ; preds = %5
  %trunc = trunc nuw i32 %0 to i8
  switch i8 %trunc, label %42 [
    i8 1, label %45
    i8 2, label %14
    i8 3, label %15
    i8 4, label %16
    i8 5, label %17
    i8 6, label %18
    i8 7, label %19
    i8 8, label %20
    i8 9, label %21
    i8 10, label %22
    i8 11, label %23
    i8 12, label %24
    i8 13, label %25
    i8 18, label %26
    i8 19, label %27
    i8 20, label %28
    i8 21, label %29
    i8 22, label %30
    i8 23, label %31
    i8 24, label %32
    i8 25, label %33
    i8 26, label %34
    i8 27, label %35
    i8 28, label %36
    i8 29, label %37
    i8 30, label %38
    i8 48, label %39
    i8 49, label %40
    i8 -96, label %41
  ]

14:                                               ; preds = %13
  br label %45

15:                                               ; preds = %13
  br label %45

16:                                               ; preds = %13
  br label %45

17:                                               ; preds = %13
  br label %45

18:                                               ; preds = %13
  br label %45

19:                                               ; preds = %13
  br label %45

20:                                               ; preds = %13
  br label %45

21:                                               ; preds = %13
  br label %45

22:                                               ; preds = %13
  br label %45

23:                                               ; preds = %13
  br label %45

24:                                               ; preds = %13
  br label %45

25:                                               ; preds = %13
  br label %45

26:                                               ; preds = %13
  br label %45

27:                                               ; preds = %13
  br label %45

28:                                               ; preds = %13
  br label %45

29:                                               ; preds = %13
  br label %45

30:                                               ; preds = %13
  br label %45

31:                                               ; preds = %13
  br label %45

32:                                               ; preds = %13
  br label %45

33:                                               ; preds = %13
  br label %45

34:                                               ; preds = %13
  br label %45

35:                                               ; preds = %13
  br label %45

36:                                               ; preds = %13
  br label %45

37:                                               ; preds = %13
  br label %45

38:                                               ; preds = %13
  br label %45

39:                                               ; preds = %13
  br label %45

40:                                               ; preds = %13
  br label %45

41:                                               ; preds = %13
  br label %45

42:                                               ; preds = %13
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 78, ptr noundef nonnull @__FUNCTION__.asn1_tag_name) #2
  br label %45

45:                                               ; preds = %13, %5, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %12, %7, %2
  %.0 = phi ptr [ null, %2 ], [ null, %42 ], [ @.str.32, %41 ], [ @.str.31, %40 ], [ @.str.30, %39 ], [ @.str.29, %38 ], [ @.str.28, %37 ], [ @.str.27, %36 ], [ @.str.26, %35 ], [ @.str.25, %34 ], [ @.str.24, %33 ], [ @.str.23, %32 ], [ @.str.22, %31 ], [ @.str.21, %30 ], [ @.str.20, %29 ], [ @.str.19, %28 ], [ @.str.18, %27 ], [ @.str.17, %26 ], [ @.str.16, %25 ], [ @.str.15, %24 ], [ @.str.14, %23 ], [ @.str.13, %22 ], [ @.str.12, %21 ], [ @.str.11, %20 ], [ @.str.10, %19 ], [ @.str.9, %18 ], [ @.str.8, %17 ], [ @.str.7, %16 ], [ @.str.6, %15 ], [ @.str.5, %14 ], [ @.str.3, %12 ], [ %11, %7 ], [ @.str.2, %5 ], [ @.str.4, %13 ]
  ret ptr %.0
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { nofree 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 = { nofree 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 #2 = { cold 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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass