; LLVM IR from specinfo-ua/UAPKI :: library/common/pkix (oid-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"

@OID_X520_CommonName = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_Surname = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_SerialNumber = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@OID_X520_Country = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_Locality = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_State = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_StreetAddress = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@OID_X520_Organization = external global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_OrganizationalUnit = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_Title = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [6 x i8], align 1
@OID_X520_GivenName = external global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_OrganizationIdentifier = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [3 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

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

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

9:                                                ; preds = %1
  store ptr @.str.3, ptr %3, align 8, !tbaa !5
  br label %87

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr @OID_X520_Surname, align 8, !tbaa !5
  %13 = call i32 @strcmp(ptr noundef %11, ptr noundef %12) #4
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  store ptr @.str.4, ptr %3, align 8, !tbaa !5
  br label %86

16:                                               ; preds = %10
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = load ptr, ptr @OID_X520_SerialNumber, align 8, !tbaa !5
  %19 = call i32 @strcmp(ptr noundef %17, ptr noundef %18) #4
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  store ptr @.str.5, ptr %3, align 8, !tbaa !5
  br label %85

22:                                               ; preds = %16
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = load ptr, ptr @OID_X520_Country, align 8, !tbaa !5
  %25 = call i32 @strcmp(ptr noundef %23, ptr noundef %24) #4
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  store ptr @.str.6, ptr %3, align 8, !tbaa !5
  br label %84

28:                                               ; preds = %22
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load ptr, ptr @OID_X520_Locality, align 8, !tbaa !5
  %31 = call i32 @strcmp(ptr noundef %29, ptr noundef %30) #4
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %28
  store ptr @.str.7, ptr %3, align 8, !tbaa !5
  br label %83

34:                                               ; preds = %28
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = load ptr, ptr @OID_X520_State, align 8, !tbaa !5
  %37 = call i32 @strcmp(ptr noundef %35, ptr noundef %36) #4
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %34
  store ptr @.str.8, ptr %3, align 8, !tbaa !5
  br label %82

40:                                               ; preds = %34
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = load ptr, ptr @OID_X520_StreetAddress, align 8, !tbaa !5
  %43 = call i32 @strcmp(ptr noundef %41, ptr noundef %42) #4
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  store ptr @.str.9, ptr %3, align 8, !tbaa !5
  br label %81

46:                                               ; preds = %40
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = load ptr, ptr @OID_X520_Organization, align 8, !tbaa !5
  %49 = call i32 @strcmp(ptr noundef %47, ptr noundef %48) #4
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %46
  store ptr @.str.10, ptr %3, align 8, !tbaa !5
  br label %80

52:                                               ; preds = %46
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = load ptr, ptr @OID_X520_OrganizationalUnit, align 8, !tbaa !5
  %55 = call i32 @strcmp(ptr noundef %53, ptr noundef %54) #4
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %52
  store ptr @.str.11, ptr %3, align 8, !tbaa !5
  br label %79

58:                                               ; preds = %52
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = load ptr, ptr @OID_X520_Title, align 8, !tbaa !5
  %61 = call i32 @strcmp(ptr noundef %59, ptr noundef %60) #4
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %58
  store ptr @.str.12, ptr %3, align 8, !tbaa !5
  br label %78

64:                                               ; preds = %58
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = load ptr, ptr @OID_X520_GivenName, align 8, !tbaa !5
  %67 = call i32 @strcmp(ptr noundef %65, ptr noundef %66) #4
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %70

69:                                               ; preds = %64
  store ptr @.str.13, ptr %3, align 8, !tbaa !5
  br label %77

70:                                               ; preds = %64
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = load ptr, ptr @OID_X520_OrganizationIdentifier, align 8, !tbaa !5
  %73 = call i32 @strcmp(ptr noundef %71, ptr noundef %72) #4
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %70
  store ptr @.str.14, ptr %3, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %75, %70
  br label %77

77:                                               ; preds = %76, %69
  br label %78

78:                                               ; preds = %77, %63
  br label %79

79:                                               ; preds = %78, %57
  br label %80

80:                                               ; preds = %79, %51
  br label %81

81:                                               ; preds = %80, %45
  br label %82

82:                                               ; preds = %81, %39
  br label %83

83:                                               ; preds = %82, %33
  br label %84

84:                                               ; preds = %83, %27
  br label %85

85:                                               ; preds = %84, %21
  br label %86

86:                                               ; preds = %85, %15
  br label %87

87:                                               ; preds = %86, %9
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %88
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nounwind willreturn memory(read) "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 }
attributes #4 = { nounwind willreturn memory(read) }

!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"}


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

@OID_X520_CommonName = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_Surname = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_SerialNumber = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@OID_X520_Country = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_Locality = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_State = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_StreetAddress = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@OID_X520_Organization = external local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_OrganizationalUnit = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@OID_X520_Title = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [6 x i8], align 1
@OID_X520_GivenName = external local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@OID_X520_OrganizationIdentifier = external local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local ptr @oid_to_rdname(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @OID_X520_CommonName, align 8, !tbaa !5
  %3 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %2) #2
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %49, label %5

5:                                                ; preds = %1
  %6 = load ptr, ptr @OID_X520_Surname, align 8, !tbaa !5
  %7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %6) #2
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %49, label %9

9:                                                ; preds = %5
  %10 = load ptr, ptr @OID_X520_SerialNumber, align 8, !tbaa !5
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %10) #2
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %49, label %13

13:                                               ; preds = %9
  %14 = load ptr, ptr @OID_X520_Country, align 8, !tbaa !5
  %15 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %14) #2
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %49, label %17

17:                                               ; preds = %13
  %18 = load ptr, ptr @OID_X520_Locality, align 8, !tbaa !5
  %19 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %18) #2
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %49, label %21

21:                                               ; preds = %17
  %22 = load ptr, ptr @OID_X520_State, align 8, !tbaa !5
  %23 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %22) #2
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %49, label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr @OID_X520_StreetAddress, align 8, !tbaa !5
  %27 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %26) #2
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %49, label %29

29:                                               ; preds = %25
  %30 = load ptr, ptr @OID_X520_Organization, align 8, !tbaa !5
  %31 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %30) #2
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %49, label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr @OID_X520_OrganizationalUnit, align 8, !tbaa !5
  %35 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %34) #2
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %49, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr @OID_X520_Title, align 8, !tbaa !5
  %39 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %38) #2
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %49, label %41

41:                                               ; preds = %37
  %42 = load ptr, ptr @OID_X520_GivenName, align 8, !tbaa !5
  %43 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %42) #2
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %49, label %45

45:                                               ; preds = %41
  %46 = load ptr, ptr @OID_X520_OrganizationIdentifier, align 8, !tbaa !5
  %47 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %46) #2
  %48 = icmp eq i32 %47, 0
  %spec.select = select i1 %48, ptr @.str.14, ptr %0
  br label %49

49:                                               ; preds = %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %5, %1
  %.0 = phi ptr [ @.str.3, %1 ], [ @.str.4, %5 ], [ @.str.5, %9 ], [ @.str.6, %13 ], [ @.str.7, %17 ], [ @.str.8, %21 ], [ @.str.9, %25 ], [ @.str.10, %29 ], [ @.str.11, %33 ], [ @.str.12, %37 ], [ @.str.13, %41 ], [ %spec.select, %45 ]
  ret ptr %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) 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 nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }

!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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass