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

; 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.mpoint_t = type { i32, i32 }
%struct.cheatseq_t = type { ptr, ptr }
%struct.event_t = type { i32, i32, i32, i32 }
%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 }

@automapactive = external dso_local global i32, align 4
@scale_ftom = external hidden global i32, align 4
@followplayer = external hidden global i32, align 4
@plr = external hidden global ptr, align 8
@markpointnum = external hidden global i32, align 4
@m_paninc = external hidden global %struct.mpoint_t, align 4
@f_oldloc = external hidden global %struct.mpoint_t, align 4
@ftom_zoommul = external hidden global i32, align 4
@mtof_zoommul = external hidden global i32, align 4
@AM_Responder.bigstate = external hidden global i32, align 4
@AM_Responder.buffer = external hidden global [20 x i8], align 16
@viewactive = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@grid = external hidden global i32, align 4
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@deathmatch = external global i32, align 4
@cheat_amap = external hidden global %struct.cheatseq_t, align 8
@cheating = external hidden 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: inlinehint nounwind uwtable
declare hidden i32 @FixedMul(i32 noundef, i32 noundef) #1

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

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

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

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

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

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

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

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

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

6:                                                ; preds = %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.event_t, ptr %7, i32 0, i32 0
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %17

11:                                               ; preds = %6
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.event_t, ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = icmp eq i32 %14, 9
  br i1 %15, label %16, label %17

16:                                               ; preds = %11
  call void @AM_Start()
  store i32 0, ptr @viewactive, align 4, !tbaa !9
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %16, %11, %6
  br label %153

18:                                               ; preds = %1
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.event_t, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %120

23:                                               ; preds = %18
  store i32 1, ptr %3, align 4, !tbaa !9
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.event_t, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !13
  switch i32 %26, label %104 [
    i32 174, label %27
    i32 172, label %35
    i32 173, label %44
    i32 175, label %52
    i32 45, label %61
    i32 61, label %62
    i32 9, label %63
    i32 48, label %64
    i32 102, label %74
    i32 103, label %85
    i32 109, label %96
    i32 99, label %101
  ]

27:                                               ; preds = %23
  %28 = load i32, ptr @followplayer, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %33, label %30

30:                                               ; preds = %27
  %31 = load i32, ptr @scale_ftom, align 4, !tbaa !9
  %32 = call i32 @FixedMul(i32 noundef 262144, i32 noundef %31)
  store i32 %32, ptr @m_paninc, align 4, !tbaa !14
  br label %34

33:                                               ; preds = %27
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %34

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

35:                                               ; preds = %23
  %36 = load i32, ptr @followplayer, align 4, !tbaa !9
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %42, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr @scale_ftom, align 4, !tbaa !9
  %40 = call i32 @FixedMul(i32 noundef 262144, i32 noundef %39)
  %41 = sub nsw i32 0, %40
  store i32 %41, ptr @m_paninc, align 4, !tbaa !14
  br label %43

42:                                               ; preds = %35
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %42, %38
  br label %105

44:                                               ; preds = %23
  %45 = load i32, ptr @followplayer, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr @scale_ftom, align 4, !tbaa !9
  %49 = call i32 @FixedMul(i32 noundef 262144, i32 noundef %48)
  store i32 %49, ptr getelementptr inbounds (%struct.mpoint_t, ptr @m_paninc, i32 0, i32 1), align 4, !tbaa !16
  br label %51

50:                                               ; preds = %44
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %50, %47
  br label %105

52:                                               ; preds = %23
  %53 = load i32, ptr @followplayer, align 4, !tbaa !9
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %59, label %55

55:                                               ; preds = %52
  %56 = load i32, ptr @scale_ftom, align 4, !tbaa !9
  %57 = call i32 @FixedMul(i32 noundef 262144, i32 noundef %56)
  %58 = sub nsw i32 0, %57
  store i32 %58, ptr getelementptr inbounds (%struct.mpoint_t, ptr @m_paninc, i32 0, i32 1), align 4, !tbaa !16
  br label %60

59:                                               ; preds = %52
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %59, %55
  br label %105

61:                                               ; preds = %23
  store i32 64250, ptr @mtof_zoommul, align 4, !tbaa !9
  store i32 66846, ptr @ftom_zoommul, align 4, !tbaa !9
  br label %105

62:                                               ; preds = %23
  store i32 66846, ptr @mtof_zoommul, align 4, !tbaa !9
  store i32 64250, ptr @ftom_zoommul, align 4, !tbaa !9
  br label %105

63:                                               ; preds = %23
  store i32 0, ptr @AM_Responder.bigstate, align 4, !tbaa !9
  store i32 1, ptr @viewactive, align 4, !tbaa !9
  call void @AM_Stop()
  br label %105

64:                                               ; preds = %23
  %65 = load i32, ptr @AM_Responder.bigstate, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  %67 = xor i1 %66, true
  %68 = zext i1 %67 to i32
  store i32 %68, ptr @AM_Responder.bigstate, align 4, !tbaa !9
  %69 = load i32, ptr @AM_Responder.bigstate, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %64
  call void @AM_saveScaleAndLoc()
  call void @AM_minOutWindowScale()
  br label %73

72:                                               ; preds = %64
  call void @AM_restoreScaleAndLoc()
  br label %73

73:                                               ; preds = %72, %71
  br label %105

74:                                               ; preds = %23
  %75 = load i32, ptr @followplayer, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  %77 = xor i1 %76, true
  %78 = zext i1 %77 to i32
  store i32 %78, ptr @followplayer, align 4, !tbaa !9
  store i32 2147483647, ptr @f_oldloc, align 4, !tbaa !14
  %79 = load i32, ptr @followplayer, align 4, !tbaa !9
  %80 = icmp ne i32 %79, 0
  %81 = zext i1 %80 to i64
  %82 = select i1 %80, ptr @.str.2, ptr @.str.3
  %83 = load ptr, ptr @plr, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.player_s, ptr %83, i32 0, i32 26
  store ptr %82, ptr %84, align 8, !tbaa !17
  br label %105

85:                                               ; preds = %23
  %86 = load i32, ptr @grid, align 4, !tbaa !9
  %87 = icmp ne i32 %86, 0
  %88 = xor i1 %87, true
  %89 = zext i1 %88 to i32
  store i32 %89, ptr @grid, align 4, !tbaa !9
  %90 = load i32, ptr @grid, align 4, !tbaa !9
  %91 = icmp ne i32 %90, 0
  %92 = zext i1 %91 to i64
  %93 = select i1 %91, ptr @.str.4, ptr @.str.5
  %94 = load ptr, ptr @plr, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.player_s, ptr %94, i32 0, i32 26
  store ptr %93, ptr %95, align 8, !tbaa !17
  br label %105

96:                                               ; preds = %23
  %97 = load i32, ptr @markpointnum, align 4, !tbaa !9
  %98 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef @AM_Responder.buffer, ptr noundef @.str.6, ptr noundef @.str.7, i32 noundef %97) #5
  %99 = load ptr, ptr @plr, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.player_s, ptr %99, i32 0, i32 26
  store ptr @AM_Responder.buffer, ptr %100, align 8, !tbaa !17
  call void @AM_addMark()
  br label %105

101:                                              ; preds = %23
  call void @AM_clearMarks()
  %102 = load ptr, ptr @plr, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.player_s, ptr %102, i32 0, i32 26
  store ptr @.str.8, ptr %103, align 8, !tbaa !17
  br label %105

104:                                              ; preds = %23
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %104, %101, %96, %85, %74, %73, %63, %62, %61, %60, %51, %43, %34
  %106 = load i32, ptr @deathmatch, align 4, !tbaa !9
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %119, label %108

108:                                              ; preds = %105
  %109 = load ptr, ptr %2, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.event_t, ptr %109, i32 0, i32 1
  %111 = load i32, ptr %110, align 4, !tbaa !13
  %112 = trunc i32 %111 to i8
  %113 = call i32 @cht_CheckCheat(ptr noundef @cheat_amap, i8 noundef signext %112)
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %119

115:                                              ; preds = %108
  store i32 0, ptr %3, align 4, !tbaa !9
  %116 = load i32, ptr @cheating, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  %118 = srem i32 %117, 3
  store i32 %118, ptr @cheating, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %115, %108, %105
  br label %152

120:                                              ; preds = %18
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.event_t, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !11
  %124 = icmp eq i32 %123, 1
  br i1 %124, label %125, label %151

125:                                              ; preds = %120
  store i32 0, ptr %3, align 4, !tbaa !9
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.event_t, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !13
  switch i32 %128, label %150 [
    i32 174, label %129
    i32 172, label %134
    i32 173, label %139
    i32 175, label %144
    i32 45, label %149
    i32 61, label %149
  ]

129:                                              ; preds = %125
  %130 = load i32, ptr @followplayer, align 4, !tbaa !9
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %133, label %132

132:                                              ; preds = %129
  store i32 0, ptr @m_paninc, align 4, !tbaa !14
  br label %133

133:                                              ; preds = %132, %129
  br label %150

134:                                              ; preds = %125
  %135 = load i32, ptr @followplayer, align 4, !tbaa !9
  %136 = icmp ne i32 %135, 0
  br i1 %136, label %138, label %137

137:                                              ; preds = %134
  store i32 0, ptr @m_paninc, align 4, !tbaa !14
  br label %138

138:                                              ; preds = %137, %134
  br label %150

139:                                              ; preds = %125
  %140 = load i32, ptr @followplayer, align 4, !tbaa !9
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %143, label %142

142:                                              ; preds = %139
  store i32 0, ptr getelementptr inbounds (%struct.mpoint_t, ptr @m_paninc, i32 0, i32 1), align 4, !tbaa !16
  br label %143

143:                                              ; preds = %142, %139
  br label %150

144:                                              ; preds = %125
  %145 = load i32, ptr @followplayer, align 4, !tbaa !9
  %146 = icmp ne i32 %145, 0
  br i1 %146, label %148, label %147

147:                                              ; preds = %144
  store i32 0, ptr getelementptr inbounds (%struct.mpoint_t, ptr @m_paninc, i32 0, i32 1), align 4, !tbaa !16
  br label %148

148:                                              ; preds = %147, %144
  br label %150

149:                                              ; preds = %125, %125
  store i32 65536, ptr @mtof_zoommul, align 4, !tbaa !9
  store i32 65536, ptr @ftom_zoommul, align 4, !tbaa !9
  br label %150

150:                                              ; preds = %149, %148, %143, %138, %133, %125
  br label %151

151:                                              ; preds = %150, %120
  br label %152

152:                                              ; preds = %151, %119
  br label %153

153:                                              ; preds = %152, %17
  %154 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 %154
}

declare i32 @cht_CheckCheat(ptr noundef, i8 noundef signext) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "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 = { "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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!13 = !{!12, !10, i64 4}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0, !10, i64 4}
!16 = !{!15, !10, i64 4}
!17 = !{!18, !6, i64 224}
!18 = !{!"player_s", !6, i64 0, !10, i64 8, !19, i64 12, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !7, i64 48, !7, i64 72, !10, i64 96, !7, i64 100, !10, i64 116, !10, i64 120, !7, i64 124, !7, i64 160, !7, i64 176, !10, i64 192, !10, i64 196, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !6, i64 224, !10, i64 232, !10, i64 236, !6, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !7, i64 264, !10, i64 312}
!19 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !20, i64 4, !7, i64 6, !7, i64 7}
!20 = !{!"short", !7, i64 0}


; 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.mpoint_t = type { i32, i32 }
%struct.cheatseq_t = type { ptr, ptr }

@automapactive = external dso_local local_unnamed_addr global i32, align 4
@scale_ftom = external hidden local_unnamed_addr global i32, align 4
@followplayer = external hidden local_unnamed_addr global i32, align 4
@plr = external hidden local_unnamed_addr global ptr, align 8
@markpointnum = external hidden local_unnamed_addr global i32, align 4
@m_paninc = external hidden local_unnamed_addr global %struct.mpoint_t, align 4
@f_oldloc = external hidden local_unnamed_addr global %struct.mpoint_t, align 4
@ftom_zoommul = external hidden local_unnamed_addr global i32, align 4
@mtof_zoommul = external hidden local_unnamed_addr global i32, align 4
@AM_Responder.bigstate = external hidden local_unnamed_addr global i32, align 4
@AM_Responder.buffer = external hidden global [20 x i8], align 16
@viewactive = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@grid = external hidden local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [18 x i8], align 1
@deathmatch = external local_unnamed_addr global i32, align 4
@cheat_amap = external hidden global %struct.cheatseq_t, align 8
@cheating = external hidden local_unnamed_addr global i32, align 4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @FixedMul(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @AM_saveScaleAndLoc() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @AM_restoreScaleAndLoc() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @AM_addMark() local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @AM_clearMarks() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @AM_Stop() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @AM_Start() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @AM_minOutWindowScale() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @AM_Responder(ptr nocapture noundef readonly %0) local_unnamed_addr #1 {
  %2 = load i32, ptr @automapactive, align 4, !tbaa !5
  %.not = icmp eq i32 %2, 0
  %3 = load i32, ptr %0, align 4, !tbaa !9
  br i1 %.not, label %4, label %11

4:                                                ; preds = %1
  %5 = icmp eq i32 %3, 0
  br i1 %5, label %6, label %91

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !11
  %9 = icmp eq i32 %8, 9
  br i1 %9, label %10, label %91

10:                                               ; preds = %6
  tail call void @AM_Start()
  store i32 0, ptr @viewactive, align 4, !tbaa !5
  br label %91

11:                                               ; preds = %1
  switch i32 %3, label %91 [
    i32 0, label %12
    i32 1, label %75
  ]

12:                                               ; preds = %11
  %13 = getelementptr inbounds i8, ptr %0, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !11
  switch i32 %14, label %65 [
    i32 174, label %15
    i32 172, label %20
    i32 173, label %26
    i32 175, label %31
    i32 45, label %37
    i32 61, label %38
    i32 9, label %39
    i32 48, label %40
    i32 102, label %45
    i32 103, label %51
    i32 109, label %57
    i32 99, label %62
  ]

15:                                               ; preds = %12
  %16 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not18 = icmp eq i32 %16, 0
  br i1 %.not18, label %17, label %65

17:                                               ; preds = %15
  %18 = load i32, ptr @scale_ftom, align 4, !tbaa !5
  %19 = tail call i32 @FixedMul(i32 noundef 262144, i32 noundef %18)
  store i32 %19, ptr @m_paninc, align 4, !tbaa !12
  br label %65

20:                                               ; preds = %12
  %21 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not17 = icmp eq i32 %21, 0
  br i1 %.not17, label %22, label %65

22:                                               ; preds = %20
  %23 = load i32, ptr @scale_ftom, align 4, !tbaa !5
  %24 = tail call i32 @FixedMul(i32 noundef 262144, i32 noundef %23)
  %25 = sub nsw i32 0, %24
  store i32 %25, ptr @m_paninc, align 4, !tbaa !12
  br label %65

26:                                               ; preds = %12
  %27 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not16 = icmp eq i32 %27, 0
  br i1 %.not16, label %28, label %65

28:                                               ; preds = %26
  %29 = load i32, ptr @scale_ftom, align 4, !tbaa !5
  %30 = tail call i32 @FixedMul(i32 noundef 262144, i32 noundef %29)
  store i32 %30, ptr getelementptr inbounds (i8, ptr @m_paninc, i64 4), align 4, !tbaa !14
  br label %65

31:                                               ; preds = %12
  %32 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not15 = icmp eq i32 %32, 0
  br i1 %.not15, label %33, label %65

33:                                               ; preds = %31
  %34 = load i32, ptr @scale_ftom, align 4, !tbaa !5
  %35 = tail call i32 @FixedMul(i32 noundef 262144, i32 noundef %34)
  %36 = sub nsw i32 0, %35
  store i32 %36, ptr getelementptr inbounds (i8, ptr @m_paninc, i64 4), align 4, !tbaa !14
  br label %65

37:                                               ; preds = %12
  store i32 64250, ptr @mtof_zoommul, align 4, !tbaa !5
  store i32 66846, ptr @ftom_zoommul, align 4, !tbaa !5
  br label %65

38:                                               ; preds = %12
  store i32 66846, ptr @mtof_zoommul, align 4, !tbaa !5
  store i32 64250, ptr @ftom_zoommul, align 4, !tbaa !5
  br label %65

39:                                               ; preds = %12
  store i32 0, ptr @AM_Responder.bigstate, align 4, !tbaa !5
  store i32 1, ptr @viewactive, align 4, !tbaa !5
  tail call void @AM_Stop()
  br label %65

40:                                               ; preds = %12
  %41 = load i32, ptr @AM_Responder.bigstate, align 4, !tbaa !5
  %.not14 = icmp eq i32 %41, 0
  %42 = zext i1 %.not14 to i32
  store i32 %42, ptr @AM_Responder.bigstate, align 4, !tbaa !5
  br i1 %.not14, label %43, label %44

43:                                               ; preds = %40
  tail call void @AM_saveScaleAndLoc()
  tail call void @AM_minOutWindowScale()
  br label %65

44:                                               ; preds = %40
  tail call void @AM_restoreScaleAndLoc()
  br label %65

45:                                               ; preds = %12
  %46 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not13 = icmp eq i32 %46, 0
  %47 = zext i1 %.not13 to i32
  store i32 %47, ptr @followplayer, align 4, !tbaa !5
  store i32 2147483647, ptr @f_oldloc, align 4, !tbaa !12
  %48 = select i1 %.not13, ptr @.str.2, ptr @.str.3
  %49 = load ptr, ptr @plr, align 8, !tbaa !15
  %50 = getelementptr inbounds i8, ptr %49, i64 224
  store ptr %48, ptr %50, align 8, !tbaa !17
  br label %65

51:                                               ; preds = %12
  %52 = load i32, ptr @grid, align 4, !tbaa !5
  %.not12 = icmp eq i32 %52, 0
  %53 = zext i1 %.not12 to i32
  store i32 %53, ptr @grid, align 4, !tbaa !5
  %54 = select i1 %.not12, ptr @.str.4, ptr @.str.5
  %55 = load ptr, ptr @plr, align 8, !tbaa !15
  %56 = getelementptr inbounds i8, ptr %55, i64 224
  store ptr %54, ptr %56, align 8, !tbaa !17
  br label %65

57:                                               ; preds = %12
  %58 = load i32, ptr @markpointnum, align 4, !tbaa !5
  %59 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @AM_Responder.buffer, ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull @.str.7, i32 noundef %58) #4
  %60 = load ptr, ptr @plr, align 8, !tbaa !15
  %61 = getelementptr inbounds i8, ptr %60, i64 224
  store ptr @AM_Responder.buffer, ptr %61, align 8, !tbaa !17
  tail call void @AM_addMark()
  br label %65

62:                                               ; preds = %12
  tail call void @AM_clearMarks()
  %63 = load ptr, ptr @plr, align 8, !tbaa !15
  %64 = getelementptr inbounds i8, ptr %63, i64 224
  store ptr @.str.8, ptr %64, align 8, !tbaa !17
  br label %65

65:                                               ; preds = %12, %31, %26, %20, %15, %43, %44, %33, %28, %22, %17, %62, %57, %51, %45, %39, %38, %37
  %.0 = phi i32 [ 1, %62 ], [ 1, %57 ], [ 1, %51 ], [ 1, %45 ], [ 1, %43 ], [ 1, %44 ], [ 1, %39 ], [ 1, %38 ], [ 1, %37 ], [ 1, %33 ], [ 1, %28 ], [ 1, %22 ], [ 1, %17 ], [ 0, %15 ], [ 0, %20 ], [ 0, %26 ], [ 0, %31 ], [ 0, %12 ]
  %66 = load i32, ptr @deathmatch, align 4, !tbaa !5
  %.not19 = icmp eq i32 %66, 0
  br i1 %.not19, label %67, label %91

67:                                               ; preds = %65
  %68 = load i32, ptr %13, align 4, !tbaa !11
  %69 = trunc i32 %68 to i8
  %70 = tail call i32 @cht_CheckCheat(ptr noundef nonnull @cheat_amap, i8 noundef signext %69) #4
  %.not20 = icmp eq i32 %70, 0
  br i1 %.not20, label %91, label %71

71:                                               ; preds = %67
  %72 = load i32, ptr @cheating, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  %74 = srem i32 %73, 3
  store i32 %74, ptr @cheating, align 4, !tbaa !5
  br label %91

75:                                               ; preds = %11
  %76 = getelementptr inbounds i8, ptr %0, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !11
  switch i32 %77, label %91 [
    i32 174, label %78
    i32 172, label %81
    i32 173, label %84
    i32 175, label %87
    i32 45, label %90
    i32 61, label %90
  ]

78:                                               ; preds = %75
  %79 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not11 = icmp eq i32 %79, 0
  br i1 %.not11, label %80, label %91

80:                                               ; preds = %78
  store i32 0, ptr @m_paninc, align 4, !tbaa !12
  br label %91

81:                                               ; preds = %75
  %82 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not10 = icmp eq i32 %82, 0
  br i1 %.not10, label %83, label %91

83:                                               ; preds = %81
  store i32 0, ptr @m_paninc, align 4, !tbaa !12
  br label %91

84:                                               ; preds = %75
  %85 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not9 = icmp eq i32 %85, 0
  br i1 %.not9, label %86, label %91

86:                                               ; preds = %84
  store i32 0, ptr getelementptr inbounds (i8, ptr @m_paninc, i64 4), align 4, !tbaa !14
  br label %91

87:                                               ; preds = %75
  %88 = load i32, ptr @followplayer, align 4, !tbaa !5
  %.not8 = icmp eq i32 %88, 0
  br i1 %.not8, label %89, label %91

89:                                               ; preds = %87
  store i32 0, ptr getelementptr inbounds (i8, ptr @m_paninc, i64 4), align 4, !tbaa !14
  br label %91

90:                                               ; preds = %75, %75
  store i32 65536, ptr @mtof_zoommul, align 4, !tbaa !5
  store i32 65536, ptr @ftom_zoommul, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %11, %71, %67, %65, %75, %90, %80, %78, %83, %81, %86, %84, %89, %87, %4, %6, %10
  %.1 = phi i32 [ %.0, %65 ], [ 0, %71 ], [ %.0, %67 ], [ 0, %75 ], [ 0, %90 ], [ 0, %87 ], [ 0, %89 ], [ 0, %84 ], [ 0, %86 ], [ 0, %81 ], [ 0, %83 ], [ 0, %78 ], [ 0, %80 ], [ 1, %10 ], [ 0, %6 ], [ 0, %4 ], [ 0, %11 ]
  ret i32 %.1
}

declare i32 @cht_CheckCheat(ptr noundef, i8 noundef signext) local_unnamed_addr #3

attributes #0 = { inlinehint 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 = { 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 = { 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 = { "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 }

!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 0}
!10 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = !{!10, !6, i64 4}
!12 = !{!13, !6, i64 0}
!13 = !{!"", !6, i64 0, !6, i64 4}
!14 = !{!13, !6, i64 4}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!18, !16, i64 224}
!18 = !{!"player_s", !16, i64 0, !6, i64 8, !19, 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}
!19 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !20, i64 4, !7, i64 6, !7, i64 7}
!20 = !{!"short", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass