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

; 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.maplinedef_t = type { i16, i16, i16, i16, i16, [2 x i16] }
%struct.line_s = type { ptr, ptr, i32, i32, i16, i16, i16, [2 x i16], [4 x i32], i32, ptr, ptr, i32, ptr }
%struct.vertex_t = type { i32, i32 }
%struct.side_t = type { i32, i32, i16, i16, i16, ptr }

@vertexes = external dso_local global ptr, align 8
@lines = external dso_local global ptr, align 8
@sides = external dso_local global ptr, align 8
@numlines = external dso_local global i32, align 4

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

declare i32 @W_LumpLength(i32 noundef) #1

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

declare ptr @W_CacheLumpNum(i32 noundef, i32 noundef) #1

declare void @Z_Free(ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @P_LoadLineDefs(i32 noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !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 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = call i32 @W_LumpLength(i32 noundef %9)
  %11 = sext i32 %10 to i64
  %12 = udiv i64 %11, 14
  %13 = trunc i64 %12 to i32
  store i32 %13, ptr @numlines, align 4, !tbaa !5
  %14 = load i32, ptr @numlines, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = mul i64 %15, 88
  %17 = trunc i64 %16 to i32
  %18 = call ptr @Z_Malloc(i32 noundef %17, i32 noundef 50, ptr noundef null)
  store ptr %18, ptr @lines, align 8, !tbaa !9
  %19 = load ptr, ptr @lines, align 8, !tbaa !9
  %20 = load i32, ptr @numlines, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = mul i64 %21, 88
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 %22, i1 false)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = call ptr @W_CacheLumpNum(i32 noundef %23, i32 noundef 1)
  store ptr %24, ptr %3, align 8, !tbaa !9
  %25 = load ptr, ptr %3, align 8, !tbaa !9
  store ptr %25, ptr %5, align 8, !tbaa !9
  %26 = load ptr, ptr @lines, align 8, !tbaa !9
  store ptr %26, ptr %6, align 8, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %240, %1
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @numlines, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %31, label %247

31:                                               ; preds = %27
  %32 = load ptr, ptr %5, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.maplinedef_t, ptr %32, i32 0, i32 2
  %34 = load i16, ptr %33, align 2, !tbaa !11
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.line_s, ptr %35, i32 0, i32 4
  store i16 %34, ptr %36, align 8, !tbaa !14
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.maplinedef_t, ptr %37, i32 0, i32 3
  %39 = load i16, ptr %38, align 2, !tbaa !16
  %40 = load ptr, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.line_s, ptr %40, i32 0, i32 5
  store i16 %39, ptr %41, align 2, !tbaa !17
  %42 = load ptr, ptr %5, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.maplinedef_t, ptr %42, i32 0, i32 4
  %44 = load i16, ptr %43, align 2, !tbaa !18
  %45 = load ptr, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.line_s, ptr %45, i32 0, i32 6
  store i16 %44, ptr %46, align 4, !tbaa !19
  %47 = load ptr, ptr @vertexes, align 8, !tbaa !9
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.maplinedef_t, ptr %48, i32 0, i32 0
  %50 = load i16, ptr %49, align 2, !tbaa !20
  %51 = sext i16 %50 to i64
  %52 = getelementptr inbounds %struct.vertex_t, ptr %47, i64 %51
  %53 = load ptr, ptr %6, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.line_s, ptr %53, i32 0, i32 0
  store ptr %52, ptr %54, align 8, !tbaa !21
  store ptr %52, ptr %7, align 8, !tbaa !9
  %55 = load ptr, ptr @vertexes, align 8, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.maplinedef_t, ptr %56, i32 0, i32 1
  %58 = load i16, ptr %57, align 2, !tbaa !22
  %59 = sext i16 %58 to i64
  %60 = getelementptr inbounds %struct.vertex_t, ptr %55, i64 %59
  %61 = load ptr, ptr %6, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.line_s, ptr %61, i32 0, i32 1
  store ptr %60, ptr %62, align 8, !tbaa !23
  store ptr %60, ptr %8, align 8, !tbaa !9
  %63 = load ptr, ptr %8, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.vertex_t, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 4, !tbaa !24
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.vertex_t, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !24
  %69 = sub nsw i32 %65, %68
  %70 = load ptr, ptr %6, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.line_s, ptr %70, i32 0, i32 2
  store i32 %69, ptr %71, align 8, !tbaa !26
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.vertex_t, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !27
  %75 = load ptr, ptr %7, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.vertex_t, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !27
  %78 = sub nsw i32 %74, %77
  %79 = load ptr, ptr %6, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.line_s, ptr %79, i32 0, i32 3
  store i32 %78, ptr %80, align 4, !tbaa !28
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.line_s, ptr %81, i32 0, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !26
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %88, label %85

85:                                               ; preds = %31
  %86 = load ptr, ptr %6, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.line_s, ptr %86, i32 0, i32 9
  store i32 1, ptr %87, align 4, !tbaa !29
  br label %113

88:                                               ; preds = %31
  %89 = load ptr, ptr %6, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.line_s, ptr %89, i32 0, i32 3
  %91 = load i32, ptr %90, align 4, !tbaa !28
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %96, label %93

93:                                               ; preds = %88
  %94 = load ptr, ptr %6, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.line_s, ptr %94, i32 0, i32 9
  store i32 0, ptr %95, align 4, !tbaa !29
  br label %112

96:                                               ; preds = %88
  %97 = load ptr, ptr %6, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.line_s, ptr %97, i32 0, i32 3
  %99 = load i32, ptr %98, align 4, !tbaa !28
  %100 = load ptr, ptr %6, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.line_s, ptr %100, i32 0, i32 2
  %102 = load i32, ptr %101, align 8, !tbaa !26
  %103 = call i32 @FixedDiv(i32 noundef %99, i32 noundef %102)
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %105, label %108

105:                                              ; preds = %96
  %106 = load ptr, ptr %6, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct.line_s, ptr %106, i32 0, i32 9
  store i32 2, ptr %107, align 4, !tbaa !29
  br label %111

108:                                              ; preds = %96
  %109 = load ptr, ptr %6, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.line_s, ptr %109, i32 0, i32 9
  store i32 3, ptr %110, align 4, !tbaa !29
  br label %111

111:                                              ; preds = %108, %105
  br label %112

112:                                              ; preds = %111, %93
  br label %113

113:                                              ; preds = %112, %85
  %114 = load ptr, ptr %7, align 8, !tbaa !9
  %115 = getelementptr inbounds %struct.vertex_t, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !24
  %117 = load ptr, ptr %8, align 8, !tbaa !9
  %118 = getelementptr inbounds %struct.vertex_t, ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !24
  %120 = icmp slt i32 %116, %119
  br i1 %120, label %121, label %134

121:                                              ; preds = %113
  %122 = load ptr, ptr %7, align 8, !tbaa !9
  %123 = getelementptr inbounds %struct.vertex_t, ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !24
  %125 = load ptr, ptr %6, align 8, !tbaa !9
  %126 = getelementptr inbounds %struct.line_s, ptr %125, i32 0, i32 8
  %127 = getelementptr inbounds [4 x i32], ptr %126, i64 0, i64 2
  store i32 %124, ptr %127, align 4, !tbaa !5
  %128 = load ptr, ptr %8, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.vertex_t, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 4, !tbaa !24
  %131 = load ptr, ptr %6, align 8, !tbaa !9
  %132 = getelementptr inbounds %struct.line_s, ptr %131, i32 0, i32 8
  %133 = getelementptr inbounds [4 x i32], ptr %132, i64 0, i64 3
  store i32 %130, ptr %133, align 4, !tbaa !5
  br label %147

134:                                              ; preds = %113
  %135 = load ptr, ptr %8, align 8, !tbaa !9
  %136 = getelementptr inbounds %struct.vertex_t, ptr %135, i32 0, i32 0
  %137 = load i32, ptr %136, align 4, !tbaa !24
  %138 = load ptr, ptr %6, align 8, !tbaa !9
  %139 = getelementptr inbounds %struct.line_s, ptr %138, i32 0, i32 8
  %140 = getelementptr inbounds [4 x i32], ptr %139, i64 0, i64 2
  store i32 %137, ptr %140, align 4, !tbaa !5
  %141 = load ptr, ptr %7, align 8, !tbaa !9
  %142 = getelementptr inbounds %struct.vertex_t, ptr %141, i32 0, i32 0
  %143 = load i32, ptr %142, align 4, !tbaa !24
  %144 = load ptr, ptr %6, align 8, !tbaa !9
  %145 = getelementptr inbounds %struct.line_s, ptr %144, i32 0, i32 8
  %146 = getelementptr inbounds [4 x i32], ptr %145, i64 0, i64 3
  store i32 %143, ptr %146, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %134, %121
  %148 = load ptr, ptr %7, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct.vertex_t, ptr %148, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !27
  %151 = load ptr, ptr %8, align 8, !tbaa !9
  %152 = getelementptr inbounds %struct.vertex_t, ptr %151, i32 0, i32 1
  %153 = load i32, ptr %152, align 4, !tbaa !27
  %154 = icmp slt i32 %150, %153
  br i1 %154, label %155, label %168

155:                                              ; preds = %147
  %156 = load ptr, ptr %7, align 8, !tbaa !9
  %157 = getelementptr inbounds %struct.vertex_t, ptr %156, i32 0, i32 1
  %158 = load i32, ptr %157, align 4, !tbaa !27
  %159 = load ptr, ptr %6, align 8, !tbaa !9
  %160 = getelementptr inbounds %struct.line_s, ptr %159, i32 0, i32 8
  %161 = getelementptr inbounds [4 x i32], ptr %160, i64 0, i64 1
  store i32 %158, ptr %161, align 4, !tbaa !5
  %162 = load ptr, ptr %8, align 8, !tbaa !9
  %163 = getelementptr inbounds %struct.vertex_t, ptr %162, i32 0, i32 1
  %164 = load i32, ptr %163, align 4, !tbaa !27
  %165 = load ptr, ptr %6, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct.line_s, ptr %165, i32 0, i32 8
  %167 = getelementptr inbounds [4 x i32], ptr %166, i64 0, i64 0
  store i32 %164, ptr %167, align 4, !tbaa !5
  br label %181

168:                                              ; preds = %147
  %169 = load ptr, ptr %8, align 8, !tbaa !9
  %170 = getelementptr inbounds %struct.vertex_t, ptr %169, i32 0, i32 1
  %171 = load i32, ptr %170, align 4, !tbaa !27
  %172 = load ptr, ptr %6, align 8, !tbaa !9
  %173 = getelementptr inbounds %struct.line_s, ptr %172, i32 0, i32 8
  %174 = getelementptr inbounds [4 x i32], ptr %173, i64 0, i64 1
  store i32 %171, ptr %174, align 4, !tbaa !5
  %175 = load ptr, ptr %7, align 8, !tbaa !9
  %176 = getelementptr inbounds %struct.vertex_t, ptr %175, i32 0, i32 1
  %177 = load i32, ptr %176, align 4, !tbaa !27
  %178 = load ptr, ptr %6, align 8, !tbaa !9
  %179 = getelementptr inbounds %struct.line_s, ptr %178, i32 0, i32 8
  %180 = getelementptr inbounds [4 x i32], ptr %179, i64 0, i64 0
  store i32 %177, ptr %180, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %168, %155
  %182 = load ptr, ptr %5, align 8, !tbaa !9
  %183 = getelementptr inbounds %struct.maplinedef_t, ptr %182, i32 0, i32 5
  %184 = getelementptr inbounds [2 x i16], ptr %183, i64 0, i64 0
  %185 = load i16, ptr %184, align 2, !tbaa !30
  %186 = load ptr, ptr %6, align 8, !tbaa !9
  %187 = getelementptr inbounds %struct.line_s, ptr %186, i32 0, i32 7
  %188 = getelementptr inbounds [2 x i16], ptr %187, i64 0, i64 0
  store i16 %185, ptr %188, align 2, !tbaa !30
  %189 = load ptr, ptr %5, align 8, !tbaa !9
  %190 = getelementptr inbounds %struct.maplinedef_t, ptr %189, i32 0, i32 5
  %191 = getelementptr inbounds [2 x i16], ptr %190, i64 0, i64 1
  %192 = load i16, ptr %191, align 2, !tbaa !30
  %193 = load ptr, ptr %6, align 8, !tbaa !9
  %194 = getelementptr inbounds %struct.line_s, ptr %193, i32 0, i32 7
  %195 = getelementptr inbounds [2 x i16], ptr %194, i64 0, i64 1
  store i16 %192, ptr %195, align 2, !tbaa !30
  %196 = load ptr, ptr %6, align 8, !tbaa !9
  %197 = getelementptr inbounds %struct.line_s, ptr %196, i32 0, i32 7
  %198 = getelementptr inbounds [2 x i16], ptr %197, i64 0, i64 0
  %199 = load i16, ptr %198, align 2, !tbaa !30
  %200 = sext i16 %199 to i32
  %201 = icmp ne i32 %200, -1
  br i1 %201, label %202, label %214

202:                                              ; preds = %181
  %203 = load ptr, ptr @sides, align 8, !tbaa !9
  %204 = load ptr, ptr %6, align 8, !tbaa !9
  %205 = getelementptr inbounds %struct.line_s, ptr %204, i32 0, i32 7
  %206 = getelementptr inbounds [2 x i16], ptr %205, i64 0, i64 0
  %207 = load i16, ptr %206, align 2, !tbaa !30
  %208 = sext i16 %207 to i64
  %209 = getelementptr inbounds %struct.side_t, ptr %203, i64 %208
  %210 = getelementptr inbounds %struct.side_t, ptr %209, i32 0, i32 5
  %211 = load ptr, ptr %210, align 8, !tbaa !31
  %212 = load ptr, ptr %6, align 8, !tbaa !9
  %213 = getelementptr inbounds %struct.line_s, ptr %212, i32 0, i32 10
  store ptr %211, ptr %213, align 8, !tbaa !33
  br label %217

214:                                              ; preds = %181
  %215 = load ptr, ptr %6, align 8, !tbaa !9
  %216 = getelementptr inbounds %struct.line_s, ptr %215, i32 0, i32 10
  store ptr null, ptr %216, align 8, !tbaa !33
  br label %217

217:                                              ; preds = %214, %202
  %218 = load ptr, ptr %6, align 8, !tbaa !9
  %219 = getelementptr inbounds %struct.line_s, ptr %218, i32 0, i32 7
  %220 = getelementptr inbounds [2 x i16], ptr %219, i64 0, i64 1
  %221 = load i16, ptr %220, align 2, !tbaa !30
  %222 = sext i16 %221 to i32
  %223 = icmp ne i32 %222, -1
  br i1 %223, label %224, label %236

224:                                              ; preds = %217
  %225 = load ptr, ptr @sides, align 8, !tbaa !9
  %226 = load ptr, ptr %6, align 8, !tbaa !9
  %227 = getelementptr inbounds %struct.line_s, ptr %226, i32 0, i32 7
  %228 = getelementptr inbounds [2 x i16], ptr %227, i64 0, i64 1
  %229 = load i16, ptr %228, align 2, !tbaa !30
  %230 = sext i16 %229 to i64
  %231 = getelementptr inbounds %struct.side_t, ptr %225, i64 %230
  %232 = getelementptr inbounds %struct.side_t, ptr %231, i32 0, i32 5
  %233 = load ptr, ptr %232, align 8, !tbaa !31
  %234 = load ptr, ptr %6, align 8, !tbaa !9
  %235 = getelementptr inbounds %struct.line_s, ptr %234, i32 0, i32 11
  store ptr %233, ptr %235, align 8, !tbaa !34
  br label %239

236:                                              ; preds = %217
  %237 = load ptr, ptr %6, align 8, !tbaa !9
  %238 = getelementptr inbounds %struct.line_s, ptr %237, i32 0, i32 11
  store ptr null, ptr %238, align 8, !tbaa !34
  br label %239

239:                                              ; preds = %236, %224
  br label %240

240:                                              ; preds = %239
  %241 = load i32, ptr %4, align 4, !tbaa !5
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %4, align 4, !tbaa !5
  %243 = load ptr, ptr %5, align 8, !tbaa !9
  %244 = getelementptr inbounds %struct.maplinedef_t, ptr %243, i32 1
  store ptr %244, ptr %5, align 8, !tbaa !9
  %245 = load ptr, ptr %6, align 8, !tbaa !9
  %246 = getelementptr inbounds %struct.line_s, ptr %245, i32 1
  store ptr %246, ptr %6, align 8, !tbaa !9
  br label %27, !llvm.loop !35

247:                                              ; preds = %27
  %248 = load ptr, ptr %3, align 8, !tbaa !9
  call void @Z_Free(ptr noundef %248)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 void
}

declare i32 @FixedDiv(i32 noundef, i32 noundef) #1

attributes #0 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !13, i64 4}
!12 = !{!"", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8, !7, i64 10}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !13, i64 24}
!15 = !{!"line_s", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !13, i64 24, !13, i64 26, !13, i64 28, !7, i64 30, !7, i64 36, !6, i64 52, !10, i64 56, !10, i64 64, !6, i64 72, !10, i64 80}
!16 = !{!12, !13, i64 6}
!17 = !{!15, !13, i64 26}
!18 = !{!12, !13, i64 8}
!19 = !{!15, !13, i64 28}
!20 = !{!12, !13, i64 0}
!21 = !{!15, !10, i64 0}
!22 = !{!12, !13, i64 2}
!23 = !{!15, !10, i64 8}
!24 = !{!25, !6, i64 0}
!25 = !{!"", !6, i64 0, !6, i64 4}
!26 = !{!15, !6, i64 16}
!27 = !{!25, !6, i64 4}
!28 = !{!15, !6, i64 20}
!29 = !{!15, !6, i64 52}
!30 = !{!13, !13, i64 0}
!31 = !{!32, !10, i64 16}
!32 = !{!"", !6, i64 0, !6, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !10, i64 16}
!33 = !{!15, !10, i64 56}
!34 = !{!15, !10, i64 64}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; 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.vertex_t = type { i32, i32 }
%struct.side_t = type { i32, i32, i16, i16, i16, ptr }

@vertexes = external dso_local local_unnamed_addr global ptr, align 8
@lines = external dso_local local_unnamed_addr global ptr, align 8
@sides = external dso_local local_unnamed_addr global ptr, align 8
@numlines = external dso_local local_unnamed_addr global i32, align 4

declare i32 @W_LumpLength(i32 noundef) local_unnamed_addr #0

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

declare ptr @W_CacheLumpNum(i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @Z_Free(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @P_LoadLineDefs(i32 noundef %0) local_unnamed_addr #2 {
  %2 = tail call i32 @W_LumpLength(i32 noundef %0) #4
  %3 = sext i32 %2 to i64
  %4 = udiv i64 %3, 14
  %5 = trunc i64 %4 to i32
  store i32 %5, ptr @numlines, align 4, !tbaa !5
  %6 = mul i32 %5, 88
  %7 = tail call ptr @Z_Malloc(i32 noundef %6, i32 noundef 50, ptr noundef null) #4
  store ptr %7, ptr @lines, align 8, !tbaa !9
  %8 = load i32, ptr @numlines, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = mul nsw i64 %9, 88
  tail call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 %10, i1 false)
  %11 = tail call ptr @W_CacheLumpNum(i32 noundef %0, i32 noundef 1) #4
  %12 = load i32, ptr @numlines, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %1
  %14 = load ptr, ptr @lines, align 8, !tbaa !9
  %.pre80 = load ptr, ptr @vertexes, align 8, !tbaa !9
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %82
  %15 = phi ptr [ %53, %82 ], [ %.pre80, %.lr.ph.preheader ]
  %.076 = phi i32 [ %84, %82 ], [ 0, %.lr.ph.preheader ]
  %.06375 = phi ptr [ %85, %82 ], [ %11, %.lr.ph.preheader ]
  %.06474 = phi ptr [ %86, %82 ], [ %14, %.lr.ph.preheader ]
  %16 = getelementptr inbounds i8, ptr %.06375, i64 4
  %17 = getelementptr inbounds i8, ptr %.06474, i64 24
  %18 = load <2 x i16>, ptr %16, align 2, !tbaa !11
  store <2 x i16> %18, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %.06375, i64 8
  %20 = load i16, ptr %19, align 2, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %.06474, i64 28
  store i16 %20, ptr %21, align 4, !tbaa !15
  %22 = load i16, ptr %.06375, align 2, !tbaa !17
  %23 = sext i16 %22 to i64
  %24 = getelementptr inbounds %struct.vertex_t, ptr %15, i64 %23
  store ptr %24, ptr %.06474, align 8, !tbaa !18
  %25 = load ptr, ptr @vertexes, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %.06375, i64 2
  %27 = load i16, ptr %26, align 2, !tbaa !19
  %28 = sext i16 %27 to i64
  %29 = getelementptr inbounds %struct.vertex_t, ptr %25, i64 %28
  %30 = getelementptr inbounds i8, ptr %.06474, i64 8
  store ptr %29, ptr %30, align 8, !tbaa !20
  %31 = load i32, ptr %29, align 4, !tbaa !21
  %32 = load i32, ptr %24, align 4, !tbaa !21
  %33 = sub nsw i32 %31, %32
  %34 = getelementptr inbounds i8, ptr %.06474, i64 16
  store i32 %33, ptr %34, align 8, !tbaa !23
  %35 = getelementptr inbounds i8, ptr %29, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !24
  %37 = getelementptr inbounds i8, ptr %24, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !24
  %39 = sub nsw i32 %36, %38
  %40 = getelementptr inbounds i8, ptr %.06474, i64 20
  store i32 %39, ptr %40, align 4, !tbaa !25
  %.not = icmp eq i32 %31, %32
  br i1 %.not, label %41, label %43

41:                                               ; preds = %.lr.ph
  %42 = getelementptr inbounds i8, ptr %.06474, i64 52
  store i32 1, ptr %42, align 4, !tbaa !26
  br label %52

43:                                               ; preds = %.lr.ph
  %.not71 = icmp eq i32 %36, %38
  br i1 %.not71, label %44, label %46

44:                                               ; preds = %43
  %45 = getelementptr inbounds i8, ptr %.06474, i64 52
  store i32 0, ptr %45, align 4, !tbaa !26
  br label %52

46:                                               ; preds = %43
  %47 = tail call i32 @FixedDiv(i32 noundef %39, i32 noundef %33) #4
  %48 = icmp sgt i32 %47, 0
  %.pre = load ptr, ptr @vertexes, align 8, !tbaa !9
  %49 = getelementptr inbounds i8, ptr %.06474, i64 52
  br i1 %48, label %50, label %51

50:                                               ; preds = %46
  store i32 2, ptr %49, align 4, !tbaa !26
  br label %52

51:                                               ; preds = %46
  store i32 3, ptr %49, align 4, !tbaa !26
  br label %52

52:                                               ; preds = %44, %51, %50, %41
  %53 = phi ptr [ %25, %44 ], [ %.pre, %51 ], [ %.pre, %50 ], [ %25, %41 ]
  %54 = load i32, ptr %24, align 4, !tbaa !21
  %55 = load i32, ptr %29, align 4, !tbaa !21
  %56 = icmp slt i32 %54, %55
  %57 = getelementptr inbounds i8, ptr %.06474, i64 44
  %. = tail call i32 @llvm.smin.i32(i32 %54, i32 %55)
  store i32 %., ptr %57, align 4, !tbaa !5
  %.val = load i32, ptr %29, align 4
  %.val85 = load i32, ptr %24, align 4
  %.sink = select i1 %56, i32 %.val, i32 %.val85
  %58 = getelementptr inbounds i8, ptr %.06474, i64 48
  store i32 %.sink, ptr %58, align 4
  %59 = load i32, ptr %37, align 4, !tbaa !24
  %60 = load i32, ptr %35, align 4, !tbaa !24
  %61 = icmp slt i32 %59, %60
  %.sink82 = tail call i32 @llvm.smin.i32(i32 %59, i32 %60)
  %62 = getelementptr inbounds i8, ptr %.06474, i64 40
  store i32 %.sink82, ptr %62, align 4, !tbaa !5
  %.val86 = load i32, ptr %35, align 4
  %.val87 = load i32, ptr %37, align 4
  %.sink77 = select i1 %61, i32 %.val86, i32 %.val87
  %63 = getelementptr inbounds i8, ptr %.06474, i64 36
  store i32 %.sink77, ptr %63, align 4
  %64 = getelementptr inbounds i8, ptr %.06375, i64 10
  %65 = load i16, ptr %64, align 2, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %.06474, i64 30
  store i16 %65, ptr %66, align 2, !tbaa !11
  %67 = getelementptr inbounds i8, ptr %.06375, i64 12
  %68 = load i16, ptr %67, align 2, !tbaa !11
  %69 = getelementptr inbounds i8, ptr %.06474, i64 32
  store i16 %68, ptr %69, align 2, !tbaa !11
  %.not72 = icmp eq i16 %65, -1
  br i1 %.not72, label %75, label %70

70:                                               ; preds = %52
  %71 = load ptr, ptr @sides, align 8, !tbaa !9
  %72 = sext i16 %65 to i64
  %73 = getelementptr inbounds %struct.side_t, ptr %71, i64 %72, i32 5
  %74 = load ptr, ptr %73, align 8, !tbaa !27
  br label %75

75:                                               ; preds = %52, %70
  %.sink78 = phi ptr [ %74, %70 ], [ null, %52 ]
  %76 = getelementptr inbounds i8, ptr %.06474, i64 56
  store ptr %.sink78, ptr %76, align 8
  %.not73 = icmp eq i16 %68, -1
  br i1 %.not73, label %82, label %77

77:                                               ; preds = %75
  %78 = load ptr, ptr @sides, align 8, !tbaa !9
  %79 = sext i16 %68 to i64
  %80 = getelementptr inbounds %struct.side_t, ptr %78, i64 %79, i32 5
  %81 = load ptr, ptr %80, align 8, !tbaa !27
  br label %82

82:                                               ; preds = %75, %77
  %.sink79 = phi ptr [ %81, %77 ], [ null, %75 ]
  %83 = getelementptr inbounds i8, ptr %.06474, i64 64
  store ptr %.sink79, ptr %83, align 8
  %84 = add nuw nsw i32 %.076, 1
  %85 = getelementptr inbounds i8, ptr %.06375, i64 14
  %86 = getelementptr inbounds i8, ptr %.06474, i64 88
  %87 = load i32, ptr @numlines, align 4, !tbaa !5
  %88 = icmp slt i32 %84, %87
  br i1 %88, label %.lr.ph, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %82, %1
  tail call void @Z_Free(ptr noundef %11) #4
  ret void
}

declare i32 @FixedDiv(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #3

attributes #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"", !12, i64 0, !12, i64 2, !12, i64 4, !12, i64 6, !12, i64 8, !7, i64 10}
!15 = !{!16, !12, i64 28}
!16 = !{!"line_s", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 20, !12, i64 24, !12, i64 26, !12, i64 28, !7, i64 30, !7, i64 36, !6, i64 52, !10, i64 56, !10, i64 64, !6, i64 72, !10, i64 80}
!17 = !{!14, !12, i64 0}
!18 = !{!16, !10, i64 0}
!19 = !{!14, !12, i64 2}
!20 = !{!16, !10, i64 8}
!21 = !{!22, !6, i64 0}
!22 = !{!"", !6, i64 0, !6, i64 4}
!23 = !{!16, !6, i64 16}
!24 = !{!22, !6, i64 4}
!25 = !{!16, !6, i64 20}
!26 = !{!16, !6, i64 52}
!27 = !{!28, !10, i64 16}
!28 = !{!"", !6, i64 0, !6, i64 4, !12, i64 8, !12, i64 10, !12, i64 12, !10, i64 16}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass