; 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.state_t = type { i32, i64, i64, %union.actionf_t, i32, i64, i64 }
%union.actionf_t = type { ptr }
%struct.mobjinfo_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@gamemode = external global i32, align 4
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@skytexture = external global i32, align 4
@gamemap = external dso_local global i32, align 4
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@players = external dso_local global [4 x %struct.player_s], align 16
@gameepisode = external dso_local global i32, align 4
@gameskill = external dso_local global i32, align 4
@paused = external dso_local global i32, align 4
@demoplayback = external dso_local global i32, align 4
@automapactive = external global i32, align 4
@viewactive = external dso_local global i32, align 4
@respawnparm = external global i32, align 4
@fastparm = external global i32, align 4
@respawnmonsters = external dso_local global i32, align 4
@states = external global [967 x %struct.state_t], align 16
@mobjinfo = external global [137 x %struct.mobjinfo_t], align 16
@usergame = external dso_local global i32, align 4
@.str.16 = external hidden unnamed_addr constant [5 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: nounwind uwtable
declare dso_local void @G_DoLoadLevel() #1

declare i32 @R_TextureNumForName(ptr noundef) #2

declare void @S_ResumeSound() #2

; Function Attrs: nounwind uwtable
define dso_local void @G_InitNew(i32 noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %8 = load i32, ptr @paused, align 4, !tbaa !5
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  store i32 0, ptr @paused, align 4, !tbaa !5
  call void @S_ResumeSound()
  br label %11

11:                                               ; preds = %10, %3
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = icmp ugt i32 %12, 4
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  store i32 4, ptr %4, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %14, %11
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %18, %15
  %20 = load i32, ptr @gamemode, align 4, !tbaa !5
  %21 = icmp eq i32 %20, 3
  br i1 %21, label %22, label %27

22:                                               ; preds = %19
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 4
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  store i32 4, ptr %5, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %25, %22
  br label %41

27:                                               ; preds = %19
  %28 = load i32, ptr @gamemode, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 1
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %33, %30
  br label %40

35:                                               ; preds = %27
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 3
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 3, ptr %5, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %38, %35
  br label %40

40:                                               ; preds = %39, %34
  br label %41

41:                                               ; preds = %40, %26
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = icmp slt i32 %42, 1
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %44, %41
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 9
  br i1 %47, label %48, label %52

48:                                               ; preds = %45
  %49 = load i32, ptr @gamemode, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 2
  br i1 %50, label %51, label %52

51:                                               ; preds = %48
  store i32 9, ptr %6, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %51, %48, %45
  call void @M_ClearRandom()
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = icmp eq i32 %53, 4
  br i1 %54, label %58, label %55

55:                                               ; preds = %52
  %56 = load i32, ptr @respawnparm, align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %55, %52
  store i32 1, ptr @respawnmonsters, align 4, !tbaa !5
  br label %60

59:                                               ; preds = %55
  store i32 0, ptr @respawnmonsters, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %59, %58
  %61 = load i32, ptr @fastparm, align 4, !tbaa !5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %69, label %63

63:                                               ; preds = %60
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = icmp eq i32 %64, 4
  br i1 %65, label %66, label %84

66:                                               ; preds = %63
  %67 = load i32, ptr @gameskill, align 4, !tbaa !5
  %68 = icmp ne i32 %67, 4
  br i1 %68, label %69, label %84

69:                                               ; preds = %66, %60
  store i32 477, ptr %7, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %80, %69
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = icmp sle i32 %71, 489
  br i1 %72, label %73, label %83

73:                                               ; preds = %70
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [967 x %struct.state_t], ptr @states, i64 0, i64 %75
  %77 = getelementptr inbounds %struct.state_t, ptr %76, i32 0, i32 2
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = ashr i64 %78, 1
  store i64 %79, ptr %77, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %73
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %7, align 4, !tbaa !5
  br label %70, !llvm.loop !12

83:                                               ; preds = %70
  store i32 1310720, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 16), i32 0, i32 15), align 4, !tbaa !14
  store i32 1310720, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 32), i32 0, i32 15), align 4, !tbaa !14
  store i32 1310720, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 31), i32 0, i32 15), align 4, !tbaa !14
  br label %106

84:                                               ; preds = %66, %63
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = icmp ne i32 %85, 4
  br i1 %86, label %87, label %105

87:                                               ; preds = %84
  %88 = load i32, ptr @gameskill, align 4, !tbaa !5
  %89 = icmp eq i32 %88, 4
  br i1 %89, label %90, label %105

90:                                               ; preds = %87
  store i32 477, ptr %7, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %101, %90
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = icmp sle i32 %92, 489
  br i1 %93, label %94, label %104

94:                                               ; preds = %91
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [967 x %struct.state_t], ptr @states, i64 0, i64 %96
  %98 = getelementptr inbounds %struct.state_t, ptr %97, i32 0, i32 2
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = shl i64 %99, 1
  store i64 %100, ptr %98, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %94
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !5
  br label %91, !llvm.loop !16

104:                                              ; preds = %91
  store i32 983040, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 16), i32 0, i32 15), align 4, !tbaa !14
  store i32 655360, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 32), i32 0, i32 15), align 4, !tbaa !14
  store i32 655360, ptr getelementptr inbounds (%struct.mobjinfo_t, ptr getelementptr inbounds ([137 x %struct.mobjinfo_t], ptr @mobjinfo, i64 0, i64 31), i32 0, i32 15), align 4, !tbaa !14
  br label %105

105:                                              ; preds = %104, %87, %84
  br label %106

106:                                              ; preds = %105, %83
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %115, %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = icmp slt i32 %108, 4
  br i1 %109, label %110, label %118

110:                                              ; preds = %107
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %112
  %114 = getelementptr inbounds %struct.player_s, ptr %113, i32 0, i32 1
  store i32 2, ptr %114, align 8, !tbaa !17
  br label %115

115:                                              ; preds = %110
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %7, align 4, !tbaa !5
  br label %107, !llvm.loop !22

118:                                              ; preds = %107
  store i32 1, ptr @usergame, align 4, !tbaa !5
  store i32 0, ptr @paused, align 4, !tbaa !5
  store i32 0, ptr @demoplayback, align 4, !tbaa !5
  store i32 0, ptr @automapactive, align 4, !tbaa !5
  store i32 1, ptr @viewactive, align 4, !tbaa !5
  %119 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %119, ptr @gameepisode, align 4, !tbaa !5
  %120 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %120, ptr @gamemap, align 4, !tbaa !5
  %121 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %121, ptr @gameskill, align 4, !tbaa !5
  store i32 1, ptr @viewactive, align 4, !tbaa !5
  %122 = load i32, ptr @gamemode, align 4, !tbaa !5
  %123 = icmp eq i32 %122, 2
  br i1 %123, label %124, label %137

124:                                              ; preds = %118
  %125 = call i32 @R_TextureNumForName(ptr noundef @.str.1)
  store i32 %125, ptr @skytexture, align 4, !tbaa !5
  %126 = load i32, ptr @gamemap, align 4, !tbaa !5
  %127 = icmp slt i32 %126, 12
  br i1 %127, label %128, label %130

128:                                              ; preds = %124
  %129 = call i32 @R_TextureNumForName(ptr noundef @.str.2)
  store i32 %129, ptr @skytexture, align 4, !tbaa !5
  br label %136

130:                                              ; preds = %124
  %131 = load i32, ptr @gamemap, align 4, !tbaa !5
  %132 = icmp slt i32 %131, 21
  br i1 %132, label %133, label %135

133:                                              ; preds = %130
  %134 = call i32 @R_TextureNumForName(ptr noundef @.str.3)
  store i32 %134, ptr @skytexture, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %133, %130
  br label %136

136:                                              ; preds = %135, %128
  br label %148

137:                                              ; preds = %118
  %138 = load i32, ptr %5, align 4, !tbaa !5
  switch i32 %138, label %147 [
    i32 1, label %139
    i32 2, label %141
    i32 3, label %143
    i32 4, label %145
  ]

139:                                              ; preds = %137
  %140 = call i32 @R_TextureNumForName(ptr noundef @.str.2)
  store i32 %140, ptr @skytexture, align 4, !tbaa !5
  br label %147

141:                                              ; preds = %137
  %142 = call i32 @R_TextureNumForName(ptr noundef @.str.3)
  store i32 %142, ptr @skytexture, align 4, !tbaa !5
  br label %147

143:                                              ; preds = %137
  %144 = call i32 @R_TextureNumForName(ptr noundef @.str.1)
  store i32 %144, ptr @skytexture, align 4, !tbaa !5
  br label %147

145:                                              ; preds = %137
  %146 = call i32 @R_TextureNumForName(ptr noundef @.str.16)
  store i32 %146, ptr @skytexture, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %145, %143, %141, %139, %137
  br label %148

148:                                              ; preds = %147, %136
  call void @G_DoLoadLevel()
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret void
}

declare void @M_ClearRandom() #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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, !11, i64 16}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !6, i64 32, !11, i64 40, !11, i64 48}
!11 = !{!"long", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !6, i64 60}
!15 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !6, i64 88}
!16 = distinct !{!16, !13}
!17 = !{!18, !6, i64 8}
!18 = !{!"player_s", !19, i64 0, !6, i64 8, !20, 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, !19, i64 224, !6, i64 232, !6, i64 236, !19, i64 240, !6, i64 248, !6, i64 252, !6, i64 256, !7, i64 264, !6, i64 312}
!19 = !{!"any pointer", !7, i64 0}
!20 = !{!"", !7, i64 0, !7, i64 1, !21, i64 2, !21, i64 4, !7, i64 6, !7, i64 7}
!21 = !{!"short", !7, i64 0}
!22 = distinct !{!22, !13}


; 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.state_t = type { i32, i64, i64, %union.actionf_t, i32, i64, i64 }
%union.actionf_t = type { ptr }
%struct.mobjinfo_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@gamemode = external local_unnamed_addr global i32, align 4
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@skytexture = external local_unnamed_addr global i32, align 4
@gamemap = external dso_local local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@players = external dso_local local_unnamed_addr global [4 x %struct.player_s], align 16
@gameepisode = external dso_local local_unnamed_addr global i32, align 4
@gameskill = 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
@automapactive = external local_unnamed_addr global i32, align 4
@viewactive = external dso_local local_unnamed_addr global i32, align 4
@respawnparm = external local_unnamed_addr global i32, align 4
@fastparm = external local_unnamed_addr global i32, align 4
@respawnmonsters = external dso_local local_unnamed_addr global i32, align 4
@states = external local_unnamed_addr global [967 x %struct.state_t], align 16
@mobjinfo = external local_unnamed_addr global [137 x %struct.mobjinfo_t], align 16
@usergame = external dso_local local_unnamed_addr global i32, align 4
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@switch.table.G_InitNew = private unnamed_addr constant [4 x ptr] [ptr @.str.2, ptr @.str.3, ptr @.str.1, ptr @.str.16], align 8

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

declare i32 @R_TextureNumForName(ptr noundef) local_unnamed_addr #1

declare void @S_ResumeSound() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @G_InitNew(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = load i32, ptr @paused, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %6, label %5

5:                                                ; preds = %3
  store i32 0, ptr @paused, align 4, !tbaa !5
  tail call void @S_ResumeSound() #3
  br label %6

6:                                                ; preds = %5, %3
  %spec.store.select = tail call i32 @llvm.umin.i32(i32 %0, i32 4)
  %spec.store.select12 = tail call i32 @llvm.smax.i32(i32 %1, i32 1)
  %7 = load i32, ptr @gamemode, align 4
  switch i32 %7, label %9 [
    i32 3, label %8
    i32 0, label %10
  ]

8:                                                ; preds = %6
  %spec.store.select1 = tail call i32 @llvm.umin.i32(i32 %spec.store.select12, i32 4)
  br label %10

9:                                                ; preds = %6
  %spec.store.select3 = tail call i32 @llvm.umin.i32(i32 %spec.store.select12, i32 3)
  br label %10

10:                                               ; preds = %6, %9, %8
  %.036 = phi i32 [ %spec.store.select1, %8 ], [ %spec.store.select3, %9 ], [ 1, %6 ]
  %spec.store.select4 = tail call i32 @llvm.smax.i32(i32 %2, i32 1)
  %.not40 = icmp eq i32 %7, 2
  %11 = tail call i32 @llvm.umin.i32(i32 %spec.store.select4, i32 9)
  %spec.store.select13 = select i1 %.not40, i32 %spec.store.select4, i32 %11
  tail call void @M_ClearRandom() #3
  %12 = icmp ugt i32 %0, 3
  %13 = load i32, ptr @respawnparm, align 4
  %14 = icmp ne i32 %13, 0
  %or.cond7 = select i1 %12, i1 true, i1 %14
  %. = zext i1 %or.cond7 to i32
  store i32 %., ptr @respawnmonsters, align 4, !tbaa !5
  %15 = load i32, ptr @fastparm, align 4, !tbaa !5
  %.not39 = icmp eq i32 %15, 0
  br i1 %.not39, label %16, label %19

16:                                               ; preds = %10
  %17 = load i32, ptr @gameskill, align 4
  %18 = icmp ne i32 %17, 4
  %or.cond9 = select i1 %12, i1 %18, i1 false
  br i1 %or.cond9, label %19, label %46

19:                                               ; preds = %16, %10
  %20 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26728), align 8, !tbaa !9
  %21 = ashr i64 %20, 1
  store i64 %21, ptr getelementptr inbounds (i8, ptr @states, i64 26728), align 8, !tbaa !9
  %22 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26784), align 16, !tbaa !9
  %23 = ashr i64 %22, 1
  store i64 %23, ptr getelementptr inbounds (i8, ptr @states, i64 26784), align 16, !tbaa !9
  %24 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26840), align 8, !tbaa !9
  %25 = ashr i64 %24, 1
  store i64 %25, ptr getelementptr inbounds (i8, ptr @states, i64 26840), align 8, !tbaa !9
  %26 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26896), align 16, !tbaa !9
  %27 = ashr i64 %26, 1
  store i64 %27, ptr getelementptr inbounds (i8, ptr @states, i64 26896), align 16, !tbaa !9
  %28 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26952), align 8, !tbaa !9
  %29 = ashr i64 %28, 1
  store i64 %29, ptr getelementptr inbounds (i8, ptr @states, i64 26952), align 8, !tbaa !9
  %30 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27008), align 16, !tbaa !9
  %31 = ashr i64 %30, 1
  store i64 %31, ptr getelementptr inbounds (i8, ptr @states, i64 27008), align 16, !tbaa !9
  %32 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27064), align 8, !tbaa !9
  %33 = ashr i64 %32, 1
  store i64 %33, ptr getelementptr inbounds (i8, ptr @states, i64 27064), align 8, !tbaa !9
  %34 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27120), align 16, !tbaa !9
  %35 = ashr i64 %34, 1
  store i64 %35, ptr getelementptr inbounds (i8, ptr @states, i64 27120), align 16, !tbaa !9
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27176), align 8, !tbaa !9
  %37 = ashr i64 %36, 1
  store i64 %37, ptr getelementptr inbounds (i8, ptr @states, i64 27176), align 8, !tbaa !9
  %38 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27232), align 16, !tbaa !9
  %39 = ashr i64 %38, 1
  store i64 %39, ptr getelementptr inbounds (i8, ptr @states, i64 27232), align 16, !tbaa !9
  %40 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27288), align 8, !tbaa !9
  %41 = ashr i64 %40, 1
  store i64 %41, ptr getelementptr inbounds (i8, ptr @states, i64 27288), align 8, !tbaa !9
  %42 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27344), align 16, !tbaa !9
  %43 = ashr i64 %42, 1
  store i64 %43, ptr getelementptr inbounds (i8, ptr @states, i64 27344), align 16, !tbaa !9
  %44 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27400), align 8, !tbaa !9
  %45 = ashr i64 %44, 1
  br label %.sink.split

46:                                               ; preds = %16
  %47 = icmp ult i32 %0, 4
  %48 = icmp eq i32 %17, 4
  %or.cond11 = select i1 %47, i1 %48, i1 false
  br i1 %or.cond11, label %.preheader.preheader, label %75

.preheader.preheader:                             ; preds = %46
  %49 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26728), align 8, !tbaa !9
  %50 = shl i64 %49, 1
  store i64 %50, ptr getelementptr inbounds (i8, ptr @states, i64 26728), align 8, !tbaa !9
  %51 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26784), align 16, !tbaa !9
  %52 = shl i64 %51, 1
  store i64 %52, ptr getelementptr inbounds (i8, ptr @states, i64 26784), align 16, !tbaa !9
  %53 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26840), align 8, !tbaa !9
  %54 = shl i64 %53, 1
  store i64 %54, ptr getelementptr inbounds (i8, ptr @states, i64 26840), align 8, !tbaa !9
  %55 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26896), align 16, !tbaa !9
  %56 = shl i64 %55, 1
  store i64 %56, ptr getelementptr inbounds (i8, ptr @states, i64 26896), align 16, !tbaa !9
  %57 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 26952), align 8, !tbaa !9
  %58 = shl i64 %57, 1
  store i64 %58, ptr getelementptr inbounds (i8, ptr @states, i64 26952), align 8, !tbaa !9
  %59 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27008), align 16, !tbaa !9
  %60 = shl i64 %59, 1
  store i64 %60, ptr getelementptr inbounds (i8, ptr @states, i64 27008), align 16, !tbaa !9
  %61 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27064), align 8, !tbaa !9
  %62 = shl i64 %61, 1
  store i64 %62, ptr getelementptr inbounds (i8, ptr @states, i64 27064), align 8, !tbaa !9
  %63 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27120), align 16, !tbaa !9
  %64 = shl i64 %63, 1
  store i64 %64, ptr getelementptr inbounds (i8, ptr @states, i64 27120), align 16, !tbaa !9
  %65 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27176), align 8, !tbaa !9
  %66 = shl i64 %65, 1
  store i64 %66, ptr getelementptr inbounds (i8, ptr @states, i64 27176), align 8, !tbaa !9
  %67 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27232), align 16, !tbaa !9
  %68 = shl i64 %67, 1
  store i64 %68, ptr getelementptr inbounds (i8, ptr @states, i64 27232), align 16, !tbaa !9
  %69 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27288), align 8, !tbaa !9
  %70 = shl i64 %69, 1
  store i64 %70, ptr getelementptr inbounds (i8, ptr @states, i64 27288), align 8, !tbaa !9
  %71 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27344), align 16, !tbaa !9
  %72 = shl i64 %71, 1
  store i64 %72, ptr getelementptr inbounds (i8, ptr @states, i64 27344), align 16, !tbaa !9
  %73 = load i64, ptr getelementptr inbounds (i8, ptr @states, i64 27400), align 8, !tbaa !9
  %74 = shl i64 %73, 1
  br label %.sink.split

.sink.split:                                      ; preds = %19, %.preheader.preheader
  %.sink49 = phi i64 [ %74, %.preheader.preheader ], [ %45, %19 ]
  %.sink48 = phi i32 [ 983040, %.preheader.preheader ], [ 1310720, %19 ]
  %.sink47 = phi i32 [ 655360, %.preheader.preheader ], [ 1310720, %19 ]
  store i64 %.sink49, ptr getelementptr inbounds (i8, ptr @states, i64 27400), align 8, !tbaa !9
  store i32 %.sink48, ptr getelementptr inbounds (i8, ptr @mobjinfo, i64 1532), align 4, !tbaa !12
  store i32 %.sink47, ptr getelementptr inbounds (i8, ptr @mobjinfo, i64 3004), align 4, !tbaa !12
  store i32 %.sink47, ptr getelementptr inbounds (i8, ptr @mobjinfo, i64 2912), align 16, !tbaa !12
  br label %75

75:                                               ; preds = %.sink.split, %46
  store i32 2, ptr getelementptr inbounds (i8, ptr @players, i64 8), align 8, !tbaa !14
  store i32 2, ptr getelementptr inbounds (i8, ptr @players, i64 328), align 8, !tbaa !14
  store i32 2, ptr getelementptr inbounds (i8, ptr @players, i64 648), align 8, !tbaa !14
  store i32 2, ptr getelementptr inbounds (i8, ptr @players, i64 968), align 8, !tbaa !14
  store i32 1, ptr @usergame, align 4, !tbaa !5
  store i32 0, ptr @paused, align 4, !tbaa !5
  store i32 0, ptr @demoplayback, align 4, !tbaa !5
  store i32 0, ptr @automapactive, align 4, !tbaa !5
  store i32 %.036, ptr @gameepisode, align 4, !tbaa !5
  store i32 %spec.store.select13, ptr @gamemap, align 4, !tbaa !5
  store i32 %spec.store.select, ptr @gameskill, align 4, !tbaa !5
  store i32 1, ptr @viewactive, align 4, !tbaa !5
  %76 = load i32, ptr @gamemode, align 4, !tbaa !5
  %77 = icmp eq i32 %76, 2
  br i1 %77, label %78, label %switch.lookup

78:                                               ; preds = %75
  %79 = tail call i32 @R_TextureNumForName(ptr noundef nonnull @.str.1) #3
  store i32 %79, ptr @skytexture, align 4, !tbaa !5
  %80 = load i32, ptr @gamemap, align 4, !tbaa !5
  %81 = icmp slt i32 %80, 12
  br i1 %81, label %.sink.split50, label %82

82:                                               ; preds = %78
  %83 = icmp ult i32 %80, 21
  br i1 %83, label %.sink.split50, label %86

switch.lookup:                                    ; preds = %75
  %switch.tableidx = add nsw i32 %.036, -1
  %84 = sext i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [4 x ptr], ptr @switch.table.G_InitNew, i64 0, i64 %84
  %switch.load = load ptr, ptr %switch.gep, align 8
  br label %.sink.split50

.sink.split50:                                    ; preds = %switch.lookup, %82, %78
  %.str.2.sink = phi ptr [ @.str.2, %78 ], [ @.str.3, %82 ], [ %switch.load, %switch.lookup ]
  %85 = tail call i32 @R_TextureNumForName(ptr noundef nonnull %.str.2.sink) #3
  store i32 %85, ptr @skytexture, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %.sink.split50, %82
  tail call void @G_DoLoadLevel()
  ret void
}

declare void @M_ClearRandom() local_unnamed_addr #1

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

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !11, i64 16}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !6, i64 32, !11, i64 40, !11, i64 48}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !6, i64 60}
!13 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !6, i64 88}
!14 = !{!15, !6, i64 8}
!15 = !{!"player_s", !16, i64 0, !6, i64 8, !17, 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, !16, i64 224, !6, i64 232, !6, i64 236, !16, i64 240, !6, i64 248, !6, i64 252, !6, i64 256, !7, i64 264, !6, i64 312}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!"", !7, i64 0, !7, i64 1, !18, i64 2, !18, i64 4, !7, i64 6, !7, i64 7}
!18 = !{!"short", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass