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

; 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.player_s = type { ptr, i32, %struct.ticcmd_t, i32, i32, i32, i32, i32, i32, i32, [6 x i32], [6 x i32], i32, [4 x i32], i32, i32, [9 x i32], [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, [2 x %struct.pspdef_t], i32 }
%struct.ticcmd_t = type { i8, i8, i16, i16, i8, i8 }
%struct.pspdef_t = type { ptr, 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 }
%struct.mobj_s = type { %struct.thinker_s, i32, i32, i32, ptr, ptr, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, i32, ptr, i32, i32, i32, i32, ptr, i32, i32, ptr, i32, %struct.mapthing_t, ptr }
%struct.mapthing_t = type { i16, i16, i16, i16, i16 }

@playeringame = external global [4 x i32], align 16
@players = external global [4 x %struct.player_s], align 16
@thinkercap = external global %struct.thinker_s, align 8
@gamemode = external global i32, align 4
@gamemap = external global i32, align 4
@gameepisode = external 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

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

declare void @P_MobjThinker(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @A_BossDeath(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.line_s, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 88, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %8 = load i32, ptr @gamemode, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 2
  br i1 %9, label %10, label %26

10:                                               ; preds = %1
  %11 = load i32, ptr @gamemap, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 7
  br i1 %12, label %13, label %14

13:                                               ; preds = %10
  store i32 1, ptr %7, align 4
  br label %186

14:                                               ; preds = %10
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mobj_s, ptr %15, i32 0, i32 20
  %17 = load i32, ptr %16, align 8, !tbaa !11
  %18 = icmp ne i32 %17, 8
  br i1 %18, label %19, label %25

19:                                               ; preds = %14
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.mobj_s, ptr %20, i32 0, i32 20
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp ne i32 %22, 20
  br i1 %23, label %24, label %25

24:                                               ; preds = %19
  store i32 1, ptr %7, align 4
  br label %186

25:                                               ; preds = %19, %14
  br label %85

26:                                               ; preds = %1
  %27 = load i32, ptr @gameepisode, align 4, !tbaa !9
  switch i32 %27, label %79 [
    i32 1, label %28
    i32 2, label %39
    i32 3, label %50
    i32 4, label %61
  ]

28:                                               ; preds = %26
  %29 = load i32, ptr @gamemap, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 8
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store i32 1, ptr %7, align 4
  br label %186

32:                                               ; preds = %28
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mobj_s, ptr %33, i32 0, i32 20
  %35 = load i32, ptr %34, align 8, !tbaa !11
  %36 = icmp ne i32 %35, 15
  br i1 %36, label %37, label %38

37:                                               ; preds = %32
  store i32 1, ptr %7, align 4
  br label %186

38:                                               ; preds = %32
  br label %84

39:                                               ; preds = %26
  %40 = load i32, ptr @gamemap, align 4, !tbaa !9
  %41 = icmp ne i32 %40, 8
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 1, ptr %7, align 4
  br label %186

43:                                               ; preds = %39
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mobj_s, ptr %44, i32 0, i32 20
  %46 = load i32, ptr %45, align 8, !tbaa !11
  %47 = icmp ne i32 %46, 21
  br i1 %47, label %48, label %49

48:                                               ; preds = %43
  store i32 1, ptr %7, align 4
  br label %186

49:                                               ; preds = %43
  br label %84

50:                                               ; preds = %26
  %51 = load i32, ptr @gamemap, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 8
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  store i32 1, ptr %7, align 4
  br label %186

54:                                               ; preds = %50
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mobj_s, ptr %55, i32 0, i32 20
  %57 = load i32, ptr %56, align 8, !tbaa !11
  %58 = icmp ne i32 %57, 19
  br i1 %58, label %59, label %60

59:                                               ; preds = %54
  store i32 1, ptr %7, align 4
  br label %186

60:                                               ; preds = %54
  br label %84

61:                                               ; preds = %26
  %62 = load i32, ptr @gamemap, align 4, !tbaa !9
  switch i32 %62, label %77 [
    i32 6, label %63
    i32 8, label %70
  ]

63:                                               ; preds = %61
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mobj_s, ptr %64, i32 0, i32 20
  %66 = load i32, ptr %65, align 8, !tbaa !11
  %67 = icmp ne i32 %66, 21
  br i1 %67, label %68, label %69

68:                                               ; preds = %63
  store i32 1, ptr %7, align 4
  br label %186

69:                                               ; preds = %63
  br label %78

70:                                               ; preds = %61
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.mobj_s, ptr %71, i32 0, i32 20
  %73 = load i32, ptr %72, align 8, !tbaa !11
  %74 = icmp ne i32 %73, 19
  br i1 %74, label %75, label %76

75:                                               ; preds = %70
  store i32 1, ptr %7, align 4
  br label %186

76:                                               ; preds = %70
  br label %78

77:                                               ; preds = %61
  store i32 1, ptr %7, align 4
  br label %186

78:                                               ; preds = %76, %69
  br label %84

79:                                               ; preds = %26
  %80 = load i32, ptr @gamemap, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 8
  br i1 %81, label %82, label %83

82:                                               ; preds = %79
  store i32 1, ptr %7, align 4
  br label %186

83:                                               ; preds = %79
  br label %84

84:                                               ; preds = %83, %78, %60, %49, %38
  br label %85

85:                                               ; preds = %84, %25
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %86

86:                                               ; preds = %104, %85
  %87 = load i32, ptr %6, align 4, !tbaa !9
  %88 = icmp slt i32 %87, 4
  br i1 %88, label %89, label %107

89:                                               ; preds = %86
  %90 = load i32, ptr %6, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %103

95:                                               ; preds = %89
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.player_s, ptr %98, i32 0, i32 7
  %100 = load i32, ptr %99, align 4, !tbaa !16
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %102, label %103

102:                                              ; preds = %95
  br label %107

103:                                              ; preds = %95, %89
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %6, align 4, !tbaa !9
  br label %86, !llvm.loop !19

107:                                              ; preds = %102, %86
  %108 = load i32, ptr %6, align 4, !tbaa !9
  %109 = icmp eq i32 %108, 4
  br i1 %109, label %110, label %111

110:                                              ; preds = %107
  store i32 1, ptr %7, align 4
  br label %186

111:                                              ; preds = %107
  %112 = load ptr, ptr getelementptr inbounds (%struct.thinker_s, ptr @thinkercap, i32 0, i32 1), align 8, !tbaa !21
  store ptr %112, ptr %3, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %142, %111
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = icmp ne ptr %114, @thinkercap
  br i1 %115, label %116, label %146

116:                                              ; preds = %113
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.thinker_s, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !22
  %120 = icmp ne ptr %119, @P_MobjThinker
  br i1 %120, label %121, label %122

121:                                              ; preds = %116
  br label %142

122:                                              ; preds = %116
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %123, ptr %4, align 8, !tbaa !5
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = icmp ne ptr %124, %125
  br i1 %126, label %127, label %141

127:                                              ; preds = %122
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.mobj_s, ptr %128, i32 0, i32 20
  %130 = load i32, ptr %129, align 8, !tbaa !11
  %131 = load ptr, ptr %2, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.mobj_s, ptr %131, i32 0, i32 20
  %133 = load i32, ptr %132, align 8, !tbaa !11
  %134 = icmp eq i32 %130, %133
  br i1 %134, label %135, label %141

135:                                              ; preds = %127
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.mobj_s, ptr %136, i32 0, i32 25
  %138 = load i32, ptr %137, align 4, !tbaa !23
  %139 = icmp sgt i32 %138, 0
  br i1 %139, label %140, label %141

140:                                              ; preds = %135
  store i32 1, ptr %7, align 4
  br label %186

141:                                              ; preds = %135, %127, %122
  br label %142

142:                                              ; preds = %141, %121
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.thinker_s, ptr %143, i32 0, i32 1
  %145 = load ptr, ptr %144, align 8, !tbaa !21
  store ptr %145, ptr %3, align 8, !tbaa !5
  br label %113, !llvm.loop !24

146:                                              ; preds = %113
  %147 = load i32, ptr @gamemode, align 4, !tbaa !9
  %148 = icmp eq i32 %147, 2
  br i1 %148, label %149, label %170

149:                                              ; preds = %146
  %150 = load i32, ptr @gamemap, align 4, !tbaa !9
  %151 = icmp eq i32 %150, 7
  br i1 %151, label %152, label %169

152:                                              ; preds = %149
  %153 = load ptr, ptr %2, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.mobj_s, ptr %153, i32 0, i32 20
  %155 = load i32, ptr %154, align 8, !tbaa !11
  %156 = icmp eq i32 %155, 8
  br i1 %156, label %157, label %160

157:                                              ; preds = %152
  %158 = getelementptr inbounds %struct.line_s, ptr %5, i32 0, i32 6
  store i16 666, ptr %158, align 4, !tbaa !25
  %159 = call i32 @EV_DoFloor(ptr noundef %5, i32 noundef 1)
  store i32 1, ptr %7, align 4
  br label %186

160:                                              ; preds = %152
  %161 = load ptr, ptr %2, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.mobj_s, ptr %161, i32 0, i32 20
  %163 = load i32, ptr %162, align 8, !tbaa !11
  %164 = icmp eq i32 %163, 20
  br i1 %164, label %165, label %168

165:                                              ; preds = %160
  %166 = getelementptr inbounds %struct.line_s, ptr %5, i32 0, i32 6
  store i16 667, ptr %166, align 4, !tbaa !25
  %167 = call i32 @EV_DoFloor(ptr noundef %5, i32 noundef 5)
  store i32 1, ptr %7, align 4
  br label %186

168:                                              ; preds = %160
  br label %169

169:                                              ; preds = %168, %149
  br label %185

170:                                              ; preds = %146
  %171 = load i32, ptr @gameepisode, align 4, !tbaa !9
  switch i32 %171, label %184 [
    i32 1, label %172
    i32 4, label %175
  ]

172:                                              ; preds = %170
  %173 = getelementptr inbounds %struct.line_s, ptr %5, i32 0, i32 6
  store i16 666, ptr %173, align 4, !tbaa !25
  %174 = call i32 @EV_DoFloor(ptr noundef %5, i32 noundef 1)
  store i32 1, ptr %7, align 4
  br label %186

175:                                              ; preds = %170
  %176 = load i32, ptr @gamemap, align 4, !tbaa !9
  switch i32 %176, label %183 [
    i32 6, label %177
    i32 8, label %180
  ]

177:                                              ; preds = %175
  %178 = getelementptr inbounds %struct.line_s, ptr %5, i32 0, i32 6
  store i16 666, ptr %178, align 4, !tbaa !25
  %179 = call i32 @EV_DoDoor(ptr noundef %5, i32 noundef 6)
  store i32 1, ptr %7, align 4
  br label %186

180:                                              ; preds = %175
  %181 = getelementptr inbounds %struct.line_s, ptr %5, i32 0, i32 6
  store i16 666, ptr %181, align 4, !tbaa !25
  %182 = call i32 @EV_DoFloor(ptr noundef %5, i32 noundef 1)
  store i32 1, ptr %7, align 4
  br label %186

183:                                              ; preds = %175
  br label %184

184:                                              ; preds = %183, %170
  br label %185

185:                                              ; preds = %184, %169
  call void @G_ExitLevel()
  store i32 0, ptr %7, align 4
  br label %186

186:                                              ; preds = %185, %180, %177, %172, %165, %157, %140, %110, %82, %77, %75, %68, %59, %53, %48, %42, %37, %31, %24, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 88, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %187 = load i32, ptr %7, align 4
  switch i32 %187, label %189 [
    i32 0, label %188
    i32 1, label %188
  ]

188:                                              ; preds = %186, %186
  ret void

189:                                              ; preds = %186
  unreachable
}

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

declare void @G_ExitLevel() #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 = { 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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 128}
!12 = !{!"mobj_s", !13, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !10, i64 144, !6, i64 152, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !6, i64 176, !10, i64 184, !10, i64 188, !6, i64 192, !10, i64 200, !14, i64 204, !6, i64 216}
!13 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!14 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !10, i64 36}
!17 = !{!"player_s", !6, i64 0, !10, i64 8, !18, i64 12, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !7, i64 48, !7, i64 72, !10, i64 96, !7, i64 100, !10, i64 116, !10, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !6, i64 224, !10, i64 232, !10, i64 236, !6, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !7, i64 264, !10, i64 312}
!18 = !{!"", !7, i64 0, !7, i64 1, !15, i64 2, !15, i64 4, !7, i64 6, !7, i64 7}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!13, !6, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!12, !10, i64 164}
!24 = distinct !{!24, !20}
!25 = !{!26, !15, i64 28}
!26 = !{!"line_s", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !15, i64 24, !15, i64 26, !15, i64 28, !7, i64 30, !7, i64 36, !10, i64 52, !6, i64 56, !6, i64 64, !10, i64 72, !6, i64 80}


; 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.player_s = type { ptr, i32, %struct.ticcmd_t, i32, i32, i32, i32, i32, i32, i32, [6 x i32], [6 x i32], i32, [4 x i32], i32, i32, [9 x i32], [4 x i32], [4 x i32], i32, i32, i32, i32, i32, i32, i32, ptr, i32, i32, ptr, i32, i32, i32, [2 x %struct.pspdef_t], i32 }
%struct.ticcmd_t = type { i8, i8, i16, i16, i8, i8 }
%struct.pspdef_t = type { ptr, 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 }

@playeringame = external local_unnamed_addr global [4 x i32], align 16
@players = external local_unnamed_addr global [4 x %struct.player_s], align 16
@thinkercap = external global %struct.thinker_s, align 8
@gamemode = external local_unnamed_addr global i32, align 4
@gamemap = external local_unnamed_addr global i32, align 4
@gameepisode = external local_unnamed_addr global i32, align 4

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

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

declare void @P_MobjThinker(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @A_BossDeath(ptr noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca %struct.line_s, align 8
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %2) #3
  %3 = load i32, ptr @gamemode, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 2
  br i1 %4, label %5, label %10

5:                                                ; preds = %1
  %6 = load i32, ptr @gamemap, align 4, !tbaa !5
  %.not34 = icmp eq i32 %6, 7
  br i1 %.not34, label %7, label %.loopexit

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 128
  %9 = load i32, ptr %8, align 8, !tbaa !9
  switch i32 %9, label %.loopexit [
    i32 8, label %33
    i32 20, label %33
  ]

10:                                               ; preds = %1
  %11 = load i32, ptr @gameepisode, align 4, !tbaa !5
  %12 = load i32, ptr @gamemap, align 4, !tbaa !5
  switch i32 %11, label %32 [
    i32 1, label %13
    i32 2, label %17
    i32 3, label %21
    i32 4, label %25
  ]

13:                                               ; preds = %10
  %.not31 = icmp eq i32 %12, 8
  br i1 %.not31, label %14, label %.loopexit

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %0, i64 128
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %.not32 = icmp eq i32 %16, 15
  br i1 %.not32, label %33, label %.loopexit

17:                                               ; preds = %10
  %.not29 = icmp eq i32 %12, 8
  br i1 %.not29, label %18, label %.loopexit

18:                                               ; preds = %17
  %19 = getelementptr inbounds i8, ptr %0, i64 128
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %.not30 = icmp eq i32 %20, 21
  br i1 %.not30, label %33, label %.loopexit

21:                                               ; preds = %10
  %.not27 = icmp eq i32 %12, 8
  br i1 %.not27, label %22, label %.loopexit

22:                                               ; preds = %21
  %23 = getelementptr inbounds i8, ptr %0, i64 128
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %.not28 = icmp eq i32 %24, 19
  br i1 %.not28, label %33, label %.loopexit

25:                                               ; preds = %10
  switch i32 %12, label %.loopexit [
    i32 6, label %26
    i32 8, label %29
  ]

26:                                               ; preds = %25
  %27 = getelementptr inbounds i8, ptr %0, i64 128
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %.not26 = icmp eq i32 %28, 21
  br i1 %.not26, label %33, label %.loopexit

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 128
  %31 = load i32, ptr %30, align 8, !tbaa !9
  %.not = icmp eq i32 %31, 19
  br i1 %.not, label %33, label %.loopexit

32:                                               ; preds = %10
  %.not33 = icmp eq i32 %12, 8
  br i1 %.not33, label %33, label %.loopexit

33:                                               ; preds = %7, %7, %14, %18, %22, %29, %26, %32
  %34 = phi i32 [ 7, %7 ], [ 7, %7 ], [ 8, %14 ], [ 8, %18 ], [ 8, %22 ], [ 8, %29 ], [ 6, %26 ], [ 8, %32 ]
  %35 = load i32, ptr @playeringame, align 16, !tbaa !5
  %.not37 = icmp ne i32 %35, 0
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 36), align 4
  %37 = icmp sgt i32 %36, 0
  %or.cond47 = select i1 %.not37, i1 %37, i1 false
  br i1 %or.cond47, label %.preheader, label %38

38:                                               ; preds = %33
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !5
  %.not37.1 = icmp ne i32 %39, 0
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 356), align 4
  %41 = icmp sgt i32 %40, 0
  %or.cond49 = select i1 %.not37.1, i1 %41, i1 false
  br i1 %or.cond49, label %.preheader, label %42

42:                                               ; preds = %38
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !5
  %.not37.2 = icmp ne i32 %43, 0
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 676), align 4
  %45 = icmp sgt i32 %44, 0
  %or.cond51 = select i1 %.not37.2, i1 %45, i1 false
  br i1 %or.cond51, label %.preheader, label %46

46:                                               ; preds = %42
  %47 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !5
  %.not37.3 = icmp ne i32 %47, 0
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 996), align 4
  %49 = icmp sgt i32 %48, 0
  %or.cond53 = select i1 %.not37.3, i1 %49, i1 false
  br i1 %or.cond53, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %46, %42, %38, %33
  %.02242 = load ptr, ptr getelementptr inbounds (i8, ptr @thinkercap, i64 8), align 8, !tbaa !15
  %.not3843 = icmp eq ptr %.02242, @thinkercap
  br i1 %.not3843, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %50 = getelementptr inbounds i8, ptr %0, i64 128
  br label %51

51:                                               ; preds = %.lr.ph, %63
  %.02244 = phi ptr [ %.02242, %.lr.ph ], [ %.022, %63 ]
  %52 = getelementptr inbounds i8, ptr %.02244, i64 16
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %.not39 = icmp ne ptr %53, @P_MobjThinker
  %.not40 = icmp eq ptr %.02244, %0
  %or.cond = or i1 %.not40, %.not39
  br i1 %or.cond, label %63, label %54

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %.02244, i64 128
  %56 = load i32, ptr %55, align 8, !tbaa !9
  %57 = load i32, ptr %50, align 8, !tbaa !9
  %58 = icmp eq i32 %56, %57
  br i1 %58, label %59, label %63

59:                                               ; preds = %54
  %60 = getelementptr inbounds i8, ptr %.02244, i64 164
  %61 = load i32, ptr %60, align 4, !tbaa !17
  %62 = icmp sgt i32 %61, 0
  br i1 %62, label %.loopexit, label %63

63:                                               ; preds = %54, %59, %51
  %64 = getelementptr inbounds i8, ptr %.02244, i64 8
  %.022 = load ptr, ptr %64, align 8, !tbaa !15
  %.not38 = icmp eq ptr %.022, @thinkercap
  br i1 %.not38, label %._crit_edge, label %51, !llvm.loop !18

._crit_edge:                                      ; preds = %63, %.preheader
  br i1 %4, label %65, label %74

65:                                               ; preds = %._crit_edge
  %66 = getelementptr inbounds i8, ptr %0, i64 128
  %67 = load i32, ptr %66, align 8, !tbaa !9
  switch i32 %67, label %86 [
    i32 8, label %68
    i32 20, label %71
  ]

68:                                               ; preds = %65
  %69 = getelementptr inbounds i8, ptr %2, i64 28
  store i16 666, ptr %69, align 4, !tbaa !20
  %70 = call i32 @EV_DoFloor(ptr noundef nonnull %2, i32 noundef 1) #3
  br label %.loopexit

71:                                               ; preds = %65
  %72 = getelementptr inbounds i8, ptr %2, i64 28
  store i16 667, ptr %72, align 4, !tbaa !20
  %73 = call i32 @EV_DoFloor(ptr noundef nonnull %2, i32 noundef 5) #3
  br label %.loopexit

74:                                               ; preds = %._crit_edge
  %75 = load i32, ptr @gameepisode, align 4, !tbaa !5
  switch i32 %75, label %86 [
    i32 1, label %76
    i32 4, label %79
  ]

76:                                               ; preds = %74
  %77 = getelementptr inbounds i8, ptr %2, i64 28
  store i16 666, ptr %77, align 4, !tbaa !20
  %78 = call i32 @EV_DoFloor(ptr noundef nonnull %2, i32 noundef 1) #3
  br label %.loopexit

79:                                               ; preds = %74
  switch i32 %34, label %86 [
    i32 6, label %80
    i32 8, label %83
  ]

80:                                               ; preds = %79
  %81 = getelementptr inbounds i8, ptr %2, i64 28
  store i16 666, ptr %81, align 4, !tbaa !20
  %82 = call i32 @EV_DoDoor(ptr noundef nonnull %2, i32 noundef 6) #3
  br label %.loopexit

83:                                               ; preds = %79
  %84 = getelementptr inbounds i8, ptr %2, i64 28
  store i16 666, ptr %84, align 4, !tbaa !20
  %85 = call i32 @EV_DoFloor(ptr noundef nonnull %2, i32 noundef 1) #3
  br label %.loopexit

86:                                               ; preds = %65, %74, %79
  tail call void @G_ExitLevel() #3
  br label %.loopexit

.loopexit:                                        ; preds = %59, %46, %32, %25, %29, %26, %22, %21, %18, %17, %14, %13, %7, %5, %86, %83, %80, %76, %71, %68
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %2) #3
  ret void
}

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

declare void @G_ExitLevel() local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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, !6, i64 128}
!10 = !{!"mobj_s", !11, i64 0, !6, i64 24, !6, i64 28, !6, i64 32, !12, i64 40, !12, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !6, i64 96, !6, i64 100, !6, i64 104, !6, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !12, i64 136, !6, i64 144, !12, i64 152, !6, i64 160, !6, i64 164, !6, i64 168, !6, i64 172, !12, i64 176, !6, i64 184, !6, i64 188, !12, i64 192, !6, i64 200, !13, i64 204, !12, i64 216}
!11 = !{!"thinker_s", !12, i64 0, !12, i64 8, !7, i64 16}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!14 = !{!"short", !7, i64 0}
!15 = !{!11, !12, i64 8}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !6, i64 164}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !14, i64 28}
!21 = !{!"line_s", !12, i64 0, !12, i64 8, !6, i64 16, !6, i64 20, !14, i64 24, !14, i64 26, !14, i64 28, !7, i64 30, !7, i64 36, !6, i64 52, !12, i64 56, !12, i64 64, !6, i64 72, !12, i64 80}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass