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

; 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.ByteArray_st = type { ptr, i64 }
%struct.AesCtx_st = type { i64, [16 x i8], [16 x i8], [64 x i32], [64 x i32], [32 x i8], [16 x i8], i64, i64, i64, i32 }

@.str = external hidden unnamed_addr constant [13 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 @aes_base_init(ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

19:                                               ; preds = %16
  store i32 2, ptr %9, align 4, !tbaa !11
  %20 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1887, i32 noundef %20, ptr noundef null)
  br label %221

21:                                               ; preds = %16
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %29, label %27

27:                                               ; preds = %24
  store i32 2, ptr %9, align 4, !tbaa !11
  %28 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1888, i32 noundef %28, ptr noundef null)
  br label %221

29:                                               ; preds = %24
  br label %30

30:                                               ; preds = %29
  br label %31

31:                                               ; preds = %30
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %37, label %35

35:                                               ; preds = %32
  store i32 2, ptr %9, align 4, !tbaa !11
  %36 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1889, i32 noundef %36, ptr noundef null)
  br label %221

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load i64, ptr %8, align 8, !tbaa !9
  %41 = icmp ult i64 %40, 4
  br i1 %41, label %45, label %42

42:                                               ; preds = %39
  %43 = load i64, ptr %8, align 8, !tbaa !9
  %44 = icmp ugt i64 %43, 16
  br i1 %44, label %45, label %50

45:                                               ; preds = %42, %39
  br label %46

46:                                               ; preds = %45
  store i32 2, ptr %9, align 4, !tbaa !11
  %47 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1892, i32 noundef %47, ptr noundef null)
  br label %221

48:                                               ; No predecessors!
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49, %42
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ByteArray_st, ptr %51, i32 0, i32 1
  %53 = load i64, ptr %52, align 8, !tbaa !13
  store i64 %53, ptr %12, align 8, !tbaa !9
  %54 = load i64, ptr %12, align 8, !tbaa !9
  %55 = icmp eq i64 %54, 0
  br i1 %55, label %56, label %61

56:                                               ; preds = %50
  br label %57

57:                                               ; preds = %56
  store i32 12, ptr %9, align 4, !tbaa !11
  %58 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_create(ptr noundef @.str, i64 noundef 1898, i32 noundef %58, ptr noundef null)
  br label %221

59:                                               ; No predecessors!
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60, %50
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.AesCtx_st, ptr %62, i32 0, i32 1
  %64 = getelementptr inbounds [16 x i8], ptr %63, i64 0, i64 0
  store ptr %64, ptr %10, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.AesCtx_st, ptr %65, i32 0, i32 6
  %67 = getelementptr inbounds [16 x i8], ptr %66, i64 0, i64 0
  store ptr %67, ptr %11, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %61
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = call i32 @aes_base_init(ptr noundef %69, ptr noundef %70)
  store i32 %71, ptr %9, align 4, !tbaa !11
  %72 = load i32, ptr %9, align 4, !tbaa !11
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %68
  %75 = load i32, ptr %9, align 4, !tbaa !11
  call void @stacktrace_add(ptr noundef @.str, i64 noundef 1904, i32 noundef %75)
  br label %221

76:                                               ; preds = %68
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.AesCtx_st, ptr %79, i32 0, i32 10
  store i32 5, ptr %80, align 8, !tbaa !15
  %81 = load i64, ptr %8, align 8, !tbaa !9
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.AesCtx_st, ptr %82, i32 0, i32 9
  store i64 %81, ptr %83, align 8, !tbaa !17
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %84, i8 0, i64 16, i1 false)
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  call void @block_encrypt(ptr noundef %85, ptr noundef %86, ptr noundef %87)
  %88 = load i64, ptr %12, align 8, !tbaa !9
  %89 = icmp eq i64 %88, 12
  br i1 %89, label %90, label %103

90:                                               ; preds = %78
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ByteArray_st, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !18
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %91, ptr align 1 %94, i64 12, i1 false)
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %95, i64 14
  store i8 0, ptr %96, align 1, !tbaa !19
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %97, i64 13
  store i8 0, ptr %98, align 1, !tbaa !19
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds i8, ptr %99, i64 12
  store i8 0, ptr %100, align 1, !tbaa !19
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %101, i64 15
  store i8 1, ptr %102, align 1, !tbaa !19
  br label %220

103:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.ByteArray_st, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !18
  store ptr %106, ptr %15, align 8, !tbaa !5
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 1 %107, i8 0, i64 16, i1 false)
  br label %108

108:                                              ; preds = %117, %103
  %109 = load i64, ptr %12, align 8, !tbaa !9
  %110 = icmp ugt i64 %109, 0
  br i1 %110, label %111, label %132

111:                                              ; preds = %108
  %112 = load i64, ptr %12, align 8, !tbaa !9
  %113 = icmp ult i64 %112, 16
  br i1 %113, label %114, label %116

114:                                              ; preds = %111
  %115 = load i64, ptr %12, align 8, !tbaa !9
  br label %117

116:                                              ; preds = %111
  br label %117

117:                                              ; preds = %116, %114
  %118 = phi i64 [ %115, %114 ], [ 16, %116 ]
  store i64 %118, ptr %14, align 8, !tbaa !9
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load ptr, ptr %15, align 8, !tbaa !5
  %122 = load i64, ptr %14, align 8, !tbaa !9
  call void @xor_bytes(ptr noundef %119, ptr noundef %120, ptr noundef %121, i64 noundef %122)
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  call void @gcm_mul(ptr noundef %123, ptr noundef %124, ptr noundef %125)
  %126 = load i64, ptr %14, align 8, !tbaa !9
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 %126
  store ptr %128, ptr %15, align 8, !tbaa !5
  %129 = load i64, ptr %14, align 8, !tbaa !9
  %130 = load i64, ptr %12, align 8, !tbaa !9
  %131 = sub i64 %130, %129
  store i64 %131, ptr %12, align 8, !tbaa !9
  br label %108, !llvm.loop !20

132:                                              ; preds = %108
  %133 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %133, i8 0, i64 8, i1 false)
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.ByteArray_st, ptr %134, i32 0, i32 1
  %136 = load i64, ptr %135, align 8, !tbaa !13
  %137 = mul i64 %136, 8
  %138 = lshr i64 %137, 56
  %139 = and i64 %138, 255
  %140 = trunc i64 %139 to i8
  %141 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %142 = getelementptr inbounds i8, ptr %141, i64 8
  %143 = getelementptr inbounds i8, ptr %142, i64 0
  store i8 %140, ptr %143, align 1, !tbaa !19
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.ByteArray_st, ptr %144, i32 0, i32 1
  %146 = load i64, ptr %145, align 8, !tbaa !13
  %147 = mul i64 %146, 8
  %148 = lshr i64 %147, 48
  %149 = and i64 %148, 255
  %150 = trunc i64 %149 to i8
  %151 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %152 = getelementptr inbounds i8, ptr %151, i64 8
  %153 = getelementptr inbounds i8, ptr %152, i64 1
  store i8 %150, ptr %153, align 1, !tbaa !19
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.ByteArray_st, ptr %154, i32 0, i32 1
  %156 = load i64, ptr %155, align 8, !tbaa !13
  %157 = mul i64 %156, 8
  %158 = lshr i64 %157, 40
  %159 = and i64 %158, 255
  %160 = trunc i64 %159 to i8
  %161 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %162 = getelementptr inbounds i8, ptr %161, i64 8
  %163 = getelementptr inbounds i8, ptr %162, i64 2
  store i8 %160, ptr %163, align 1, !tbaa !19
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.ByteArray_st, ptr %164, i32 0, i32 1
  %166 = load i64, ptr %165, align 8, !tbaa !13
  %167 = mul i64 %166, 8
  %168 = lshr i64 %167, 32
  %169 = and i64 %168, 255
  %170 = trunc i64 %169 to i8
  %171 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %172 = getelementptr inbounds i8, ptr %171, i64 8
  %173 = getelementptr inbounds i8, ptr %172, i64 3
  store i8 %170, ptr %173, align 1, !tbaa !19
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.ByteArray_st, ptr %174, i32 0, i32 1
  %176 = load i64, ptr %175, align 8, !tbaa !13
  %177 = mul i64 %176, 8
  %178 = lshr i64 %177, 24
  %179 = and i64 %178, 255
  %180 = trunc i64 %179 to i8
  %181 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %182 = getelementptr inbounds i8, ptr %181, i64 8
  %183 = getelementptr inbounds i8, ptr %182, i64 4
  store i8 %180, ptr %183, align 1, !tbaa !19
  %184 = load ptr, ptr %7, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.ByteArray_st, ptr %184, i32 0, i32 1
  %186 = load i64, ptr %185, align 8, !tbaa !13
  %187 = mul i64 %186, 8
  %188 = lshr i64 %187, 16
  %189 = and i64 %188, 255
  %190 = trunc i64 %189 to i8
  %191 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %192 = getelementptr inbounds i8, ptr %191, i64 8
  %193 = getelementptr inbounds i8, ptr %192, i64 5
  store i8 %190, ptr %193, align 1, !tbaa !19
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.ByteArray_st, ptr %194, i32 0, i32 1
  %196 = load i64, ptr %195, align 8, !tbaa !13
  %197 = mul i64 %196, 8
  %198 = lshr i64 %197, 8
  %199 = and i64 %198, 255
  %200 = trunc i64 %199 to i8
  %201 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %202 = getelementptr inbounds i8, ptr %201, i64 8
  %203 = getelementptr inbounds i8, ptr %202, i64 6
  store i8 %200, ptr %203, align 1, !tbaa !19
  %204 = load ptr, ptr %7, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.ByteArray_st, ptr %204, i32 0, i32 1
  %206 = load i64, ptr %205, align 8, !tbaa !13
  %207 = mul i64 %206, 8
  %208 = lshr i64 %207, 0
  %209 = and i64 %208, 255
  %210 = trunc i64 %209 to i8
  %211 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %212 = getelementptr inbounds i8, ptr %211, i64 8
  %213 = getelementptr inbounds i8, ptr %212, i64 7
  store i8 %210, ptr %213, align 1, !tbaa !19
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = load ptr, ptr %11, align 8, !tbaa !5
  %216 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  call void @xor_bytes(ptr noundef %214, ptr noundef %215, ptr noundef %216, i64 noundef 16)
  %217 = load ptr, ptr %11, align 8, !tbaa !5
  %218 = load ptr, ptr %11, align 8, !tbaa !5
  %219 = load ptr, ptr %10, align 8, !tbaa !5
  call void @gcm_mul(ptr noundef %217, ptr noundef %218, ptr noundef %219)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %220

220:                                              ; preds = %132, %90
  br label %221

221:                                              ; preds = %220, %74, %57, %46, %35, %27, %19
  %222 = load i32, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret i32 %222
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @block_encrypt(ptr noundef, ptr noundef, ptr noundef) #5

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

; Function Attrs: nounwind uwtable
declare hidden void @gcm_mul(ptr noundef, ptr noundef, ptr noundef) #2

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint 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 #6 = { 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 8}
!14 = !{!"ByteArray_st", !6, i64 0, !10, i64 8}
!15 = !{!16, !12, i64 624}
!16 = !{!"AesCtx_st", !10, i64 0, !7, i64 8, !7, i64 24, !7, i64 40, !7, i64 296, !7, i64 552, !7, i64 584, !10, i64 600, !10, i64 608, !10, i64 616, !12, i64 624}
!17 = !{!16, !10, i64 616}
!18 = !{!14, !6, i64 0}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; 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 [13 x i8], align 1

; Function Attrs: mustprogress 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) local_unnamed_addr #1

; Function Attrs: mustprogress 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) local_unnamed_addr #1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @aes_init_gcm(ptr noundef %0, ptr noundef %1, ptr noundef readonly %2, i64 noundef %3) local_unnamed_addr #2 {
  %5 = alloca [16 x i8], align 16
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

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

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

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

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

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

11:                                               ; preds = %9
  %12 = add i64 %3, -17
  %or.cond = icmp ult i64 %12, -13
  br i1 %or.cond, label %13, label %14

13:                                               ; preds = %11
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 1892, i32 noundef 2, ptr noundef null) #7
  br label %62

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  tail call void @stacktrace_create(ptr noundef nonnull @.str, i64 noundef 1898, i32 noundef 12, ptr noundef null) #7
  br label %62

19:                                               ; preds = %14
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = getelementptr inbounds i8, ptr %0, i64 584
  %22 = tail call i32 @aes_base_init(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %.not72 = icmp eq i32 %22, 0
  br i1 %.not72, label %24, label %23

23:                                               ; preds = %19
  tail call void @stacktrace_add(ptr noundef nonnull @.str, i64 noundef 1904, i32 noundef %22) #7
  br label %62

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %0, i64 624
  store i32 5, ptr %25, align 8, !tbaa !11
  %26 = getelementptr inbounds i8, ptr %0, i64 616
  store i64 %3, ptr %26, align 8, !tbaa !14
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %20, i8 0, i64 16, i1 false)
  tail call void @block_encrypt(ptr noundef nonnull %0, ptr noundef nonnull %20, ptr noundef nonnull %20)
  %27 = icmp eq i64 %16, 12
  br i1 %27, label %28, label %31

28:                                               ; preds = %24
  %29 = load ptr, ptr %2, align 8, !tbaa !15
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(12) %21, ptr noundef nonnull align 1 dereferenceable(12) %29, i64 12, i1 false)
  %30 = getelementptr inbounds i8, ptr %0, i64 596
  store <4 x i8> <i8 0, i8 0, i8 0, i8 1>, ptr %30, align 1, !tbaa !16
  br label %62

31:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %32 = load ptr, ptr %2, align 8, !tbaa !15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(16) %21, i8 0, i64 16, i1 false)
  br label %33

33:                                               ; preds = %31, %33
  %.075 = phi ptr [ %32, %31 ], [ %35, %33 ]
  %.06374 = phi i64 [ %16, %31 ], [ %36, %33 ]
  %34 = tail call i64 @llvm.umin.i64(i64 %.06374, i64 16)
  tail call void @xor_bytes(ptr noundef nonnull %21, ptr noundef nonnull %21, ptr noundef %.075, i64 noundef %34)
  tail call void @gcm_mul(ptr noundef nonnull %21, ptr noundef nonnull %21, ptr noundef nonnull %20)
  %35 = getelementptr inbounds i8, ptr %.075, i64 %34
  %36 = sub i64 %.06374, %34
  %.not73 = icmp eq i64 %36, 0
  br i1 %.not73, label %37, label %33, !llvm.loop !17

37:                                               ; preds = %33
  store i64 0, ptr %5, align 16
  %38 = load i64, ptr %15, align 8, !tbaa !5
  %39 = lshr i64 %38, 53
  %40 = trunc i64 %39 to i8
  %41 = getelementptr inbounds i8, ptr %5, i64 8
  store i8 %40, ptr %41, align 8, !tbaa !16
  %42 = lshr i64 %38, 45
  %43 = trunc i64 %42 to i8
  %44 = getelementptr inbounds i8, ptr %5, i64 9
  store i8 %43, ptr %44, align 1, !tbaa !16
  %45 = lshr i64 %38, 37
  %46 = trunc i64 %45 to i8
  %47 = getelementptr inbounds i8, ptr %5, i64 10
  store i8 %46, ptr %47, align 2, !tbaa !16
  %48 = lshr i64 %38, 29
  %49 = trunc i64 %48 to i8
  %50 = getelementptr inbounds i8, ptr %5, i64 11
  store i8 %49, ptr %50, align 1, !tbaa !16
  %51 = lshr i64 %38, 21
  %52 = trunc i64 %51 to i8
  %53 = getelementptr inbounds i8, ptr %5, i64 12
  store i8 %52, ptr %53, align 4, !tbaa !16
  %54 = lshr i64 %38, 13
  %55 = trunc i64 %54 to i8
  %56 = getelementptr inbounds i8, ptr %5, i64 13
  store i8 %55, ptr %56, align 1, !tbaa !16
  %57 = lshr i64 %38, 5
  %58 = trunc i64 %57 to i8
  %59 = getelementptr inbounds i8, ptr %5, i64 14
  store i8 %58, ptr %59, align 2, !tbaa !16
  %.tr = trunc i64 %38 to i8
  %60 = shl i8 %.tr, 3
  %61 = getelementptr inbounds i8, ptr %5, i64 15
  store i8 %60, ptr %61, align 1, !tbaa !16
  call void @xor_bytes(ptr noundef nonnull %21, ptr noundef nonnull %21, ptr noundef nonnull %5, i64 noundef 16)
  call void @gcm_mul(ptr noundef nonnull %21, ptr noundef nonnull %21, ptr noundef nonnull %20)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %62

62:                                               ; preds = %28, %37, %23, %18, %13, %10, %8, %6
  %.062 = phi i32 [ 2, %13 ], [ 12, %18 ], [ %22, %23 ], [ 0, %28 ], [ 0, %37 ], [ 2, %10 ], [ 2, %8 ], [ 2, %6 ]
  ret i32 %.062
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @block_encrypt(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden void @xor_bytes(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @gcm_mul(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #6

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 8}
!6 = !{!"ByteArray_st", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!12, !13, i64 624}
!12 = !{!"AesCtx_st", !10, i64 0, !8, i64 8, !8, i64 24, !8, i64 40, !8, i64 296, !8, i64 552, !8, i64 584, !10, i64 600, !10, i64 608, !10, i64 616, !13, i64 624}
!13 = !{!"int", !8, i64 0}
!14 = !{!12, !10, i64 616}
!15 = !{!6, !7, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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