; LLVM IR from DanEngelbrecht/longtail :: lib/brotli/ext/dec (state)

; 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.BrotliDecoderStateStruct = type { i32, i32, %struct.BrotliBitReader, ptr, ptr, ptr, %union.anon, i64, i32, i32, i32, i32, i32, i32, [4 x i32], i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.HuffmanTreeGroup, %struct.HuffmanTreeGroup, %struct.HuffmanTreeGroup, ptr, ptr, i32, i32, [3 x i64], i64, [3 x i64], [6 x i64], i64, i64, i64, ptr, ptr, i64, i64, i64, [65 x i32], i32, i32, i8, ptr, ptr, ptr, i64, i32, i32, i32, i32, i32, i32, i64, ptr, ptr, ptr, ptr, [8 x i32], %union.anon.0 }
%struct.BrotliBitReader = type { i64, i64, ptr, ptr, ptr }
%union.anon = type { i64 }
%struct.HuffmanTreeGroup = type { ptr, ptr, i16, i16, i16 }
%union.anon.0 = type { %struct.BrotliMetablockBodyArena }
%struct.BrotliMetablockBodyArena = type { [544 x i8], [544 x i64] }

; Function Attrs: nounwind uwtable
define hidden void @BrotliDecoderStateMetablockBegin(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %3, i32 0, i32 16
  store i32 0, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %5, i32 0, i32 30
  %7 = getelementptr inbounds [3 x i64], ptr %6, i64 0, i64 0
  store i64 16777216, ptr %7, align 8, !tbaa !16
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %8, i32 0, i32 30
  %10 = getelementptr inbounds [3 x i64], ptr %9, i64 0, i64 1
  store i64 16777216, ptr %10, align 8, !tbaa !16
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %11, i32 0, i32 30
  %13 = getelementptr inbounds [3 x i64], ptr %12, i64 0, i64 2
  store i64 16777216, ptr %13, align 8, !tbaa !16
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %14, i32 0, i32 32
  %16 = getelementptr inbounds [3 x i64], ptr %15, i64 0, i64 0
  store i64 1, ptr %16, align 8, !tbaa !16
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %17, i32 0, i32 32
  %19 = getelementptr inbounds [3 x i64], ptr %18, i64 0, i64 1
  store i64 1, ptr %19, align 8, !tbaa !16
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %20, i32 0, i32 32
  %22 = getelementptr inbounds [3 x i64], ptr %21, i64 0, i64 2
  store i64 1, ptr %22, align 8, !tbaa !16
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %23, i32 0, i32 33
  %25 = getelementptr inbounds [6 x i64], ptr %24, i64 0, i64 0
  store i64 1, ptr %25, align 8, !tbaa !16
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %26, i32 0, i32 33
  %28 = getelementptr inbounds [6 x i64], ptr %27, i64 0, i64 1
  store i64 0, ptr %28, align 8, !tbaa !16
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %29, i32 0, i32 33
  %31 = getelementptr inbounds [6 x i64], ptr %30, i64 0, i64 2
  store i64 1, ptr %31, align 8, !tbaa !16
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %32, i32 0, i32 33
  %34 = getelementptr inbounds [6 x i64], ptr %33, i64 0, i64 3
  store i64 0, ptr %34, align 8, !tbaa !16
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %35, i32 0, i32 33
  %37 = getelementptr inbounds [6 x i64], ptr %36, i64 0, i64 4
  store i64 1, ptr %37, align 8, !tbaa !16
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %38, i32 0, i32 33
  %40 = getelementptr inbounds [6 x i64], ptr %39, i64 0, i64 5
  store i64 0, ptr %40, align 8, !tbaa !16
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %41, i32 0, i32 57
  store ptr null, ptr %42, align 8, !tbaa !17
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %43, i32 0, i32 58
  store ptr null, ptr %44, align 8, !tbaa !18
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %45, i32 0, i32 37
  store ptr null, ptr %46, align 8, !tbaa !19
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %47, i32 0, i32 21
  store ptr null, ptr %48, align 8, !tbaa !20
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %49, i32 0, i32 38
  store ptr null, ptr %50, align 8, !tbaa !21
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %51, i32 0, i32 22
  store ptr null, ptr %52, align 8, !tbaa !22
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %53, i32 0, i32 45
  store i8 0, ptr %54, align 4, !tbaa !23
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %55, i32 0, i32 20
  store ptr null, ptr %56, align 8, !tbaa !24
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %57, i32 0, i32 23
  %59 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %58, i32 0, i32 1
  store ptr null, ptr %59, align 8, !tbaa !25
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %60, i32 0, i32 23
  %62 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %61, i32 0, i32 0
  store ptr null, ptr %62, align 8, !tbaa !26
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %63, i32 0, i32 24
  %65 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %64, i32 0, i32 1
  store ptr null, ptr %65, align 8, !tbaa !27
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %66, i32 0, i32 24
  %68 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %67, i32 0, i32 0
  store ptr null, ptr %68, align 8, !tbaa !28
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %69, i32 0, i32 25
  %71 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %70, i32 0, i32 1
  store ptr null, ptr %71, align 8, !tbaa !29
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.BrotliDecoderStateStruct, ptr %72, i32 0, i32 25
  %74 = getelementptr inbounds %struct.HuffmanTreeGroup, ptr %73, i32 0, i32 0
  store ptr null, ptr %74, align 8, !tbaa !30
  ret void
}

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

!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, !11, i64 132}
!10 = !{!"BrotliDecoderStateStruct", !11, i64 0, !11, i64 4, !12, i64 8, !6, i64 48, !6, i64 56, !6, i64 64, !7, i64 72, !13, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !7, i64 112, !11, i64 128, !11, i64 132, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !14, i64 184, !14, i64 208, !14, i64 232, !6, i64 256, !6, i64 264, !11, i64 272, !11, i64 276, !7, i64 280, !13, i64 304, !7, i64 312, !7, i64 336, !13, i64 384, !13, i64 392, !13, i64 400, !6, i64 408, !6, i64 416, !13, i64 424, !13, i64 432, !13, i64 440, !7, i64 448, !11, i64 708, !11, i64 712, !7, i64 716, !6, i64 720, !6, i64 728, !6, i64 736, !13, i64 744, !11, i64 752, !11, i64 756, !11, i64 760, !11, i64 764, !11, i64 768, !11, i64 772, !11, i64 772, !11, i64 772, !11, i64 772, !11, i64 772, !11, i64 772, !11, i64 772, !11, i64 773, !13, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !7, i64 816, !7, i64 848}
!11 = !{!"int", !7, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!13 = !{!"long", !7, i64 0}
!14 = !{!"", !6, i64 0, !6, i64 8, !15, i64 16, !15, i64 18, !15, i64 20}
!15 = !{!"short", !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!10, !6, i64 784}
!18 = !{!10, !6, i64 792}
!19 = !{!10, !6, i64 408}
!20 = !{!10, !6, i64 168}
!21 = !{!10, !6, i64 416}
!22 = !{!10, !6, i64 176}
!23 = !{!10, !7, i64 716}
!24 = !{!10, !6, i64 160}
!25 = !{!10, !6, i64 192}
!26 = !{!10, !6, i64 184}
!27 = !{!10, !6, i64 216}
!28 = !{!10, !6, i64 208}
!29 = !{!10, !6, i64 240}
!30 = !{!10, !6, i64 232}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define hidden void @BrotliDecoderStateMetablockBegin(ptr nocapture noundef writeonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 132
  store i32 0, ptr %2, align 4, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 280
  store i64 16777216, ptr %3, align 8, !tbaa !15
  %4 = getelementptr inbounds i8, ptr %0, i64 288
  store i64 16777216, ptr %4, align 8, !tbaa !15
  %5 = getelementptr inbounds i8, ptr %0, i64 296
  store i64 16777216, ptr %5, align 8, !tbaa !15
  %6 = getelementptr inbounds i8, ptr %0, i64 312
  store i64 1, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %0, i64 320
  store i64 1, ptr %7, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 328
  store i64 1, ptr %8, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %0, i64 336
  store i64 1, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %0, i64 344
  store i64 0, ptr %10, align 8, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %0, i64 352
  store i64 1, ptr %11, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 360
  store i64 0, ptr %12, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 368
  store i64 1, ptr %13, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %0, i64 376
  store i64 0, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 784
  %16 = getelementptr inbounds i8, ptr %0, i64 408
  %17 = getelementptr inbounds i8, ptr %0, i64 716
  store i8 0, ptr %17, align 4, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 160
  %19 = getelementptr inbounds i8, ptr %0, i64 208
  %20 = getelementptr inbounds i8, ptr %0, i64 232
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %18, i8 0, i64 40, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %19, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %20, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %16, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %15, i8 0, i64 16, i1 false)
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 nounwind willreturn memory(argmem: write) }

!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 132}
!6 = !{!"BrotliDecoderStateStruct", !7, i64 0, !7, i64 4, !10, i64 8, !12, i64 48, !12, i64 56, !12, i64 64, !8, i64 72, !11, i64 80, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !8, i64 112, !7, i64 128, !7, i64 132, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !13, i64 184, !13, i64 208, !13, i64 232, !12, i64 256, !12, i64 264, !7, i64 272, !7, i64 276, !8, i64 280, !11, i64 304, !8, i64 312, !8, i64 336, !11, i64 384, !11, i64 392, !11, i64 400, !12, i64 408, !12, i64 416, !11, i64 424, !11, i64 432, !11, i64 440, !8, i64 448, !7, i64 708, !7, i64 712, !8, i64 716, !12, i64 720, !12, i64 728, !12, i64 736, !11, i64 744, !7, i64 752, !7, i64 756, !7, i64 760, !7, i64 764, !7, i64 768, !7, i64 772, !7, i64 772, !7, i64 772, !7, i64 772, !7, i64 772, !7, i64 772, !7, i64 772, !7, i64 773, !11, i64 776, !12, i64 784, !12, i64 792, !12, i64 800, !12, i64 808, !8, i64 816, !8, i64 848}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 8, !14, i64 16, !14, i64 18, !14, i64 20}
!14 = !{!"short", !8, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!6, !8, i64 716}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass