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

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

@netgame = external global i32, align 4
@players = external global [4 x %struct.player_s], align 16
@consoleplayer = external global i32, align 4
@automapactive = external global i32, align 4

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

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

; Function Attrs: nounwind uwtable
define dso_local void @P_KillMobj(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.mobj_s, ptr %8, i32 0, i32 24
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = and i32 %10, -16793605
  store i32 %11, ptr %9, align 8, !tbaa !9
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.mobj_s, ptr %12, i32 0, i32 20
  %14 = load i32, ptr %13, align 8, !tbaa !15
  %15 = icmp ne i32 %14, 18
  br i1 %15, label %16, label %21

16:                                               ; preds = %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.mobj_s, ptr %17, i32 0, i32 24
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = and i32 %19, -513
  store i32 %20, ptr %18, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %16, %2
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.mobj_s, ptr %22, i32 0, i32 24
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = or i32 %24, 1049600
  store i32 %25, ptr %23, align 8, !tbaa !9
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mobj_s, ptr %26, i32 0, i32 15
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = ashr i32 %28, 2
  store i32 %29, ptr %27, align 4, !tbaa !16
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %70

32:                                               ; preds = %21
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mobj_s, ptr %33, i32 0, i32 31
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %70

37:                                               ; preds = %32
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mobj_s, ptr %38, i32 0, i32 24
  %40 = load i32, ptr %39, align 8, !tbaa !9
  %41 = and i32 %40, 4194304
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %50

43:                                               ; preds = %37
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.mobj_s, ptr %44, i32 0, i32 31
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  %47 = getelementptr inbounds %struct.player_s, ptr %46, i32 0, i32 23
  %48 = load i32, ptr %47, align 8, !tbaa !18
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 8, !tbaa !18
  br label %50

50:                                               ; preds = %43, %37
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.mobj_s, ptr %51, i32 0, i32 31
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %69

55:                                               ; preds = %50
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.mobj_s, ptr %56, i32 0, i32 31
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = getelementptr inbounds %struct.player_s, ptr %58, i32 0, i32 13
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mobj_s, ptr %60, i32 0, i32 31
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = ptrtoint ptr %62 to i64
  %64 = sub i64 %63, ptrtoint (ptr @players to i64)
  %65 = sdiv exact i64 %64, 320
  %66 = getelementptr inbounds [4 x i32], ptr %59, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !21
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %66, align 4, !tbaa !21
  br label %69

69:                                               ; preds = %55, %50
  br label %83

70:                                               ; preds = %32, %21
  %71 = load i32, ptr @netgame, align 4, !tbaa !21
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %82, label %73

73:                                               ; preds = %70
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mobj_s, ptr %74, i32 0, i32 24
  %76 = load i32, ptr %75, align 8, !tbaa !9
  %77 = and i32 %76, 4194304
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %82

79:                                               ; preds = %73
  %80 = load i32, ptr getelementptr inbounds (%struct.player_s, ptr @players, i32 0, i32 23), align 16, !tbaa !18
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr getelementptr inbounds (%struct.player_s, ptr @players, i32 0, i32 23), align 16, !tbaa !18
  br label %82

82:                                               ; preds = %79, %73, %70
  br label %83

83:                                               ; preds = %82, %69
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mobj_s, ptr %84, i32 0, i32 31
  %86 = load ptr, ptr %85, align 8, !tbaa !17
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %129

88:                                               ; preds = %83
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = icmp ne ptr %89, null
  br i1 %90, label %105, label %91

91:                                               ; preds = %88
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.mobj_s, ptr %92, i32 0, i32 31
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = getelementptr inbounds %struct.player_s, ptr %94, i32 0, i32 13
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.mobj_s, ptr %96, i32 0, i32 31
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  %99 = ptrtoint ptr %98 to i64
  %100 = sub i64 %99, ptrtoint (ptr @players to i64)
  %101 = sdiv exact i64 %100, 320
  %102 = getelementptr inbounds [4 x i32], ptr %95, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !21
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %102, align 4, !tbaa !21
  br label %105

105:                                              ; preds = %91, %88
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.mobj_s, ptr %106, i32 0, i32 24
  %108 = load i32, ptr %107, align 8, !tbaa !9
  %109 = and i32 %108, -3
  store i32 %109, ptr %107, align 8, !tbaa !9
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.mobj_s, ptr %110, i32 0, i32 31
  %112 = load ptr, ptr %111, align 8, !tbaa !17
  %113 = getelementptr inbounds %struct.player_s, ptr %112, i32 0, i32 1
  store i32 1, ptr %113, align 8, !tbaa !22
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.mobj_s, ptr %114, i32 0, i32 31
  %116 = load ptr, ptr %115, align 8, !tbaa !17
  call void @P_DropWeapon(ptr noundef %116)
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.mobj_s, ptr %117, i32 0, i32 31
  %119 = load ptr, ptr %118, align 8, !tbaa !17
  %120 = load i32, ptr @consoleplayer, align 4, !tbaa !21
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %121
  %123 = icmp eq ptr %119, %122
  br i1 %123, label %124, label %128

124:                                              ; preds = %105
  %125 = load i32, ptr @automapactive, align 4, !tbaa !21
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %128

127:                                              ; preds = %124
  call void @AM_Stop()
  br label %128

128:                                              ; preds = %127, %124, %105
  br label %129

129:                                              ; preds = %128, %83
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.mobj_s, ptr %130, i32 0, i32 25
  %132 = load i32, ptr %131, align 4, !tbaa !23
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.mobj_s, ptr %133, i32 0, i32 21
  %135 = load ptr, ptr %134, align 8, !tbaa !24
  %136 = getelementptr inbounds %struct.mobjinfo_t, ptr %135, i32 0, i32 2
  %137 = load i32, ptr %136, align 4, !tbaa !25
  %138 = sub nsw i32 0, %137
  %139 = icmp slt i32 %132, %138
  br i1 %139, label %140, label %155

140:                                              ; preds = %129
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.mobj_s, ptr %141, i32 0, i32 21
  %143 = load ptr, ptr %142, align 8, !tbaa !24
  %144 = getelementptr inbounds %struct.mobjinfo_t, ptr %143, i32 0, i32 13
  %145 = load i32, ptr %144, align 4, !tbaa !27
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %147, label %155

147:                                              ; preds = %140
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.mobj_s, ptr %149, i32 0, i32 21
  %151 = load ptr, ptr %150, align 8, !tbaa !24
  %152 = getelementptr inbounds %struct.mobjinfo_t, ptr %151, i32 0, i32 13
  %153 = load i32, ptr %152, align 4, !tbaa !27
  %154 = call i32 @P_SetMobjState(ptr noundef %148, i32 noundef %153)
  br label %163

155:                                              ; preds = %140, %129
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.mobj_s, ptr %157, i32 0, i32 21
  %159 = load ptr, ptr %158, align 8, !tbaa !24
  %160 = getelementptr inbounds %struct.mobjinfo_t, ptr %159, i32 0, i32 12
  %161 = load i32, ptr %160, align 4, !tbaa !28
  %162 = call i32 @P_SetMobjState(ptr noundef %156, i32 noundef %161)
  br label %163

163:                                              ; preds = %155, %147
  %164 = call i32 @P_Random()
  %165 = and i32 %164, 3
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.mobj_s, ptr %166, i32 0, i32 22
  %168 = load i32, ptr %167, align 8, !tbaa !29
  %169 = sub nsw i32 %168, %165
  store i32 %169, ptr %167, align 8, !tbaa !29
  %170 = load ptr, ptr %4, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.mobj_s, ptr %170, i32 0, i32 22
  %172 = load i32, ptr %171, align 8, !tbaa !29
  %173 = icmp slt i32 %172, 1
  br i1 %173, label %174, label %177

174:                                              ; preds = %163
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.mobj_s, ptr %175, i32 0, i32 22
  store i32 1, ptr %176, align 8, !tbaa !29
  br label %177

177:                                              ; preds = %174, %163
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.mobj_s, ptr %178, i32 0, i32 20
  %180 = load i32, ptr %179, align 8, !tbaa !15
  switch i32 %180, label %184 [
    i32 23, label %181
    i32 1, label %181
    i32 2, label %182
    i32 10, label %183
  ]

181:                                              ; preds = %177, %177
  store i32 63, ptr %5, align 4, !tbaa !21
  br label %185

182:                                              ; preds = %177
  store i32 77, ptr %5, align 4, !tbaa !21
  br label %185

183:                                              ; preds = %177
  store i32 73, ptr %5, align 4, !tbaa !21
  br label %185

184:                                              ; preds = %177
  store i32 1, ptr %7, align 4
  br label %198

185:                                              ; preds = %183, %182, %181
  %186 = load ptr, ptr %4, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.mobj_s, ptr %186, i32 0, i32 1
  %188 = load i32, ptr %187, align 8, !tbaa !30
  %189 = load ptr, ptr %4, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.mobj_s, ptr %189, i32 0, i32 2
  %191 = load i32, ptr %190, align 4, !tbaa !31
  %192 = load i32, ptr %5, align 4, !tbaa !21
  %193 = call ptr @P_SpawnMobj(i32 noundef %188, i32 noundef %191, i32 noundef -2147483648, i32 noundef %192)
  store ptr %193, ptr %6, align 8, !tbaa !5
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.mobj_s, ptr %194, i32 0, i32 24
  %196 = load i32, ptr %195, align 8, !tbaa !9
  %197 = or i32 %196, 131072
  store i32 %197, ptr %195, align 8, !tbaa !9
  store i32 0, ptr %7, align 4
  br label %198

198:                                              ; preds = %185, %184
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  %199 = load i32, ptr %7, align 4
  switch i32 %199, label %201 [
    i32 0, label %200
    i32 1, label %200
  ]

200:                                              ; preds = %198, %198
  ret void

201:                                              ; preds = %198
  unreachable
}

declare void @P_DropWeapon(ptr noundef) #2

declare void @AM_Stop() #2

declare i32 @P_SetMobjState(ptr noundef, i32 noundef) #2

declare i32 @P_Random() #2

declare ptr @P_SpawnMobj(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 160}
!10 = !{!"mobj_s", !11, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !12, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !6, i64 136, !12, i64 144, !6, i64 152, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !6, i64 176, !12, i64 184, !12, i64 188, !6, i64 192, !12, i64 200, !13, i64 204, !6, i64 216}
!11 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!14 = !{!"short", !7, i64 0}
!15 = !{!10, !12, i64 128}
!16 = !{!10, !12, i64 108}
!17 = !{!10, !6, i64 192}
!18 = !{!19, !12, i64 208}
!19 = !{!"player_s", !6, i64 0, !12, i64 8, !20, i64 12, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !7, i64 48, !7, i64 72, !12, i64 96, !7, i64 100, !12, i64 116, !12, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !12, i64 192, !12, i64 196, !12, i64 200, !12, i64 204, !12, i64 208, !12, i64 212, !12, i64 216, !6, i64 224, !12, i64 232, !12, i64 236, !6, i64 240, !12, i64 248, !12, i64 252, !12, i64 256, !7, i64 264, !12, i64 312}
!20 = !{!"", !7, i64 0, !7, i64 1, !14, i64 2, !14, i64 4, !7, i64 6, !7, i64 7}
!21 = !{!12, !12, i64 0}
!22 = !{!19, !12, i64 8}
!23 = !{!10, !12, i64 164}
!24 = !{!10, !6, i64 136}
!25 = !{!26, !12, i64 8}
!26 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88}
!27 = !{!26, !12, i64 52}
!28 = !{!26, !12, i64 48}
!29 = !{!10, !12, i64 144}
!30 = !{!10, !12, i64 24}
!31 = !{!10, !12, i64 28}


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

@netgame = external local_unnamed_addr global i32, align 4
@players = external global [4 x %struct.player_s], align 16
@consoleplayer = external local_unnamed_addr global i32, align 4
@automapactive = external local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @P_KillMobj(ptr noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 160
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 128
  %6 = load i32, ptr %5, align 8, !tbaa !14
  %.not = icmp eq i32 %6, 18
  %spec.select50.v = select i1 %.not, i32 -17843205, i32 -17843717
  %spec.select50 = and i32 %4, %spec.select50.v
  %7 = or disjoint i32 %spec.select50, 1049600
  store i32 %7, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 108
  %9 = load i32, ptr %8, align 4, !tbaa !15
  %10 = ashr i32 %9, 2
  store i32 %10, ptr %8, align 4, !tbaa !15
  %.not41 = icmp eq ptr %0, null
  br i1 %.not41, label %31, label %11

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 192
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %.not42 = icmp eq ptr %13, null
  br i1 %.not42, label %31, label %14

14:                                               ; preds = %11
  %15 = and i32 %4, 4194304
  %.not45 = icmp eq i32 %15, 0
  br i1 %.not45, label %20, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %13, i64 208
  %18 = load i32, ptr %17, align 8, !tbaa !17
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %17, align 8, !tbaa !17
  br label %20

20:                                               ; preds = %16, %14
  %21 = getelementptr inbounds i8, ptr %1, i64 192
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %.not46 = icmp eq ptr %22, null
  br i1 %.not46, label %37, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %13, i64 100
  %25 = ptrtoint ptr %22 to i64
  %26 = sub i64 %25, ptrtoint (ptr @players to i64)
  %27 = sdiv exact i64 %26, 320
  %28 = getelementptr inbounds [4 x i32], ptr %24, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !20
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %28, align 4, !tbaa !20
  br label %37

31:                                               ; preds = %11, %2
  %32 = load i32, ptr @netgame, align 4, !tbaa !20
  %.not43 = icmp ne i32 %32, 0
  %33 = and i32 %4, 4194304
  %.not44 = icmp eq i32 %33, 0
  %or.cond49 = select i1 %.not43, i1 true, i1 %.not44
  br i1 %or.cond49, label %37, label %34

34:                                               ; preds = %31
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @players, i64 208), align 16, !tbaa !17
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr getelementptr inbounds (i8, ptr @players, i64 208), align 16, !tbaa !17
  br label %37

37:                                               ; preds = %31, %34, %20, %23
  %38 = getelementptr inbounds i8, ptr %1, i64 192
  %39 = load ptr, ptr %38, align 8, !tbaa !16
  %.not47 = icmp eq ptr %39, null
  br i1 %.not47, label %61, label %40

40:                                               ; preds = %37
  br i1 %.not41, label %41, label %49

41:                                               ; preds = %40
  %42 = getelementptr inbounds i8, ptr %39, i64 100
  %43 = ptrtoint ptr %39 to i64
  %44 = sub i64 %43, ptrtoint (ptr @players to i64)
  %45 = sdiv exact i64 %44, 320
  %46 = getelementptr inbounds [4 x i32], ptr %42, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !20
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %46, align 4, !tbaa !20
  br label %49

49:                                               ; preds = %41, %40
  %50 = load i32, ptr %3, align 8, !tbaa !5
  %51 = and i32 %50, -3
  store i32 %51, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %39, i64 8
  store i32 1, ptr %52, align 8, !tbaa !21
  tail call void @P_DropWeapon(ptr noundef nonnull %39) #3
  %53 = load ptr, ptr %38, align 8, !tbaa !16
  %54 = load i32, ptr @consoleplayer, align 4, !tbaa !20
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4 x %struct.player_s], ptr @players, i64 0, i64 %55
  %57 = icmp eq ptr %53, %56
  %58 = load i32, ptr @automapactive, align 4
  %59 = icmp ne i32 %58, 0
  %or.cond = select i1 %57, i1 %59, i1 false
  br i1 %or.cond, label %60, label %61

60:                                               ; preds = %49
  tail call void @AM_Stop() #3
  br label %61

61:                                               ; preds = %49, %60, %37
  %62 = getelementptr inbounds i8, ptr %1, i64 164
  %63 = load i32, ptr %62, align 4, !tbaa !22
  %64 = getelementptr inbounds i8, ptr %1, i64 136
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load i32, ptr %66, align 4, !tbaa !24
  %68 = sub nsw i32 0, %67
  %69 = icmp slt i32 %63, %68
  br i1 %69, label %70, label %73

70:                                               ; preds = %61
  %71 = getelementptr inbounds i8, ptr %65, i64 52
  %72 = load i32, ptr %71, align 4, !tbaa !26
  %.not48 = icmp eq i32 %72, 0
  br i1 %.not48, label %73, label %76

73:                                               ; preds = %70, %61
  %74 = getelementptr inbounds i8, ptr %65, i64 48
  %75 = load i32, ptr %74, align 4, !tbaa !27
  br label %76

76:                                               ; preds = %70, %73
  %.sink = phi i32 [ %75, %73 ], [ %72, %70 ]
  %77 = tail call i32 @P_SetMobjState(ptr noundef nonnull %1, i32 noundef %.sink) #3
  %78 = tail call i32 @P_Random() #3
  %79 = and i32 %78, 3
  %80 = getelementptr inbounds i8, ptr %1, i64 144
  %81 = load i32, ptr %80, align 8, !tbaa !28
  %82 = sub nsw i32 %81, %79
  %spec.select = tail call i32 @llvm.smax.i32(i32 %82, i32 1)
  store i32 %spec.select, ptr %80, align 8, !tbaa !28
  %83 = load i32, ptr %5, align 8, !tbaa !14
  switch i32 %83, label %95 [
    i32 23, label %86
    i32 1, label %86
    i32 2, label %84
    i32 10, label %85
  ]

84:                                               ; preds = %76
  br label %86

85:                                               ; preds = %76
  br label %86

86:                                               ; preds = %76, %76, %85, %84
  %.0 = phi i32 [ 73, %85 ], [ 77, %84 ], [ 63, %76 ], [ 63, %76 ]
  %87 = getelementptr inbounds i8, ptr %1, i64 24
  %88 = load i32, ptr %87, align 8, !tbaa !29
  %89 = getelementptr inbounds i8, ptr %1, i64 28
  %90 = load i32, ptr %89, align 4, !tbaa !30
  %91 = tail call ptr @P_SpawnMobj(i32 noundef %88, i32 noundef %90, i32 noundef -2147483648, i32 noundef %.0) #3
  %92 = getelementptr inbounds i8, ptr %91, i64 160
  %93 = load i32, ptr %92, align 8, !tbaa !5
  %94 = or i32 %93, 131072
  store i32 %94, ptr %92, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %76, %86
  ret void
}

declare void @P_DropWeapon(ptr noundef) local_unnamed_addr #1

declare void @AM_Stop() local_unnamed_addr #1

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

declare i32 @P_Random() local_unnamed_addr #1

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

; 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, !11, i64 160}
!6 = !{!"mobj_s", !7, i64 0, !11, i64 24, !11, i64 28, !11, i64 32, !8, i64 40, !8, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !8, i64 136, !11, i64 144, !8, i64 152, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !8, i64 176, !11, i64 184, !11, i64 188, !8, i64 192, !11, i64 200, !12, i64 204, !8, i64 216}
!7 = !{!"thinker_s", !8, i64 0, !8, i64 8, !9, i64 16}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!13 = !{!"short", !9, i64 0}
!14 = !{!6, !11, i64 128}
!15 = !{!6, !11, i64 108}
!16 = !{!6, !8, i64 192}
!17 = !{!18, !11, i64 208}
!18 = !{!"player_s", !8, i64 0, !11, i64 8, !19, i64 12, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !9, i64 48, !9, i64 72, !11, i64 96, !9, i64 100, !11, i64 116, !11, i64 120, !9, i64 124, !9, i64 160, !9, i64 176, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !11, i64 208, !11, i64 212, !11, i64 216, !8, i64 224, !11, i64 232, !11, i64 236, !8, i64 240, !11, i64 248, !11, i64 252, !11, i64 256, !9, i64 264, !11, i64 312}
!19 = !{!"", !9, i64 0, !9, i64 1, !13, i64 2, !13, i64 4, !9, i64 6, !9, i64 7}
!20 = !{!11, !11, i64 0}
!21 = !{!18, !11, i64 8}
!22 = !{!6, !11, i64 164}
!23 = !{!6, !8, i64 136}
!24 = !{!25, !11, i64 8}
!25 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88}
!26 = !{!25, !11, i64 52}
!27 = !{!25, !11, i64 48}
!28 = !{!6, !11, i64 144}
!29 = !{!6, !11, i64 24}
!30 = !{!6, !11, i64 28}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass