; LLVM IR from specinfo-ua/UAPKI :: library/uapkic/src (dstu7624)

; 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.Dstu7624Ctx_st = type { i32, [8 x [256 x i64]], [8 x [256 x i64]], [1024 x i8], [1024 x i8], [1280 x i64], [1280 x i64], [8 x i64], i64, i64, i64, %union.anon, ptr, ptr, ptr }
%union.anon = type { %struct.Dstu7624GmacCtx_st }
%struct.Dstu7624GmacCtx_st = type { [8 x i64], [8 x i64], [64 x i8], i64, i64, i64, ptr }
%struct.Dstu7624CcmCtx_st = type { i64, ptr, ptr, [64 x i8], i64 }

@.str = external hidden unnamed_addr constant [18 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

declare void @stacktrace_add(ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i32 @dstu7624_init(ptr noundef, ptr noundef, i64 noundef) #2

declare i64 @ba_get_len(ptr noundef) #1

declare i32 @ba_to_uint8(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @dstu7624_init_ccm(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = 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 i64 %3, ptr %9, align 8, !tbaa !9
  store i64 %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %17, label %15

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

17:                                               ; preds = %12
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  br label %20

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

23:                                               ; preds = %20
  store i32 2, ptr %11, align 4, !tbaa !11
  %24 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 4142, i32 noundef %24, ptr noundef null)
  br label %114

25:                                               ; preds = %20
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  br label %28

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

31:                                               ; preds = %28
  store i32 2, ptr %11, align 4, !tbaa !11
  %32 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 4143, i32 noundef %32, ptr noundef null)
  br label %114

33:                                               ; preds = %28
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load i64, ptr %9, align 8, !tbaa !9
  %38 = icmp ugt i64 %37, 0
  br i1 %38, label %41, label %39

39:                                               ; preds = %36
  store i32 2, ptr %11, align 4, !tbaa !11
  %40 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 4144, i32 noundef %40, ptr noundef null)
  br label %114

41:                                               ; preds = %36
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  %45 = load i64, ptr %10, align 8, !tbaa !9
  %46 = icmp uge i64 %45, 8
  br i1 %46, label %49, label %47

47:                                               ; preds = %44
  store i32 2, ptr %11, align 4, !tbaa !11
  %48 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 4145, i32 noundef %48, ptr noundef null)
  br label %114

49:                                               ; preds = %44
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = call i64 @ba_get_len(ptr noundef %55)
  %57 = call i32 @dstu7624_init(ptr noundef %53, ptr noundef %54, i64 noundef %56)
  store i32 %57, ptr %11, align 4, !tbaa !11
  %58 = load i32, ptr %11, align 4, !tbaa !11
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %52
  %61 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 4147, i32 noundef %61)
  br label %114

62:                                               ; preds = %52
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %9, align 8, !tbaa !9
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %67, i32 0, i32 9
  %69 = load i64, ptr %68, align 8, !tbaa !13
  %70 = icmp ule i64 %66, %69
  br i1 %70, label %73, label %71

71:                                               ; preds = %65
  store i32 2, ptr %11, align 4, !tbaa !11
  %72 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 4149, i32 noundef %72, ptr noundef null)
  br label %114

73:                                               ; preds = %65
  br label %74

74:                                               ; preds = %73
  br label %75

75:                                               ; preds = %74
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %77, i32 0, i32 11
  %79 = getelementptr inbounds %struct.Dstu7624CcmCtx_st, ptr %78, i32 0, i32 1
  store ptr %76, ptr %79, align 8, !tbaa !15
  br label %80

80:                                               ; preds = %75
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %82, i32 0, i32 11
  %84 = getelementptr inbounds %struct.Dstu7624CcmCtx_st, ptr %83, i32 0, i32 3
  %85 = getelementptr inbounds [64 x i8], ptr %84, i64 0, i64 0
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %86, i32 0, i32 9
  %88 = load i64, ptr %87, align 8, !tbaa !13
  %89 = call i32 @ba_to_uint8(ptr noundef %81, ptr noundef %85, i64 noundef %88)
  store i32 %89, ptr %11, align 4, !tbaa !11
  %90 = load i32, ptr %11, align 4, !tbaa !11
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %94

92:                                               ; preds = %80
  %93 = load i32, ptr %11, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 4153, i32 noundef %93)
  br label %114

94:                                               ; preds = %80
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %98, i32 0, i32 11
  %100 = getelementptr inbounds %struct.Dstu7624CcmCtx_st, ptr %99, i32 0, i32 2
  store ptr %97, ptr %100, align 8, !tbaa !15
  %101 = load i64, ptr %9, align 8, !tbaa !9
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %102, i32 0, i32 11
  %104 = getelementptr inbounds %struct.Dstu7624CcmCtx_st, ptr %103, i32 0, i32 0
  store i64 %101, ptr %104, align 8, !tbaa !15
  %105 = load i64, ptr %10, align 8, !tbaa !9
  %106 = sub i64 %105, 3
  %107 = lshr i64 %106, 3
  %108 = add i64 %107, 1
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %109, i32 0, i32 11
  %111 = getelementptr inbounds %struct.Dstu7624CcmCtx_st, ptr %110, i32 0, i32 4
  store i64 %108, ptr %111, align 8, !tbaa !15
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.Dstu7624Ctx_st, ptr %112, i32 0, i32 0
  store i32 8, ptr %113, align 8, !tbaa !16
  br label %114

114:                                              ; preds = %96, %92, %71, %60, %47, %39, %31, %23, %15
  %115 = load i32, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  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 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 #3 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 55376}
!14 = !{!"Dstu7624Ctx_st", !12, i64 0, !7, i64 8, !7, i64 16392, !7, i64 32776, !7, i64 33800, !7, i64 34824, !7, i64 45064, !7, i64 55304, !10, i64 55368, !10, i64 55376, !10, i64 55384, !7, i64 55392, !6, i64 55616, !6, i64 55624, !6, i64 55632}
!15 = !{!7, !7, i64 0}
!16 = !{!14, !12, 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 [18 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @dstu7624_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare i64 @ba_get_len(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @dstu7624_init_ccm(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

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

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

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

9:                                                ; preds = %7
  %.not40 = icmp eq ptr %2, null
  br i1 %.not40, label %10, label %11

10:                                               ; preds = %9
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 4143, i32 noundef 2, ptr noundef null) #2
  br label %36

11:                                               ; preds = %9
  %.not41 = icmp eq i64 %3, 0
  br i1 %.not41, label %12, label %13

12:                                               ; preds = %11
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 4144, i32 noundef 2, ptr noundef null) #2
  br label %36

13:                                               ; preds = %11
  %14 = icmp ugt i64 %4, 7
  br i1 %14, label %16, label %15

15:                                               ; preds = %13
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 4145, i32 noundef 2, ptr noundef null) #2
  br label %36

16:                                               ; preds = %13
  %17 = tail call i64 @ba_get_len(ptr noundef nonnull %2) #2
  %18 = tail call i32 @dstu7624_init(ptr noundef nonnull %0, ptr noundef nonnull %1, i64 noundef %17)
  %.not42 = icmp eq i32 %18, 0
  br i1 %.not42, label %20, label %19

19:                                               ; preds = %16
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 4147, i32 noundef %18) #2
  br label %36

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 55376
  %22 = load i64, ptr %21, align 8, !tbaa !5
  %.not43 = icmp ult i64 %22, %3
  br i1 %.not43, label %23, label %24

23:                                               ; preds = %20
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 4149, i32 noundef 2, ptr noundef null) #2
  br label %36

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 55400
  store ptr %1, ptr %25, align 8, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %0, i64 55416
  %27 = tail call i32 @ba_to_uint8(ptr noundef nonnull %2, ptr noundef nonnull %26, i64 noundef %22) #2
  %.not44 = icmp eq i32 %27, 0
  br i1 %.not44, label %29, label %28

28:                                               ; preds = %24
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 4153, i32 noundef %27) #2
  br label %36

29:                                               ; preds = %24
  %30 = getelementptr inbounds i8, ptr %0, i64 55392
  %31 = getelementptr inbounds i8, ptr %0, i64 55408
  store ptr %2, ptr %31, align 8, !tbaa !12
  store i64 %3, ptr %30, align 8, !tbaa !12
  %32 = add i64 %4, -3
  %33 = lshr i64 %32, 3
  %34 = add nuw nsw i64 %33, 1
  %35 = getelementptr inbounds i8, ptr %0, i64 55480
  store i64 %34, ptr %35, align 8, !tbaa !12
  store i32 8, ptr %0, align 8, !tbaa !13
  br label %36

36:                                               ; preds = %29, %28, %23, %19, %15, %12, %10, %8, %6
  %.0 = phi i32 [ %18, %19 ], [ %27, %28 ], [ 0, %29 ], [ 2, %23 ], [ 2, %15 ], [ 2, %12 ], [ 2, %10 ], [ 2, %8 ], [ 2, %6 ]
  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 = { 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 }

!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, !10, i64 55376}
!6 = !{!"Dstu7624Ctx_st", !7, i64 0, !8, i64 8, !8, i64 16392, !8, i64 32776, !8, i64 33800, !8, i64 34824, !8, i64 45064, !8, i64 55304, !10, i64 55368, !10, i64 55376, !10, i64 55384, !8, i64 55392, !11, i64 55616, !11, i64 55624, !11, i64 55632}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!6, !7, i64 0}


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