; LLVM IR from caryll/otfcc :: lib/table/otl/subtables/chaining (read)

; 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.otfcc_HandlePackage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otfcc_Handle = type { i32, i16, ptr }
%struct.otl_ChainingRule = type { i16, i16, i16, ptr, i16, ptr }
%struct.otl_ChainLookupApplication = type { i16, %struct.otfcc_Handle }

@otfcc_iHandle = external constant %struct.otfcc_HandlePackage, align 8

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 noundef) #1

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

; 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 ptr @GeneralReadContextualRule(ptr noundef %0, i32 noundef %1, i32 noundef %2, i16 noundef zeroext %3, i1 noundef zeroext %4, ptr noundef %5, i16 noundef zeroext %6, ptr noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i16, align 2
  %14 = alloca i8, align 1
  %15 = alloca ptr, align 8
  %16 = alloca i16, align 2
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i16, align 2
  %20 = alloca i16, align 2
  %21 = alloca i16, align 2
  %22 = alloca i16, align 2
  %23 = alloca i16, align 2
  %24 = alloca i32, align 4
  %25 = alloca i16, align 2
  %26 = alloca %struct.otfcc_Handle, align 8
  %27 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !9
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i16 %3, ptr %13, align 2, !tbaa !11
  %28 = zext i1 %4 to i8
  store i8 %28, ptr %14, align 1, !tbaa !13
  store ptr %5, ptr %15, align 8, !tbaa !5
  store i16 %6, ptr %16, align 2, !tbaa !11
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %29 = call ptr @__caryll_allocate_clean(i64 noundef 32, i64 noundef 83)
  store ptr %29, ptr %18, align 8, !tbaa !5
  %30 = load ptr, ptr %18, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.otl_ChainingRule, ptr %30, i32 0, i32 3
  store ptr null, ptr %31, align 8, !tbaa !15
  %32 = load ptr, ptr %18, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.otl_ChainingRule, ptr %32, i32 0, i32 5
  store ptr null, ptr %33, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 2, ptr %19) #4
  %34 = load i8, ptr %14, align 1, !tbaa !13, !range !18, !noundef !19
  %35 = trunc i8 %34 to i1
  %36 = zext i1 %35 to i64
  %37 = select i1 %35, i32 1, i32 0
  %38 = trunc i32 %37 to i16
  store i16 %38, ptr %19, align 2, !tbaa !11
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = load i32, ptr %12, align 4, !tbaa !9
  %41 = add i32 %40, 4
  %42 = icmp ult i32 %39, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %8
  br label %243

44:                                               ; preds = %8
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = load i32, ptr %12, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %45, i64 %47
  %49 = call zeroext i16 @read_16u(ptr noundef %48)
  store i16 %49, ptr %20, align 2, !tbaa !11
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = load i32, ptr %12, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %50, i64 %52
  %54 = getelementptr inbounds i8, ptr %53, i64 2
  %55 = call zeroext i16 @read_16u(ptr noundef %54)
  store i16 %55, ptr %21, align 2, !tbaa !11
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %12, align 4, !tbaa !9
  %58 = add i32 %57, 4
  %59 = load i16, ptr %20, align 2, !tbaa !11
  %60 = zext i16 %59 to i32
  %61 = mul nsw i32 2, %60
  %62 = add i32 %58, %61
  %63 = load i16, ptr %21, align 2, !tbaa !11
  %64 = zext i16 %63 to i32
  %65 = mul nsw i32 4, %64
  %66 = add i32 %62, %65
  %67 = icmp ult i32 %56, %66
  br i1 %67, label %68, label %69

68:                                               ; preds = %44
  br label %243

69:                                               ; preds = %44
  %70 = load i16, ptr %20, align 2, !tbaa !11
  %71 = load ptr, ptr %18, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.otl_ChainingRule, ptr %71, i32 0, i32 0
  store i16 %70, ptr %72, align 8, !tbaa !20
  %73 = load ptr, ptr %18, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.otl_ChainingRule, ptr %73, i32 0, i32 1
  store i16 0, ptr %74, align 2, !tbaa !21
  %75 = load i16, ptr %20, align 2, !tbaa !11
  %76 = load ptr, ptr %18, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.otl_ChainingRule, ptr %76, i32 0, i32 2
  store i16 %75, ptr %77, align 4, !tbaa !22
  %78 = load ptr, ptr %18, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.otl_ChainingRule, ptr %78, i32 0, i32 0
  %80 = load i16, ptr %79, align 8, !tbaa !20
  %81 = zext i16 %80 to i64
  %82 = mul i64 8, %81
  %83 = call ptr @__caryll_allocate_clean(i64 noundef %82, i64 noundef 98)
  %84 = load ptr, ptr %18, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.otl_ChainingRule, ptr %84, i32 0, i32 3
  store ptr %83, ptr %85, align 8, !tbaa !15
  store i16 0, ptr %22, align 2, !tbaa !11
  %86 = load i8, ptr %14, align 1, !tbaa !13, !range !18, !noundef !19
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %104

88:                                               ; preds = %69
  %89 = load ptr, ptr %15, align 8, !tbaa !5
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !9
  %92 = load i16, ptr %13, align 2, !tbaa !11
  %93 = load i32, ptr %12, align 4, !tbaa !9
  %94 = load i16, ptr %16, align 2, !tbaa !11
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = call ptr %89(ptr noundef %90, i32 noundef %91, i16 noundef zeroext %92, i32 noundef %93, i16 noundef zeroext 2, i16 noundef zeroext %94, ptr noundef %95)
  %97 = load ptr, ptr %18, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.otl_ChainingRule, ptr %97, i32 0, i32 3
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = load i16, ptr %22, align 2, !tbaa !11
  %101 = add i16 %100, 1
  store i16 %101, ptr %22, align 2, !tbaa !11
  %102 = zext i16 %100 to i64
  %103 = getelementptr inbounds ptr, ptr %99, i64 %102
  store ptr %96, ptr %103, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %88, %69
  call void @llvm.lifetime.start.p0(i64 2, ptr %23) #4
  store i16 0, ptr %23, align 2, !tbaa !11
  br label %105

105:                                              ; preds = %144, %104
  %106 = load i16, ptr %23, align 2, !tbaa !11
  %107 = zext i16 %106 to i32
  %108 = load i16, ptr %20, align 2, !tbaa !11
  %109 = zext i16 %108 to i32
  %110 = load i16, ptr %19, align 2, !tbaa !11
  %111 = zext i16 %110 to i32
  %112 = sub nsw i32 %109, %111
  %113 = icmp slt i32 %107, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 2, ptr %23) #4
  br label %147

115:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load i32, ptr %12, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  %120 = getelementptr inbounds i8, ptr %119, i64 4
  %121 = load i16, ptr %23, align 2, !tbaa !11
  %122 = zext i16 %121 to i32
  %123 = mul nsw i32 %122, 2
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds i8, ptr %120, i64 %124
  %126 = call zeroext i16 @read_16u(ptr noundef %125)
  %127 = zext i16 %126 to i32
  store i32 %127, ptr %24, align 4, !tbaa !9
  %128 = load ptr, ptr %15, align 8, !tbaa !5
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = load i32, ptr %11, align 4, !tbaa !9
  %131 = load i32, ptr %24, align 4, !tbaa !9
  %132 = trunc i32 %131 to i16
  %133 = load i32, ptr %12, align 4, !tbaa !9
  %134 = load i16, ptr %16, align 2, !tbaa !11
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = call ptr %128(ptr noundef %129, i32 noundef %130, i16 noundef zeroext %132, i32 noundef %133, i16 noundef zeroext 2, i16 noundef zeroext %134, ptr noundef %135)
  %137 = load ptr, ptr %18, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.otl_ChainingRule, ptr %137, i32 0, i32 3
  %139 = load ptr, ptr %138, align 8, !tbaa !15
  %140 = load i16, ptr %22, align 2, !tbaa !11
  %141 = add i16 %140, 1
  store i16 %141, ptr %22, align 2, !tbaa !11
  %142 = zext i16 %140 to i64
  %143 = getelementptr inbounds ptr, ptr %139, i64 %142
  store ptr %136, ptr %143, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %144

144:                                              ; preds = %115
  %145 = load i16, ptr %23, align 2, !tbaa !11
  %146 = add i16 %145, 1
  store i16 %146, ptr %23, align 2, !tbaa !11
  br label %105, !llvm.loop !23

147:                                              ; preds = %114
  %148 = load i16, ptr %21, align 2, !tbaa !11
  %149 = load ptr, ptr %18, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.otl_ChainingRule, ptr %149, i32 0, i32 4
  store i16 %148, ptr %150, align 8, !tbaa !25
  %151 = load ptr, ptr %18, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.otl_ChainingRule, ptr %151, i32 0, i32 4
  %153 = load i16, ptr %152, align 8, !tbaa !25
  %154 = zext i16 %153 to i64
  %155 = mul i64 24, %154
  %156 = call ptr @__caryll_allocate_clean(i64 noundef %155, i64 noundef 108)
  %157 = load ptr, ptr %18, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.otl_ChainingRule, ptr %157, i32 0, i32 5
  store ptr %156, ptr %158, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 2, ptr %25) #4
  store i16 0, ptr %25, align 2, !tbaa !11
  br label %159

159:                                              ; preds = %237, %147
  %160 = load i16, ptr %25, align 2, !tbaa !11
  %161 = zext i16 %160 to i32
  %162 = load i16, ptr %21, align 2, !tbaa !11
  %163 = zext i16 %162 to i32
  %164 = icmp slt i32 %161, %163
  br i1 %164, label %166, label %165

165:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 2, ptr %25) #4
  br label %240

166:                                              ; preds = %159
  %167 = load ptr, ptr %18, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.otl_ChainingRule, ptr %167, i32 0, i32 1
  %169 = load i16, ptr %168, align 2, !tbaa !21
  %170 = zext i16 %169 to i32
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = load i32, ptr %12, align 4, !tbaa !9
  %173 = zext i32 %172 to i64
  %174 = getelementptr inbounds i8, ptr %171, i64 %173
  %175 = getelementptr inbounds i8, ptr %174, i64 4
  %176 = load ptr, ptr %18, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.otl_ChainingRule, ptr %176, i32 0, i32 0
  %178 = load i16, ptr %177, align 8, !tbaa !20
  %179 = zext i16 %178 to i32
  %180 = load i16, ptr %19, align 2, !tbaa !11
  %181 = zext i16 %180 to i32
  %182 = sub nsw i32 %179, %181
  %183 = mul nsw i32 2, %182
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds i8, ptr %175, i64 %184
  %186 = load i16, ptr %25, align 2, !tbaa !11
  %187 = zext i16 %186 to i32
  %188 = mul nsw i32 %187, 4
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds i8, ptr %185, i64 %189
  %191 = call zeroext i16 @read_16u(ptr noundef %190)
  %192 = zext i16 %191 to i32
  %193 = add nsw i32 %170, %192
  %194 = trunc i32 %193 to i16
  %195 = load ptr, ptr %18, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.otl_ChainingRule, ptr %195, i32 0, i32 5
  %197 = load ptr, ptr %196, align 8, !tbaa !17
  %198 = load i16, ptr %25, align 2, !tbaa !11
  %199 = zext i16 %198 to i64
  %200 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %197, i64 %199
  %201 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %200, i32 0, i32 0
  store i16 %194, ptr %201, align 8, !tbaa !26
  %202 = load ptr, ptr %18, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.otl_ChainingRule, ptr %202, i32 0, i32 5
  %204 = load ptr, ptr %203, align 8, !tbaa !17
  %205 = load i16, ptr %25, align 2, !tbaa !11
  %206 = zext i16 %205 to i64
  %207 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %204, i64 %206
  %208 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %207, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #4
  %209 = load ptr, ptr getelementptr inbounds (%struct.otfcc_HandlePackage, ptr @otfcc_iHandle, i32 0, i32 8), align 8, !tbaa !29
  %210 = load ptr, ptr %10, align 8, !tbaa !5
  %211 = load i32, ptr %12, align 4, !tbaa !9
  %212 = zext i32 %211 to i64
  %213 = getelementptr inbounds i8, ptr %210, i64 %212
  %214 = getelementptr inbounds i8, ptr %213, i64 4
  %215 = load ptr, ptr %18, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.otl_ChainingRule, ptr %215, i32 0, i32 0
  %217 = load i16, ptr %216, align 8, !tbaa !20
  %218 = zext i16 %217 to i32
  %219 = load i16, ptr %19, align 2, !tbaa !11
  %220 = zext i16 %219 to i32
  %221 = sub nsw i32 %218, %220
  %222 = mul nsw i32 2, %221
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds i8, ptr %214, i64 %223
  %225 = load i16, ptr %25, align 2, !tbaa !11
  %226 = zext i16 %225 to i32
  %227 = mul nsw i32 %226, 4
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds i8, ptr %224, i64 %228
  %230 = getelementptr inbounds i8, ptr %229, i64 2
  %231 = call zeroext i16 @read_16u(ptr noundef %230)
  %232 = call { i64, ptr } %209(i16 noundef zeroext %231)
  %233 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 0
  %234 = extractvalue { i64, ptr } %232, 0
  store i64 %234, ptr %233, align 8
  %235 = getelementptr inbounds { i64, ptr }, ptr %26, i32 0, i32 1
  %236 = extractvalue { i64, ptr } %232, 1
  store ptr %236, ptr %235, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %208, ptr align 8 %26, i64 16, i1 false), !tbaa.struct !31
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #4
  br label %237

237:                                              ; preds = %166
  %238 = load i16, ptr %25, align 2, !tbaa !11
  %239 = add i16 %238, 1
  store i16 %239, ptr %25, align 2, !tbaa !11
  br label %159, !llvm.loop !32

240:                                              ; preds = %165
  %241 = load ptr, ptr %18, align 8, !tbaa !5
  call void @reverseBacktracks(ptr noundef %241)
  %242 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %242, ptr %9, align 8
  store i32 1, ptr %27, align 4
  br label %245

243:                                              ; preds = %68, %43
  %244 = load ptr, ptr %18, align 8, !tbaa !5
  call void @deleteRule(ptr noundef %244)
  store ptr null, ptr %18, align 8, !tbaa !5
  store ptr null, ptr %9, align 8
  store i32 1, ptr %27, align 4
  br label %245

245:                                              ; preds = %243, %240
  call void @llvm.lifetime.end.p0(i64 2, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %246 = load ptr, ptr %9, align 8
  ret ptr %246
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @read_16u(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @reverseBacktracks(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @deleteRule(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"", !12, i64 0, !12, i64 2, !12, i64 4, !6, i64 8, !12, i64 16, !6, i64 24}
!17 = !{!16, !6, i64 24}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!16, !12, i64 0}
!21 = !{!16, !12, i64 2}
!22 = !{!16, !12, i64 4}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!16, !12, i64 16}
!26 = !{!27, !12, i64 0}
!27 = !{!"", !12, i64 0, !28, i64 8}
!28 = !{!"otfcc_Handle", !10, i64 0, !12, i64 4, !6, i64 8}
!29 = !{!30, !6, i64 64}
!30 = !{!"otfcc_HandlePackage", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!31 = !{i64 0, i64 4, !9, i64 4, i64 2, !11, i64 8, i64 8, !5}
!32 = distinct !{!32, !24}


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

%struct.otfcc_HandlePackage = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.otl_ChainLookupApplication = type { i16, %struct.otfcc_Handle }
%struct.otfcc_Handle = type { i32, i16, ptr }

@otfcc_iHandle = external local_unnamed_addr constant %struct.otfcc_HandlePackage, align 8

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__caryll_allocate_clean(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @GeneralReadContextualRule(ptr noundef %0, i32 noundef %1, i32 noundef %2, i16 noundef zeroext %3, i1 noundef zeroext %4, ptr nocapture noundef readonly %5, i16 noundef zeroext %6, ptr noundef %7) local_unnamed_addr #1 {
  %9 = tail call ptr @__caryll_allocate_clean(i64 noundef 32, i64 noundef 83)
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr null, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %9, i64 24
  store ptr null, ptr %11, align 8, !tbaa !11
  %12 = add i32 %2, 4
  %13 = icmp ugt i32 %12, %1
  br i1 %13, label %88, label %14

14:                                               ; preds = %8
  %15 = zext i32 %2 to i64
  %16 = getelementptr inbounds i8, ptr %0, i64 %15
  %17 = tail call zeroext i16 @read_16u(ptr noundef %16)
  %18 = getelementptr inbounds i8, ptr %16, i64 2
  %19 = tail call zeroext i16 @read_16u(ptr noundef nonnull %18)
  %20 = zext i16 %17 to i32
  %21 = shl nuw nsw i32 %20, 1
  %22 = add i32 %21, %12
  %23 = zext i16 %19 to i32
  %24 = shl nuw nsw i32 %23, 2
  %25 = add i32 %22, %24
  %26 = icmp ugt i32 %25, %1
  br i1 %26, label %88, label %27

27:                                               ; preds = %14
  store i16 %17, ptr %9, align 8, !tbaa !12
  %28 = getelementptr inbounds i8, ptr %9, i64 2
  store i16 0, ptr %28, align 2, !tbaa !13
  %29 = getelementptr inbounds i8, ptr %9, i64 4
  store i16 %17, ptr %29, align 4, !tbaa !14
  %30 = zext i16 %17 to i64
  %31 = shl nuw nsw i64 %30, 3
  %32 = tail call ptr @__caryll_allocate_clean(i64 noundef %31, i64 noundef 98)
  store ptr %32, ptr %10, align 8, !tbaa !5
  br i1 %4, label %33, label %36

33:                                               ; preds = %27
  %34 = tail call ptr %5(ptr noundef %0, i32 noundef %1, i16 noundef zeroext %3, i32 noundef %2, i16 noundef zeroext 2, i16 noundef zeroext %6, ptr noundef %7) #2
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %34, ptr %35, align 8, !tbaa !15
  br label %36

36:                                               ; preds = %33, %27
  %.072 = phi i16 [ 1, %33 ], [ 0, %27 ]
  %37 = zext i1 %4 to i32
  %38 = sub nsw i32 %20, %37
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %36
  %40 = getelementptr inbounds i8, ptr %16, i64 4
  br label %47

._crit_edge:                                      ; preds = %47, %36
  %41 = getelementptr inbounds i8, ptr %9, i64 16
  store i16 %19, ptr %41, align 8, !tbaa !16
  %42 = zext i16 %19 to i64
  %43 = mul nuw nsw i64 %42, 24
  %44 = tail call ptr @__caryll_allocate_clean(i64 noundef %43, i64 noundef 108)
  store ptr %44, ptr %11, align 8, !tbaa !11
  %.not = icmp eq i16 %19, 0
  br i1 %.not, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %._crit_edge
  %45 = getelementptr inbounds i8, ptr %16, i64 4
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @otfcc_iHandle, i64 64), align 8
  br label %61

47:                                               ; preds = %.lr.ph, %47
  %48 = phi i32 [ 0, %.lr.ph ], [ %59, %47 ]
  %.179 = phi i16 [ %.072, %.lr.ph ], [ %55, %47 ]
  %.07378 = phi i16 [ 0, %.lr.ph ], [ %58, %47 ]
  %49 = shl nuw nsw i32 %48, 1
  %50 = zext nneg i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %40, i64 %50
  %52 = tail call zeroext i16 @read_16u(ptr noundef nonnull %51)
  %53 = tail call ptr %5(ptr noundef %0, i32 noundef %1, i16 noundef zeroext %52, i32 noundef %2, i16 noundef zeroext 2, i16 noundef zeroext %6, ptr noundef %7) #2
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = add i16 %.179, 1
  %56 = zext i16 %.179 to i64
  %57 = getelementptr inbounds ptr, ptr %54, i64 %56
  store ptr %53, ptr %57, align 8, !tbaa !15
  %58 = add nuw i16 %.07378, 1
  %59 = zext i16 %58 to i32
  %60 = icmp ugt i32 %38, %59
  br i1 %60, label %47, label %._crit_edge, !llvm.loop !17

._crit_edge83:                                    ; preds = %61, %._crit_edge
  tail call void @reverseBacktracks(ptr noundef nonnull %9)
  br label %89

61:                                               ; preds = %.lr.ph82, %61
  %indvars.iv = phi i64 [ 0, %.lr.ph82 ], [ %indvars.iv.next, %61 ]
  %62 = load i16, ptr %28, align 2, !tbaa !13
  %63 = load i16, ptr %9, align 8, !tbaa !12
  %64 = zext i16 %63 to i32
  %65 = sub nsw i32 %64, %37
  %66 = shl nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %45, i64 %67
  %69 = shl nuw nsw i64 %indvars.iv, 2
  %70 = getelementptr inbounds i8, ptr %68, i64 %69
  %71 = tail call zeroext i16 @read_16u(ptr noundef nonnull %70)
  %72 = add i16 %71, %62
  %73 = load ptr, ptr %11, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %73, i64 %indvars.iv
  store i16 %72, ptr %74, align 8, !tbaa !19
  %75 = getelementptr inbounds %struct.otl_ChainLookupApplication, ptr %73, i64 %indvars.iv, i32 1
  %76 = load i16, ptr %9, align 8, !tbaa !12
  %77 = zext i16 %76 to i32
  %78 = sub nsw i32 %77, %37
  %79 = shl nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i8, ptr %45, i64 %80
  %82 = getelementptr inbounds i8, ptr %81, i64 %69
  %83 = getelementptr inbounds i8, ptr %82, i64 2
  %84 = tail call zeroext i16 @read_16u(ptr noundef nonnull %83)
  %85 = tail call { i64, ptr } %46(i16 noundef zeroext %84) #2
  %86 = extractvalue { i64, ptr } %85, 0
  %87 = extractvalue { i64, ptr } %85, 1
  store i64 %86, ptr %75, align 8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %75, i64 8
  store ptr %87, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %42
  br i1 %exitcond.not, label %._crit_edge83, label %61, !llvm.loop !23

88:                                               ; preds = %14, %8
  tail call void @deleteRule(ptr noundef nonnull %9)
  br label %89

89:                                               ; preds = %88, %._crit_edge83
  %.0 = phi ptr [ null, %88 ], [ %9, %._crit_edge83 ]
  ret ptr %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @read_16u(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @reverseBacktracks(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @deleteRule(ptr noundef) local_unnamed_addr #0

attributes #0 = { 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 #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 8}
!6 = !{!"", !7, i64 0, !7, i64 2, !7, i64 4, !10, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 2}
!14 = !{!6, !7, i64 4}
!15 = !{!10, !10, i64 0}
!16 = !{!6, !7, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !7, i64 0}
!20 = !{!"", !7, i64 0, !21, i64 8}
!21 = !{!"otfcc_Handle", !22, i64 0, !7, i64 4, !10, i64 8}
!22 = !{!"int", !8, i64 0}
!23 = distinct !{!23, !18}


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