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

; 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.ceiling_t = type { %struct.thinker_s, i32, ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }
%struct.sector_t = type { i32, i32, i16, i16, i16, i16, i16, i32, ptr, [4 x i32], %struct.degenmobj_t, i32, ptr, ptr, i32, ptr }
%struct.degenmobj_t = type { %struct.thinker_s, i32, i32, i32 }
%struct.vldoor_t = type { %struct.thinker_s, i32, ptr, i32, i32, i32, i32, i32 }
%struct.floormove_t = type { %struct.thinker_s, i32, i32, ptr, i32, i32, i16, i32, i32 }
%struct.plat_t = type { %struct.thinker_s, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.lightflash_t = type { %struct.thinker_s, ptr, i32, i32, i32, i32, i32 }
%struct.strobe_t = type { %struct.thinker_s, ptr, i32, i32, i32, i32, i32 }
%struct.glow_t = type { %struct.thinker_s, ptr, i32, i32, i32 }

@save_p = external dso_local global ptr, align 8
@sectors = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1

; 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

declare void @P_AddThinker(ptr noundef) #2

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

declare void @T_MoveCeiling(ptr noundef) #2

declare void @T_VerticalDoor(ptr noundef) #2

declare void @T_MoveFloor(ptr noundef) #2

declare void @T_PlatRaise(ptr noundef) #2

declare void @T_LightFlash(ptr noundef) #2

declare void @T_StrobeFlash(ptr noundef) #2

declare void @T_Glow(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @P_UnArchiveSpecials() #4 {
  %1 = alloca i8, align 1
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  br label %9

9:                                                ; preds = %238, %0
  br label %10

10:                                               ; preds = %9
  %11 = load ptr, ptr @save_p, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i32 1
  store ptr %12, ptr @save_p, align 8, !tbaa !5
  %13 = load i8, ptr %11, align 1, !tbaa !9
  store i8 %13, ptr %1, align 1, !tbaa !9
  %14 = load i8, ptr %1, align 1, !tbaa !9
  %15 = zext i8 %14 to i32
  switch i32 %15, label %235 [
    i32 7, label %16
    i32 0, label %17
    i32 1, label %56
    i32 2, label %87
    i32 3, label %118
    i32 4, label %157
    i32 5, label %183
    i32 6, label %209
  ]

16:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %1) #5
  ret void

17:                                               ; preds = %10
  %18 = load ptr, ptr @save_p, align 8, !tbaa !5
  %19 = ptrtoint ptr %18 to i64
  %20 = and i64 %19, 3
  %21 = sub i64 4, %20
  %22 = and i64 %21, 3
  %23 = load ptr, ptr @save_p, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 %22
  store ptr %24, ptr @save_p, align 8, !tbaa !5
  %25 = call ptr @Z_Malloc(i32 noundef 72, i32 noundef 50, ptr noundef null)
  store ptr %25, ptr %2, align 8, !tbaa !5
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 1 %27, i64 72, i1 false)
  %28 = load ptr, ptr @save_p, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 72
  store ptr %29, ptr @save_p, align 8, !tbaa !5
  %30 = load ptr, ptr @sectors, align 8, !tbaa !5
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ceiling_t, ptr %31, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !10
  %34 = ptrtoint ptr %33 to i64
  %35 = getelementptr inbounds %struct.sector_t, ptr %30, i64 %34
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ceiling_t, ptr %36, i32 0, i32 2
  store ptr %35, ptr %37, align 8, !tbaa !10
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ceiling_t, ptr %39, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !10
  %42 = getelementptr inbounds %struct.sector_t, ptr %41, i32 0, i32 13
  store ptr %38, ptr %42, align 8, !tbaa !14
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ceiling_t, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.thinker_s, ptr %44, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %52

48:                                               ; preds = %17
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ceiling_t, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.thinker_s, ptr %50, i32 0, i32 2
  store ptr @T_MoveCeiling, ptr %51, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %48, %17
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.ceiling_t, ptr %53, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %54)
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  call void @P_AddActiveCeiling(ptr noundef %55)
  br label %238

56:                                               ; preds = %10
  %57 = load ptr, ptr @save_p, align 8, !tbaa !5
  %58 = ptrtoint ptr %57 to i64
  %59 = and i64 %58, 3
  %60 = sub i64 4, %59
  %61 = and i64 %60, 3
  %62 = load ptr, ptr @save_p, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 %61
  store ptr %63, ptr @save_p, align 8, !tbaa !5
  %64 = call ptr @Z_Malloc(i32 noundef 64, i32 noundef 50, ptr noundef null)
  store ptr %64, ptr %3, align 8, !tbaa !5
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %65, ptr align 1 %66, i64 64, i1 false)
  %67 = load ptr, ptr @save_p, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 64
  store ptr %68, ptr @save_p, align 8, !tbaa !5
  %69 = load ptr, ptr @sectors, align 8, !tbaa !5
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.vldoor_t, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !18
  %73 = ptrtoint ptr %72 to i64
  %74 = getelementptr inbounds %struct.sector_t, ptr %69, i64 %73
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.vldoor_t, ptr %75, i32 0, i32 2
  store ptr %74, ptr %76, align 8, !tbaa !18
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.vldoor_t, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = getelementptr inbounds %struct.sector_t, ptr %80, i32 0, i32 13
  store ptr %77, ptr %81, align 8, !tbaa !14
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.vldoor_t, ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds %struct.thinker_s, ptr %83, i32 0, i32 2
  store ptr @T_VerticalDoor, ptr %84, align 8, !tbaa !9
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.vldoor_t, ptr %85, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %86)
  br label %238

87:                                               ; preds = %10
  %88 = load ptr, ptr @save_p, align 8, !tbaa !5
  %89 = ptrtoint ptr %88 to i64
  %90 = and i64 %89, 3
  %91 = sub i64 4, %90
  %92 = and i64 %91, 3
  %93 = load ptr, ptr @save_p, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i64 %92
  store ptr %94, ptr @save_p, align 8, !tbaa !5
  %95 = call ptr @Z_Malloc(i32 noundef 64, i32 noundef 50, ptr noundef null)
  store ptr %95, ptr %4, align 8, !tbaa !5
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %96, ptr align 1 %97, i64 64, i1 false)
  %98 = load ptr, ptr @save_p, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 64
  store ptr %99, ptr @save_p, align 8, !tbaa !5
  %100 = load ptr, ptr @sectors, align 8, !tbaa !5
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.floormove_t, ptr %101, i32 0, i32 3
  %103 = load ptr, ptr %102, align 8, !tbaa !20
  %104 = ptrtoint ptr %103 to i64
  %105 = getelementptr inbounds %struct.sector_t, ptr %100, i64 %104
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.floormove_t, ptr %106, i32 0, i32 3
  store ptr %105, ptr %107, align 8, !tbaa !20
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.floormove_t, ptr %109, i32 0, i32 3
  %111 = load ptr, ptr %110, align 8, !tbaa !20
  %112 = getelementptr inbounds %struct.sector_t, ptr %111, i32 0, i32 13
  store ptr %108, ptr %112, align 8, !tbaa !14
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.floormove_t, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.thinker_s, ptr %114, i32 0, i32 2
  store ptr @T_MoveFloor, ptr %115, align 8, !tbaa !9
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.floormove_t, ptr %116, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %117)
  br label %238

118:                                              ; preds = %10
  %119 = load ptr, ptr @save_p, align 8, !tbaa !5
  %120 = ptrtoint ptr %119 to i64
  %121 = and i64 %120, 3
  %122 = sub i64 4, %121
  %123 = and i64 %122, 3
  %124 = load ptr, ptr @save_p, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i64 %123
  store ptr %125, ptr @save_p, align 8, !tbaa !5
  %126 = call ptr @Z_Malloc(i32 noundef 72, i32 noundef 50, ptr noundef null)
  store ptr %126, ptr %5, align 8, !tbaa !5
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %127, ptr align 1 %128, i64 72, i1 false)
  %129 = load ptr, ptr @save_p, align 8, !tbaa !5
  %130 = getelementptr inbounds i8, ptr %129, i64 72
  store ptr %130, ptr @save_p, align 8, !tbaa !5
  %131 = load ptr, ptr @sectors, align 8, !tbaa !5
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.plat_t, ptr %132, i32 0, i32 1
  %134 = load ptr, ptr %133, align 8, !tbaa !22
  %135 = ptrtoint ptr %134 to i64
  %136 = getelementptr inbounds %struct.sector_t, ptr %131, i64 %135
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.plat_t, ptr %137, i32 0, i32 1
  store ptr %136, ptr %138, align 8, !tbaa !22
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.plat_t, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !22
  %143 = getelementptr inbounds %struct.sector_t, ptr %142, i32 0, i32 13
  store ptr %139, ptr %143, align 8, !tbaa !14
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.plat_t, ptr %144, i32 0, i32 0
  %146 = getelementptr inbounds %struct.thinker_s, ptr %145, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !9
  %148 = icmp ne ptr %147, null
  br i1 %148, label %149, label %153

149:                                              ; preds = %118
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.plat_t, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.thinker_s, ptr %151, i32 0, i32 2
  store ptr @T_PlatRaise, ptr %152, align 8, !tbaa !9
  br label %153

153:                                              ; preds = %149, %118
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.plat_t, ptr %154, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %155)
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  call void @P_AddActivePlat(ptr noundef %156)
  br label %238

157:                                              ; preds = %10
  %158 = load ptr, ptr @save_p, align 8, !tbaa !5
  %159 = ptrtoint ptr %158 to i64
  %160 = and i64 %159, 3
  %161 = sub i64 4, %160
  %162 = and i64 %161, 3
  %163 = load ptr, ptr @save_p, align 8, !tbaa !5
  %164 = getelementptr inbounds i8, ptr %163, i64 %162
  store ptr %164, ptr @save_p, align 8, !tbaa !5
  %165 = call ptr @Z_Malloc(i32 noundef 56, i32 noundef 50, ptr noundef null)
  store ptr %165, ptr %6, align 8, !tbaa !5
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %166, ptr align 1 %167, i64 56, i1 false)
  %168 = load ptr, ptr @save_p, align 8, !tbaa !5
  %169 = getelementptr inbounds i8, ptr %168, i64 56
  store ptr %169, ptr @save_p, align 8, !tbaa !5
  %170 = load ptr, ptr @sectors, align 8, !tbaa !5
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.lightflash_t, ptr %171, i32 0, i32 1
  %173 = load ptr, ptr %172, align 8, !tbaa !24
  %174 = ptrtoint ptr %173 to i64
  %175 = getelementptr inbounds %struct.sector_t, ptr %170, i64 %174
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.lightflash_t, ptr %176, i32 0, i32 1
  store ptr %175, ptr %177, align 8, !tbaa !24
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.lightflash_t, ptr %178, i32 0, i32 0
  %180 = getelementptr inbounds %struct.thinker_s, ptr %179, i32 0, i32 2
  store ptr @T_LightFlash, ptr %180, align 8, !tbaa !9
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.lightflash_t, ptr %181, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %182)
  br label %238

183:                                              ; preds = %10
  %184 = load ptr, ptr @save_p, align 8, !tbaa !5
  %185 = ptrtoint ptr %184 to i64
  %186 = and i64 %185, 3
  %187 = sub i64 4, %186
  %188 = and i64 %187, 3
  %189 = load ptr, ptr @save_p, align 8, !tbaa !5
  %190 = getelementptr inbounds i8, ptr %189, i64 %188
  store ptr %190, ptr @save_p, align 8, !tbaa !5
  %191 = call ptr @Z_Malloc(i32 noundef 56, i32 noundef 50, ptr noundef null)
  store ptr %191, ptr %7, align 8, !tbaa !5
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  %193 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %192, ptr align 1 %193, i64 56, i1 false)
  %194 = load ptr, ptr @save_p, align 8, !tbaa !5
  %195 = getelementptr inbounds i8, ptr %194, i64 56
  store ptr %195, ptr @save_p, align 8, !tbaa !5
  %196 = load ptr, ptr @sectors, align 8, !tbaa !5
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.strobe_t, ptr %197, i32 0, i32 1
  %199 = load ptr, ptr %198, align 8, !tbaa !24
  %200 = ptrtoint ptr %199 to i64
  %201 = getelementptr inbounds %struct.sector_t, ptr %196, i64 %200
  %202 = load ptr, ptr %7, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.strobe_t, ptr %202, i32 0, i32 1
  store ptr %201, ptr %203, align 8, !tbaa !24
  %204 = load ptr, ptr %7, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.strobe_t, ptr %204, i32 0, i32 0
  %206 = getelementptr inbounds %struct.thinker_s, ptr %205, i32 0, i32 2
  store ptr @T_StrobeFlash, ptr %206, align 8, !tbaa !9
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.strobe_t, ptr %207, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %208)
  br label %238

209:                                              ; preds = %10
  %210 = load ptr, ptr @save_p, align 8, !tbaa !5
  %211 = ptrtoint ptr %210 to i64
  %212 = and i64 %211, 3
  %213 = sub i64 4, %212
  %214 = and i64 %213, 3
  %215 = load ptr, ptr @save_p, align 8, !tbaa !5
  %216 = getelementptr inbounds i8, ptr %215, i64 %214
  store ptr %216, ptr @save_p, align 8, !tbaa !5
  %217 = call ptr @Z_Malloc(i32 noundef 48, i32 noundef 50, ptr noundef null)
  store ptr %217, ptr %8, align 8, !tbaa !5
  %218 = load ptr, ptr %8, align 8, !tbaa !5
  %219 = load ptr, ptr @save_p, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %218, ptr align 1 %219, i64 48, i1 false)
  %220 = load ptr, ptr @save_p, align 8, !tbaa !5
  %221 = getelementptr inbounds i8, ptr %220, i64 48
  store ptr %221, ptr @save_p, align 8, !tbaa !5
  %222 = load ptr, ptr @sectors, align 8, !tbaa !5
  %223 = load ptr, ptr %8, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.glow_t, ptr %223, i32 0, i32 1
  %225 = load ptr, ptr %224, align 8, !tbaa !26
  %226 = ptrtoint ptr %225 to i64
  %227 = getelementptr inbounds %struct.sector_t, ptr %222, i64 %226
  %228 = load ptr, ptr %8, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.glow_t, ptr %228, i32 0, i32 1
  store ptr %227, ptr %229, align 8, !tbaa !26
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.glow_t, ptr %230, i32 0, i32 0
  %232 = getelementptr inbounds %struct.thinker_s, ptr %231, i32 0, i32 2
  store ptr @T_Glow, ptr %232, align 8, !tbaa !9
  %233 = load ptr, ptr %8, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.glow_t, ptr %233, i32 0, i32 0
  call void @P_AddThinker(ptr noundef %234)
  br label %238

235:                                              ; preds = %10
  %236 = load i8, ptr %1, align 1, !tbaa !9
  %237 = zext i8 %236 to i32
  call void (ptr, ...) @I_Error(ptr noundef @.str.1, i32 noundef %237) #6
  unreachable

238:                                              ; preds = %209, %183, %157, %153, %87, %56, %52
  br label %9
}

declare void @P_AddActiveCeiling(ptr noundef) #2

declare void @P_AddActivePlat(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 }
attributes #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 32}
!11 = !{!"", !12, i64 0, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64}
!12 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 104}
!15 = !{!"", !13, i64 0, !13, i64 4, !16, i64 8, !16, i64 10, !16, i64 12, !16, i64 14, !16, i64 16, !13, i64 20, !6, i64 24, !7, i64 32, !17, i64 48, !13, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !6, i64 120}
!16 = !{!"short", !7, i64 0}
!17 = !{!"", !12, i64 0, !13, i64 24, !13, i64 28, !13, i64 32}
!18 = !{!19, !6, i64 32}
!19 = !{!"", !12, i64 0, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56}
!20 = !{!21, !6, i64 32}
!21 = !{!"", !12, i64 0, !13, i64 24, !13, i64 28, !6, i64 32, !13, i64 40, !13, i64 44, !16, i64 48, !13, i64 52, !13, i64 56}
!22 = !{!23, !6, i64 24}
!23 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68}
!24 = !{!25, !6, i64 24}
!25 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48}
!26 = !{!27, !6, i64 24}
!27 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40}


; 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.sector_t = type { i32, i32, i16, i16, i16, i16, i16, i32, ptr, [4 x i32], %struct.degenmobj_t, i32, ptr, ptr, i32, ptr }
%struct.degenmobj_t = type { %struct.thinker_s, i32, i32, i32 }
%struct.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }

@save_p = external dso_local local_unnamed_addr global ptr, align 8
@sectors = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [50 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

declare void @P_AddThinker(ptr noundef) local_unnamed_addr #1

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

declare void @T_MoveCeiling(ptr noundef) #1

declare void @T_VerticalDoor(ptr noundef) #1

declare void @T_MoveFloor(ptr noundef) #1

declare void @T_PlatRaise(ptr noundef) #1

declare void @T_LightFlash(ptr noundef) #1

declare void @T_StrobeFlash(ptr noundef) #1

declare void @T_Glow(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @P_UnArchiveSpecials() local_unnamed_addr #3 {
  br label %1

1:                                                ; preds = %.backedge, %0
  %2 = load ptr, ptr @save_p, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 1
  store ptr %3, ptr @save_p, align 8, !tbaa !5
  %4 = load i8, ptr %2, align 1, !tbaa !9
  switch i8 %4, label %121 [
    i8 7, label %5
    i8 0, label %6
    i8 1, label %25
    i8 2, label %41
    i8 3, label %57
    i8 4, label %76
    i8 5, label %91
    i8 6, label %106
  ]

5:                                                ; preds = %1
  ret void

6:                                                ; preds = %1
  %7 = ptrtoint ptr %3 to i64
  %8 = sub i64 0, %7
  %9 = and i64 %8, 3
  %10 = getelementptr inbounds i8, ptr %3, i64 %9
  store ptr %10, ptr @save_p, align 8, !tbaa !5
  %11 = tail call ptr @Z_Malloc(i32 noundef 72, i32 noundef 50, ptr noundef null) #4
  %12 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %11, ptr noundef nonnull align 1 dereferenceable(72) %12, i64 72, i1 false)
  %13 = load ptr, ptr @save_p, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 72
  store ptr %14, ptr @save_p, align 8, !tbaa !5
  %15 = load ptr, ptr @sectors, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %11, i64 32
  %17 = load ptr, ptr %16, align 8, !tbaa !10
  %18 = ptrtoint ptr %17 to i64
  %19 = getelementptr inbounds %struct.sector_t, ptr %15, i64 %18
  store ptr %19, ptr %16, align 8, !tbaa !10
  %20 = getelementptr inbounds i8, ptr %19, i64 104
  store ptr %11, ptr %20, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %11, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %.not48 = icmp eq ptr %22, null
  br i1 %.not48, label %24, label %23

23:                                               ; preds = %6
  store ptr @T_MoveCeiling, ptr %21, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %23, %6
  tail call void @P_AddThinker(ptr noundef nonnull %11) #4
  tail call void @P_AddActiveCeiling(ptr noundef nonnull %11) #4
  br label %.backedge

25:                                               ; preds = %1
  %26 = ptrtoint ptr %3 to i64
  %27 = sub i64 0, %26
  %28 = and i64 %27, 3
  %29 = getelementptr inbounds i8, ptr %3, i64 %28
  store ptr %29, ptr @save_p, align 8, !tbaa !5
  %30 = tail call ptr @Z_Malloc(i32 noundef 64, i32 noundef 50, ptr noundef null) #4
  %31 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %30, ptr noundef nonnull align 1 dereferenceable(64) %31, i64 64, i1 false)
  %32 = load ptr, ptr @save_p, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 64
  store ptr %33, ptr @save_p, align 8, !tbaa !5
  %34 = load ptr, ptr @sectors, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %30, i64 32
  %36 = load ptr, ptr %35, align 8, !tbaa !18
  %37 = ptrtoint ptr %36 to i64
  %38 = getelementptr inbounds %struct.sector_t, ptr %34, i64 %37
  store ptr %38, ptr %35, align 8, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %38, i64 104
  store ptr %30, ptr %39, align 8, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %30, i64 16
  store ptr @T_VerticalDoor, ptr %40, align 8, !tbaa !9
  tail call void @P_AddThinker(ptr noundef %30) #4
  br label %.backedge

41:                                               ; preds = %1
  %42 = ptrtoint ptr %3 to i64
  %43 = sub i64 0, %42
  %44 = and i64 %43, 3
  %45 = getelementptr inbounds i8, ptr %3, i64 %44
  store ptr %45, ptr @save_p, align 8, !tbaa !5
  %46 = tail call ptr @Z_Malloc(i32 noundef 64, i32 noundef 50, ptr noundef null) #4
  %47 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %46, ptr noundef nonnull align 1 dereferenceable(64) %47, i64 64, i1 false)
  %48 = load ptr, ptr @save_p, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 64
  store ptr %49, ptr @save_p, align 8, !tbaa !5
  %50 = load ptr, ptr @sectors, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %46, i64 32
  %52 = load ptr, ptr %51, align 8, !tbaa !20
  %53 = ptrtoint ptr %52 to i64
  %54 = getelementptr inbounds %struct.sector_t, ptr %50, i64 %53
  store ptr %54, ptr %51, align 8, !tbaa !20
  %55 = getelementptr inbounds i8, ptr %54, i64 104
  store ptr %46, ptr %55, align 8, !tbaa !14
  %56 = getelementptr inbounds i8, ptr %46, i64 16
  store ptr @T_MoveFloor, ptr %56, align 8, !tbaa !9
  tail call void @P_AddThinker(ptr noundef %46) #4
  br label %.backedge

57:                                               ; preds = %1
  %58 = ptrtoint ptr %3 to i64
  %59 = sub i64 0, %58
  %60 = and i64 %59, 3
  %61 = getelementptr inbounds i8, ptr %3, i64 %60
  store ptr %61, ptr @save_p, align 8, !tbaa !5
  %62 = tail call ptr @Z_Malloc(i32 noundef 72, i32 noundef 50, ptr noundef null) #4
  %63 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %62, ptr noundef nonnull align 1 dereferenceable(72) %63, i64 72, i1 false)
  %64 = load ptr, ptr @save_p, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 72
  store ptr %65, ptr @save_p, align 8, !tbaa !5
  %66 = load ptr, ptr @sectors, align 8, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %62, i64 24
  %68 = load ptr, ptr %67, align 8, !tbaa !22
  %69 = ptrtoint ptr %68 to i64
  %70 = getelementptr inbounds %struct.sector_t, ptr %66, i64 %69
  store ptr %70, ptr %67, align 8, !tbaa !22
  %71 = getelementptr inbounds i8, ptr %70, i64 104
  store ptr %62, ptr %71, align 8, !tbaa !14
  %72 = getelementptr inbounds i8, ptr %62, i64 16
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %.not = icmp eq ptr %73, null
  br i1 %.not, label %75, label %74

74:                                               ; preds = %57
  store ptr @T_PlatRaise, ptr %72, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %74, %57
  tail call void @P_AddThinker(ptr noundef nonnull %62) #4
  tail call void @P_AddActivePlat(ptr noundef nonnull %62) #4
  br label %.backedge

76:                                               ; preds = %1
  %77 = ptrtoint ptr %3 to i64
  %78 = sub i64 0, %77
  %79 = and i64 %78, 3
  %80 = getelementptr inbounds i8, ptr %3, i64 %79
  store ptr %80, ptr @save_p, align 8, !tbaa !5
  %81 = tail call ptr @Z_Malloc(i32 noundef 56, i32 noundef 50, ptr noundef null) #4
  %82 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %81, ptr noundef nonnull align 1 dereferenceable(56) %82, i64 56, i1 false)
  %83 = load ptr, ptr @save_p, align 8, !tbaa !5
  %84 = getelementptr inbounds i8, ptr %83, i64 56
  store ptr %84, ptr @save_p, align 8, !tbaa !5
  %85 = load ptr, ptr @sectors, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %81, i64 24
  %87 = load ptr, ptr %86, align 8, !tbaa !24
  %88 = ptrtoint ptr %87 to i64
  %89 = getelementptr inbounds %struct.sector_t, ptr %85, i64 %88
  store ptr %89, ptr %86, align 8, !tbaa !24
  %90 = getelementptr inbounds i8, ptr %81, i64 16
  store ptr @T_LightFlash, ptr %90, align 8, !tbaa !9
  tail call void @P_AddThinker(ptr noundef %81) #4
  br label %.backedge

91:                                               ; preds = %1
  %92 = ptrtoint ptr %3 to i64
  %93 = sub i64 0, %92
  %94 = and i64 %93, 3
  %95 = getelementptr inbounds i8, ptr %3, i64 %94
  store ptr %95, ptr @save_p, align 8, !tbaa !5
  %96 = tail call ptr @Z_Malloc(i32 noundef 56, i32 noundef 50, ptr noundef null) #4
  %97 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %96, ptr noundef nonnull align 1 dereferenceable(56) %97, i64 56, i1 false)
  %98 = load ptr, ptr @save_p, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i64 56
  store ptr %99, ptr @save_p, align 8, !tbaa !5
  %100 = load ptr, ptr @sectors, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %96, i64 24
  %102 = load ptr, ptr %101, align 8, !tbaa !24
  %103 = ptrtoint ptr %102 to i64
  %104 = getelementptr inbounds %struct.sector_t, ptr %100, i64 %103
  store ptr %104, ptr %101, align 8, !tbaa !24
  %105 = getelementptr inbounds i8, ptr %96, i64 16
  store ptr @T_StrobeFlash, ptr %105, align 8, !tbaa !9
  tail call void @P_AddThinker(ptr noundef %96) #4
  br label %.backedge

106:                                              ; preds = %1
  %107 = ptrtoint ptr %3 to i64
  %108 = sub i64 0, %107
  %109 = and i64 %108, 3
  %110 = getelementptr inbounds i8, ptr %3, i64 %109
  store ptr %110, ptr @save_p, align 8, !tbaa !5
  %111 = tail call ptr @Z_Malloc(i32 noundef 48, i32 noundef 50, ptr noundef null) #4
  %112 = load ptr, ptr @save_p, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %111, ptr noundef nonnull align 1 dereferenceable(48) %112, i64 48, i1 false)
  %113 = load ptr, ptr @save_p, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i64 48
  store ptr %114, ptr @save_p, align 8, !tbaa !5
  %115 = load ptr, ptr @sectors, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %111, i64 24
  %117 = load ptr, ptr %116, align 8, !tbaa !26
  %118 = ptrtoint ptr %117 to i64
  %119 = getelementptr inbounds %struct.sector_t, ptr %115, i64 %118
  store ptr %119, ptr %116, align 8, !tbaa !26
  %120 = getelementptr inbounds i8, ptr %111, i64 16
  store ptr @T_Glow, ptr %120, align 8, !tbaa !9
  tail call void @P_AddThinker(ptr noundef %111) #4
  br label %.backedge

.backedge:                                        ; preds = %106, %91, %76, %75, %41, %25, %24
  br label %1

121:                                              ; preds = %1
  %122 = zext i8 %4 to i32
  tail call void (ptr, ...) @I_Error(ptr noundef nonnull @.str.1, i32 noundef %122) #5
  unreachable
}

declare void @P_AddActiveCeiling(ptr noundef) local_unnamed_addr #1

declare void @P_AddActivePlat(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree 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 = { nounwind }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 32}
!11 = !{!"", !12, i64 0, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64}
!12 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 104}
!15 = !{!"", !13, i64 0, !13, i64 4, !16, i64 8, !16, i64 10, !16, i64 12, !16, i64 14, !16, i64 16, !13, i64 20, !6, i64 24, !7, i64 32, !17, i64 48, !13, i64 88, !6, i64 96, !6, i64 104, !13, i64 112, !6, i64 120}
!16 = !{!"short", !7, i64 0}
!17 = !{!"", !12, i64 0, !13, i64 24, !13, i64 28, !13, i64 32}
!18 = !{!19, !6, i64 32}
!19 = !{!"", !12, i64 0, !13, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56}
!20 = !{!21, !6, i64 32}
!21 = !{!"", !12, i64 0, !13, i64 24, !13, i64 28, !6, i64 32, !13, i64 40, !13, i64 44, !16, i64 48, !13, i64 52, !13, i64 56}
!22 = !{!23, !6, i64 24}
!23 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68}
!24 = !{!25, !6, i64 24}
!25 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48}
!26 = !{!27, !6, i64 24}
!27 = !{!"", !12, i64 0, !6, i64 24, !13, i64 32, !13, i64 36, !13, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass