; LLVM IR from paintdream/DontStarveLuaJIT :: src/luajit/src (lj_bcread)

; 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.LexState = type { ptr, ptr, %union.TValue, %union.TValue, ptr, ptr, i32, i32, i32, %struct.SBuf, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32 }
%union.TValue = type { i64 }
%struct.SBuf = type { %struct.MRef, %struct.MRef, %struct.MRef, %struct.MRef }
%struct.MRef = type { i32 }
%struct.GCproto = type { %struct.GCRef, i8, i8, i8, i8, i32, %struct.GCRef, %struct.MRef, %struct.MRef, i32, i32, i32, i8, i8, i16, %struct.GCRef, i32, i32, %struct.MRef, %struct.MRef, %struct.MRef }
%struct.GCRef = type { i32 }

; Function Attrs: nounwind uwtable
define hidden ptr @lj_bcread_proto(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call i32 @bcread_byte(ptr noundef %19)
  store i32 %20, ptr %6, align 4, !tbaa !9
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = call i32 @bcread_byte(ptr noundef %21)
  store i32 %22, ptr %5, align 4, !tbaa !9
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call i32 @bcread_byte(ptr noundef %23)
  store i32 %24, ptr %4, align 4, !tbaa !9
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = call i32 @bcread_byte(ptr noundef %25)
  store i32 %26, ptr %7, align 4, !tbaa !9
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = call i32 @bcread_uleb128(ptr noundef %27)
  store i32 %28, ptr %8, align 4, !tbaa !9
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = call i32 @bcread_uleb128(ptr noundef %29)
  store i32 %30, ptr %9, align 4, !tbaa !9
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = call i32 @bcread_uleb128(ptr noundef %31)
  %33 = add i32 %32, 1
  store i32 %33, ptr %10, align 4, !tbaa !9
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.LexState, ptr %34, i32 0, i32 22
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = and i32 %36, 2
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %50, label %39

39:                                               ; preds = %1
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = call i32 @bcread_uleb128(ptr noundef %40)
  store i32 %41, ptr %15, align 4, !tbaa !9
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %49

44:                                               ; preds = %39
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = call i32 @bcread_uleb128(ptr noundef %45)
  store i32 %46, ptr %16, align 4, !tbaa !9
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = call i32 @bcread_uleb128(ptr noundef %47)
  store i32 %48, ptr %17, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %44, %39
  br label %50

50:                                               ; preds = %49, %1
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = mul i32 %51, 4
  %53 = add i32 64, %52
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = mul i32 %54, 4
  %56 = add i32 %53, %55
  store i32 %56, ptr %11, align 4, !tbaa !9
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = add i32 %57, 8
  %59 = sub i32 %58, 1
  %60 = and i32 %59, -8
  store i32 %60, ptr %11, align 4, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %61, ptr %12, align 4, !tbaa !9
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = mul i32 %62, 8
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = add i32 %64, %63
  store i32 %65, ptr %11, align 4, !tbaa !9
  %66 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %66, ptr %13, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = add i32 %67, 1
  %69 = and i32 %68, -2
  %70 = mul i32 %69, 2
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = add i32 %71, %70
  store i32 %72, ptr %11, align 4, !tbaa !9
  %73 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %73, ptr %14, align 4, !tbaa !9
  %74 = load i32, ptr %15, align 4, !tbaa !9
  %75 = load i32, ptr %11, align 4, !tbaa !9
  %76 = add i32 %75, %74
  store i32 %76, ptr %11, align 4, !tbaa !9
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.LexState, ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !15
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = call ptr @lj_mem_newgco(ptr noundef %79, i32 noundef %80)
  store ptr %81, ptr %3, align 8, !tbaa !5
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.GCproto, ptr %82, i32 0, i32 2
  store i8 7, ptr %83, align 1, !tbaa !16
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = trunc i32 %84 to i8
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.GCproto, ptr %86, i32 0, i32 3
  store i8 %85, ptr %87, align 2, !tbaa !20
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = trunc i32 %88 to i8
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.GCproto, ptr %90, i32 0, i32 4
  store i8 %89, ptr %91, align 1, !tbaa !21
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = load ptr, ptr %3, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.GCproto, ptr %93, i32 0, i32 5
  store i32 %92, ptr %94, align 4, !tbaa !22
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = load i32, ptr %12, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds i8, ptr %95, i64 %97
  %99 = ptrtoint ptr %98 to i64
  %100 = trunc i64 %99 to i32
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.GCproto, ptr %101, i32 0, i32 7
  %103 = getelementptr inbounds %struct.MRef, ptr %102, i32 0, i32 0
  store i32 %100, ptr %103, align 4, !tbaa !23
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = load i32, ptr %13, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds i8, ptr %104, i64 %106
  %108 = ptrtoint ptr %107 to i64
  %109 = trunc i64 %108 to i32
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.GCproto, ptr %110, i32 0, i32 8
  %112 = getelementptr inbounds %struct.MRef, ptr %111, i32 0, i32 0
  store i32 %109, ptr %112, align 4, !tbaa !24
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.GCproto, ptr %113, i32 0, i32 9
  store i32 0, ptr %114, align 4, !tbaa !25
  %115 = load i32, ptr %9, align 4, !tbaa !9
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.GCproto, ptr %116, i32 0, i32 10
  store i32 %115, ptr %117, align 4, !tbaa !26
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.GCproto, ptr %119, i32 0, i32 11
  store i32 %118, ptr %120, align 4, !tbaa !27
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = trunc i32 %121 to i8
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.GCproto, ptr %123, i32 0, i32 12
  store i8 %122, ptr %124, align 4, !tbaa !28
  %125 = load i32, ptr %6, align 4, !tbaa !9
  %126 = trunc i32 %125 to i8
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.GCproto, ptr %127, i32 0, i32 13
  store i8 %126, ptr %128, align 1, !tbaa !29
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.GCproto, ptr %129, i32 0, i32 14
  store i16 0, ptr %130, align 2, !tbaa !30
  %131 = load ptr, ptr %2, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.LexState, ptr %131, i32 0, i32 14
  %133 = load ptr, ptr %132, align 8, !tbaa !31
  %134 = ptrtoint ptr %133 to i64
  %135 = trunc i64 %134 to i32
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.GCproto, ptr %136, i32 0, i32 15
  %138 = getelementptr inbounds %struct.GCRef, ptr %137, i32 0, i32 0
  store i32 %135, ptr %138, align 4, !tbaa !32
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = load i32, ptr %12, align 4, !tbaa !9
  %141 = zext i32 %140 to i64
  %142 = getelementptr inbounds i8, ptr %139, i64 %141
  %143 = load i32, ptr %8, align 4, !tbaa !9
  %144 = add i32 %143, 1
  %145 = zext i32 %144 to i64
  %146 = mul i64 4, %145
  %147 = sub i64 0, %146
  %148 = getelementptr inbounds i8, ptr %142, i64 %147
  store i32 0, ptr %148, align 4, !tbaa !9
  %149 = load ptr, ptr %2, align 8, !tbaa !5
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = load i32, ptr %10, align 4, !tbaa !9
  call void @bcread_bytecode(ptr noundef %149, ptr noundef %150, i32 noundef %151)
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = load i32, ptr %7, align 4, !tbaa !9
  call void @bcread_uv(ptr noundef %152, ptr noundef %153, i32 noundef %154)
  %155 = load ptr, ptr %2, align 8, !tbaa !5
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = load i32, ptr %8, align 4, !tbaa !9
  call void @bcread_kgc(ptr noundef %155, ptr noundef %156, i32 noundef %157)
  %158 = load i32, ptr %8, align 4, !tbaa !9
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.GCproto, ptr %159, i32 0, i32 9
  store i32 %158, ptr %160, align 4, !tbaa !25
  %161 = load ptr, ptr %2, align 8, !tbaa !5
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = load i32, ptr %9, align 4, !tbaa !9
  call void @bcread_knum(ptr noundef %161, ptr noundef %162, i32 noundef %163)
  %164 = load i32, ptr %16, align 4, !tbaa !9
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.GCproto, ptr %165, i32 0, i32 16
  store i32 %164, ptr %166, align 4, !tbaa !33
  %167 = load i32, ptr %17, align 4, !tbaa !9
  %168 = load ptr, ptr %3, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.GCproto, ptr %168, i32 0, i32 17
  store i32 %167, ptr %169, align 4, !tbaa !34
  %170 = load i32, ptr %15, align 4, !tbaa !9
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %217

172:                                              ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %173 = load i32, ptr %10, align 4, !tbaa !9
  %174 = sub i32 %173, 1
  %175 = load i32, ptr %17, align 4, !tbaa !9
  %176 = icmp slt i32 %175, 256
  br i1 %176, label %177, label %178

177:                                              ; preds = %172
  br label %183

178:                                              ; preds = %172
  %179 = load i32, ptr %17, align 4, !tbaa !9
  %180 = icmp slt i32 %179, 65536
  %181 = zext i1 %180 to i64
  %182 = select i1 %180, i32 1, i32 2
  br label %183

183:                                              ; preds = %178, %177
  %184 = phi i32 [ 0, %177 ], [ %182, %178 ]
  %185 = shl i32 %174, %184
  store i32 %185, ptr %18, align 4, !tbaa !9
  %186 = load ptr, ptr %3, align 8, !tbaa !5
  %187 = load i32, ptr %14, align 4, !tbaa !9
  %188 = zext i32 %187 to i64
  %189 = getelementptr inbounds i8, ptr %186, i64 %188
  %190 = ptrtoint ptr %189 to i64
  %191 = trunc i64 %190 to i32
  %192 = load ptr, ptr %3, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.GCproto, ptr %192, i32 0, i32 18
  %194 = getelementptr inbounds %struct.MRef, ptr %193, i32 0, i32 0
  store i32 %191, ptr %194, align 4, !tbaa !35
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = load i32, ptr %14, align 4, !tbaa !9
  %197 = zext i32 %196 to i64
  %198 = getelementptr inbounds i8, ptr %195, i64 %197
  %199 = load i32, ptr %18, align 4, !tbaa !9
  %200 = zext i32 %199 to i64
  %201 = getelementptr inbounds i8, ptr %198, i64 %200
  %202 = ptrtoint ptr %201 to i64
  %203 = trunc i64 %202 to i32
  %204 = load ptr, ptr %3, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.GCproto, ptr %204, i32 0, i32 19
  %206 = getelementptr inbounds %struct.MRef, ptr %205, i32 0, i32 0
  store i32 %203, ptr %206, align 4, !tbaa !36
  %207 = load ptr, ptr %2, align 8, !tbaa !5
  %208 = load ptr, ptr %3, align 8, !tbaa !5
  %209 = load i32, ptr %15, align 4, !tbaa !9
  call void @bcread_dbg(ptr noundef %207, ptr noundef %208, i32 noundef %209)
  %210 = load ptr, ptr %3, align 8, !tbaa !5
  %211 = call ptr @bcread_varinfo(ptr noundef %210)
  %212 = ptrtoint ptr %211 to i64
  %213 = trunc i64 %212 to i32
  %214 = load ptr, ptr %3, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.GCproto, ptr %214, i32 0, i32 20
  %216 = getelementptr inbounds %struct.MRef, ptr %215, i32 0, i32 0
  store i32 %213, ptr %216, align 4, !tbaa !37
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %227

217:                                              ; preds = %50
  %218 = load ptr, ptr %3, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.GCproto, ptr %218, i32 0, i32 18
  %220 = getelementptr inbounds %struct.MRef, ptr %219, i32 0, i32 0
  store i32 0, ptr %220, align 4, !tbaa !35
  %221 = load ptr, ptr %3, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.GCproto, ptr %221, i32 0, i32 19
  %223 = getelementptr inbounds %struct.MRef, ptr %222, i32 0, i32 0
  store i32 0, ptr %223, align 4, !tbaa !36
  %224 = load ptr, ptr %3, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.GCproto, ptr %224, i32 0, i32 20
  %226 = getelementptr inbounds %struct.MRef, ptr %225, i32 0, i32 0
  store i32 0, ptr %226, align 4, !tbaa !37
  br label %227

227:                                              ; preds = %217, %183
  %228 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret ptr %228
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @bcread_byte(ptr noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @bcread_uleb128(ptr noundef) #2

declare hidden ptr @lj_mem_newgco(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @bcread_bytecode(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_uv(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_kgc(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_knum(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_dbg(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @bcread_varinfo(ptr noundef) #0

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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, !10, i64 156}
!12 = !{!"LexState", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 60, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !10, i64 136, !10, i64 140, !6, i64 144, !10, i64 152, !10, i64 156}
!13 = !{!"SBuf", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"MRef", !10, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!17, !7, i64 5}
!17 = !{!"GCproto", !18, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !10, i64 8, !18, i64 12, !14, i64 16, !14, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 36, !7, i64 37, !19, i64 38, !18, i64 40, !10, i64 44, !10, i64 48, !14, i64 52, !14, i64 56, !14, i64 60}
!18 = !{!"GCRef", !10, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = !{!17, !7, i64 6}
!21 = !{!17, !7, i64 7}
!22 = !{!17, !10, i64 8}
!23 = !{!17, !10, i64 16}
!24 = !{!17, !10, i64 20}
!25 = !{!17, !10, i64 24}
!26 = !{!17, !10, i64 28}
!27 = !{!17, !10, i64 32}
!28 = !{!17, !7, i64 36}
!29 = !{!17, !7, i64 37}
!30 = !{!17, !19, i64 38}
!31 = !{!12, !6, i64 104}
!32 = !{!17, !10, i64 40}
!33 = !{!17, !10, i64 44}
!34 = !{!17, !10, i64 48}
!35 = !{!17, !10, i64 52}
!36 = !{!17, !10, i64 56}
!37 = !{!17, !10, i64 60}


; 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: nounwind uwtable
define hidden ptr @lj_bcread_proto(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call i32 @bcread_byte(ptr noundef %0)
  %3 = tail call i32 @bcread_byte(ptr noundef %0)
  %4 = tail call i32 @bcread_byte(ptr noundef %0)
  %5 = tail call i32 @bcread_byte(ptr noundef %0)
  %6 = tail call i32 @bcread_uleb128(ptr noundef %0)
  %7 = tail call i32 @bcread_uleb128(ptr noundef %0)
  %8 = tail call i32 @bcread_uleb128(ptr noundef %0)
  %9 = add i32 %8, 1
  %10 = getelementptr inbounds i8, ptr %0, i64 156
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = and i32 %11, 2
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %13, label %18

13:                                               ; preds = %1
  %14 = tail call i32 @bcread_uleb128(ptr noundef nonnull %0)
  %.not94 = icmp eq i32 %14, 0
  br i1 %.not94, label %18, label %15

15:                                               ; preds = %13
  %16 = tail call i32 @bcread_uleb128(ptr noundef nonnull %0)
  %17 = tail call i32 @bcread_uleb128(ptr noundef nonnull %0)
  br label %18

18:                                               ; preds = %13, %15, %1
  %.092 = phi i32 [ 0, %1 ], [ %16, %15 ], [ 0, %13 ]
  %.091 = phi i32 [ 0, %1 ], [ %17, %15 ], [ 0, %13 ]
  %.0 = phi i32 [ 0, %1 ], [ %14, %15 ], [ 0, %13 ]
  %19 = add i32 %9, %6
  %20 = shl i32 %19, 2
  %21 = add i32 %20, 71
  %22 = and i32 %21, -8
  %23 = shl i32 %7, 3
  %24 = add i32 %22, %23
  %25 = shl i32 %5, 1
  %26 = add i32 %25, 2
  %27 = and i32 %26, -4
  %28 = add i32 %24, %27
  %29 = add i32 %.0, %28
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = tail call ptr @lj_mem_newgco(ptr noundef %31, i32 noundef %29) #3
  %33 = getelementptr inbounds i8, ptr %32, i64 5
  store i8 7, ptr %33, align 1, !tbaa !14
  %34 = trunc i32 %3 to i8
  %35 = getelementptr inbounds i8, ptr %32, i64 6
  store i8 %34, ptr %35, align 2, !tbaa !18
  %36 = trunc i32 %4 to i8
  %37 = getelementptr inbounds i8, ptr %32, i64 7
  store i8 %36, ptr %37, align 1, !tbaa !19
  %38 = getelementptr inbounds i8, ptr %32, i64 8
  store i32 %9, ptr %38, align 4, !tbaa !20
  %39 = zext i32 %22 to i64
  %40 = getelementptr inbounds i8, ptr %32, i64 %39
  %41 = ptrtoint ptr %40 to i64
  %42 = trunc i64 %41 to i32
  %43 = getelementptr inbounds i8, ptr %32, i64 16
  store i32 %42, ptr %43, align 4, !tbaa !21
  %44 = zext i32 %24 to i64
  %45 = getelementptr inbounds i8, ptr %32, i64 %44
  %46 = ptrtoint ptr %45 to i64
  %47 = trunc i64 %46 to i32
  %48 = getelementptr inbounds i8, ptr %32, i64 20
  store i32 %47, ptr %48, align 4, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %32, i64 24
  store i32 0, ptr %49, align 4, !tbaa !23
  %50 = getelementptr inbounds i8, ptr %32, i64 28
  store i32 %7, ptr %50, align 4, !tbaa !24
  %51 = getelementptr inbounds i8, ptr %32, i64 32
  store i32 %29, ptr %51, align 4, !tbaa !25
  %52 = trunc i32 %5 to i8
  %53 = getelementptr inbounds i8, ptr %32, i64 36
  store i8 %52, ptr %53, align 4, !tbaa !26
  %54 = trunc i32 %2 to i8
  %55 = getelementptr inbounds i8, ptr %32, i64 37
  store i8 %54, ptr %55, align 1, !tbaa !27
  %56 = getelementptr inbounds i8, ptr %32, i64 38
  store i16 0, ptr %56, align 2, !tbaa !28
  %57 = getelementptr inbounds i8, ptr %0, i64 104
  %58 = load ptr, ptr %57, align 8, !tbaa !29
  %59 = ptrtoint ptr %58 to i64
  %60 = trunc i64 %59 to i32
  %61 = getelementptr inbounds i8, ptr %32, i64 40
  store i32 %60, ptr %61, align 4, !tbaa !30
  %62 = add i32 %6, 1
  %63 = zext i32 %62 to i64
  %.neg = mul nsw i64 %63, -4
  %64 = getelementptr inbounds i8, ptr %40, i64 %.neg
  store i32 0, ptr %64, align 4, !tbaa !31
  tail call void @bcread_bytecode(ptr noundef nonnull %0, ptr noundef %32, i32 noundef %9)
  tail call void @bcread_uv(ptr noundef nonnull %0, ptr noundef %32, i32 noundef %5)
  tail call void @bcread_kgc(ptr noundef nonnull %0, ptr noundef %32, i32 noundef %6)
  store i32 %6, ptr %49, align 4, !tbaa !23
  tail call void @bcread_knum(ptr noundef nonnull %0, ptr noundef %32, i32 noundef %7)
  %65 = getelementptr inbounds i8, ptr %32, i64 44
  store i32 %.092, ptr %65, align 4, !tbaa !32
  %66 = getelementptr inbounds i8, ptr %32, i64 48
  store i32 %.091, ptr %66, align 4, !tbaa !33
  %.not95 = icmp eq i32 %.0, 0
  br i1 %.not95, label %86, label %67

67:                                               ; preds = %18
  %68 = icmp slt i32 %.091, 256
  %69 = icmp slt i32 %.091, 65536
  %70 = select i1 %69, i32 1, i32 2
  %71 = select i1 %68, i32 0, i32 %70
  %72 = shl i32 %8, %71
  %73 = zext i32 %28 to i64
  %74 = getelementptr inbounds i8, ptr %32, i64 %73
  %75 = ptrtoint ptr %74 to i64
  %76 = trunc i64 %75 to i32
  %77 = getelementptr inbounds i8, ptr %32, i64 52
  store i32 %76, ptr %77, align 4, !tbaa !34
  %78 = zext i32 %72 to i64
  %79 = getelementptr inbounds i8, ptr %74, i64 %78
  %80 = ptrtoint ptr %79 to i64
  %81 = trunc i64 %80 to i32
  %82 = getelementptr inbounds i8, ptr %32, i64 56
  store i32 %81, ptr %82, align 4, !tbaa !35
  tail call void @bcread_dbg(ptr noundef nonnull %0, ptr noundef nonnull %32, i32 noundef %.0)
  %83 = tail call ptr @bcread_varinfo(ptr noundef nonnull %32)
  %84 = ptrtoint ptr %83 to i64
  %85 = trunc i64 %84 to i32
  br label %89

86:                                               ; preds = %18
  %87 = getelementptr inbounds i8, ptr %32, i64 52
  store i32 0, ptr %87, align 4, !tbaa !34
  %88 = getelementptr inbounds i8, ptr %32, i64 56
  store i32 0, ptr %88, align 4, !tbaa !35
  br label %89

89:                                               ; preds = %86, %67
  %.sink = phi i32 [ 0, %86 ], [ %85, %67 ]
  %90 = getelementptr inbounds i8, ptr %32, i64 60
  store i32 %.sink, ptr %90, align 4
  ret ptr %32
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @bcread_byte(ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @bcread_uleb128(ptr noundef) local_unnamed_addr #1

declare hidden ptr @lj_mem_newgco(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @bcread_bytecode(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_uv(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_kgc(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_knum(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @bcread_dbg(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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 = { 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 #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 = { 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 156}
!6 = !{!"LexState", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 60, !7, i64 80, !7, i64 88, !10, i64 96, !10, i64 100, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !10, i64 136, !10, i64 140, !7, i64 144, !10, i64 152, !10, i64 156}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"SBuf", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!12 = !{!"MRef", !10, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !8, i64 5}
!15 = !{!"GCproto", !16, i64 0, !8, i64 4, !8, i64 5, !8, i64 6, !8, i64 7, !10, i64 8, !16, i64 12, !12, i64 16, !12, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !8, i64 36, !8, i64 37, !17, i64 38, !16, i64 40, !10, i64 44, !10, i64 48, !12, i64 52, !12, i64 56, !12, i64 60}
!16 = !{!"GCRef", !10, i64 0}
!17 = !{!"short", !8, i64 0}
!18 = !{!15, !8, i64 6}
!19 = !{!15, !8, i64 7}
!20 = !{!15, !10, i64 8}
!21 = !{!15, !10, i64 16}
!22 = !{!15, !10, i64 20}
!23 = !{!15, !10, i64 24}
!24 = !{!15, !10, i64 28}
!25 = !{!15, !10, i64 32}
!26 = !{!15, !8, i64 36}
!27 = !{!15, !8, i64 37}
!28 = !{!15, !17, i64 38}
!29 = !{!6, !7, i64 104}
!30 = !{!15, !10, i64 40}
!31 = !{!10, !10, i64 0}
!32 = !{!15, !10, i64 44}
!33 = !{!15, !10, i64 48}
!34 = !{!15, !10, i64 52}
!35 = !{!15, !10, i64 56}


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