; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Doom/mc1-doom/src (r_data)

; 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.maptexture_t = type { [8 x i8], i16, i8, i8, i16, i16, [4 x i8], i16, [1 x %struct.mappatch_t] }
%struct.mappatch_t = type { i16, i16, i16, i16, i16 }
%struct.texture_t = type { [8 x i8], i16, i16, i16, [1 x %struct.texpatch_t] }
%struct.texpatch_t = type { i32, i32, i32 }

@textures = external dso_local global ptr, align 8
@texturecompositesize = external dso_local global ptr, align 8
@texturecomposite = external dso_local global ptr, align 8
@texturecolumnlump = external dso_local global ptr, align 8
@texturecolumnofs = external dso_local global ptr, align 8
@texturewidthmask = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@numtextures = external dso_local global i32, align 4
@textureheight = external dso_local global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [44 x i8], align 1
@texturetranslation = external dso_local global ptr, 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: 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) #1

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

declare ptr @Z_Malloc(i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: noreturn
declare void @I_Error(ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare dso_local void @R_GenerateLookup(i32 noundef) #4

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

; Function Attrs: nounwind uwtable
define dso_local void @R_InitTextures() #4 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca [9 x i8], align 1
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %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
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 9, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %25 = getelementptr inbounds [9 x i8], ptr %10, i64 0, i64 8
  store i8 0, ptr %25, align 1, !tbaa !5
  %26 = call ptr @W_CacheLumpName(ptr noundef @.str.3, i32 noundef 1)
  store ptr %26, ptr %11, align 8, !tbaa !8
  %27 = load ptr, ptr %11, align 8, !tbaa !8
  %28 = load i32, ptr %27, align 4, !tbaa !10
  store i32 %28, ptr %15, align 4, !tbaa !10
  %29 = load ptr, ptr %11, align 8, !tbaa !8
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  store ptr %30, ptr %12, align 8, !tbaa !8
  %31 = load i32, ptr %15, align 4, !tbaa !10
  %32 = sext i32 %31 to i64
  %33 = mul i64 %32, 4
  %34 = call noalias ptr @malloc(i64 noundef %33) #8
  store ptr %34, ptr %13, align 8, !tbaa !8
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %35

35:                                               ; preds = %53, %0
  %36 = load i32, ptr %5, align 4, !tbaa !10
  %37 = load i32, ptr %15, align 4, !tbaa !10
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %39, label %56

39:                                               ; preds = %35
  %40 = getelementptr inbounds [9 x i8], ptr %10, i64 0, i64 0
  %41 = load ptr, ptr %12, align 8, !tbaa !8
  %42 = load i32, ptr %5, align 4, !tbaa !10
  %43 = mul nsw i32 %42, 8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %41, i64 %44
  %46 = call ptr @strncpy(ptr noundef %40, ptr noundef %45, i64 noundef 8) #7
  %47 = getelementptr inbounds [9 x i8], ptr %10, i64 0, i64 0
  %48 = call i32 @W_CheckNumForName(ptr noundef %47)
  %49 = load ptr, ptr %13, align 8, !tbaa !8
  %50 = load i32, ptr %5, align 4, !tbaa !10
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %49, i64 %51
  store i32 %48, ptr %52, align 4, !tbaa !10
  br label %53

53:                                               ; preds = %39
  %54 = load i32, ptr %5, align 4, !tbaa !10
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %5, align 4, !tbaa !10
  br label %35, !llvm.loop !12

56:                                               ; preds = %35
  %57 = load ptr, ptr %11, align 8, !tbaa !8
  call void @Z_Free(ptr noundef %57)
  %58 = call ptr @W_CacheLumpName(ptr noundef @.str.4, i32 noundef 1)
  store ptr %58, ptr %9, align 8, !tbaa !8
  store ptr %58, ptr %7, align 8, !tbaa !8
  %59 = load ptr, ptr %7, align 8, !tbaa !8
  %60 = load i32, ptr %59, align 4, !tbaa !10
  store i32 %60, ptr %19, align 4, !tbaa !10
  %61 = call i32 @W_GetNumForName(ptr noundef @.str.4)
  %62 = call i32 @W_LumpLength(i32 noundef %61)
  store i32 %62, ptr %17, align 4, !tbaa !10
  %63 = load ptr, ptr %7, align 8, !tbaa !8
  %64 = getelementptr inbounds i32, ptr %63, i64 1
  store ptr %64, ptr %21, align 8, !tbaa !8
  %65 = call i32 @W_CheckNumForName(ptr noundef @.str.5)
  %66 = icmp ne i32 %65, -1
  br i1 %66, label %67, label %73

67:                                               ; preds = %56
  %68 = call ptr @W_CacheLumpName(ptr noundef @.str.5, i32 noundef 1)
  store ptr %68, ptr %8, align 8, !tbaa !8
  %69 = load ptr, ptr %8, align 8, !tbaa !8
  %70 = load i32, ptr %69, align 4, !tbaa !10
  store i32 %70, ptr %20, align 4, !tbaa !10
  %71 = call i32 @W_GetNumForName(ptr noundef @.str.5)
  %72 = call i32 @W_LumpLength(i32 noundef %71)
  store i32 %72, ptr %18, align 4, !tbaa !10
  br label %74

73:                                               ; preds = %56
  store ptr null, ptr %8, align 8, !tbaa !8
  store i32 0, ptr %20, align 4, !tbaa !10
  store i32 0, ptr %18, align 4, !tbaa !10
  br label %74

74:                                               ; preds = %73, %67
  %75 = load i32, ptr %19, align 4, !tbaa !10
  %76 = load i32, ptr %20, align 4, !tbaa !10
  %77 = add nsw i32 %75, %76
  store i32 %77, ptr @numtextures, align 4, !tbaa !10
  %78 = load i32, ptr @numtextures, align 4, !tbaa !10
  %79 = sext i32 %78 to i64
  %80 = mul i64 %79, 8
  %81 = trunc i64 %80 to i32
  %82 = call ptr @Z_Malloc(i32 noundef %81, i32 noundef 1, ptr noundef null)
  store ptr %82, ptr @textures, align 8, !tbaa !8
  %83 = load i32, ptr @numtextures, align 4, !tbaa !10
  %84 = sext i32 %83 to i64
  %85 = mul i64 %84, 8
  %86 = trunc i64 %85 to i32
  %87 = call ptr @Z_Malloc(i32 noundef %86, i32 noundef 1, ptr noundef null)
  store ptr %87, ptr @texturecolumnlump, align 8, !tbaa !8
  %88 = load i32, ptr @numtextures, align 4, !tbaa !10
  %89 = sext i32 %88 to i64
  %90 = mul i64 %89, 8
  %91 = trunc i64 %90 to i32
  %92 = call ptr @Z_Malloc(i32 noundef %91, i32 noundef 1, ptr noundef null)
  store ptr %92, ptr @texturecolumnofs, align 8, !tbaa !8
  %93 = load i32, ptr @numtextures, align 4, !tbaa !10
  %94 = sext i32 %93 to i64
  %95 = mul i64 %94, 8
  %96 = trunc i64 %95 to i32
  %97 = call ptr @Z_Malloc(i32 noundef %96, i32 noundef 1, ptr noundef null)
  store ptr %97, ptr @texturecomposite, align 8, !tbaa !8
  %98 = load i32, ptr @numtextures, align 4, !tbaa !10
  %99 = sext i32 %98 to i64
  %100 = mul i64 %99, 4
  %101 = trunc i64 %100 to i32
  %102 = call ptr @Z_Malloc(i32 noundef %101, i32 noundef 1, ptr noundef null)
  store ptr %102, ptr @texturecompositesize, align 8, !tbaa !8
  %103 = load i32, ptr @numtextures, align 4, !tbaa !10
  %104 = sext i32 %103 to i64
  %105 = mul i64 %104, 4
  %106 = trunc i64 %105 to i32
  %107 = call ptr @Z_Malloc(i32 noundef %106, i32 noundef 1, ptr noundef null)
  store ptr %107, ptr @texturewidthmask, align 8, !tbaa !8
  %108 = load i32, ptr @numtextures, align 4, !tbaa !10
  %109 = sext i32 %108 to i64
  %110 = mul i64 %109, 4
  %111 = trunc i64 %110 to i32
  %112 = call ptr @Z_Malloc(i32 noundef %111, i32 noundef 1, ptr noundef null)
  store ptr %112, ptr @textureheight, align 8, !tbaa !8
  store i32 0, ptr %14, align 4, !tbaa !10
  %113 = call i32 @W_GetNumForName(ptr noundef @.str.6)
  store i32 %113, ptr %22, align 4, !tbaa !10
  %114 = call i32 @W_GetNumForName(ptr noundef @.str.7)
  %115 = sub nsw i32 %114, 1
  store i32 %115, ptr %23, align 4, !tbaa !10
  %116 = load i32, ptr %23, align 4, !tbaa !10
  %117 = load i32, ptr %22, align 4, !tbaa !10
  %118 = sub nsw i32 %116, %117
  %119 = add nsw i32 %118, 63
  %120 = sdiv i32 %119, 64
  %121 = load i32, ptr @numtextures, align 4, !tbaa !10
  %122 = add nsw i32 %121, 63
  %123 = sdiv i32 %122, 64
  %124 = add nsw i32 %120, %123
  store i32 %124, ptr %24, align 4, !tbaa !10
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %126

126:                                              ; preds = %132, %74
  %127 = load i32, ptr %5, align 4, !tbaa !10
  %128 = load i32, ptr %24, align 4, !tbaa !10
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %130, label %135

130:                                              ; preds = %126
  %131 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %132

132:                                              ; preds = %130
  %133 = load i32, ptr %5, align 4, !tbaa !10
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %5, align 4, !tbaa !10
  br label %126, !llvm.loop !14

135:                                              ; preds = %126
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %137

137:                                              ; preds = %143, %135
  %138 = load i32, ptr %5, align 4, !tbaa !10
  %139 = load i32, ptr %24, align 4, !tbaa !10
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %146

141:                                              ; preds = %137
  %142 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  br label %143

143:                                              ; preds = %141
  %144 = load i32, ptr %5, align 4, !tbaa !10
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %5, align 4, !tbaa !10
  br label %137, !llvm.loop !15

146:                                              ; preds = %137
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %148

148:                                              ; preds = %321, %146
  %149 = load i32, ptr %5, align 4, !tbaa !10
  %150 = load i32, ptr @numtextures, align 4, !tbaa !10
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %152, label %326

152:                                              ; preds = %148
  %153 = load i32, ptr %5, align 4, !tbaa !10
  %154 = and i32 %153, 63
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %158, label %156

156:                                              ; preds = %152
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %158

158:                                              ; preds = %156, %152
  %159 = load i32, ptr %5, align 4, !tbaa !10
  %160 = load i32, ptr %19, align 4, !tbaa !10
  %161 = icmp eq i32 %159, %160
  br i1 %161, label %162, label %167

162:                                              ; preds = %158
  %163 = load ptr, ptr %8, align 8, !tbaa !8
  store ptr %163, ptr %7, align 8, !tbaa !8
  %164 = load i32, ptr %18, align 4, !tbaa !10
  store i32 %164, ptr %17, align 4, !tbaa !10
  %165 = load ptr, ptr %7, align 8, !tbaa !8
  %166 = getelementptr inbounds i32, ptr %165, i64 1
  store ptr %166, ptr %21, align 8, !tbaa !8
  br label %167

167:                                              ; preds = %162, %158
  %168 = load ptr, ptr %21, align 8, !tbaa !8
  %169 = load i32, ptr %168, align 4, !tbaa !10
  store i32 %169, ptr %16, align 4, !tbaa !10
  %170 = load i32, ptr %16, align 4, !tbaa !10
  %171 = load i32, ptr %17, align 4, !tbaa !10
  %172 = icmp sgt i32 %170, %171
  br i1 %172, label %173, label %174

173:                                              ; preds = %167
  call void (ptr, ...) @I_Error(ptr noundef @.str.14) #9
  unreachable

174:                                              ; preds = %167
  %175 = load ptr, ptr %7, align 8, !tbaa !8
  %176 = load i32, ptr %16, align 4, !tbaa !10
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i8, ptr %175, i64 %177
  store ptr %178, ptr %1, align 8, !tbaa !8
  %179 = load ptr, ptr %1, align 8, !tbaa !8
  %180 = getelementptr inbounds %struct.maptexture_t, ptr %179, i32 0, i32 7
  %181 = load i16, ptr %180, align 2, !tbaa !16
  %182 = sext i16 %181 to i32
  %183 = sub nsw i32 %182, 1
  %184 = sext i32 %183 to i64
  %185 = mul i64 12, %184
  %186 = add i64 28, %185
  %187 = trunc i64 %186 to i32
  %188 = call ptr @Z_Malloc(i32 noundef %187, i32 noundef 1, ptr noundef null)
  %189 = load ptr, ptr @textures, align 8, !tbaa !8
  %190 = load i32, ptr %5, align 4, !tbaa !10
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds ptr, ptr %189, i64 %191
  store ptr %188, ptr %192, align 8, !tbaa !8
  store ptr %188, ptr %2, align 8, !tbaa !8
  %193 = load ptr, ptr %1, align 8, !tbaa !8
  %194 = getelementptr inbounds %struct.maptexture_t, ptr %193, i32 0, i32 4
  %195 = load i16, ptr %194, align 2, !tbaa !19
  %196 = load ptr, ptr %2, align 8, !tbaa !8
  %197 = getelementptr inbounds %struct.texture_t, ptr %196, i32 0, i32 1
  store i16 %195, ptr %197, align 4, !tbaa !20
  %198 = load ptr, ptr %1, align 8, !tbaa !8
  %199 = getelementptr inbounds %struct.maptexture_t, ptr %198, i32 0, i32 5
  %200 = load i16, ptr %199, align 2, !tbaa !22
  %201 = load ptr, ptr %2, align 8, !tbaa !8
  %202 = getelementptr inbounds %struct.texture_t, ptr %201, i32 0, i32 2
  store i16 %200, ptr %202, align 2, !tbaa !23
  %203 = load ptr, ptr %1, align 8, !tbaa !8
  %204 = getelementptr inbounds %struct.maptexture_t, ptr %203, i32 0, i32 7
  %205 = load i16, ptr %204, align 2, !tbaa !16
  %206 = load ptr, ptr %2, align 8, !tbaa !8
  %207 = getelementptr inbounds %struct.texture_t, ptr %206, i32 0, i32 3
  store i16 %205, ptr %207, align 4, !tbaa !24
  %208 = load ptr, ptr %2, align 8, !tbaa !8
  %209 = getelementptr inbounds %struct.texture_t, ptr %208, i32 0, i32 0
  %210 = getelementptr inbounds [8 x i8], ptr %209, i64 0, i64 0
  %211 = load ptr, ptr %1, align 8, !tbaa !8
  %212 = getelementptr inbounds %struct.maptexture_t, ptr %211, i32 0, i32 0
  %213 = getelementptr inbounds [8 x i8], ptr %212, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %210, ptr align 2 %213, i64 8, i1 false)
  %214 = load ptr, ptr %1, align 8, !tbaa !8
  %215 = getelementptr inbounds %struct.maptexture_t, ptr %214, i32 0, i32 8
  %216 = getelementptr inbounds [1 x %struct.mappatch_t], ptr %215, i64 0, i64 0
  store ptr %216, ptr %3, align 8, !tbaa !8
  %217 = load ptr, ptr %2, align 8, !tbaa !8
  %218 = getelementptr inbounds %struct.texture_t, ptr %217, i32 0, i32 4
  %219 = getelementptr inbounds [1 x %struct.texpatch_t], ptr %218, i64 0, i64 0
  store ptr %219, ptr %4, align 8, !tbaa !8
  store i32 0, ptr %6, align 4, !tbaa !10
  br label %220

220:                                              ; preds = %258, %174
  %221 = load i32, ptr %6, align 4, !tbaa !10
  %222 = load ptr, ptr %2, align 8, !tbaa !8
  %223 = getelementptr inbounds %struct.texture_t, ptr %222, i32 0, i32 3
  %224 = load i16, ptr %223, align 4, !tbaa !24
  %225 = sext i16 %224 to i32
  %226 = icmp slt i32 %221, %225
  br i1 %226, label %227, label %265

227:                                              ; preds = %220
  %228 = load ptr, ptr %3, align 8, !tbaa !8
  %229 = getelementptr inbounds %struct.mappatch_t, ptr %228, i32 0, i32 0
  %230 = load i16, ptr %229, align 2, !tbaa !25
  %231 = sext i16 %230 to i32
  %232 = load ptr, ptr %4, align 8, !tbaa !8
  %233 = getelementptr inbounds %struct.texpatch_t, ptr %232, i32 0, i32 0
  store i32 %231, ptr %233, align 4, !tbaa !27
  %234 = load ptr, ptr %3, align 8, !tbaa !8
  %235 = getelementptr inbounds %struct.mappatch_t, ptr %234, i32 0, i32 1
  %236 = load i16, ptr %235, align 2, !tbaa !29
  %237 = sext i16 %236 to i32
  %238 = load ptr, ptr %4, align 8, !tbaa !8
  %239 = getelementptr inbounds %struct.texpatch_t, ptr %238, i32 0, i32 1
  store i32 %237, ptr %239, align 4, !tbaa !30
  %240 = load ptr, ptr %13, align 8, !tbaa !8
  %241 = load ptr, ptr %3, align 8, !tbaa !8
  %242 = getelementptr inbounds %struct.mappatch_t, ptr %241, i32 0, i32 2
  %243 = load i16, ptr %242, align 2, !tbaa !31
  %244 = sext i16 %243 to i64
  %245 = getelementptr inbounds i32, ptr %240, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !10
  %247 = load ptr, ptr %4, align 8, !tbaa !8
  %248 = getelementptr inbounds %struct.texpatch_t, ptr %247, i32 0, i32 2
  store i32 %246, ptr %248, align 4, !tbaa !32
  %249 = load ptr, ptr %4, align 8, !tbaa !8
  %250 = getelementptr inbounds %struct.texpatch_t, ptr %249, i32 0, i32 2
  %251 = load i32, ptr %250, align 4, !tbaa !32
  %252 = icmp eq i32 %251, -1
  br i1 %252, label %253, label %257

253:                                              ; preds = %227
  %254 = load ptr, ptr %2, align 8, !tbaa !8
  %255 = getelementptr inbounds %struct.texture_t, ptr %254, i32 0, i32 0
  %256 = getelementptr inbounds [8 x i8], ptr %255, i64 0, i64 0
  call void (ptr, ...) @I_Error(ptr noundef @.str.15, ptr noundef %256) #9
  unreachable

257:                                              ; preds = %227
  br label %258

258:                                              ; preds = %257
  %259 = load i32, ptr %6, align 4, !tbaa !10
  %260 = add nsw i32 %259, 1
  store i32 %260, ptr %6, align 4, !tbaa !10
  %261 = load ptr, ptr %3, align 8, !tbaa !8
  %262 = getelementptr inbounds %struct.mappatch_t, ptr %261, i32 1
  store ptr %262, ptr %3, align 8, !tbaa !8
  %263 = load ptr, ptr %4, align 8, !tbaa !8
  %264 = getelementptr inbounds %struct.texpatch_t, ptr %263, i32 1
  store ptr %264, ptr %4, align 8, !tbaa !8
  br label %220, !llvm.loop !33

265:                                              ; preds = %220
  %266 = load ptr, ptr %2, align 8, !tbaa !8
  %267 = getelementptr inbounds %struct.texture_t, ptr %266, i32 0, i32 1
  %268 = load i16, ptr %267, align 4, !tbaa !20
  %269 = sext i16 %268 to i64
  %270 = mul i64 %269, 2
  %271 = trunc i64 %270 to i32
  %272 = call ptr @Z_Malloc(i32 noundef %271, i32 noundef 1, ptr noundef null)
  %273 = load ptr, ptr @texturecolumnlump, align 8, !tbaa !8
  %274 = load i32, ptr %5, align 4, !tbaa !10
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds ptr, ptr %273, i64 %275
  store ptr %272, ptr %276, align 8, !tbaa !8
  %277 = load ptr, ptr %2, align 8, !tbaa !8
  %278 = getelementptr inbounds %struct.texture_t, ptr %277, i32 0, i32 1
  %279 = load i16, ptr %278, align 4, !tbaa !20
  %280 = sext i16 %279 to i64
  %281 = mul i64 %280, 2
  %282 = trunc i64 %281 to i32
  %283 = call ptr @Z_Malloc(i32 noundef %282, i32 noundef 1, ptr noundef null)
  %284 = load ptr, ptr @texturecolumnofs, align 8, !tbaa !8
  %285 = load i32, ptr %5, align 4, !tbaa !10
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds ptr, ptr %284, i64 %286
  store ptr %283, ptr %287, align 8, !tbaa !8
  store i32 1, ptr %6, align 4, !tbaa !10
  br label %288

288:                                              ; preds = %296, %265
  %289 = load i32, ptr %6, align 4, !tbaa !10
  %290 = mul nsw i32 %289, 2
  %291 = load ptr, ptr %2, align 8, !tbaa !8
  %292 = getelementptr inbounds %struct.texture_t, ptr %291, i32 0, i32 1
  %293 = load i16, ptr %292, align 4, !tbaa !20
  %294 = sext i16 %293 to i32
  %295 = icmp sle i32 %290, %294
  br i1 %295, label %296, label %299

296:                                              ; preds = %288
  %297 = load i32, ptr %6, align 4, !tbaa !10
  %298 = shl i32 %297, 1
  store i32 %298, ptr %6, align 4, !tbaa !10
  br label %288, !llvm.loop !34

299:                                              ; preds = %288
  %300 = load i32, ptr %6, align 4, !tbaa !10
  %301 = sub nsw i32 %300, 1
  %302 = load ptr, ptr @texturewidthmask, align 8, !tbaa !8
  %303 = load i32, ptr %5, align 4, !tbaa !10
  %304 = sext i32 %303 to i64
  %305 = getelementptr inbounds i32, ptr %302, i64 %304
  store i32 %301, ptr %305, align 4, !tbaa !10
  %306 = load ptr, ptr %2, align 8, !tbaa !8
  %307 = getelementptr inbounds %struct.texture_t, ptr %306, i32 0, i32 2
  %308 = load i16, ptr %307, align 2, !tbaa !23
  %309 = sext i16 %308 to i32
  %310 = shl i32 %309, 16
  %311 = load ptr, ptr @textureheight, align 8, !tbaa !8
  %312 = load i32, ptr %5, align 4, !tbaa !10
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds i32, ptr %311, i64 %313
  store i32 %310, ptr %314, align 4, !tbaa !10
  %315 = load ptr, ptr %2, align 8, !tbaa !8
  %316 = getelementptr inbounds %struct.texture_t, ptr %315, i32 0, i32 1
  %317 = load i16, ptr %316, align 4, !tbaa !20
  %318 = sext i16 %317 to i32
  %319 = load i32, ptr %14, align 4, !tbaa !10
  %320 = add nsw i32 %319, %318
  store i32 %320, ptr %14, align 4, !tbaa !10
  br label %321

321:                                              ; preds = %299
  %322 = load i32, ptr %5, align 4, !tbaa !10
  %323 = add nsw i32 %322, 1
  store i32 %323, ptr %5, align 4, !tbaa !10
  %324 = load ptr, ptr %21, align 8, !tbaa !8
  %325 = getelementptr inbounds i32, ptr %324, i32 1
  store ptr %325, ptr %21, align 8, !tbaa !8
  br label %148, !llvm.loop !35

326:                                              ; preds = %148
  %327 = load ptr, ptr %9, align 8, !tbaa !8
  call void @Z_Free(ptr noundef %327)
  %328 = load ptr, ptr %8, align 8, !tbaa !8
  %329 = icmp ne ptr %328, null
  br i1 %329, label %330, label %332

330:                                              ; preds = %326
  %331 = load ptr, ptr %8, align 8, !tbaa !8
  call void @Z_Free(ptr noundef %331)
  br label %332

332:                                              ; preds = %330, %326
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %333

333:                                              ; preds = %339, %332
  %334 = load i32, ptr %5, align 4, !tbaa !10
  %335 = load i32, ptr @numtextures, align 4, !tbaa !10
  %336 = icmp slt i32 %334, %335
  br i1 %336, label %337, label %342

337:                                              ; preds = %333
  %338 = load i32, ptr %5, align 4, !tbaa !10
  call void @R_GenerateLookup(i32 noundef %338)
  br label %339

339:                                              ; preds = %337
  %340 = load i32, ptr %5, align 4, !tbaa !10
  %341 = add nsw i32 %340, 1
  store i32 %341, ptr %5, align 4, !tbaa !10
  br label %333, !llvm.loop !36

342:                                              ; preds = %333
  %343 = load i32, ptr @numtextures, align 4, !tbaa !10
  %344 = add nsw i32 %343, 1
  %345 = sext i32 %344 to i64
  %346 = mul i64 %345, 4
  %347 = trunc i64 %346 to i32
  %348 = call ptr @Z_Malloc(i32 noundef %347, i32 noundef 1, ptr noundef null)
  store ptr %348, ptr @texturetranslation, align 8, !tbaa !8
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %349

349:                                              ; preds = %359, %342
  %350 = load i32, ptr %5, align 4, !tbaa !10
  %351 = load i32, ptr @numtextures, align 4, !tbaa !10
  %352 = icmp slt i32 %350, %351
  br i1 %352, label %353, label %362

353:                                              ; preds = %349
  %354 = load i32, ptr %5, align 4, !tbaa !10
  %355 = load ptr, ptr @texturetranslation, align 8, !tbaa !8
  %356 = load i32, ptr %5, align 4, !tbaa !10
  %357 = sext i32 %356 to i64
  %358 = getelementptr inbounds i32, ptr %355, i64 %357
  store i32 %354, ptr %358, align 4, !tbaa !10
  br label %359

359:                                              ; preds = %353
  %360 = load i32, ptr %5, align 4, !tbaa !10
  %361 = add nsw i32 %360, 1
  store i32 %361, ptr %5, align 4, !tbaa !10
  br label %349, !llvm.loop !37

362:                                              ; preds = %349
  %363 = load ptr, ptr %13, align 8, !tbaa !8
  call void @free(ptr noundef %363) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 9, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  ret void
}

declare ptr @W_CacheLumpName(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #6

declare i32 @W_CheckNumForName(ptr noundef) #2

declare void @Z_Free(ptr noundef) #2

declare i32 @W_LumpLength(i32 noundef) #2

declare i32 @W_GetNumForName(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn "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 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 #5 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind "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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { noreturn }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !18, i64 20}
!17 = !{!"", !6, i64 0, !18, i64 8, !6, i64 10, !6, i64 11, !18, i64 12, !18, i64 14, !6, i64 16, !18, i64 20, !6, i64 22}
!18 = !{!"short", !6, i64 0}
!19 = !{!17, !18, i64 12}
!20 = !{!21, !18, i64 8}
!21 = !{!"", !6, i64 0, !18, i64 8, !18, i64 10, !18, i64 12, !6, i64 16}
!22 = !{!17, !18, i64 14}
!23 = !{!21, !18, i64 10}
!24 = !{!21, !18, i64 12}
!25 = !{!26, !18, i64 0}
!26 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !18, i64 6, !18, i64 8}
!27 = !{!28, !11, i64 0}
!28 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!29 = !{!26, !18, i64 2}
!30 = !{!28, !11, i64 4}
!31 = !{!26, !18, i64 4}
!32 = !{!28, !11, i64 8}
!33 = distinct !{!33, !13}
!34 = distinct !{!34, !13}
!35 = distinct !{!35, !13}
!36 = distinct !{!36, !13}
!37 = distinct !{!37, !13}


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

@textures = external dso_local local_unnamed_addr global ptr, align 8
@texturecompositesize = external dso_local local_unnamed_addr global ptr, align 8
@texturecomposite = external dso_local local_unnamed_addr global ptr, align 8
@texturecolumnlump = external dso_local local_unnamed_addr global ptr, align 8
@texturecolumnofs = external dso_local local_unnamed_addr global ptr, align 8
@texturewidthmask = external dso_local local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@numtextures = external dso_local local_unnamed_addr global i32, align 4
@textureheight = external dso_local local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [44 x i8], align 1
@texturetranslation = external dso_local local_unnamed_addr global ptr, align 8

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

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

declare ptr @Z_Malloc(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: noreturn
declare void @I_Error(ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @R_GenerateLookup(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
define dso_local void @R_InitTextures() local_unnamed_addr #3 {
  %1 = alloca [9 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 9, ptr nonnull %1) #8
  %2 = getelementptr inbounds i8, ptr %1, i64 8
  store i8 0, ptr %2, align 1, !tbaa !5
  %3 = tail call ptr @W_CacheLumpName(ptr noundef nonnull @.str.3, i32 noundef 1) #8
  %4 = load i32, ptr %3, align 4, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %3, i64 4
  %6 = sext i32 %4 to i64
  %7 = shl nsw i64 %6, 2
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #9
  %9 = icmp sgt i32 %4, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = zext nneg i32 %4 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %10 = shl nsw i64 %indvars.iv, 3
  %11 = getelementptr inbounds i8, ptr %5, i64 %10
  %12 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %11, i64 noundef 8) #8
  %13 = call i32 @W_CheckNumForName(ptr noundef nonnull %1) #8
  %14 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  store i32 %13, ptr %14, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @Z_Free(ptr noundef nonnull %3) #8
  %15 = call ptr @W_CacheLumpName(ptr noundef nonnull @.str.4, i32 noundef 1) #8
  %16 = load i32, ptr %15, align 4, !tbaa !8
  %17 = call i32 @W_GetNumForName(ptr noundef nonnull @.str.4) #8
  %18 = call i32 @W_LumpLength(i32 noundef %17) #8
  %19 = call i32 @W_CheckNumForName(ptr noundef nonnull @.str.5) #8
  %.not = icmp eq i32 %19, -1
  br i1 %.not, label %25, label %20

20:                                               ; preds = %._crit_edge
  %21 = call ptr @W_CacheLumpName(ptr noundef nonnull @.str.5, i32 noundef 1) #8
  %22 = load i32, ptr %21, align 4, !tbaa !8
  %23 = call i32 @W_GetNumForName(ptr noundef nonnull @.str.5) #8
  %24 = call i32 @W_LumpLength(i32 noundef %23) #8
  br label %25

25:                                               ; preds = %._crit_edge, %20
  %.099 = phi ptr [ %21, %20 ], [ null, %._crit_edge ]
  %.094 = phi i32 [ %24, %20 ], [ 0, %._crit_edge ]
  %.091 = phi i32 [ %22, %20 ], [ 0, %._crit_edge ]
  %26 = add nsw i32 %.091, %16
  store i32 %26, ptr @numtextures, align 4, !tbaa !8
  %27 = shl i32 %26, 3
  %28 = call ptr @Z_Malloc(i32 noundef %27, i32 noundef 1, ptr noundef null) #8
  store ptr %28, ptr @textures, align 8, !tbaa !12
  %29 = load i32, ptr @numtextures, align 4, !tbaa !8
  %30 = shl i32 %29, 3
  %31 = call ptr @Z_Malloc(i32 noundef %30, i32 noundef 1, ptr noundef null) #8
  store ptr %31, ptr @texturecolumnlump, align 8, !tbaa !12
  %32 = load i32, ptr @numtextures, align 4, !tbaa !8
  %33 = shl i32 %32, 3
  %34 = call ptr @Z_Malloc(i32 noundef %33, i32 noundef 1, ptr noundef null) #8
  store ptr %34, ptr @texturecolumnofs, align 8, !tbaa !12
  %35 = load i32, ptr @numtextures, align 4, !tbaa !8
  %36 = shl i32 %35, 3
  %37 = call ptr @Z_Malloc(i32 noundef %36, i32 noundef 1, ptr noundef null) #8
  store ptr %37, ptr @texturecomposite, align 8, !tbaa !12
  %38 = load i32, ptr @numtextures, align 4, !tbaa !8
  %39 = shl i32 %38, 2
  %40 = call ptr @Z_Malloc(i32 noundef %39, i32 noundef 1, ptr noundef null) #8
  store ptr %40, ptr @texturecompositesize, align 8, !tbaa !12
  %41 = load i32, ptr @numtextures, align 4, !tbaa !8
  %42 = shl i32 %41, 2
  %43 = call ptr @Z_Malloc(i32 noundef %42, i32 noundef 1, ptr noundef null) #8
  store ptr %43, ptr @texturewidthmask, align 8, !tbaa !12
  %44 = load i32, ptr @numtextures, align 4, !tbaa !8
  %45 = shl i32 %44, 2
  %46 = call ptr @Z_Malloc(i32 noundef %45, i32 noundef 1, ptr noundef null) #8
  store ptr %46, ptr @textureheight, align 8, !tbaa !12
  %47 = call i32 @W_GetNumForName(ptr noundef nonnull @.str.6) #8
  %48 = call i32 @W_GetNumForName(ptr noundef nonnull @.str.7) #8
  %reass.sub = sub i32 %48, %47
  %49 = add i32 %reass.sub, 62
  %50 = sdiv i32 %49, 64
  %51 = load i32, ptr @numtextures, align 4, !tbaa !8
  %52 = add nsw i32 %51, 63
  %53 = sdiv i32 %52, 64
  %54 = add nsw i32 %53, %50
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %56 = icmp sgt i32 %54, 0
  br i1 %56, label %.lr.ph111, label %._crit_edge112.thread

._crit_edge112.thread:                            ; preds = %25
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %._crit_edge116

.lr.ph111:                                        ; preds = %25, %.lr.ph111
  %.1109 = phi i32 [ %59, %.lr.ph111 ], [ 0, %25 ]
  %58 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %59 = add nuw nsw i32 %.1109, 1
  %exitcond142.not = icmp eq i32 %59, %54
  br i1 %exitcond142.not, label %._crit_edge112, label %.lr.ph111, !llvm.loop !14

._crit_edge112:                                   ; preds = %.lr.ph111
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br i1 %56, label %.lr.ph115, label %._crit_edge116

.lr.ph115:                                        ; preds = %._crit_edge112, %.lr.ph115
  %.2113 = phi i32 [ %62, %.lr.ph115 ], [ 0, %._crit_edge112 ]
  %61 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %62 = add nuw nsw i32 %.2113, 1
  %exitcond143.not = icmp eq i32 %62, %54
  br i1 %exitcond143.not, label %._crit_edge116, label %.lr.ph115, !llvm.loop !15

._crit_edge116:                                   ; preds = %.lr.ph115, %._crit_edge112.thread, %._crit_edge112
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %64 = load i32, ptr @numtextures, align 4, !tbaa !8
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %.lr.ph128.preheader, label %._crit_edge129

.lr.ph128.preheader:                              ; preds = %._crit_edge116
  %66 = zext i32 %16 to i64
  br label %.lr.ph128

.lr.ph128:                                        ; preds = %.lr.ph128.preheader, %131
  %indvars.iv145 = phi i64 [ 0, %.lr.ph128.preheader ], [ %indvars.iv.next146, %131 ]
  %.pn125 = phi ptr [ %15, %.lr.ph128.preheader ], [ %.190, %131 ]
  %.095124 = phi i32 [ %18, %.lr.ph128.preheader ], [ %.196, %131 ]
  %.097123 = phi ptr [ %15, %.lr.ph128.preheader ], [ %.198, %131 ]
  %67 = and i64 %indvars.iv145, 63
  %.not105 = icmp eq i64 %67, 0
  br i1 %.not105, label %68, label %70

68:                                               ; preds = %.lr.ph128
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %70

70:                                               ; preds = %68, %.lr.ph128
  %71 = icmp eq i64 %indvars.iv145, %66
  %.198 = select i1 %71, ptr %.099, ptr %.097123
  %.196 = select i1 %71, i32 %.094, i32 %.095124
  %.099.pn = select i1 %71, ptr %.099, ptr %.pn125
  %.190 = getelementptr inbounds i8, ptr %.099.pn, i64 4
  %72 = load i32, ptr %.190, align 4, !tbaa !8
  %73 = icmp sgt i32 %72, %.196
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  call void (ptr, ...) @I_Error(ptr noundef nonnull @.str.14) #10
  unreachable

75:                                               ; preds = %70
  %76 = sext i32 %72 to i64
  %77 = getelementptr inbounds i8, ptr %.198, i64 %76
  %78 = getelementptr inbounds i8, ptr %77, i64 20
  %79 = load i16, ptr %78, align 2, !tbaa !16
  %80 = sext i16 %79 to i32
  %81 = mul nsw i32 %80, 12
  %82 = add nsw i32 %81, 16
  %83 = call ptr @Z_Malloc(i32 noundef %82, i32 noundef 1, ptr noundef null) #8
  %84 = load ptr, ptr @textures, align 8, !tbaa !12
  %85 = getelementptr inbounds ptr, ptr %84, i64 %indvars.iv145
  store ptr %83, ptr %85, align 8, !tbaa !12
  %86 = getelementptr inbounds i8, ptr %77, i64 12
  %87 = getelementptr inbounds i8, ptr %83, i64 8
  %88 = getelementptr inbounds i8, ptr %83, i64 10
  %89 = load <2 x i16>, ptr %86, align 2, !tbaa !19
  store <2 x i16> %89, ptr %87, align 4, !tbaa !19
  %90 = load i16, ptr %78, align 2, !tbaa !16
  %91 = getelementptr inbounds i8, ptr %83, i64 12
  store i16 %90, ptr %91, align 4, !tbaa !20
  %92 = load i64, ptr %77, align 2
  store i64 %92, ptr %83, align 4
  %93 = sext i16 %90 to i32
  %94 = icmp sgt i16 %90, 0
  br i1 %94, label %.lr.ph121.preheader, label %._crit_edge122

.lr.ph121.preheader:                              ; preds = %75
  %95 = getelementptr inbounds i8, ptr %83, i64 16
  %96 = getelementptr inbounds i8, ptr %77, i64 22
  br label %.lr.ph121

.lr.ph121:                                        ; preds = %.lr.ph121.preheader, %111
  %.0119 = phi ptr [ %113, %111 ], [ %96, %.lr.ph121.preheader ]
  %.087118 = phi ptr [ %114, %111 ], [ %95, %.lr.ph121.preheader ]
  %.092117 = phi i32 [ %112, %111 ], [ 0, %.lr.ph121.preheader ]
  %97 = load i16, ptr %.0119, align 2, !tbaa !22
  %98 = sext i16 %97 to i32
  store i32 %98, ptr %.087118, align 4, !tbaa !24
  %99 = getelementptr inbounds i8, ptr %.0119, i64 2
  %100 = load i16, ptr %99, align 2, !tbaa !26
  %101 = sext i16 %100 to i32
  %102 = getelementptr inbounds i8, ptr %.087118, i64 4
  store i32 %101, ptr %102, align 4, !tbaa !27
  %103 = getelementptr inbounds i8, ptr %.0119, i64 4
  %104 = load i16, ptr %103, align 2, !tbaa !28
  %105 = sext i16 %104 to i64
  %106 = getelementptr inbounds i32, ptr %8, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !8
  %108 = getelementptr inbounds i8, ptr %.087118, i64 8
  store i32 %107, ptr %108, align 4, !tbaa !29
  %109 = icmp eq i32 %107, -1
  br i1 %109, label %110, label %111

110:                                              ; preds = %.lr.ph121
  call void (ptr, ...) @I_Error(ptr noundef nonnull @.str.15, ptr noundef nonnull %83) #10
  unreachable

111:                                              ; preds = %.lr.ph121
  %112 = add nuw nsw i32 %.092117, 1
  %113 = getelementptr inbounds i8, ptr %.0119, i64 10
  %114 = getelementptr inbounds i8, ptr %.087118, i64 12
  %exitcond144.not = icmp eq i32 %112, %93
  br i1 %exitcond144.not, label %._crit_edge122, label %.lr.ph121, !llvm.loop !30

._crit_edge122:                                   ; preds = %111, %75
  %115 = extractelement <2 x i16> %89, i64 0
  %116 = sext i16 %115 to i32
  %117 = shl nsw i32 %116, 1
  %118 = call ptr @Z_Malloc(i32 noundef %117, i32 noundef 1, ptr noundef null) #8
  %119 = load ptr, ptr @texturecolumnlump, align 8, !tbaa !12
  %120 = getelementptr inbounds ptr, ptr %119, i64 %indvars.iv145
  store ptr %118, ptr %120, align 8, !tbaa !12
  %121 = load i16, ptr %87, align 4, !tbaa !31
  %122 = sext i16 %121 to i32
  %123 = shl nsw i32 %122, 1
  %124 = call ptr @Z_Malloc(i32 noundef %123, i32 noundef 1, ptr noundef null) #8
  %125 = load ptr, ptr @texturecolumnofs, align 8, !tbaa !12
  %126 = getelementptr inbounds ptr, ptr %125, i64 %indvars.iv145
  store ptr %124, ptr %126, align 8, !tbaa !12
  %127 = load i16, ptr %87, align 4, !tbaa !31
  %128 = sext i16 %127 to i32
  br label %129

129:                                              ; preds = %129, %._crit_edge122
  %.193 = phi i32 [ 1, %._crit_edge122 ], [ %130, %129 ]
  %130 = shl nsw i32 %.193, 1
  %.not106 = icmp sgt i32 %130, %128
  br i1 %.not106, label %131, label %129, !llvm.loop !32

131:                                              ; preds = %129
  %132 = add nsw i32 %.193, -1
  %133 = load ptr, ptr @texturewidthmask, align 8, !tbaa !12
  %134 = getelementptr inbounds i32, ptr %133, i64 %indvars.iv145
  store i32 %132, ptr %134, align 4, !tbaa !8
  %135 = load i16, ptr %88, align 2, !tbaa !33
  %136 = sext i16 %135 to i32
  %137 = shl nsw i32 %136, 16
  %138 = load ptr, ptr @textureheight, align 8, !tbaa !12
  %139 = getelementptr inbounds i32, ptr %138, i64 %indvars.iv145
  store i32 %137, ptr %139, align 4, !tbaa !8
  %indvars.iv.next146 = add nuw nsw i64 %indvars.iv145, 1
  %140 = load i32, ptr @numtextures, align 4, !tbaa !8
  %141 = sext i32 %140 to i64
  %142 = icmp slt i64 %indvars.iv.next146, %141
  br i1 %142, label %.lr.ph128, label %._crit_edge129, !llvm.loop !34

._crit_edge129:                                   ; preds = %131, %._crit_edge116
  call void @Z_Free(ptr noundef nonnull %15) #8
  %.not104 = icmp eq ptr %.099, null
  br i1 %.not104, label %144, label %143

143:                                              ; preds = %._crit_edge129
  call void @Z_Free(ptr noundef nonnull %.099) #8
  br label %144

144:                                              ; preds = %143, %._crit_edge129
  %145 = load i32, ptr @numtextures, align 4, !tbaa !8
  %146 = icmp sgt i32 %145, 0
  br i1 %146, label %.lr.ph132, label %._crit_edge133

.lr.ph132:                                        ; preds = %144, %.lr.ph132
  %.4130 = phi i32 [ %147, %.lr.ph132 ], [ 0, %144 ]
  call void @R_GenerateLookup(i32 noundef %.4130)
  %147 = add nuw nsw i32 %.4130, 1
  %148 = load i32, ptr @numtextures, align 4, !tbaa !8
  %149 = icmp slt i32 %147, %148
  br i1 %149, label %.lr.ph132, label %._crit_edge133, !llvm.loop !35

._crit_edge133:                                   ; preds = %.lr.ph132, %144
  %.lcssa = phi i32 [ %145, %144 ], [ %148, %.lr.ph132 ]
  %150 = shl i32 %.lcssa, 2
  %151 = add i32 %150, 4
  %152 = call ptr @Z_Malloc(i32 noundef %151, i32 noundef 1, ptr noundef null) #8
  store ptr %152, ptr @texturetranslation, align 8, !tbaa !12
  %153 = load i32, ptr @numtextures, align 4, !tbaa !8
  %154 = icmp sgt i32 %153, 0
  br i1 %154, label %.lr.ph136, label %._crit_edge137

.lr.ph136:                                        ; preds = %._crit_edge133, %.lr.ph136
  %indvars.iv148 = phi i64 [ %indvars.iv.next149, %.lr.ph136 ], [ 0, %._crit_edge133 ]
  %155 = getelementptr inbounds i32, ptr %152, i64 %indvars.iv148
  %156 = trunc nuw nsw i64 %indvars.iv148 to i32
  store i32 %156, ptr %155, align 4, !tbaa !8
  %indvars.iv.next149 = add nuw nsw i64 %indvars.iv148, 1
  %157 = load i32, ptr @numtextures, align 4, !tbaa !8
  %158 = sext i32 %157 to i64
  %159 = icmp slt i64 %indvars.iv.next149, %158
  br i1 %159, label %.lr.ph136, label %._crit_edge137, !llvm.loop !36

._crit_edge137:                                   ; preds = %.lr.ph136, %._crit_edge133
  call void @free(ptr noundef %8) #8
  call void @llvm.lifetime.end.p0(i64 9, ptr nonnull %1) #8
  ret void
}

declare ptr @W_CacheLumpName(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #7

declare i32 @W_CheckNumForName(ptr noundef) local_unnamed_addr #1

declare void @Z_Free(ptr noundef) local_unnamed_addr #1

declare i32 @W_LumpLength(i32 noundef) local_unnamed_addr #1

declare i32 @W_GetNumForName(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn "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 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { noreturn 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = !{!17, !18, i64 20}
!17 = !{!"", !6, i64 0, !18, i64 8, !6, i64 10, !6, i64 11, !18, i64 12, !18, i64 14, !6, i64 16, !18, i64 20, !6, i64 22}
!18 = !{!"short", !6, i64 0}
!19 = !{!18, !18, i64 0}
!20 = !{!21, !18, i64 12}
!21 = !{!"", !6, i64 0, !18, i64 8, !18, i64 10, !18, i64 12, !6, i64 16}
!22 = !{!23, !18, i64 0}
!23 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !18, i64 6, !18, i64 8}
!24 = !{!25, !9, i64 0}
!25 = !{!"", !9, i64 0, !9, i64 4, !9, i64 8}
!26 = !{!23, !18, i64 2}
!27 = !{!25, !9, i64 4}
!28 = !{!23, !18, i64 4}
!29 = !{!25, !9, i64 8}
!30 = distinct !{!30, !11}
!31 = !{!21, !18, i64 8}
!32 = distinct !{!32, !11}
!33 = !{!21, !18, i64 10}
!34 = distinct !{!34, !11}
!35 = distinct !{!35, !11}
!36 = distinct !{!36, !11}


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