; LLVM IR from BrunoLevy/learn-fpga :: LiteX/software/Doom/mc1-doom/src (p_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.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 }

@tmymove = external dso_local global i32, align 4
@tmxmove = external dso_local global i32, align 4
@slidemo = external dso_local global ptr, align 8
@bestslidefrac = external dso_local global i32, align 4
@bestslideline = external dso_local global ptr, align 8

; 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 i32 @P_TryMove(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @P_HitSlideLine(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PTR_SlideTraverse(ptr noundef) #1

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

12:                                               ; preds = %231, %1
  %13 = load i32, ptr %9, align 4, !tbaa !9
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %9, align 4, !tbaa !9
  %15 = icmp eq i32 %14, 3
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  br label %130

17:                                               ; preds = %12
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.mobj_s, ptr %18, i32 0, i32 16
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %22, label %37

22:                                               ; preds = %17
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.mobj_s, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !16
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mobj_s, ptr %26, i32 0, i32 14
  %28 = load i32, ptr %27, align 8, !tbaa !17
  %29 = add nsw i32 %25, %28
  store i32 %29, ptr %3, align 4, !tbaa !9
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mobj_s, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !16
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mobj_s, ptr %33, i32 0, i32 14
  %35 = load i32, ptr %34, align 8, !tbaa !17
  %36 = sub nsw i32 %32, %35
  store i32 %36, ptr %5, align 4, !tbaa !9
  br label %52

37:                                               ; preds = %17
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mobj_s, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !16
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mobj_s, ptr %41, i32 0, i32 14
  %43 = load i32, ptr %42, align 8, !tbaa !17
  %44 = sub nsw i32 %40, %43
  store i32 %44, ptr %3, align 4, !tbaa !9
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mobj_s, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 8, !tbaa !16
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.mobj_s, ptr %48, i32 0, i32 14
  %50 = load i32, ptr %49, align 8, !tbaa !17
  %51 = add nsw i32 %47, %50
  store i32 %51, ptr %5, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %37, %22
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mobj_s, ptr %53, i32 0, i32 17
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %72

57:                                               ; preds = %52
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.mobj_s, ptr %58, i32 0, i32 2
  %60 = load i32, ptr %59, align 4, !tbaa !19
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.mobj_s, ptr %61, i32 0, i32 14
  %63 = load i32, ptr %62, align 8, !tbaa !17
  %64 = add nsw i32 %60, %63
  store i32 %64, ptr %4, align 4, !tbaa !9
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.mobj_s, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 4, !tbaa !19
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.mobj_s, ptr %68, i32 0, i32 14
  %70 = load i32, ptr %69, align 8, !tbaa !17
  %71 = sub nsw i32 %67, %70
  store i32 %71, ptr %6, align 4, !tbaa !9
  br label %87

72:                                               ; preds = %52
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.mobj_s, ptr %73, i32 0, i32 2
  %75 = load i32, ptr %74, align 4, !tbaa !19
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mobj_s, ptr %76, i32 0, i32 14
  %78 = load i32, ptr %77, align 8, !tbaa !17
  %79 = sub nsw i32 %75, %78
  store i32 %79, ptr %4, align 4, !tbaa !9
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mobj_s, ptr %80, i32 0, i32 2
  %82 = load i32, ptr %81, align 4, !tbaa !19
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.mobj_s, ptr %83, i32 0, i32 14
  %85 = load i32, ptr %84, align 8, !tbaa !17
  %86 = add nsw i32 %82, %85
  store i32 %86, ptr %6, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %72, %57
  store i32 65537, ptr @bestslidefrac, align 4, !tbaa !9
  %88 = load i32, ptr %3, align 4, !tbaa !9
  %89 = load i32, ptr %4, align 4, !tbaa !9
  %90 = load i32, ptr %3, align 4, !tbaa !9
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mobj_s, ptr %91, i32 0, i32 16
  %93 = load i32, ptr %92, align 8, !tbaa !11
  %94 = add nsw i32 %90, %93
  %95 = load i32, ptr %4, align 4, !tbaa !9
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.mobj_s, ptr %96, i32 0, i32 17
  %98 = load i32, ptr %97, align 4, !tbaa !18
  %99 = add nsw i32 %95, %98
  %100 = call i32 @P_PathTraverse(i32 noundef %88, i32 noundef %89, i32 noundef %94, i32 noundef %99, i32 noundef 1, ptr noundef @PTR_SlideTraverse)
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = load i32, ptr %4, align 4, !tbaa !9
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = load ptr, ptr %2, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.mobj_s, ptr %104, i32 0, i32 16
  %106 = load i32, ptr %105, align 8, !tbaa !11
  %107 = add nsw i32 %103, %106
  %108 = load i32, ptr %4, align 4, !tbaa !9
  %109 = load ptr, ptr %2, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.mobj_s, ptr %109, i32 0, i32 17
  %111 = load i32, ptr %110, align 4, !tbaa !18
  %112 = add nsw i32 %108, %111
  %113 = call i32 @P_PathTraverse(i32 noundef %101, i32 noundef %102, i32 noundef %107, i32 noundef %112, i32 noundef 1, ptr noundef @PTR_SlideTraverse)
  %114 = load i32, ptr %3, align 4, !tbaa !9
  %115 = load i32, ptr %6, align 4, !tbaa !9
  %116 = load i32, ptr %3, align 4, !tbaa !9
  %117 = load ptr, ptr %2, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.mobj_s, ptr %117, i32 0, i32 16
  %119 = load i32, ptr %118, align 8, !tbaa !11
  %120 = add nsw i32 %116, %119
  %121 = load i32, ptr %6, align 4, !tbaa !9
  %122 = load ptr, ptr %2, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.mobj_s, ptr %122, i32 0, i32 17
  %124 = load i32, ptr %123, align 4, !tbaa !18
  %125 = add nsw i32 %121, %124
  %126 = call i32 @P_PathTraverse(i32 noundef %114, i32 noundef %115, i32 noundef %120, i32 noundef %125, i32 noundef 1, ptr noundef @PTR_SlideTraverse)
  %127 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %128 = icmp eq i32 %127, 65537
  br i1 %128, label %129, label %158

129:                                              ; preds = %87
  br label %130

130:                                              ; preds = %187, %129, %16
  %131 = load ptr, ptr %2, align 8, !tbaa !5
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.mobj_s, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 8, !tbaa !16
  %135 = load ptr, ptr %2, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.mobj_s, ptr %135, i32 0, i32 2
  %137 = load i32, ptr %136, align 4, !tbaa !19
  %138 = load ptr, ptr %2, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.mobj_s, ptr %138, i32 0, i32 17
  %140 = load i32, ptr %139, align 4, !tbaa !18
  %141 = add nsw i32 %137, %140
  %142 = call i32 @P_TryMove(ptr noundef %131, i32 noundef %134, i32 noundef %141)
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %157, label %144

144:                                              ; preds = %130
  %145 = load ptr, ptr %2, align 8, !tbaa !5
  %146 = load ptr, ptr %2, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.mobj_s, ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 8, !tbaa !16
  %149 = load ptr, ptr %2, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.mobj_s, ptr %149, i32 0, i32 16
  %151 = load i32, ptr %150, align 8, !tbaa !11
  %152 = add nsw i32 %148, %151
  %153 = load ptr, ptr %2, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.mobj_s, ptr %153, i32 0, i32 2
  %155 = load i32, ptr %154, align 4, !tbaa !19
  %156 = call i32 @P_TryMove(ptr noundef %145, i32 noundef %152, i32 noundef %155)
  br label %157

157:                                              ; preds = %144, %130
  store i32 1, ptr %10, align 4
  br label %233

158:                                              ; preds = %87
  %159 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %160 = sub nsw i32 %159, 2048
  store i32 %160, ptr @bestslidefrac, align 4, !tbaa !9
  %161 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %162 = icmp sgt i32 %161, 0
  br i1 %162, label %163, label %189

163:                                              ; preds = %158
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.mobj_s, ptr %164, i32 0, i32 16
  %166 = load i32, ptr %165, align 8, !tbaa !11
  %167 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %168 = call i32 @FixedMul(i32 noundef %166, i32 noundef %167)
  store i32 %168, ptr %7, align 4, !tbaa !9
  %169 = load ptr, ptr %2, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.mobj_s, ptr %169, i32 0, i32 17
  %171 = load i32, ptr %170, align 4, !tbaa !18
  %172 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %173 = call i32 @FixedMul(i32 noundef %171, i32 noundef %172)
  store i32 %173, ptr %8, align 4, !tbaa !9
  %174 = load ptr, ptr %2, align 8, !tbaa !5
  %175 = load ptr, ptr %2, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.mobj_s, ptr %175, i32 0, i32 1
  %177 = load i32, ptr %176, align 8, !tbaa !16
  %178 = load i32, ptr %7, align 4, !tbaa !9
  %179 = add nsw i32 %177, %178
  %180 = load ptr, ptr %2, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.mobj_s, ptr %180, i32 0, i32 2
  %182 = load i32, ptr %181, align 4, !tbaa !19
  %183 = load i32, ptr %8, align 4, !tbaa !9
  %184 = add nsw i32 %182, %183
  %185 = call i32 @P_TryMove(ptr noundef %174, i32 noundef %179, i32 noundef %184)
  %186 = icmp ne i32 %185, 0
  br i1 %186, label %188, label %187

187:                                              ; preds = %163
  br label %130

188:                                              ; preds = %163
  br label %189

189:                                              ; preds = %188, %158
  %190 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %191 = add nsw i32 %190, 2048
  %192 = sub nsw i32 65536, %191
  store i32 %192, ptr @bestslidefrac, align 4, !tbaa !9
  %193 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %194 = icmp sgt i32 %193, 65536
  br i1 %194, label %195, label %196

195:                                              ; preds = %189
  store i32 65536, ptr @bestslidefrac, align 4, !tbaa !9
  br label %196

196:                                              ; preds = %195, %189
  %197 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %198 = icmp sle i32 %197, 0
  br i1 %198, label %199, label %200

199:                                              ; preds = %196
  store i32 1, ptr %10, align 4
  br label %233

200:                                              ; preds = %196
  %201 = load ptr, ptr %2, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.mobj_s, ptr %201, i32 0, i32 16
  %203 = load i32, ptr %202, align 8, !tbaa !11
  %204 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %205 = call i32 @FixedMul(i32 noundef %203, i32 noundef %204)
  store i32 %205, ptr @tmxmove, align 4, !tbaa !9
  %206 = load ptr, ptr %2, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.mobj_s, ptr %206, i32 0, i32 17
  %208 = load i32, ptr %207, align 4, !tbaa !18
  %209 = load i32, ptr @bestslidefrac, align 4, !tbaa !9
  %210 = call i32 @FixedMul(i32 noundef %208, i32 noundef %209)
  store i32 %210, ptr @tmymove, align 4, !tbaa !9
  %211 = load ptr, ptr @bestslideline, align 8, !tbaa !5
  call void @P_HitSlideLine(ptr noundef %211)
  %212 = load i32, ptr @tmxmove, align 4, !tbaa !9
  %213 = load ptr, ptr %2, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.mobj_s, ptr %213, i32 0, i32 16
  store i32 %212, ptr %214, align 8, !tbaa !11
  %215 = load i32, ptr @tmymove, align 4, !tbaa !9
  %216 = load ptr, ptr %2, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.mobj_s, ptr %216, i32 0, i32 17
  store i32 %215, ptr %217, align 4, !tbaa !18
  %218 = load ptr, ptr %2, align 8, !tbaa !5
  %219 = load ptr, ptr %2, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.mobj_s, ptr %219, i32 0, i32 1
  %221 = load i32, ptr %220, align 8, !tbaa !16
  %222 = load i32, ptr @tmxmove, align 4, !tbaa !9
  %223 = add nsw i32 %221, %222
  %224 = load ptr, ptr %2, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.mobj_s, ptr %224, i32 0, i32 2
  %226 = load i32, ptr %225, align 4, !tbaa !19
  %227 = load i32, ptr @tmymove, align 4, !tbaa !9
  %228 = add nsw i32 %226, %227
  %229 = call i32 @P_TryMove(ptr noundef %218, i32 noundef %223, i32 noundef %228)
  %230 = icmp ne i32 %229, 0
  br i1 %230, label %232, label %231

231:                                              ; preds = %200
  br label %12

232:                                              ; preds = %200
  store i32 0, ptr %10, align 4
  br label %233

233:                                              ; preds = %232, %199, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  %234 = load i32, ptr %10, align 4
  switch i32 %234, label %236 [
    i32 0, label %235
    i32 1, label %235
  ]

235:                                              ; preds = %233, %233
  ret void

236:                                              ; preds = %233
  unreachable
}

declare i32 @P_PathTraverse(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

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 = { 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 #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 = !{!"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 112}
!12 = !{!"mobj_s", !13, i64 0, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !10, i64 144, !6, i64 152, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !6, i64 176, !10, i64 184, !10, i64 188, !6, i64 192, !10, i64 200, !14, i64 204, !6, i64 216}
!13 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!14 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!12, !10, i64 24}
!17 = !{!12, !10, i64 104}
!18 = !{!12, !10, i64 116}
!19 = !{!12, !10, 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"

@tmymove = external dso_local local_unnamed_addr global i32, align 4
@tmxmove = external dso_local local_unnamed_addr global i32, align 4
@slidemo = external dso_local local_unnamed_addr global ptr, align 8
@bestslidefrac = external dso_local local_unnamed_addr global i32, align 4
@bestslideline = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local i32 @P_TryMove(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @PTR_SlideTraverse(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @P_SlideMove(ptr noundef %0) local_unnamed_addr #0 {
  store ptr %0, ptr @slidemo, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 112
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  %5 = getelementptr inbounds i8, ptr %0, i64 116
  %6 = getelementptr inbounds i8, ptr %0, i64 28
  br label %7

7:                                                ; preds = %68, %1
  %.0 = phi i32 [ 0, %1 ], [ %8, %68 ]
  %8 = add nuw nsw i32 %.0, 1
  %9 = icmp eq i32 %8, 3
  br i1 %9, label %37, label %10

10:                                               ; preds = %7
  %11 = load i32, ptr %2, align 8, !tbaa !9
  %12 = icmp sgt i32 %11, 0
  %13 = load i32, ptr %3, align 8, !tbaa !15
  %14 = load i32, ptr %4, align 8, !tbaa !16
  %15 = sub i32 0, %14
  %.062.p = select i1 %12, i32 %15, i32 %14
  %.062 = add i32 %13, %.062.p
  %16 = sub i32 0, %14
  %.059.p = select i1 %12, i32 %14, i32 %16
  %.059 = add i32 %13, %.059.p
  %17 = load i32, ptr %5, align 4, !tbaa !17
  %18 = icmp sgt i32 %17, 0
  %19 = load i32, ptr %6, align 4, !tbaa !18
  %20 = sub i32 0, %14
  %.061.p = select i1 %18, i32 %20, i32 %14
  %.061 = add i32 %19, %.061.p
  %21 = sub i32 0, %14
  %.060.p = select i1 %18, i32 %14, i32 %21
  %.060 = add i32 %19, %.060.p
  store i32 65537, ptr @bestslidefrac, align 4, !tbaa !19
  %22 = add nsw i32 %.059, %11
  %23 = add nsw i32 %.060, %17
  %24 = tail call i32 @P_PathTraverse(i32 noundef %.059, i32 noundef %.060, i32 noundef %22, i32 noundef %23, i32 noundef 1, ptr noundef nonnull @PTR_SlideTraverse) #4
  %25 = load i32, ptr %2, align 8, !tbaa !9
  %26 = add nsw i32 %25, %.062
  %27 = load i32, ptr %5, align 4, !tbaa !17
  %28 = add nsw i32 %27, %.060
  %29 = tail call i32 @P_PathTraverse(i32 noundef %.062, i32 noundef %.060, i32 noundef %26, i32 noundef %28, i32 noundef 1, ptr noundef nonnull @PTR_SlideTraverse) #4
  %30 = load i32, ptr %2, align 8, !tbaa !9
  %31 = add nsw i32 %30, %.059
  %32 = load i32, ptr %5, align 4, !tbaa !17
  %33 = add nsw i32 %32, %.061
  %34 = tail call i32 @P_PathTraverse(i32 noundef %.059, i32 noundef %.061, i32 noundef %31, i32 noundef %33, i32 noundef 1, ptr noundef nonnull @PTR_SlideTraverse) #4
  %35 = load i32, ptr @bestslidefrac, align 4, !tbaa !19
  %36 = icmp eq i32 %35, 65537
  br i1 %36, label %37, label %49

37:                                               ; preds = %54, %10, %7
  %38 = load i32, ptr %3, align 8, !tbaa !15
  %39 = load i32, ptr %6, align 4, !tbaa !18
  %40 = load i32, ptr %5, align 4, !tbaa !17
  %41 = add nsw i32 %40, %39
  %42 = tail call i32 @P_TryMove(ptr noundef %0, i32 noundef %38, i32 noundef %41)
  %.not67 = icmp eq i32 %42, 0
  br i1 %.not67, label %43, label %.loopexit

43:                                               ; preds = %37
  %44 = load i32, ptr %3, align 8, !tbaa !15
  %45 = load i32, ptr %2, align 8, !tbaa !9
  %46 = add nsw i32 %45, %44
  %47 = load i32, ptr %6, align 4, !tbaa !18
  %48 = tail call i32 @P_TryMove(ptr noundef nonnull %0, i32 noundef %46, i32 noundef %47)
  br label %.loopexit

49:                                               ; preds = %10
  %50 = add nsw i32 %35, -2048
  store i32 %50, ptr @bestslidefrac, align 4, !tbaa !19
  %51 = icmp sgt i32 %35, 2048
  br i1 %51, label %54, label %.thread

.thread:                                          ; preds = %49
  %52 = sub nsw i32 65536, %35
  %53 = tail call i32 @llvm.umin.i32(i32 %52, i32 65536)
  store i32 %53, ptr @bestslidefrac, align 4
  br label %68

54:                                               ; preds = %49
  %55 = load i32, ptr %2, align 8, !tbaa !9
  %56 = tail call i32 @FixedMul(i32 noundef %55, i32 noundef %50)
  %57 = load i32, ptr %5, align 4, !tbaa !17
  %58 = load i32, ptr @bestslidefrac, align 4, !tbaa !19
  %59 = tail call i32 @FixedMul(i32 noundef %57, i32 noundef %58)
  %60 = load i32, ptr %3, align 8, !tbaa !15
  %61 = add nsw i32 %60, %56
  %62 = load i32, ptr %6, align 4, !tbaa !18
  %63 = add nsw i32 %62, %59
  %64 = tail call i32 @P_TryMove(ptr noundef nonnull %0, i32 noundef %61, i32 noundef %63)
  %.not = icmp eq i32 %64, 0
  br i1 %.not, label %37, label %65

65:                                               ; preds = %54
  %.pr = load i32, ptr @bestslidefrac, align 4, !tbaa !19
  %66 = sub nsw i32 63488, %.pr
  %spec.store.select = tail call i32 @llvm.smin.i32(i32 %66, i32 65536)
  store i32 %spec.store.select, ptr @bestslidefrac, align 4
  %67 = icmp sgt i32 %.pr, 63487
  br i1 %67, label %.loopexit, label %68

68:                                               ; preds = %.thread, %65
  %spec.store.select69 = phi i32 [ %53, %.thread ], [ %spec.store.select, %65 ]
  %69 = load i32, ptr %2, align 8, !tbaa !9
  %70 = tail call i32 @FixedMul(i32 noundef %69, i32 noundef %spec.store.select69)
  store i32 %70, ptr @tmxmove, align 4, !tbaa !19
  %71 = load i32, ptr %5, align 4, !tbaa !17
  %72 = load i32, ptr @bestslidefrac, align 4, !tbaa !19
  %73 = tail call i32 @FixedMul(i32 noundef %71, i32 noundef %72)
  store i32 %73, ptr @tmymove, align 4, !tbaa !19
  %74 = load ptr, ptr @bestslideline, align 8, !tbaa !5
  tail call void @P_HitSlideLine(ptr noundef %74)
  %75 = load i32, ptr @tmxmove, align 4, !tbaa !19
  store i32 %75, ptr %2, align 8, !tbaa !9
  %76 = load i32, ptr @tmymove, align 4, !tbaa !19
  store i32 %76, ptr %5, align 4, !tbaa !17
  %77 = load i32, ptr %3, align 8, !tbaa !15
  %78 = add nsw i32 %77, %75
  %79 = load i32, ptr %6, align 4, !tbaa !18
  %80 = add nsw i32 %79, %76
  %81 = tail call i32 @P_TryMove(ptr noundef %0, i32 noundef %78, i32 noundef %80)
  %.not66 = icmp eq i32 %81, 0
  br i1 %.not66, label %7, label %.loopexit

.loopexit:                                        ; preds = %68, %65, %37, %43
  ret void
}

declare i32 @P_PathTraverse(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

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

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 = { 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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 112}
!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 24}
!16 = !{!10, !12, i64 104}
!17 = !{!10, !12, i64 116}
!18 = !{!10, !12, i64 28}
!19 = !{!12, !12, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass