; LLVM IR from specinfo-ua/UAPKI :: library/uapkif/src/struct (CRLNumber)

; 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_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.ASN__PRIMITIVE_TYPE_s = type { ptr, i32 }

@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1

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

16:                                               ; preds = %4
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %27

19:                                               ; preds = %16
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.asn_TYPE_descriptor_s, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  call void (ptr, ptr, ptr, ptr, ...) %20(ptr noundef %21, ptr noundef %22, ptr noundef %23, ptr noundef @.str, ptr noundef %26, ptr noundef @.str.1, i32 noundef 45)
  br label %27

27:                                               ; preds = %19, %16
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %63

28:                                               ; preds = %4
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ASN__PRIMITIVE_TYPE_s, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %44

33:                                               ; preds = %28
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ASN__PRIMITIVE_TYPE_s, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %36, i64 0
  %38 = load i8, ptr %37, align 1, !tbaa !14
  %39 = zext i8 %38 to i32
  %40 = and i32 %39, 128
  %41 = icmp ne i32 %40, 0
  %42 = zext i1 %41 to i64
  %43 = select i1 %41, i32 -1, i32 1
  br label %45

44:                                               ; preds = %28
  br label %45

45:                                               ; preds = %44, %33
  %46 = phi i32 [ %43, %33 ], [ 0, %44 ]
  %47 = sext i32 %46 to i64
  store i64 %47, ptr %11, align 8, !tbaa !15
  %48 = load i64, ptr %11, align 8, !tbaa !15
  %49 = icmp sge i64 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %45
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %63

51:                                               ; preds = %45
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %62

54:                                               ; preds = %51
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.asn_TYPE_descriptor_s, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  call void (ptr, ptr, ptr, ptr, ...) %55(ptr noundef %56, ptr noundef %57, ptr noundef %58, ptr noundef @.str.2, ptr noundef %61, ptr noundef @.str.1, i32 noundef 58)
  br label %62

62:                                               ; preds = %54, %51
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %63

63:                                               ; preds = %62, %50, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  %64 = load i32, ptr %5, align 4
  ret i32 %64
}

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"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, !11, i64 104, !6, i64 112, !11, i64 120, !6, i64 128, !6, i64 136, !11, i64 144, !6, i64 152}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"ASN__PRIMITIVE_TYPE_s", !6, i64 0, !11, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"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 [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1

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

5:                                                ; preds = %4
  %.not21 = icmp eq ptr %2, null
  br i1 %.not21, label %.critedge, label %6

6:                                                ; preds = %5
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  tail call void (ptr, ptr, ptr, ptr, ...) %2(ptr noundef %3, ptr noundef nonnull %0, ptr noundef null, ptr noundef nonnull @.str, ptr noundef %7, ptr noundef nonnull @.str.1, i32 noundef 45) #1
  br label %.critedge

8:                                                ; preds = %4
  %9 = load ptr, ptr %1, align 8, !tbaa !11
  %.not22 = icmp eq ptr %9, null
  br i1 %.not22, label %.critedge, label %10

10:                                               ; preds = %8
  %11 = load i8, ptr %9, align 1, !tbaa !13
  %.not23 = icmp sgt i8 %11, -1
  br i1 %.not23, label %.critedge, label %12

12:                                               ; preds = %10
  %.not24 = icmp eq ptr %2, null
  br i1 %.not24, label %.critedge, label %13

13:                                               ; preds = %12
  %14 = load ptr, ptr %0, align 8, !tbaa !5
  tail call void (ptr, ptr, ptr, ptr, ...) %2(ptr noundef %3, ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.2, ptr noundef %14, ptr noundef nonnull @.str.1, i32 noundef 58) #1
  br label %.critedge

.critedge:                                        ; preds = %8, %12, %13, %10, %5, %6
  %.0 = phi i32 [ -1, %6 ], [ -1, %5 ], [ 0, %10 ], [ -1, %13 ], [ -1, %12 ], [ 0, %8 ]
  ret i32 %.0
}

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 }

!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 0}
!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, !7, i64 0}
!12 = !{!"ASN__PRIMITIVE_TYPE_s", !7, i64 0, !10, i64 8}
!13 = !{!8, !8, i64 0}


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