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

; 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.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.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }
%struct.mapthing_t = type { i16, i16, i16, i16, i16 }

@consistancy = external dso_local global [4 x [12 x i16]], align 16
@consoleplayer = external dso_local global i32, align 4
@ticdup = external global i32, align 4
@savegameslot = external dso_local global i32, align 4
@gametic = external dso_local global i32, align 4
@gamestate = external dso_local global i32, align 4
@playeringame = external dso_local global [4 x i32], align 16
@players = external dso_local global [4 x %struct.player_s], align 16
@gameaction = external dso_local global i32, align 4
@paused = external dso_local global i32, align 4
@demoplayback = external dso_local global i32, align 4
@netcmds = external global [4 x [12 x %struct.ticcmd_t]], align 16
@demorecording = external dso_local global i32, align 4
@G_Ticker.turbomessage = external hidden global [80 x i8], align 16
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@player_names = external global [4 x ptr], align 16
@netgame = external dso_local global i32, align 4
@netdemo = external dso_local global i32, align 4
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@rndindex = external global i32, align 4
@savedescription = external dso_local global [32 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [9 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 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoLoadLevel() #2

; Function Attrs: nounwind uwtable
define dso_local void @G_Ticker() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %23, %0
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp slt i32 %5, 4
  br i1 %6, label %7, label %26

7:                                                ; preds = %4
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %22

13:                                               ; preds = %7
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %15
  %17 = getelementptr inbounds %struct.player_s, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = icmp eq i32 %18, 2
  br i1 %19, label %20, label %22

20:                                               ; preds = %13
  %21 = load i32, ptr %1, align 4, !tbaa !5
  call void @G_DoReborn(i32 noundef %21)
  br label %22

22:                                               ; preds = %20, %13, %7
  br label %23

23:                                               ; preds = %22
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %1, align 4, !tbaa !5
  br label %4, !llvm.loop !14

26:                                               ; preds = %4
  br label %27

27:                                               ; preds = %41, %26
  %28 = load i32, ptr @gameaction, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %42

30:                                               ; preds = %27
  %31 = load i32, ptr @gameaction, align 4, !tbaa !5
  switch i32 %31, label %41 [
    i32 1, label %32
    i32 2, label %33
    i32 3, label %34
    i32 4, label %35
    i32 5, label %36
    i32 6, label %37
    i32 7, label %38
    i32 8, label %39
    i32 9, label %40
    i32 0, label %41
  ]

32:                                               ; preds = %30
  call void @G_DoLoadLevel()
  br label %41

33:                                               ; preds = %30
  call void @G_DoNewGame()
  br label %41

34:                                               ; preds = %30
  call void @G_DoLoadGame()
  br label %41

35:                                               ; preds = %30
  call void @G_DoSaveGame()
  br label %41

36:                                               ; preds = %30
  call void @G_DoPlayDemo()
  br label %41

37:                                               ; preds = %30
  call void @G_DoCompleted()
  br label %41

38:                                               ; preds = %30
  call void @F_StartFinale()
  br label %41

39:                                               ; preds = %30
  call void @G_DoWorldDone()
  br label %41

40:                                               ; preds = %30
  call void @M_ScreenShot()
  store i32 0, ptr @gameaction, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %40, %39, %38, %37, %36, %35, %34, %33, %32, %30, %30
  br label %27, !llvm.loop !16

42:                                               ; preds = %27
  %43 = load i32, ptr @gametic, align 4, !tbaa !5
  %44 = load i32, ptr @ticdup, align 4, !tbaa !5
  %45 = sdiv i32 %43, %44
  %46 = srem i32 %45, 12
  store i32 %46, ptr %2, align 4, !tbaa !5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %178, %42
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = icmp slt i32 %48, 4
  br i1 %49, label %50, label %181

50:                                               ; preds = %47
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %177

56:                                               ; preds = %50
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.player_s, ptr %59, i32 0, i32 2
  store ptr %60, ptr %3, align 8, !tbaa !17
  %61 = load ptr, ptr %3, align 8, !tbaa !17
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [4 x [12 x %struct.ticcmd_t]], ptr @netcmds, i64 0, i64 %63
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [12 x %struct.ticcmd_t], ptr %64, i64 0, i64 %66
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %61, ptr align 8 %67, i64 8, i1 false)
  %68 = load i32, ptr @demoplayback, align 4, !tbaa !5
  %69 = icmp ne i32 %68, 0
  br i1 %69, label %70, label %72

70:                                               ; preds = %56
  %71 = load ptr, ptr %3, align 8, !tbaa !17
  call void @G_ReadDemoTiccmd(ptr noundef %71)
  br label %72

72:                                               ; preds = %70, %56
  %73 = load i32, ptr @demorecording, align 4, !tbaa !5
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %72
  %76 = load ptr, ptr %3, align 8, !tbaa !17
  call void @G_WriteDemoTiccmd(ptr noundef %76)
  br label %77

77:                                               ; preds = %75, %72
  %78 = load ptr, ptr %3, align 8, !tbaa !17
  %79 = getelementptr inbounds %struct.ticcmd_t, ptr %78, i32 0, i32 0
  %80 = load i8, ptr %79, align 2, !tbaa !18
  %81 = sext i8 %80 to i32
  %82 = icmp sgt i32 %81, 50
  br i1 %82, label %83, label %103

83:                                               ; preds = %77
  %84 = load i32, ptr @gametic, align 4, !tbaa !5
  %85 = and i32 %84, 31
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %103, label %87

87:                                               ; preds = %83
  %88 = load i32, ptr @gametic, align 4, !tbaa !5
  %89 = ashr i32 %88, 5
  %90 = and i32 %89, 3
  %91 = load i32, ptr %1, align 4, !tbaa !5
  %92 = icmp eq i32 %90, %91
  br i1 %92, label %93, label %103

93:                                               ; preds = %87
  %94 = load i32, ptr %1, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [4 x ptr], ptr @player_names, i64 0, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef @G_Ticker.turbomessage, ptr noundef @.str.4, ptr noundef %97) #6
  %99 = load i32, ptr @consoleplayer, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %100
  %102 = getelementptr inbounds %struct.player_s, ptr %101, i32 0, i32 26
  store ptr @G_Ticker.turbomessage, ptr %102, align 16, !tbaa !19
  br label %103

103:                                              ; preds = %93, %87, %83, %77
  %104 = load i32, ptr @netgame, align 4, !tbaa !5
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %106, label %176

106:                                              ; preds = %103
  %107 = load i32, ptr @netdemo, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %176, label %109

109:                                              ; preds = %106
  %110 = load i32, ptr @gametic, align 4, !tbaa !5
  %111 = load i32, ptr @ticdup, align 4, !tbaa !5
  %112 = srem i32 %110, %111
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %176, label %114

114:                                              ; preds = %109
  %115 = load i32, ptr @gametic, align 4, !tbaa !5
  %116 = icmp sgt i32 %115, 12
  br i1 %116, label %117, label %144

117:                                              ; preds = %114
  %118 = load i32, ptr %1, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 %119
  %121 = load i32, ptr %2, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [12 x i16], ptr %120, i64 0, i64 %122
  %124 = load i16, ptr %123, align 2, !tbaa !20
  %125 = sext i16 %124 to i32
  %126 = load ptr, ptr %3, align 8, !tbaa !17
  %127 = getelementptr inbounds %struct.ticcmd_t, ptr %126, i32 0, i32 3
  %128 = load i16, ptr %127, align 2, !tbaa !21
  %129 = sext i16 %128 to i32
  %130 = icmp ne i32 %125, %129
  br i1 %130, label %131, label %144

131:                                              ; preds = %117
  %132 = load ptr, ptr %3, align 8, !tbaa !17
  %133 = getelementptr inbounds %struct.ticcmd_t, ptr %132, i32 0, i32 3
  %134 = load i16, ptr %133, align 2, !tbaa !21
  %135 = sext i16 %134 to i32
  %136 = load i32, ptr %1, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 %137
  %139 = load i32, ptr %2, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [12 x i16], ptr %138, i64 0, i64 %140
  %142 = load i16, ptr %141, align 2, !tbaa !20
  %143 = sext i16 %142 to i32
  call void (ptr, ...) @I_Error(ptr noundef @.str.5, i32 noundef %135, i32 noundef %143) #7
  unreachable

144:                                              ; preds = %117, %114
  %145 = load i32, ptr %1, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %146
  %148 = getelementptr inbounds %struct.player_s, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 16, !tbaa !22
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %166

151:                                              ; preds = %144
  %152 = load i32, ptr %1, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %153
  %155 = getelementptr inbounds %struct.player_s, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 16, !tbaa !22
  %157 = getelementptr inbounds %struct.mobj_s, ptr %156, i32 0, i32 1
  %158 = load i32, ptr %157, align 8, !tbaa !23
  %159 = trunc i32 %158 to i16
  %160 = load i32, ptr %1, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 %161
  %163 = load i32, ptr %2, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [12 x i16], ptr %162, i64 0, i64 %164
  store i16 %159, ptr %165, align 2, !tbaa !20
  br label %175

166:                                              ; preds = %144
  %167 = load i32, ptr @rndindex, align 4, !tbaa !5
  %168 = trunc i32 %167 to i16
  %169 = load i32, ptr %1, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 %170
  %172 = load i32, ptr %2, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [12 x i16], ptr %171, i64 0, i64 %173
  store i16 %168, ptr %174, align 2, !tbaa !20
  br label %175

175:                                              ; preds = %166, %151
  br label %176

176:                                              ; preds = %175, %109, %106, %103
  br label %177

177:                                              ; preds = %176, %50
  br label %178

178:                                              ; preds = %177
  %179 = load i32, ptr %1, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %1, align 4, !tbaa !5
  br label %47, !llvm.loop !27

181:                                              ; preds = %47
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %182

182:                                              ; preds = %236, %181
  %183 = load i32, ptr %1, align 4, !tbaa !5
  %184 = icmp slt i32 %183, 4
  br i1 %184, label %185, label %239

185:                                              ; preds = %182
  %186 = load i32, ptr %1, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [4 x i32], ptr @playeringame, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %235

191:                                              ; preds = %185
  %192 = load i32, ptr %1, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %193
  %195 = getelementptr inbounds %struct.player_s, ptr %194, i32 0, i32 2
  %196 = getelementptr inbounds %struct.ticcmd_t, ptr %195, i32 0, i32 5
  %197 = load i8, ptr %196, align 1, !tbaa !28
  %198 = zext i8 %197 to i32
  %199 = and i32 %198, 128
  %200 = icmp ne i32 %199, 0
  br i1 %200, label %201, label %234

201:                                              ; preds = %191
  %202 = load i32, ptr %1, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %203
  %205 = getelementptr inbounds %struct.player_s, ptr %204, i32 0, i32 2
  %206 = getelementptr inbounds %struct.ticcmd_t, ptr %205, i32 0, i32 5
  %207 = load i8, ptr %206, align 1, !tbaa !28
  %208 = zext i8 %207 to i32
  %209 = and i32 %208, 3
  switch i32 %209, label %233 [
    i32 1, label %210
    i32 2, label %218
  ]

210:                                              ; preds = %201
  %211 = load i32, ptr @paused, align 4, !tbaa !5
  %212 = xor i32 %211, 1
  store i32 %212, ptr @paused, align 4, !tbaa !5
  %213 = load i32, ptr @paused, align 4, !tbaa !5
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %216

215:                                              ; preds = %210
  call void @S_PauseSound()
  br label %217

216:                                              ; preds = %210
  call void @S_ResumeSound()
  br label %217

217:                                              ; preds = %216, %215
  br label %233

218:                                              ; preds = %201
  %219 = load i8, ptr @savedescription, align 16, !tbaa !29
  %220 = icmp ne i8 %219, 0
  br i1 %220, label %223, label %221

221:                                              ; preds = %218
  %222 = call ptr @strcpy(ptr noundef @savedescription, ptr noundef @.str.6) #6
  br label %223

223:                                              ; preds = %221, %218
  %224 = load i32, ptr %1, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %225
  %227 = getelementptr inbounds %struct.player_s, ptr %226, i32 0, i32 2
  %228 = getelementptr inbounds %struct.ticcmd_t, ptr %227, i32 0, i32 5
  %229 = load i8, ptr %228, align 1, !tbaa !28
  %230 = zext i8 %229 to i32
  %231 = and i32 %230, 28
  %232 = ashr i32 %231, 2
  store i32 %232, ptr @savegameslot, align 4, !tbaa !5
  store i32 4, ptr @gameaction, align 4, !tbaa !5
  br label %233

233:                                              ; preds = %223, %217, %201
  br label %234

234:                                              ; preds = %233, %191
  br label %235

235:                                              ; preds = %234, %185
  br label %236

236:                                              ; preds = %235
  %237 = load i32, ptr %1, align 4, !tbaa !5
  %238 = add nsw i32 %237, 1
  store i32 %238, ptr %1, align 4, !tbaa !5
  br label %182, !llvm.loop !30

239:                                              ; preds = %182
  %240 = load i32, ptr @gamestate, align 4, !tbaa !5
  switch i32 %240, label %245 [
    i32 0, label %241
    i32 1, label %242
    i32 2, label %243
    i32 3, label %244
  ]

241:                                              ; preds = %239
  call void @P_Ticker()
  call void @ST_Ticker()
  call void @AM_Ticker()
  call void @HU_Ticker()
  br label %245

242:                                              ; preds = %239
  call void @WI_Ticker()
  br label %245

243:                                              ; preds = %239
  call void @F_Ticker()
  br label %245

244:                                              ; preds = %239
  call void @D_PageTicker()
  br label %245

245:                                              ; preds = %244, %243, %242, %241, %239
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoReborn(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoNewGame() #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoLoadGame() #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoSaveGame() #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoPlayDemo() #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoCompleted() #2

declare void @F_StartFinale() #3

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoWorldDone() #2

declare void @M_ScreenShot() #3

; Function Attrs: nounwind uwtable
declare dso_local void @G_ReadDemoTiccmd(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @G_WriteDemoTiccmd(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #4

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

declare void @S_PauseSound() #3

declare void @S_ResumeSound() #3

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #4

declare void @P_Ticker() #3

declare void @ST_Ticker() #3

declare void @AM_Ticker() #3

declare void @HU_Ticker() #3

declare void @WI_Ticker() #3

declare void @F_Ticker() #3

declare void @D_PageTicker() #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 "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 = { 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 #6 = { nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"player_s", !11, i64 0, !6, i64 8, !12, i64 12, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !7, i64 48, !7, i64 72, !6, i64 96, !7, i64 100, !6, i64 116, !6, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !6, i64 192, !6, i64 196, !6, i64 200, !6, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !11, i64 224, !6, i64 232, !6, i64 236, !11, i64 240, !6, i64 248, !6, i64 252, !6, i64 256, !7, i64 264, !6, i64 312}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 1, !13, i64 2, !13, i64 4, !7, i64 6, !7, i64 7}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = !{!11, !11, i64 0}
!18 = !{!12, !7, i64 0}
!19 = !{!10, !11, i64 224}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 4}
!22 = !{!10, !11, i64 0}
!23 = !{!24, !6, i64 24}
!24 = !{!"mobj_s", !25, i64 0, !6, i64 24, !6, i64 28, !6, i64 32, !11, i64 40, !11, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !11, i64 72, !11, i64 80, !11, 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, !11, i64 136, !6, i64 144, !11, i64 152, !6, i64 160, !6, i64 164, !6, i64 168, !6, i64 172, !11, i64 176, !6, i64 184, !6, i64 188, !11, i64 192, !6, i64 200, !26, i64 204, !11, i64 216}
!25 = !{!"thinker_s", !11, i64 0, !11, i64 8, !7, i64 16}
!26 = !{!"", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!27 = distinct !{!27, !15}
!28 = !{!10, !7, i64 19}
!29 = !{!7, !7, i64 0}
!30 = distinct !{!30, !15}


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

@consistancy = external dso_local local_unnamed_addr global [4 x [12 x i16]], align 16
@consoleplayer = external dso_local local_unnamed_addr global i32, align 4
@ticdup = external local_unnamed_addr global i32, align 4
@savegameslot = external dso_local local_unnamed_addr global i32, align 4
@gametic = external dso_local local_unnamed_addr global i32, align 4
@gamestate = external dso_local local_unnamed_addr global i32, align 4
@playeringame = external dso_local local_unnamed_addr global [4 x i32], align 16
@players = external dso_local global [4 x %struct.player_s], align 16
@gameaction = external dso_local local_unnamed_addr global i32, align 4
@paused = external dso_local local_unnamed_addr global i32, align 4
@demoplayback = external dso_local local_unnamed_addr global i32, align 4
@netcmds = external local_unnamed_addr global [4 x [12 x %struct.ticcmd_t]], align 16
@demorecording = external dso_local local_unnamed_addr global i32, align 4
@G_Ticker.turbomessage = external hidden global [80 x i8], align 16
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@player_names = external local_unnamed_addr global [4 x ptr], align 16
@netgame = external dso_local local_unnamed_addr global i32, align 4
@netdemo = external dso_local local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@rndindex = external local_unnamed_addr global i32, align 4
@savedescription = external dso_local global [32 x i8], align 16
@.str.6 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoLoadLevel() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @G_Ticker() local_unnamed_addr #0 {
  %1 = load i32, ptr @playeringame, align 16, !tbaa !5
  %.not50 = icmp ne i32 %1, 0
  %2 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 8), align 8
  %3 = icmp eq i32 %2, 2
  %or.cond66 = select i1 %.not50, i1 %3, i1 false
  br i1 %or.cond66, label %4, label %5

4:                                                ; preds = %0
  tail call void @G_DoReborn(i32 noundef 0)
  br label %5

5:                                                ; preds = %0, %4
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !5
  %.not50.1 = icmp ne i32 %6, 0
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 328), align 8
  %8 = icmp eq i32 %7, 2
  %or.cond68 = select i1 %.not50.1, i1 %8, i1 false
  br i1 %or.cond68, label %9, label %10

9:                                                ; preds = %5
  tail call void @G_DoReborn(i32 noundef 1)
  br label %10

10:                                               ; preds = %9, %5
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !5
  %.not50.2 = icmp ne i32 %11, 0
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 648), align 8
  %13 = icmp eq i32 %12, 2
  %or.cond70 = select i1 %.not50.2, i1 %13, i1 false
  br i1 %or.cond70, label %14, label %15

14:                                               ; preds = %10
  tail call void @G_DoReborn(i32 noundef 2)
  br label %15

15:                                               ; preds = %14, %10
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !5
  %.not50.3 = icmp ne i32 %16, 0
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 968), align 8
  %18 = icmp eq i32 %17, 2
  %or.cond72 = select i1 %.not50.3, i1 %18, i1 false
  br i1 %or.cond72, label %19, label %.preheader51.preheader

19:                                               ; preds = %15
  tail call void @G_DoReborn(i32 noundef 3)
  br label %.preheader51.preheader

.preheader51.preheader:                           ; preds = %19, %15
  br label %.preheader51

.preheader51:                                     ; preds = %.preheader51.backedge, %.preheader51.preheader
  %20 = load i32, ptr @gameaction, align 4, !tbaa !5
  switch i32 %20, label %.preheader51.backedge [
    i32 0, label %30
    i32 1, label %21
    i32 2, label %22
    i32 3, label %23
    i32 4, label %24
    i32 5, label %25
    i32 6, label %26
    i32 7, label %27
    i32 8, label %28
    i32 9, label %29
  ]

.preheader51.backedge:                            ; preds = %.preheader51, %29, %28, %27, %26, %25, %24, %23, %22, %21
  br label %.preheader51, !llvm.loop !9

21:                                               ; preds = %.preheader51
  tail call void @G_DoLoadLevel()
  br label %.preheader51.backedge

22:                                               ; preds = %.preheader51
  tail call void @G_DoNewGame()
  br label %.preheader51.backedge

23:                                               ; preds = %.preheader51
  tail call void @G_DoLoadGame()
  br label %.preheader51.backedge

24:                                               ; preds = %.preheader51
  tail call void @G_DoSaveGame()
  br label %.preheader51.backedge

25:                                               ; preds = %.preheader51
  tail call void @G_DoPlayDemo()
  br label %.preheader51.backedge

26:                                               ; preds = %.preheader51
  tail call void @G_DoCompleted()
  br label %.preheader51.backedge

27:                                               ; preds = %.preheader51
  tail call void @F_StartFinale() #5
  br label %.preheader51.backedge

28:                                               ; preds = %.preheader51
  tail call void @G_DoWorldDone()
  br label %.preheader51.backedge

29:                                               ; preds = %.preheader51
  tail call void @M_ScreenShot() #5
  store i32 0, ptr @gameaction, align 4, !tbaa !5
  br label %.preheader51.backedge

30:                                               ; preds = %.preheader51
  %31 = load i32, ptr @gametic, align 4, !tbaa !5
  %32 = load i32, ptr @ticdup, align 4, !tbaa !5
  %33 = sdiv i32 %31, %32
  %34 = srem i32 %33, 12
  %35 = sext i32 %34 to i64
  %36 = load i32, ptr @playeringame, align 16, !tbaa !5
  %.not43 = icmp eq i32 %36, 0
  br i1 %.not43, label %81, label %37

37:                                               ; preds = %30
  %38 = getelementptr inbounds [4 x [12 x %struct.ticcmd_t]], ptr @netcmds, i64 0, i64 0, i64 %35
  %39 = load i64, ptr %38, align 8
  store i64 %39, ptr getelementptr inbounds (i8, ptr @players, i64 12), align 4
  %40 = load i32, ptr @demoplayback, align 4, !tbaa !5
  %.not44 = icmp eq i32 %40, 0
  br i1 %.not44, label %42, label %41

41:                                               ; preds = %37
  tail call void @G_ReadDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 12))
  br label %42

42:                                               ; preds = %41, %37
  %43 = load i32, ptr @demorecording, align 4, !tbaa !5
  %.not45 = icmp eq i32 %43, 0
  br i1 %.not45, label %45, label %44

44:                                               ; preds = %42
  tail call void @G_WriteDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 12))
  br label %45

45:                                               ; preds = %44, %42
  %46 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 12), align 4, !tbaa !11
  %47 = icmp sgt i8 %46, 50
  br i1 %47, label %48, label %59

48:                                               ; preds = %45
  %49 = load i32, ptr @gametic, align 4, !tbaa !5
  %50 = and i32 %49, 31
  %.not46 = icmp eq i32 %50, 0
  %51 = and i32 %49, 96
  %52 = icmp eq i32 %51, 0
  %or.cond78 = and i1 %.not46, %52
  br i1 %or.cond78, label %53, label %59

53:                                               ; preds = %48
  %54 = load ptr, ptr @player_names, align 16, !tbaa !14
  %55 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @G_Ticker.turbomessage, ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %54) #5
  %56 = load i32, ptr @consoleplayer, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %57, i32 26
  store ptr @G_Ticker.turbomessage, ptr %58, align 16, !tbaa !16
  br label %59

59:                                               ; preds = %53, %48, %45
  %60 = load i32, ptr @netgame, align 4, !tbaa !5
  %61 = icmp eq i32 %60, 0
  %62 = load i32, ptr @netdemo, align 4
  %63 = icmp ne i32 %62, 0
  %or.cond = select i1 %61, i1 true, i1 %63
  br i1 %or.cond, label %81, label %64

64:                                               ; preds = %59
  %65 = load i32, ptr @gametic, align 4, !tbaa !5
  %66 = load i32, ptr @ticdup, align 4, !tbaa !5
  %67 = srem i32 %65, %66
  %.not47 = icmp eq i32 %67, 0
  br i1 %.not47, label %68, label %81

68:                                               ; preds = %64
  %69 = icmp sgt i32 %65, 12
  br i1 %69, label %70, label %.sink.split

70:                                               ; preds = %68
  %71 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 0, i64 %35
  %72 = load i16, ptr %71, align 2, !tbaa !18
  %73 = load i16, ptr getelementptr inbounds (i8, ptr @players, i64 16), align 16, !tbaa !19
  %.not48 = icmp eq i16 %72, %73
  br i1 %.not48, label %.sink.split, label %74

74:                                               ; preds = %202, %159, %116, %70
  %.lcssa76 = phi i16 [ %72, %70 ], [ %118, %116 ], [ %161, %159 ], [ %204, %202 ]
  %.lcssa = phi i16 [ %73, %70 ], [ %119, %116 ], [ %162, %159 ], [ %205, %202 ]
  %75 = sext i16 %.lcssa to i32
  %76 = sext i16 %.lcssa76 to i32
  tail call void (ptr, ...) @I_Error(ptr noundef nonnull @.str.5, i32 noundef %75, i32 noundef %76) #6
  unreachable

.sink.split:                                      ; preds = %70, %68
  %77 = load ptr, ptr @players, align 16, !tbaa !20
  %.not49 = icmp eq ptr %77, null
  %78 = getelementptr inbounds i8, ptr %77, i64 24
  %.sink74.in = select i1 %.not49, ptr @rndindex, ptr %78
  %.sink74 = load i32, ptr %.sink74.in, align 4, !tbaa !5
  %79 = trunc i32 %.sink74 to i16
  %80 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 0, i64 %35
  store i16 %79, ptr %80, align 2, !tbaa !18
  br label %81

81:                                               ; preds = %.sink.split, %30, %64, %59
  %82 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !5
  %.not43.1 = icmp eq i32 %82, 0
  br i1 %.not43.1, label %124, label %83

83:                                               ; preds = %81
  %84 = getelementptr inbounds [4 x [12 x %struct.ticcmd_t]], ptr @netcmds, i64 0, i64 1, i64 %35
  %85 = load i64, ptr %84, align 8
  store i64 %85, ptr getelementptr inbounds (i8, ptr @players, i64 332), align 4
  %86 = load i32, ptr @demoplayback, align 4, !tbaa !5
  %.not44.1 = icmp eq i32 %86, 0
  br i1 %.not44.1, label %88, label %87

87:                                               ; preds = %83
  tail call void @G_ReadDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 332))
  br label %88

88:                                               ; preds = %87, %83
  %89 = load i32, ptr @demorecording, align 4, !tbaa !5
  %.not45.1 = icmp eq i32 %89, 0
  br i1 %.not45.1, label %91, label %90

90:                                               ; preds = %88
  tail call void @G_WriteDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 332))
  br label %91

91:                                               ; preds = %90, %88
  %92 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 332), align 4, !tbaa !11
  %93 = icmp sgt i8 %92, 50
  br i1 %93, label %94, label %105

94:                                               ; preds = %91
  %95 = load i32, ptr @gametic, align 4, !tbaa !5
  %96 = and i32 %95, 31
  %.not46.1 = icmp eq i32 %96, 0
  %97 = and i32 %95, 96
  %98 = icmp eq i32 %97, 32
  %or.cond80 = and i1 %.not46.1, %98
  br i1 %or.cond80, label %99, label %105

99:                                               ; preds = %94
  %100 = load ptr, ptr getelementptr inbounds (i8, ptr @player_names, i64 8), align 8, !tbaa !14
  %101 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @G_Ticker.turbomessage, ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %100) #5
  %102 = load i32, ptr @consoleplayer, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %103, i32 26
  store ptr @G_Ticker.turbomessage, ptr %104, align 16, !tbaa !16
  br label %105

105:                                              ; preds = %99, %94, %91
  %106 = load i32, ptr @netgame, align 4, !tbaa !5
  %107 = icmp eq i32 %106, 0
  %108 = load i32, ptr @netdemo, align 4
  %109 = icmp ne i32 %108, 0
  %or.cond.1 = select i1 %107, i1 true, i1 %109
  br i1 %or.cond.1, label %124, label %110

110:                                              ; preds = %105
  %111 = load i32, ptr @gametic, align 4, !tbaa !5
  %112 = load i32, ptr @ticdup, align 4, !tbaa !5
  %113 = srem i32 %111, %112
  %.not47.1 = icmp eq i32 %113, 0
  br i1 %.not47.1, label %114, label %124

114:                                              ; preds = %110
  %115 = icmp sgt i32 %111, 12
  br i1 %115, label %116, label %.sink.split.1

116:                                              ; preds = %114
  %117 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 1, i64 %35
  %118 = load i16, ptr %117, align 2, !tbaa !18
  %119 = load i16, ptr getelementptr inbounds (i8, ptr @players, i64 336), align 16, !tbaa !19
  %.not48.1 = icmp eq i16 %118, %119
  br i1 %.not48.1, label %.sink.split.1, label %74

.sink.split.1:                                    ; preds = %116, %114
  %120 = load ptr, ptr getelementptr inbounds (i8, ptr @players, i64 320), align 16, !tbaa !20
  %.not49.1 = icmp eq ptr %120, null
  %121 = getelementptr inbounds i8, ptr %120, i64 24
  %.sink74.in.1 = select i1 %.not49.1, ptr @rndindex, ptr %121
  %.sink74.1 = load i32, ptr %.sink74.in.1, align 4, !tbaa !5
  %122 = trunc i32 %.sink74.1 to i16
  %123 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 1, i64 %35
  store i16 %122, ptr %123, align 2, !tbaa !18
  br label %124

124:                                              ; preds = %.sink.split.1, %110, %105, %81
  %125 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !5
  %.not43.2 = icmp eq i32 %125, 0
  br i1 %.not43.2, label %167, label %126

126:                                              ; preds = %124
  %127 = getelementptr inbounds [4 x [12 x %struct.ticcmd_t]], ptr @netcmds, i64 0, i64 2, i64 %35
  %128 = load i64, ptr %127, align 8
  store i64 %128, ptr getelementptr inbounds (i8, ptr @players, i64 652), align 4
  %129 = load i32, ptr @demoplayback, align 4, !tbaa !5
  %.not44.2 = icmp eq i32 %129, 0
  br i1 %.not44.2, label %131, label %130

130:                                              ; preds = %126
  tail call void @G_ReadDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 652))
  br label %131

131:                                              ; preds = %130, %126
  %132 = load i32, ptr @demorecording, align 4, !tbaa !5
  %.not45.2 = icmp eq i32 %132, 0
  br i1 %.not45.2, label %134, label %133

133:                                              ; preds = %131
  tail call void @G_WriteDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 652))
  br label %134

134:                                              ; preds = %133, %131
  %135 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 652), align 4, !tbaa !11
  %136 = icmp sgt i8 %135, 50
  br i1 %136, label %137, label %148

137:                                              ; preds = %134
  %138 = load i32, ptr @gametic, align 4, !tbaa !5
  %139 = and i32 %138, 31
  %.not46.2 = icmp eq i32 %139, 0
  %140 = and i32 %138, 96
  %141 = icmp eq i32 %140, 64
  %or.cond82 = and i1 %.not46.2, %141
  br i1 %or.cond82, label %142, label %148

142:                                              ; preds = %137
  %143 = load ptr, ptr getelementptr inbounds (i8, ptr @player_names, i64 16), align 16, !tbaa !14
  %144 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @G_Ticker.turbomessage, ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %143) #5
  %145 = load i32, ptr @consoleplayer, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %146, i32 26
  store ptr @G_Ticker.turbomessage, ptr %147, align 16, !tbaa !16
  br label %148

148:                                              ; preds = %142, %137, %134
  %149 = load i32, ptr @netgame, align 4, !tbaa !5
  %150 = icmp eq i32 %149, 0
  %151 = load i32, ptr @netdemo, align 4
  %152 = icmp ne i32 %151, 0
  %or.cond.2 = select i1 %150, i1 true, i1 %152
  br i1 %or.cond.2, label %167, label %153

153:                                              ; preds = %148
  %154 = load i32, ptr @gametic, align 4, !tbaa !5
  %155 = load i32, ptr @ticdup, align 4, !tbaa !5
  %156 = srem i32 %154, %155
  %.not47.2 = icmp eq i32 %156, 0
  br i1 %.not47.2, label %157, label %167

157:                                              ; preds = %153
  %158 = icmp sgt i32 %154, 12
  br i1 %158, label %159, label %.sink.split.2

159:                                              ; preds = %157
  %160 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 2, i64 %35
  %161 = load i16, ptr %160, align 2, !tbaa !18
  %162 = load i16, ptr getelementptr inbounds (i8, ptr @players, i64 656), align 16, !tbaa !19
  %.not48.2 = icmp eq i16 %161, %162
  br i1 %.not48.2, label %.sink.split.2, label %74

.sink.split.2:                                    ; preds = %159, %157
  %163 = load ptr, ptr getelementptr inbounds (i8, ptr @players, i64 640), align 16, !tbaa !20
  %.not49.2 = icmp eq ptr %163, null
  %164 = getelementptr inbounds i8, ptr %163, i64 24
  %.sink74.in.2 = select i1 %.not49.2, ptr @rndindex, ptr %164
  %.sink74.2 = load i32, ptr %.sink74.in.2, align 4, !tbaa !5
  %165 = trunc i32 %.sink74.2 to i16
  %166 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 2, i64 %35
  store i16 %165, ptr %166, align 2, !tbaa !18
  br label %167

167:                                              ; preds = %.sink.split.2, %153, %148, %124
  %168 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !5
  %.not43.3 = icmp eq i32 %168, 0
  br i1 %.not43.3, label %.preheader.preheader, label %169

169:                                              ; preds = %167
  %170 = getelementptr inbounds [4 x [12 x %struct.ticcmd_t]], ptr @netcmds, i64 0, i64 3, i64 %35
  %171 = load i64, ptr %170, align 8
  store i64 %171, ptr getelementptr inbounds (i8, ptr @players, i64 972), align 4
  %172 = load i32, ptr @demoplayback, align 4, !tbaa !5
  %.not44.3 = icmp eq i32 %172, 0
  br i1 %.not44.3, label %174, label %173

173:                                              ; preds = %169
  tail call void @G_ReadDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 972))
  br label %174

174:                                              ; preds = %173, %169
  %175 = load i32, ptr @demorecording, align 4, !tbaa !5
  %.not45.3 = icmp eq i32 %175, 0
  br i1 %.not45.3, label %177, label %176

176:                                              ; preds = %174
  tail call void @G_WriteDemoTiccmd(ptr noundef nonnull getelementptr inbounds (i8, ptr @players, i64 972))
  br label %177

177:                                              ; preds = %176, %174
  %178 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 972), align 4, !tbaa !11
  %179 = icmp sgt i8 %178, 50
  br i1 %179, label %180, label %191

180:                                              ; preds = %177
  %181 = load i32, ptr @gametic, align 4, !tbaa !5
  %182 = and i32 %181, 31
  %.not46.3 = icmp eq i32 %182, 0
  %183 = and i32 %181, 96
  %184 = icmp eq i32 %183, 96
  %or.cond84 = and i1 %.not46.3, %184
  br i1 %or.cond84, label %185, label %191

185:                                              ; preds = %180
  %186 = load ptr, ptr getelementptr inbounds (i8, ptr @player_names, i64 24), align 8, !tbaa !14
  %187 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @G_Ticker.turbomessage, ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %186) #5
  %188 = load i32, ptr @consoleplayer, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %189, i32 26
  store ptr @G_Ticker.turbomessage, ptr %190, align 16, !tbaa !16
  br label %191

191:                                              ; preds = %185, %180, %177
  %192 = load i32, ptr @netgame, align 4, !tbaa !5
  %193 = icmp eq i32 %192, 0
  %194 = load i32, ptr @netdemo, align 4
  %195 = icmp ne i32 %194, 0
  %or.cond.3 = select i1 %193, i1 true, i1 %195
  br i1 %or.cond.3, label %.preheader.preheader, label %196

196:                                              ; preds = %191
  %197 = load i32, ptr @gametic, align 4, !tbaa !5
  %198 = load i32, ptr @ticdup, align 4, !tbaa !5
  %199 = srem i32 %197, %198
  %.not47.3 = icmp eq i32 %199, 0
  br i1 %.not47.3, label %200, label %.preheader.preheader

200:                                              ; preds = %196
  %201 = icmp sgt i32 %197, 12
  br i1 %201, label %202, label %.sink.split.3

202:                                              ; preds = %200
  %203 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 3, i64 %35
  %204 = load i16, ptr %203, align 2, !tbaa !18
  %205 = load i16, ptr getelementptr inbounds (i8, ptr @players, i64 976), align 16, !tbaa !19
  %.not48.3 = icmp eq i16 %204, %205
  br i1 %.not48.3, label %.sink.split.3, label %74

.sink.split.3:                                    ; preds = %202, %200
  %206 = load ptr, ptr getelementptr inbounds (i8, ptr @players, i64 960), align 16, !tbaa !20
  %.not49.3 = icmp eq ptr %206, null
  %207 = getelementptr inbounds i8, ptr %206, i64 24
  %.sink74.in.3 = select i1 %.not49.3, ptr @rndindex, ptr %207
  %.sink74.3 = load i32, ptr %.sink74.in.3, align 4, !tbaa !5
  %208 = trunc i32 %.sink74.3 to i16
  %209 = getelementptr inbounds [4 x [12 x i16]], ptr @consistancy, i64 0, i64 3, i64 %35
  store i16 %208, ptr %209, align 2, !tbaa !18
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %.sink.split.3, %196, %191, %167
  %210 = load i32, ptr @playeringame, align 16, !tbaa !5
  %.not39 = icmp eq i32 %210, 0
  br i1 %.not39, label %.preheader.1, label %211

211:                                              ; preds = %.preheader.preheader
  %212 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 19), align 1, !tbaa !21
  %.not40 = icmp sgt i8 %212, -1
  br i1 %.not40, label %.preheader.1, label %213

213:                                              ; preds = %211
  %214 = and i8 %212, 3
  switch i8 %214, label %.preheader.1 [
    i8 1, label %215
    i8 2, label %220
  ]

215:                                              ; preds = %213
  %216 = load i32, ptr @paused, align 4, !tbaa !5
  %217 = xor i32 %216, 1
  store i32 %217, ptr @paused, align 4, !tbaa !5
  %.not42 = icmp eq i32 %216, 1
  br i1 %.not42, label %219, label %218

218:                                              ; preds = %215
  tail call void @S_PauseSound() #5
  br label %.preheader.1

219:                                              ; preds = %215
  tail call void @S_ResumeSound() #5
  br label %.preheader.1

220:                                              ; preds = %213
  %221 = load i8, ptr @savedescription, align 16, !tbaa !22
  %.not41 = icmp eq i8 %221, 0
  br i1 %.not41, label %222, label %224

222:                                              ; preds = %220
  %223 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @savedescription, ptr noundef nonnull dereferenceable(1) @.str.6) #5
  br label %224

224:                                              ; preds = %222, %220
  %225 = lshr i8 %212, 2
  %226 = and i8 %225, 7
  %227 = zext nneg i8 %226 to i32
  store i32 %227, ptr @savegameslot, align 4, !tbaa !5
  store i32 4, ptr @gameaction, align 4, !tbaa !5
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader, %213, %224, %219, %218, %211
  %228 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 4), align 4, !tbaa !5
  %.not39.1 = icmp eq i32 %228, 0
  br i1 %.not39.1, label %.preheader.2, label %229

229:                                              ; preds = %.preheader.1
  %230 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 339), align 1, !tbaa !21
  %.not40.1 = icmp sgt i8 %230, -1
  br i1 %.not40.1, label %.preheader.2, label %231

231:                                              ; preds = %229
  %232 = and i8 %230, 3
  switch i8 %232, label %.preheader.2 [
    i8 1, label %241
    i8 2, label %233
  ]

233:                                              ; preds = %231
  %234 = load i8, ptr @savedescription, align 16, !tbaa !22
  %.not41.1 = icmp eq i8 %234, 0
  br i1 %.not41.1, label %235, label %237

235:                                              ; preds = %233
  %236 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @savedescription, ptr noundef nonnull dereferenceable(1) @.str.6) #5
  br label %237

237:                                              ; preds = %235, %233
  %238 = lshr i8 %230, 2
  %239 = and i8 %238, 7
  %240 = zext nneg i8 %239 to i32
  store i32 %240, ptr @savegameslot, align 4, !tbaa !5
  store i32 4, ptr @gameaction, align 4, !tbaa !5
  br label %.preheader.2

241:                                              ; preds = %231
  %242 = load i32, ptr @paused, align 4, !tbaa !5
  %243 = xor i32 %242, 1
  store i32 %243, ptr @paused, align 4, !tbaa !5
  %.not42.1 = icmp eq i32 %242, 1
  br i1 %.not42.1, label %245, label %244

244:                                              ; preds = %241
  tail call void @S_PauseSound() #5
  br label %.preheader.2

245:                                              ; preds = %241
  tail call void @S_ResumeSound() #5
  br label %.preheader.2

.preheader.2:                                     ; preds = %245, %244, %237, %231, %229, %.preheader.1
  %246 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 8), align 8, !tbaa !5
  %.not39.2 = icmp eq i32 %246, 0
  br i1 %.not39.2, label %.preheader.3, label %247

247:                                              ; preds = %.preheader.2
  %248 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 659), align 1, !tbaa !21
  %.not40.2 = icmp sgt i8 %248, -1
  br i1 %.not40.2, label %.preheader.3, label %249

249:                                              ; preds = %247
  %250 = and i8 %248, 3
  switch i8 %250, label %.preheader.3 [
    i8 1, label %259
    i8 2, label %251
  ]

251:                                              ; preds = %249
  %252 = load i8, ptr @savedescription, align 16, !tbaa !22
  %.not41.2 = icmp eq i8 %252, 0
  br i1 %.not41.2, label %253, label %255

253:                                              ; preds = %251
  %254 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @savedescription, ptr noundef nonnull dereferenceable(1) @.str.6) #5
  br label %255

255:                                              ; preds = %253, %251
  %256 = lshr i8 %248, 2
  %257 = and i8 %256, 7
  %258 = zext nneg i8 %257 to i32
  store i32 %258, ptr @savegameslot, align 4, !tbaa !5
  store i32 4, ptr @gameaction, align 4, !tbaa !5
  br label %.preheader.3

259:                                              ; preds = %249
  %260 = load i32, ptr @paused, align 4, !tbaa !5
  %261 = xor i32 %260, 1
  store i32 %261, ptr @paused, align 4, !tbaa !5
  %.not42.2 = icmp eq i32 %260, 1
  br i1 %.not42.2, label %263, label %262

262:                                              ; preds = %259
  tail call void @S_PauseSound() #5
  br label %.preheader.3

263:                                              ; preds = %259
  tail call void @S_ResumeSound() #5
  br label %.preheader.3

.preheader.3:                                     ; preds = %263, %262, %255, %249, %247, %.preheader.2
  %264 = load i32, ptr getelementptr inbounds (i8, ptr @playeringame, i64 12), align 4, !tbaa !5
  %.not39.3 = icmp eq i32 %264, 0
  br i1 %.not39.3, label %282, label %265

265:                                              ; preds = %.preheader.3
  %266 = load i8, ptr getelementptr inbounds (i8, ptr @players, i64 979), align 1, !tbaa !21
  %.not40.3 = icmp sgt i8 %266, -1
  br i1 %.not40.3, label %282, label %267

267:                                              ; preds = %265
  %268 = and i8 %266, 3
  switch i8 %268, label %282 [
    i8 1, label %277
    i8 2, label %269
  ]

269:                                              ; preds = %267
  %270 = load i8, ptr @savedescription, align 16, !tbaa !22
  %.not41.3 = icmp eq i8 %270, 0
  br i1 %.not41.3, label %271, label %273

271:                                              ; preds = %269
  %272 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) @savedescription, ptr noundef nonnull dereferenceable(1) @.str.6) #5
  br label %273

273:                                              ; preds = %271, %269
  %274 = lshr i8 %266, 2
  %275 = and i8 %274, 7
  %276 = zext nneg i8 %275 to i32
  store i32 %276, ptr @savegameslot, align 4, !tbaa !5
  store i32 4, ptr @gameaction, align 4, !tbaa !5
  br label %282

277:                                              ; preds = %267
  %278 = load i32, ptr @paused, align 4, !tbaa !5
  %279 = xor i32 %278, 1
  store i32 %279, ptr @paused, align 4, !tbaa !5
  %.not42.3 = icmp eq i32 %278, 1
  br i1 %.not42.3, label %281, label %280

280:                                              ; preds = %277
  tail call void @S_PauseSound() #5
  br label %282

281:                                              ; preds = %277
  tail call void @S_ResumeSound() #5
  br label %282

282:                                              ; preds = %281, %280, %273, %267, %265, %.preheader.3
  %283 = load i32, ptr @gamestate, align 4, !tbaa !5
  switch i32 %283, label %288 [
    i32 0, label %284
    i32 1, label %285
    i32 2, label %286
    i32 3, label %287
  ]

284:                                              ; preds = %282
  tail call void @P_Ticker() #5
  tail call void @ST_Ticker() #5
  tail call void @AM_Ticker() #5
  tail call void @HU_Ticker() #5
  br label %288

285:                                              ; preds = %282
  tail call void @WI_Ticker() #5
  br label %288

286:                                              ; preds = %282
  tail call void @F_Ticker() #5
  br label %288

287:                                              ; preds = %282
  tail call void @D_PageTicker() #5
  br label %288

288:                                              ; preds = %287, %286, %285, %284, %282
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoNewGame() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoLoadGame() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoSaveGame() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoPlayDemo() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoCompleted() local_unnamed_addr #0

declare void @F_StartFinale() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @G_DoWorldDone() local_unnamed_addr #0

declare void @M_ScreenShot() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @G_ReadDemoTiccmd(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @G_WriteDemoTiccmd(ptr noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

declare void @S_PauseSound() local_unnamed_addr #1

declare void @S_ResumeSound() local_unnamed_addr #1

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

declare void @P_Ticker() local_unnamed_addr #1

declare void @ST_Ticker() local_unnamed_addr #1

declare void @AM_Ticker() local_unnamed_addr #1

declare void @HU_Ticker() local_unnamed_addr #1

declare void @WI_Ticker() local_unnamed_addr #1

declare void @F_Ticker() local_unnamed_addr #1

declare void @D_PageTicker() local_unnamed_addr #1

attributes #0 = { 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 #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !7, i64 0}
!12 = !{!"", !7, i64 0, !7, i64 1, !13, i64 2, !13, i64 4, !7, i64 6, !7, i64 7}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !15, i64 224}
!17 = !{!"player_s", !15, i64 0, !6, i64 8, !12, i64 12, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !7, i64 48, !7, i64 72, !6, i64 96, !7, i64 100, !6, i64 116, !6, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !6, i64 192, !6, i64 196, !6, i64 200, !6, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !15, i64 224, !6, i64 232, !6, i64 236, !15, i64 240, !6, i64 248, !6, i64 252, !6, i64 256, !7, i64 264, !6, i64 312}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !13, i64 4}
!20 = !{!17, !15, i64 0}
!21 = !{!17, !7, i64 19}
!22 = !{!7, !7, i64 0}


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