; LLVM IR from DanEngelbrecht/longtail :: lib/brotli/ext/enc (encode)

; 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.ManagedDictionary = type { i32, %struct.MemoryManager, ptr }
%struct.MemoryManager = type { ptr, ptr, ptr }
%struct.BrotliEncoderStateStruct = type { %struct.BrotliEncoderParams, %struct.MemoryManager, i64, %struct.RingBuffer, i64, ptr, i64, i64, i64, i64, i64, [16 x i32], [4 x i32], i16, i8, i8, i8, i8, i64, ptr, %struct.Hasher, [1024 x i32], ptr, i64, ptr, ptr, ptr, ptr, i64, ptr, i64, i64, %union.anon.0, i32, i32, i32, i32 }
%struct.BrotliEncoderParams = type { i32, i32, i32, i32, i64, i64, i32, i32, %struct.BrotliHasherParams, %struct.BrotliDistanceParams, %struct.SharedEncoderDictionary }
%struct.BrotliHasherParams = type { i32, i32, i32, i32 }
%struct.BrotliDistanceParams = type { i32, i32, i32, i32, i64 }
%struct.SharedEncoderDictionary = type { i32, %struct.CompoundDictionary, %struct.ContextualEncoderDictionary, i32 }
%struct.CompoundDictionary = type { i64, i64, [16 x ptr], [16 x ptr], [16 x i64], i64, [16 x ptr] }
%struct.ContextualEncoderDictionary = type { i32, i8, [64 x i8], [64 x ptr], i64, %struct.BrotliEncoderDictionary, ptr }
%struct.BrotliEncoderDictionary = type { ptr, i32, i32, i64, ptr, ptr, ptr, ptr, %struct.BrotliTrie, i32, ptr, ptr, ptr, i64, ptr, i64, ptr, ptr }
%struct.BrotliTrie = type { ptr, i64, i64, %struct.BrotliTrieNode }
%struct.BrotliTrieNode = type { i8, i8, i8, i32, i32 }
%struct.RingBuffer = type { i32, i32, i32, i32, i32, i32, ptr, ptr }
%struct.Hasher = type { %struct.HasherCommon, %union.anon }
%struct.HasherCommon = type { [4 x ptr], i32, i64, i64, %struct.BrotliHasherParams, i32 }
%union.anon = type { %struct.H42 }
%struct.H42 = type { [512 x i16], i64, [2 x ptr], ptr }
%union.anon.0 = type { [2 x i64] }

@kStaticDictionaryHashWords = external constant [32768 x i16], align 16
@kStaticDictionaryHashLengths = external constant [32768 x i8], align 16

; 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 i32 @BrotliEncoderAttachPreparedDictionary(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %18, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store ptr null, ptr %8, align 8, !tbaa !5
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp eq i32 %19, -558043678
  br i1 %20, label %21, label %30

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %22, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ManagedDictionary, ptr %23, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = load i32, ptr %25, align 4, !tbaa !9
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ManagedDictionary, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  store ptr %29, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %30

30:                                               ; preds = %21, %2
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.BrotliEncoderStateStruct, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.BrotliEncoderParams, ptr %32, i32 0, i32 10
  store ptr %33, ptr %8, align 8, !tbaa !5
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp eq i32 %34, -558043680
  br i1 %35, label %39, label %36

36:                                               ; preds = %30
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = icmp eq i32 %37, -558043677
  br i1 %38, label %39, label %51

39:                                               ; preds = %36, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %40, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = call i32 @AttachPreparedDictionary(ptr noundef %42, ptr noundef %43)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %39
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %48

47:                                               ; preds = %39
  store i32 0, ptr %11, align 4
  br label %48

48:                                               ; preds = %47, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %49 = load i32, ptr %11, align 4
  switch i32 %49, label %182 [
    i32 0, label %50
  ]

50:                                               ; preds = %48
  br label %181

51:                                               ; preds = %36
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = icmp eq i32 %52, -558043679
  br i1 %53, label %54, label %179

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %55, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %56, i32 0, i32 2
  %58 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !14
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %86, label %61

61:                                               ; preds = %54
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %62, i32 0, i32 2
  %64 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %63, i32 0, i32 1
  %65 = load i8, ptr %64, align 4, !tbaa !22
  %66 = zext i8 %65 to i32
  %67 = icmp eq i32 %66, 1
  br i1 %67, label %68, label %86

68:                                               ; preds = %61
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %69, i32 0, i32 2
  %71 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %70, i32 0, i32 3
  %72 = getelementptr inbounds [64 x ptr], ptr %71, i64 0, i64 0
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.BrotliEncoderDictionary, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = icmp eq ptr %75, @kStaticDictionaryHashWords
  br i1 %76, label %77, label %86

77:                                               ; preds = %68
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %78, i32 0, i32 2
  %80 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %79, i32 0, i32 3
  %81 = getelementptr inbounds [64 x ptr], ptr %80, i64 0, i64 0
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.BrotliEncoderDictionary, ptr %82, i32 0, i32 5
  %84 = load ptr, ptr %83, align 8, !tbaa !24
  %85 = icmp eq ptr %84, @kStaticDictionaryHashLengths
  br label %86

86:                                               ; preds = %77, %68, %61, %54
  %87 = phi i1 [ false, %68 ], [ false, %61 ], [ false, %54 ], [ %85, %77 ]
  %88 = zext i1 %87 to i32
  store i32 %88, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %89, i32 0, i32 2
  %91 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %90, i32 0, i32 0
  %92 = load i32, ptr %91, align 8, !tbaa !14
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %119, label %94

94:                                               ; preds = %86
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %95, i32 0, i32 2
  %97 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %96, i32 0, i32 1
  %98 = load i8, ptr %97, align 4, !tbaa !22
  %99 = zext i8 %98 to i32
  %100 = icmp eq i32 %99, 1
  br i1 %100, label %101, label %119

101:                                              ; preds = %94
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %102, i32 0, i32 2
  %104 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %103, i32 0, i32 3
  %105 = getelementptr inbounds [64 x ptr], ptr %104, i64 0, i64 0
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.BrotliEncoderDictionary, ptr %106, i32 0, i32 4
  %108 = load ptr, ptr %107, align 8, !tbaa !23
  %109 = icmp eq ptr %108, @kStaticDictionaryHashWords
  br i1 %109, label %110, label %119

110:                                              ; preds = %101
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %111, i32 0, i32 2
  %113 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %112, i32 0, i32 3
  %114 = getelementptr inbounds [64 x ptr], ptr %113, i64 0, i64 0
  %115 = load ptr, ptr %114, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.BrotliEncoderDictionary, ptr %115, i32 0, i32 5
  %117 = load ptr, ptr %116, align 8, !tbaa !24
  %118 = icmp eq ptr %117, @kStaticDictionaryHashLengths
  br label %119

119:                                              ; preds = %110, %101, %94, %86
  %120 = phi i1 [ false, %101 ], [ false, %94 ], [ false, %86 ], [ %118, %110 ]
  %121 = zext i1 %120 to i32
  store i32 %121, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.BrotliEncoderStateStruct, ptr %122, i32 0, i32 36
  %124 = load i32, ptr %123, align 4, !tbaa !25
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %127

126:                                              ; preds = %119
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %176

127:                                              ; preds = %119
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %128, i32 0, i32 3
  %130 = load i32, ptr %129, align 8, !tbaa !34
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %131, i32 0, i32 3
  %133 = load i32, ptr %132, align 8, !tbaa !34
  %134 = call i32 @brotli_min_int(i32 noundef %130, i32 noundef %133)
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %135, i32 0, i32 3
  store i32 %134, ptr %136, align 8, !tbaa !34
  store i64 0, ptr %15, align 8, !tbaa !35
  br label %137

137:                                              ; preds = %157, %127
  %138 = load i64, ptr %15, align 8, !tbaa !35
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %139, i32 0, i32 1
  %141 = getelementptr inbounds %struct.CompoundDictionary, ptr %140, i32 0, i32 0
  %142 = load i64, ptr %141, align 8, !tbaa !36
  %143 = icmp ult i64 %138, %142
  br i1 %143, label %144, label %160

144:                                              ; preds = %137
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %145, i32 0, i32 1
  %147 = load ptr, ptr %12, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %147, i32 0, i32 1
  %149 = getelementptr inbounds %struct.CompoundDictionary, ptr %148, i32 0, i32 2
  %150 = load i64, ptr %15, align 8, !tbaa !35
  %151 = getelementptr inbounds [16 x ptr], ptr %149, i64 0, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !5
  %153 = call i32 @AttachPreparedDictionary(ptr noundef %146, ptr noundef %152)
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %156, label %155

155:                                              ; preds = %144
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %176

156:                                              ; preds = %144
  br label %157

157:                                              ; preds = %156
  %158 = load i64, ptr %15, align 8, !tbaa !35
  %159 = add i64 %158, 1
  store i64 %159, ptr %15, align 8, !tbaa !35
  br label %137, !llvm.loop !37

160:                                              ; preds = %137
  %161 = load i32, ptr %14, align 4, !tbaa !9
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %175, label %163

163:                                              ; preds = %160
  %164 = load i32, ptr %13, align 4, !tbaa !9
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %167, label %166

166:                                              ; preds = %163
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %176

167:                                              ; preds = %163
  %168 = load ptr, ptr %8, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %168, i32 0, i32 2
  %170 = load ptr, ptr %12, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %170, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %169, ptr align 8 %171, i64 768, i1 false), !tbaa.struct !39
  %172 = load ptr, ptr %8, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.SharedEncoderDictionary, ptr %172, i32 0, i32 2
  %174 = getelementptr inbounds %struct.ContextualEncoderDictionary, ptr %173, i32 0, i32 4
  store i64 0, ptr %174, align 8, !tbaa !41
  br label %175

175:                                              ; preds = %167, %160
  store i32 0, ptr %11, align 4
  br label %176

176:                                              ; preds = %175, %166, %155, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %177 = load i32, ptr %11, align 4
  switch i32 %177, label %182 [
    i32 0, label %178
  ]

178:                                              ; preds = %176
  br label %180

179:                                              ; preds = %51
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %182

180:                                              ; preds = %178
  br label %181

181:                                              ; preds = %180, %50
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %182

182:                                              ; preds = %181, %179, %176, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %183 = load i32, ptr %3, align 4
  ret i32 %183
}

declare hidden i32 @AttachPreparedDictionary(ptr noundef, ptr noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @brotli_min_int(i32 noundef, i32 noundef) #3

; 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) #4

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 = { "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 = { alwaysinline 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 32}
!12 = !{!"ManagedDictionary", !10, i64 0, !13, i64 8, !6, i64 32}
!13 = !{!"MemoryManager", !6, i64 0, !6, i64 8, !6, i64 16}
!14 = !{!15, !10, i64 544}
!15 = !{!"SharedEncoderDictionary", !10, i64 0, !16, i64 8, !18, i64 544, !10, i64 1312}
!16 = !{!"CompoundDictionary", !17, i64 0, !17, i64 8, !7, i64 16, !7, i64 144, !7, i64 272, !17, i64 400, !7, i64 408}
!17 = !{!"long", !7, i64 0}
!18 = !{!"ContextualEncoderDictionary", !10, i64 0, !7, i64 4, !7, i64 5, !7, i64 72, !17, i64 584, !19, i64 592, !6, i64 760}
!19 = !{!"BrotliEncoderDictionary", !6, i64 0, !10, i64 8, !10, i64 12, !17, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !20, i64 56, !10, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !17, i64 128, !6, i64 136, !17, i64 144, !6, i64 152, !6, i64 160}
!20 = !{!"BrotliTrie", !6, i64 0, !17, i64 8, !17, i64 16, !21, i64 24}
!21 = !{!"BrotliTrieNode", !7, i64 0, !7, i64 1, !7, i64 2, !10, i64 4, !10, i64 8}
!22 = !{!15, !7, i64 548}
!23 = !{!19, !6, i64 24}
!24 = !{!19, !6, i64 32}
!25 = !{!26, !10, i64 6972}
!26 = !{!"BrotliEncoderStateStruct", !27, i64 0, !13, i64 1400, !17, i64 1424, !30, i64 1432, !17, i64 1472, !6, i64 1480, !17, i64 1488, !17, i64 1496, !17, i64 1504, !17, i64 1512, !17, i64 1520, !7, i64 1528, !7, i64 1592, !31, i64 1608, !7, i64 1610, !7, i64 1611, !7, i64 1612, !7, i64 1613, !17, i64 1616, !6, i64 1624, !32, i64 1632, !7, i64 2768, !6, i64 6864, !17, i64 6872, !6, i64 6880, !6, i64 6888, !6, i64 6896, !6, i64 6904, !17, i64 6912, !6, i64 6920, !17, i64 6928, !17, i64 6936, !7, i64 6944, !10, i64 6960, !10, i64 6964, !10, i64 6968, !10, i64 6972}
!27 = !{!"BrotliEncoderParams", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !17, i64 16, !17, i64 24, !10, i64 32, !10, i64 36, !28, i64 40, !29, i64 56, !15, i64 80}
!28 = !{!"BrotliHasherParams", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!29 = !{!"BrotliDistanceParams", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !17, i64 16}
!30 = !{!"RingBuffer", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32}
!31 = !{!"short", !7, i64 0}
!32 = !{!"", !33, i64 0, !7, i64 80}
!33 = !{!"", !7, i64 0, !10, i64 32, !17, i64 40, !17, i64 48, !28, i64 56, !10, i64 72}
!34 = !{!15, !10, i64 1312}
!35 = !{!17, !17, i64 0}
!36 = !{!15, !17, i64 8}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{i64 0, i64 4, !9, i64 4, i64 1, !40, i64 5, i64 64, !40, i64 72, i64 512, !40, i64 584, i64 8, !35, i64 592, i64 8, !5, i64 600, i64 4, !9, i64 604, i64 4, !9, i64 608, i64 8, !35, i64 616, i64 8, !5, i64 624, i64 8, !5, i64 632, i64 8, !5, i64 640, i64 8, !5, i64 648, i64 8, !5, i64 656, i64 8, !35, i64 664, i64 8, !35, i64 672, i64 1, !40, i64 673, i64 1, !40, i64 674, i64 1, !40, i64 676, i64 4, !9, i64 680, i64 4, !9, i64 688, i64 4, !9, i64 696, i64 8, !5, i64 704, i64 8, !5, i64 712, i64 8, !5, i64 720, i64 8, !35, i64 728, i64 8, !5, i64 736, i64 8, !35, i64 744, i64 8, !5, i64 752, i64 8, !5, i64 760, i64 8, !5}
!40 = !{!7, !7, i64 0}
!41 = !{!15, !17, i64 1128}


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

@kStaticDictionaryHashWords = external constant [32768 x i16], align 16
@kStaticDictionaryHashLengths = external constant [32768 x i8], align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @BrotliEncoderAttachPreparedDictionary(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %4 = icmp eq i32 %3, -558043678
  br i1 %4, label %5, label %9

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = load i32, ptr %7, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %5, %2
  %.043 = phi i32 [ %8, %5 ], [ %3, %2 ]
  %.042 = phi ptr [ %7, %5 ], [ %1, %2 ]
  switch i32 %.043, label %.critedge [
    i32 -558043677, label %10
    i32 -558043680, label %10
    i32 -558043679, label %13
  ]

10:                                               ; preds = %9, %9
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = tail call i32 @AttachPreparedDictionary(ptr noundef nonnull %11, ptr noundef nonnull %.042) #4
  %.not50.not = icmp eq i32 %12, 0
  br i1 %.not50.not, label %.critedge, label %73

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 624
  %15 = load i32, ptr %14, align 8, !tbaa !13
  %.not = icmp eq i32 %15, 0
  br i1 %.not, label %16, label %30

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %0, i64 628
  %18 = load i8, ptr %17, align 4, !tbaa !21
  %19 = icmp eq i8 %18, 1
  br i1 %19, label %20, label %30

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 696
  %22 = load ptr, ptr %21, align 8, !tbaa !22
  %23 = getelementptr inbounds i8, ptr %22, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !23
  %25 = icmp eq ptr %24, @kStaticDictionaryHashWords
  br i1 %25, label %26, label %30

26:                                               ; preds = %20
  %27 = getelementptr inbounds i8, ptr %22, i64 32
  %28 = load ptr, ptr %27, align 8, !tbaa !24
  %29 = icmp eq ptr %28, @kStaticDictionaryHashLengths
  br label %30

30:                                               ; preds = %26, %20, %16, %13
  %31 = phi i1 [ false, %20 ], [ false, %16 ], [ false, %13 ], [ %29, %26 ]
  %32 = getelementptr inbounds i8, ptr %.042, i64 544
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %.not47 = icmp eq i32 %33, 0
  br i1 %.not47, label %34, label %48

34:                                               ; preds = %30
  %35 = getelementptr inbounds i8, ptr %.042, i64 548
  %36 = load i8, ptr %35, align 4, !tbaa !21
  %37 = icmp eq i8 %36, 1
  br i1 %37, label %38, label %48

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %.042, i64 616
  %40 = load ptr, ptr %39, align 8, !tbaa !22
  %41 = getelementptr inbounds i8, ptr %40, i64 24
  %42 = load ptr, ptr %41, align 8, !tbaa !23
  %43 = icmp eq ptr %42, @kStaticDictionaryHashWords
  br i1 %43, label %44, label %48

44:                                               ; preds = %38
  %45 = getelementptr inbounds i8, ptr %40, i64 32
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %47 = icmp eq ptr %46, @kStaticDictionaryHashLengths
  br label %48

48:                                               ; preds = %44, %38, %34, %30
  %49 = phi i1 [ false, %38 ], [ false, %34 ], [ false, %30 ], [ %47, %44 ]
  %50 = getelementptr inbounds i8, ptr %0, i64 6972
  %51 = load i32, ptr %50, align 4, !tbaa !25
  %.not48 = icmp eq i32 %51, 0
  br i1 %.not48, label %52, label %.critedge

52:                                               ; preds = %48
  %53 = getelementptr inbounds i8, ptr %0, i64 1392
  %54 = load i32, ptr %53, align 8, !tbaa !34
  %55 = getelementptr inbounds i8, ptr %.042, i64 1312
  %56 = load i32, ptr %55, align 8, !tbaa !34
  %57 = tail call i32 @brotli_min_int(i32 noundef %54, i32 noundef %56)
  store i32 %57, ptr %53, align 8, !tbaa !34
  %58 = getelementptr inbounds i8, ptr %.042, i64 8
  %59 = load i64, ptr %58, align 8, !tbaa !35
  %.not52 = icmp eq i64 %59, 0
  br i1 %.not52, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %52
  %60 = getelementptr inbounds i8, ptr %0, i64 88
  %61 = getelementptr inbounds i8, ptr %.042, i64 24
  br label %66

62:                                               ; preds = %66
  %63 = add nuw i64 %.051, 1
  %64 = load i64, ptr %58, align 8, !tbaa !35
  %65 = icmp ult i64 %63, %64
  br i1 %65, label %66, label %._crit_edge, !llvm.loop !36

66:                                               ; preds = %.lr.ph, %62
  %.051 = phi i64 [ 0, %.lr.ph ], [ %63, %62 ]
  %67 = getelementptr inbounds [16 x ptr], ptr %61, i64 0, i64 %.051
  %68 = load ptr, ptr %67, align 8, !tbaa !22
  %69 = tail call i32 @AttachPreparedDictionary(ptr noundef nonnull %60, ptr noundef %68) #4
  %.not49 = icmp eq i32 %69, 0
  br i1 %.not49, label %.critedge, label %62

._crit_edge:                                      ; preds = %62, %52
  br i1 %49, label %73, label %70

70:                                               ; preds = %._crit_edge
  br i1 %31, label %71, label %.critedge

71:                                               ; preds = %70
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(768) %14, ptr noundef nonnull align 8 dereferenceable(768) %32, i64 768, i1 false), !tbaa.struct !38
  %72 = getelementptr inbounds i8, ptr %0, i64 1208
  store i64 0, ptr %72, align 8, !tbaa !41
  br label %73

73:                                               ; preds = %71, %._crit_edge, %10
  br label %.critedge

.critedge:                                        ; preds = %66, %48, %70, %9, %10, %73
  %.2 = phi i32 [ 1, %73 ], [ 0, %10 ], [ 0, %9 ], [ 0, %70 ], [ 0, %48 ], [ 0, %66 ]
  ret i32 %.2
}

declare hidden i32 @AttachPreparedDictionary(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @brotli_min_int(i32 noundef, i32 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

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 = { "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 = { alwaysinline 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 32}
!10 = !{!"ManagedDictionary", !6, i64 0, !11, i64 8, !12, i64 32}
!11 = !{!"MemoryManager", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 544}
!14 = !{!"SharedEncoderDictionary", !6, i64 0, !15, i64 8, !17, i64 544, !6, i64 1312}
!15 = !{!"CompoundDictionary", !16, i64 0, !16, i64 8, !7, i64 16, !7, i64 144, !7, i64 272, !16, i64 400, !7, i64 408}
!16 = !{!"long", !7, i64 0}
!17 = !{!"ContextualEncoderDictionary", !6, i64 0, !7, i64 4, !7, i64 5, !7, i64 72, !16, i64 584, !18, i64 592, !12, i64 760}
!18 = !{!"BrotliEncoderDictionary", !12, i64 0, !6, i64 8, !6, i64 12, !16, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !19, i64 56, !6, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !16, i64 128, !12, i64 136, !16, i64 144, !12, i64 152, !12, i64 160}
!19 = !{!"BrotliTrie", !12, i64 0, !16, i64 8, !16, i64 16, !20, i64 24}
!20 = !{!"BrotliTrieNode", !7, i64 0, !7, i64 1, !7, i64 2, !6, i64 4, !6, i64 8}
!21 = !{!14, !7, i64 548}
!22 = !{!12, !12, i64 0}
!23 = !{!18, !12, i64 24}
!24 = !{!18, !12, i64 32}
!25 = !{!26, !6, i64 6972}
!26 = !{!"BrotliEncoderStateStruct", !27, i64 0, !11, i64 1400, !16, i64 1424, !30, i64 1432, !16, i64 1472, !12, i64 1480, !16, i64 1488, !16, i64 1496, !16, i64 1504, !16, i64 1512, !16, i64 1520, !7, i64 1528, !7, i64 1592, !31, i64 1608, !7, i64 1610, !7, i64 1611, !7, i64 1612, !7, i64 1613, !16, i64 1616, !12, i64 1624, !32, i64 1632, !7, i64 2768, !12, i64 6864, !16, i64 6872, !12, i64 6880, !12, i64 6888, !12, i64 6896, !12, i64 6904, !16, i64 6912, !12, i64 6920, !16, i64 6928, !16, i64 6936, !7, i64 6944, !6, i64 6960, !6, i64 6964, !6, i64 6968, !6, i64 6972}
!27 = !{!"BrotliEncoderParams", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !16, i64 16, !16, i64 24, !6, i64 32, !6, i64 36, !28, i64 40, !29, i64 56, !14, i64 80}
!28 = !{!"BrotliHasherParams", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!29 = !{!"BrotliDistanceParams", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !16, i64 16}
!30 = !{!"RingBuffer", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !12, i64 24, !12, i64 32}
!31 = !{!"short", !7, i64 0}
!32 = !{!"", !33, i64 0, !7, i64 80}
!33 = !{!"", !7, i64 0, !6, i64 32, !16, i64 40, !16, i64 48, !28, i64 56, !6, i64 72}
!34 = !{!14, !6, i64 1312}
!35 = !{!14, !16, i64 8}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{i64 0, i64 4, !5, i64 4, i64 1, !39, i64 5, i64 64, !39, i64 72, i64 512, !39, i64 584, i64 8, !40, i64 592, i64 8, !22, i64 600, i64 4, !5, i64 604, i64 4, !5, i64 608, i64 8, !40, i64 616, i64 8, !22, i64 624, i64 8, !22, i64 632, i64 8, !22, i64 640, i64 8, !22, i64 648, i64 8, !22, i64 656, i64 8, !40, i64 664, i64 8, !40, i64 672, i64 1, !39, i64 673, i64 1, !39, i64 674, i64 1, !39, i64 676, i64 4, !5, i64 680, i64 4, !5, i64 688, i64 4, !5, i64 696, i64 8, !22, i64 704, i64 8, !22, i64 712, i64 8, !22, i64 720, i64 8, !40, i64 728, i64 8, !22, i64 736, i64 8, !40, i64 744, i64 8, !22, i64 752, i64 8, !22, i64 760, i64 8, !22}
!39 = !{!7, !7, i64 0}
!40 = !{!16, !16, i64 0}
!41 = !{!14, !16, i64 1128}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass