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

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

@sectors = external global ptr, align 8
@numsectors = external global i32, align 4
@lines = external global ptr, align 8
@levelTimer = external dso_local global i32, align 4
@levelTimeCount = external dso_local global i32, align 4
@numlinespecials = external dso_local global i16, align 2
@linespeciallist = external dso_local global [64 x ptr], align 16
@buttonlist = external global [16 x %struct.button_t], align 16
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@deathmatch = external global i32, align 4
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@myargv = external global ptr, align 8
@totalsecret = external global i32, align 4
@numlines = external global i32, align 4
@activeceilings = external global [30 x ptr], align 16
@activeplats = external global [30 x ptr], align 16

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

declare i32 @W_CheckNumForName(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_SpawnSpecials() #3 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  %5 = call i32 @W_CheckNumForName(ptr noundef @.str.3)
  %6 = icmp sge i32 %5, 0
  br i1 %6, label %7, label %8

7:                                                ; preds = %0
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %7, %0
  %9 = load i32, ptr %3, align 4, !tbaa !5
  store i32 0, ptr @levelTimer, align 4, !tbaa !5
  %10 = call i32 @M_CheckParm(ptr noundef @.str.4)
  store i32 %10, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %17

13:                                               ; preds = %8
  %14 = load i32, ptr @deathmatch, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  store i32 1, ptr @levelTimer, align 4, !tbaa !5
  store i32 42000, ptr @levelTimeCount, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %16, %13, %8
  %18 = call i32 @M_CheckParm(ptr noundef @.str.5)
  store i32 %18, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %35

21:                                               ; preds = %17
  %22 = load i32, ptr @deathmatch, align 4, !tbaa !5
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %35

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %25 = load ptr, ptr @myargv, align 8, !tbaa !9
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %25, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = call i32 @atoi(ptr noundef %30) #6
  %32 = mul nsw i32 %31, 60
  %33 = mul nsw i32 %32, 35
  store i32 %33, ptr %4, align 4, !tbaa !5
  store i32 1, ptr @levelTimer, align 4, !tbaa !5
  %34 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %34, ptr @levelTimeCount, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %35

35:                                               ; preds = %24, %21, %17
  %36 = load ptr, ptr @sectors, align 8, !tbaa !9
  store ptr %36, ptr %1, align 8, !tbaa !9
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %79, %35
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = load i32, ptr @numsectors, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %41, label %84

41:                                               ; preds = %37
  %42 = load ptr, ptr %1, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.sector_t, ptr %42, i32 0, i32 5
  %44 = load i16, ptr %43, align 2, !tbaa !11
  %45 = icmp ne i16 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %41
  br label %79

47:                                               ; preds = %41
  %48 = load ptr, ptr %1, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.sector_t, ptr %48, i32 0, i32 5
  %50 = load i16, ptr %49, align 2, !tbaa !11
  %51 = sext i16 %50 to i32
  switch i32 %51, label %78 [
    i32 1, label %52
    i32 2, label %54
    i32 3, label %56
    i32 4, label %58
    i32 8, label %62
    i32 9, label %64
    i32 10, label %67
    i32 12, label %69
    i32 13, label %71
    i32 14, label %73
    i32 17, label %76
  ]

52:                                               ; preds = %47
  %53 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnLightFlash(ptr noundef %53)
  br label %78

54:                                               ; preds = %47
  %55 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnStrobeFlash(ptr noundef %55, i32 noundef 15, i32 noundef 0)
  br label %78

56:                                               ; preds = %47
  %57 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnStrobeFlash(ptr noundef %57, i32 noundef 35, i32 noundef 0)
  br label %78

58:                                               ; preds = %47
  %59 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnStrobeFlash(ptr noundef %59, i32 noundef 15, i32 noundef 0)
  %60 = load ptr, ptr %1, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.sector_t, ptr %60, i32 0, i32 5
  store i16 4, ptr %61, align 2, !tbaa !11
  br label %78

62:                                               ; preds = %47
  %63 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnGlowingLight(ptr noundef %63)
  br label %78

64:                                               ; preds = %47
  %65 = load i32, ptr @totalsecret, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr @totalsecret, align 4, !tbaa !5
  br label %78

67:                                               ; preds = %47
  %68 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnDoorCloseIn30(ptr noundef %68)
  br label %78

69:                                               ; preds = %47
  %70 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnStrobeFlash(ptr noundef %70, i32 noundef 35, i32 noundef 1)
  br label %78

71:                                               ; preds = %47
  %72 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnStrobeFlash(ptr noundef %72, i32 noundef 15, i32 noundef 1)
  br label %78

73:                                               ; preds = %47
  %74 = load ptr, ptr %1, align 8, !tbaa !9
  %75 = load i32, ptr %2, align 4, !tbaa !5
  call void @P_SpawnDoorRaiseIn5Mins(ptr noundef %74, i32 noundef %75)
  br label %78

76:                                               ; preds = %47
  %77 = load ptr, ptr %1, align 8, !tbaa !9
  call void @P_SpawnFireFlicker(ptr noundef %77)
  br label %78

78:                                               ; preds = %76, %73, %71, %69, %67, %64, %62, %58, %56, %54, %52, %47
  br label %79

79:                                               ; preds = %78, %46
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %2, align 4, !tbaa !5
  %82 = load ptr, ptr %1, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.sector_t, ptr %82, i32 1
  store ptr %83, ptr %1, align 8, !tbaa !9
  br label %37, !llvm.loop !16

84:                                               ; preds = %37
  store i16 0, ptr @numlinespecials, align 2, !tbaa !18
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %108, %84
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = load i32, ptr @numlines, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %89, label %111

89:                                               ; preds = %85
  %90 = load ptr, ptr @lines, align 8, !tbaa !9
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds %struct.line_s, ptr %90, i64 %92
  %94 = getelementptr inbounds %struct.line_s, ptr %93, i32 0, i32 5
  %95 = load i16, ptr %94, align 2, !tbaa !19
  %96 = sext i16 %95 to i32
  switch i32 %96, label %107 [
    i32 48, label %97
  ]

97:                                               ; preds = %89
  %98 = load ptr, ptr @lines, align 8, !tbaa !9
  %99 = load i32, ptr %2, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds %struct.line_s, ptr %98, i64 %100
  %102 = load i16, ptr @numlinespecials, align 2, !tbaa !18
  %103 = sext i16 %102 to i64
  %104 = getelementptr inbounds [64 x ptr], ptr @linespeciallist, i64 0, i64 %103
  store ptr %101, ptr %104, align 8, !tbaa !9
  %105 = load i16, ptr @numlinespecials, align 2, !tbaa !18
  %106 = add i16 %105, 1
  store i16 %106, ptr @numlinespecials, align 2, !tbaa !18
  br label %107

107:                                              ; preds = %97, %89
  br label %108

108:                                              ; preds = %107
  %109 = load i32, ptr %2, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %2, align 4, !tbaa !5
  br label %85, !llvm.loop !21

111:                                              ; preds = %85
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %119, %111
  %113 = load i32, ptr %2, align 4, !tbaa !5
  %114 = icmp slt i32 %113, 30
  br i1 %114, label %115, label %122

115:                                              ; preds = %112
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [30 x ptr], ptr @activeceilings, i64 0, i64 %117
  store ptr null, ptr %118, align 8, !tbaa !9
  br label %119

119:                                              ; preds = %115
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %2, align 4, !tbaa !5
  br label %112, !llvm.loop !22

122:                                              ; preds = %112
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %130, %122
  %124 = load i32, ptr %2, align 4, !tbaa !5
  %125 = icmp slt i32 %124, 30
  br i1 %125, label %126, label %133

126:                                              ; preds = %123
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [30 x ptr], ptr @activeplats, i64 0, i64 %128
  store ptr null, ptr %129, align 8, !tbaa !9
  br label %130

130:                                              ; preds = %126
  %131 = load i32, ptr %2, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %2, align 4, !tbaa !5
  br label %123, !llvm.loop !23

133:                                              ; preds = %123
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %141, %133
  %135 = load i32, ptr %2, align 4, !tbaa !5
  %136 = icmp slt i32 %135, 16
  br i1 %136, label %137, label %144

137:                                              ; preds = %134
  %138 = load i32, ptr %2, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [16 x %struct.button_t], ptr @buttonlist, i64 0, i64 %139
  call void @llvm.memset.p0.i64(ptr align 16 %140, i8 0, i64 32, i1 false)
  br label %141

141:                                              ; preds = %137
  %142 = load i32, ptr %2, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %2, align 4, !tbaa !5
  br label %134, !llvm.loop !24

144:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

declare i32 @M_CheckParm(ptr noundef) #1

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

declare void @P_SpawnLightFlash(ptr noundef) #1

declare void @P_SpawnStrobeFlash(ptr noundef, i32 noundef, i32 noundef) #1

declare void @P_SpawnGlowingLight(ptr noundef) #1

declare void @P_SpawnDoorCloseIn30(ptr noundef) #1

declare void @P_SpawnDoorRaiseIn5Mins(ptr noundef, i32 noundef) #1

declare void @P_SpawnFireFlicker(ptr 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 = { inlinehint nounwind willreturn memory(read) 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 = { nounwind willreturn memory(read) }

!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 14}
!12 = !{!"", !6, i64 0, !6, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !13, i64 14, !13, i64 16, !6, i64 20, !10, i64 24, !7, i64 32, !14, i64 48, !6, i64 88, !10, i64 96, !10, i64 104, !6, i64 112, !10, i64 120}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !15, i64 0, !6, i64 24, !6, i64 28, !6, i64 32}
!15 = !{!"thinker_s", !10, i64 0, !10, i64 8, !7, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!13, !13, i64 0}
!19 = !{!20, !13, i64 26}
!20 = !{!"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}
!21 = distinct !{!21, !17}
!22 = distinct !{!22, !17}
!23 = distinct !{!23, !17}
!24 = distinct !{!24, !17}


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

@sectors = external local_unnamed_addr global ptr, align 8
@numsectors = external local_unnamed_addr global i32, align 4
@lines = external local_unnamed_addr global ptr, align 8
@levelTimer = external dso_local local_unnamed_addr global i32, align 4
@levelTimeCount = external dso_local local_unnamed_addr global i32, align 4
@numlinespecials = external dso_local local_unnamed_addr global i16, align 2
@linespeciallist = external dso_local local_unnamed_addr global [64 x ptr], align 16
@buttonlist = external local_unnamed_addr global [16 x %struct.button_t], align 16
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@deathmatch = external local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@myargv = external local_unnamed_addr global ptr, align 8
@totalsecret = external local_unnamed_addr global i32, align 4
@numlines = external local_unnamed_addr global i32, align 4
@activeceilings = external local_unnamed_addr global [30 x ptr], align 16
@activeplats = external local_unnamed_addr global [30 x ptr], align 16

declare i32 @W_CheckNumForName(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_SpawnSpecials() local_unnamed_addr #2 {
  %1 = tail call i32 @W_CheckNumForName(ptr noundef nonnull @.str.3) #4
  store i32 0, ptr @levelTimer, align 4, !tbaa !5
  %2 = tail call i32 @M_CheckParm(ptr noundef nonnull @.str.4) #4
  %3 = icmp ne i32 %2, 0
  %4 = load i32, ptr @deathmatch, align 4
  %5 = icmp ne i32 %4, 0
  %or.cond = select i1 %3, i1 %5, i1 false
  br i1 %or.cond, label %6, label %7

6:                                                ; preds = %0
  store i32 1, ptr @levelTimer, align 4, !tbaa !5
  store i32 42000, ptr @levelTimeCount, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %6, %0
  %8 = tail call i32 @M_CheckParm(ptr noundef nonnull @.str.5) #4
  %9 = icmp ne i32 %8, 0
  %10 = load i32, ptr @deathmatch, align 4
  %11 = icmp ne i32 %10, 0
  %or.cond3 = select i1 %9, i1 %11, i1 false
  br i1 %or.cond3, label %12, label %20

12:                                               ; preds = %7
  %13 = load ptr, ptr @myargv, align 8, !tbaa !9
  %14 = sext i32 %8 to i64
  %15 = getelementptr ptr, ptr %13, i64 %14
  %16 = getelementptr i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = tail call i32 @atoi(ptr nocapture noundef %17) #5
  %19 = mul i32 %18, 2100
  store i32 1, ptr @levelTimer, align 4, !tbaa !5
  store i32 %19, ptr @levelTimeCount, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %12, %7
  %21 = load i32, ptr @numsectors, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %20
  %23 = load ptr, ptr @sectors, align 8, !tbaa !9
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %39
  %.044 = phi ptr [ %41, %39 ], [ %23, %.lr.ph.preheader ]
  %.03843 = phi i32 [ %40, %39 ], [ 0, %.lr.ph.preheader ]
  %24 = getelementptr inbounds i8, ptr %.044, i64 14
  %25 = load i16, ptr %24, align 2, !tbaa !11
  switch i16 %25, label %39 [
    i16 17, label %38
    i16 1, label %26
    i16 2, label %27
    i16 3, label %28
    i16 4, label %29
    i16 8, label %30
    i16 9, label %31
    i16 10, label %34
    i16 12, label %35
    i16 13, label %36
    i16 14, label %37
  ]

26:                                               ; preds = %.lr.ph
  tail call void @P_SpawnLightFlash(ptr noundef nonnull %.044) #4
  br label %39

27:                                               ; preds = %.lr.ph
  tail call void @P_SpawnStrobeFlash(ptr noundef nonnull %.044, i32 noundef 15, i32 noundef 0) #4
  br label %39

28:                                               ; preds = %.lr.ph
  tail call void @P_SpawnStrobeFlash(ptr noundef nonnull %.044, i32 noundef 35, i32 noundef 0) #4
  br label %39

29:                                               ; preds = %.lr.ph
  tail call void @P_SpawnStrobeFlash(ptr noundef nonnull %.044, i32 noundef 15, i32 noundef 0) #4
  store i16 4, ptr %24, align 2, !tbaa !11
  br label %39

30:                                               ; preds = %.lr.ph
  tail call void @P_SpawnGlowingLight(ptr noundef nonnull %.044) #4
  br label %39

31:                                               ; preds = %.lr.ph
  %32 = load i32, ptr @totalsecret, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @totalsecret, align 4, !tbaa !5
  br label %39

34:                                               ; preds = %.lr.ph
  tail call void @P_SpawnDoorCloseIn30(ptr noundef nonnull %.044) #4
  br label %39

35:                                               ; preds = %.lr.ph
  tail call void @P_SpawnStrobeFlash(ptr noundef nonnull %.044, i32 noundef 35, i32 noundef 1) #4
  br label %39

36:                                               ; preds = %.lr.ph
  tail call void @P_SpawnStrobeFlash(ptr noundef nonnull %.044, i32 noundef 15, i32 noundef 1) #4
  br label %39

37:                                               ; preds = %.lr.ph
  tail call void @P_SpawnDoorRaiseIn5Mins(ptr noundef nonnull %.044, i32 noundef %.03843) #4
  br label %39

38:                                               ; preds = %.lr.ph
  tail call void @P_SpawnFireFlicker(ptr noundef nonnull %.044) #4
  br label %39

39:                                               ; preds = %.lr.ph, %26, %27, %28, %29, %30, %31, %34, %35, %36, %37, %38
  %40 = add nuw nsw i32 %.03843, 1
  %41 = getelementptr inbounds i8, ptr %.044, i64 128
  %42 = load i32, ptr @numsectors, align 4, !tbaa !5
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %39, %20
  store i16 0, ptr @numlinespecials, align 2, !tbaa !18
  %44 = load i32, ptr @numlines, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph47, label %.preheader42

.lr.ph47:                                         ; preds = %._crit_edge
  %46 = load ptr, ptr @lines, align 8, !tbaa !9
  %wide.trip.count = zext nneg i32 %44 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %47 = icmp eq i32 %44, 1
  br i1 %47, label %.preheader42.loopexit.unr-lcssa, label %.lr.ph47.new

.lr.ph47.new:                                     ; preds = %.lr.ph47
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %55

.preheader42.loopexit.unr-lcssa:                  ; preds = %73, %.lr.ph47
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph47 ], [ %indvars.iv.next.1, %73 ]
  %.unr = phi i16 [ 0, %.lr.ph47 ], [ %74, %73 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader42, label %.epil.preheader

.epil.preheader:                                  ; preds = %.preheader42.loopexit.unr-lcssa
  %48 = getelementptr inbounds %struct.line_s, ptr %46, i64 %indvars.iv.unr
  %49 = getelementptr inbounds i8, ptr %48, i64 26
  %50 = load i16, ptr %49, align 2, !tbaa !19
  %cond.epil = icmp eq i16 %50, 48
  br i1 %cond.epil, label %51, label %.preheader42

51:                                               ; preds = %.epil.preheader
  %52 = sext i16 %.unr to i64
  %53 = getelementptr inbounds [64 x ptr], ptr @linespeciallist, i64 0, i64 %52
  store ptr %48, ptr %53, align 8, !tbaa !9
  %54 = add i16 %.unr, 1
  store i16 %54, ptr @numlinespecials, align 2, !tbaa !18
  br label %.preheader42

.preheader42:                                     ; preds = %.preheader42.loopexit.unr-lcssa, %51, %.epil.preheader, %._crit_edge
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240) @activeceilings, i8 0, i64 240, i1 false), !tbaa !9
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240) @activeplats, i8 0, i64 240, i1 false), !tbaa !9
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(512) @buttonlist, i8 0, i64 512, i1 false)
  ret void

55:                                               ; preds = %73, %.lr.ph47.new
  %indvars.iv = phi i64 [ 0, %.lr.ph47.new ], [ %indvars.iv.next.1, %73 ]
  %56 = phi i16 [ 0, %.lr.ph47.new ], [ %74, %73 ]
  %niter = phi i64 [ 0, %.lr.ph47.new ], [ %niter.next.1, %73 ]
  %57 = getelementptr inbounds %struct.line_s, ptr %46, i64 %indvars.iv
  %58 = getelementptr inbounds i8, ptr %57, i64 26
  %59 = load i16, ptr %58, align 2, !tbaa !19
  %cond = icmp eq i16 %59, 48
  br i1 %cond, label %60, label %64

60:                                               ; preds = %55
  %61 = sext i16 %56 to i64
  %62 = getelementptr inbounds [64 x ptr], ptr @linespeciallist, i64 0, i64 %61
  store ptr %57, ptr %62, align 8, !tbaa !9
  %63 = add i16 %56, 1
  store i16 %63, ptr @numlinespecials, align 2, !tbaa !18
  br label %64

64:                                               ; preds = %60, %55
  %65 = phi i16 [ %63, %60 ], [ %56, %55 ]
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %66 = getelementptr inbounds %struct.line_s, ptr %46, i64 %indvars.iv.next
  %67 = getelementptr inbounds i8, ptr %66, i64 26
  %68 = load i16, ptr %67, align 2, !tbaa !19
  %cond.1 = icmp eq i16 %68, 48
  br i1 %cond.1, label %69, label %73

69:                                               ; preds = %64
  %70 = sext i16 %65 to i64
  %71 = getelementptr inbounds [64 x ptr], ptr @linespeciallist, i64 0, i64 %70
  store ptr %66, ptr %71, align 8, !tbaa !9
  %72 = add i16 %65, 1
  store i16 %72, ptr @numlinespecials, align 2, !tbaa !18
  br label %73

73:                                               ; preds = %69, %64
  %74 = phi i16 [ %72, %69 ], [ %65, %64 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader42.loopexit.unr-lcssa, label %55, !llvm.loop !21
}

declare i32 @M_CheckParm(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

declare void @P_SpawnLightFlash(ptr noundef) local_unnamed_addr #0

declare void @P_SpawnStrobeFlash(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @P_SpawnGlowingLight(ptr noundef) local_unnamed_addr #0

declare void @P_SpawnDoorCloseIn30(ptr noundef) local_unnamed_addr #0

declare void @P_SpawnDoorRaiseIn5Mins(ptr noundef, i32 noundef) local_unnamed_addr #0

declare void @P_SpawnFireFlicker(ptr noundef) local_unnamed_addr #0

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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { nounwind willreturn memory(read) }

!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 14}
!12 = !{!"", !6, i64 0, !6, i64 4, !13, i64 8, !13, i64 10, !13, i64 12, !13, i64 14, !13, i64 16, !6, i64 20, !10, i64 24, !7, i64 32, !14, i64 48, !6, i64 88, !10, i64 96, !10, i64 104, !6, i64 112, !10, i64 120}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !15, i64 0, !6, i64 24, !6, i64 28, !6, i64 32}
!15 = !{!"thinker_s", !10, i64 0, !10, i64 8, !7, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!13, !13, i64 0}
!19 = !{!20, !13, i64 26}
!20 = !{!"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}
!21 = distinct !{!21, !17}


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