; 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.intercept_t = type { i32, i32, %union.anon }
%union.anon = type { ptr }
%struct.line_s = type { ptr, ptr, i32, i32, i16, i16, i16, [2 x i16], [4 x i32], i32, ptr, ptr, i32, ptr }
%struct.sector_t = type { i32, i32, i16, i16, i16, i16, i16, i32, ptr, [4 x i32], %struct.degenmobj_t, i32, ptr, ptr, i32, ptr }
%struct.degenmobj_t = type { %struct.thinker_s, i32, i32, i32 }
%struct.thinker_s = type { ptr, ptr, %union.actionf_t }
%union.actionf_t = type { ptr }
%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.mapthing_t = type { i16, i16, i16, i16, i16 }

@opentop = external global i32, align 4
@openbottom = external global i32, align 4
@attackrange = external dso_local global i32, align 4
@shootz = external dso_local global i32, align 4
@bottomslope = external global i32, align 4
@topslope = external global i32, align 4
@shootthing = external dso_local global ptr, align 8
@aimslope = external dso_local global i32, align 4
@linetarget = 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

declare void @P_LineOpening(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @PTR_AimTraverse(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %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 %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, 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 %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.intercept_t, ptr %11, i32 0, i32 1
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %91

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.intercept_t, ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  store ptr %18, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.line_s, ptr %19, i32 0, i32 4
  %21 = load i16, ptr %20, align 8, !tbaa !13
  %22 = sext i16 %21 to i32
  %23 = and i32 %22, 4
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %26, label %25

25:                                               ; preds = %15
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

26:                                               ; preds = %15
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @P_LineOpening(ptr noundef %27)
  %28 = load i32, ptr @openbottom, align 4, !tbaa !16
  %29 = load i32, ptr @opentop, align 4, !tbaa !16
  %30 = icmp sge i32 %28, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

32:                                               ; preds = %26
  %33 = load i32, ptr @attackrange, align 4, !tbaa !16
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.intercept_t, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !17
  %37 = call i32 @FixedMul(i32 noundef %33, i32 noundef %36)
  store i32 %37, ptr %9, align 4, !tbaa !16
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.line_s, ptr %38, i32 0, i32 10
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %41 = getelementptr inbounds %struct.sector_t, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.line_s, ptr %43, i32 0, i32 11
  %45 = load ptr, ptr %44, align 8, !tbaa !23
  %46 = getelementptr inbounds %struct.sector_t, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !19
  %48 = icmp ne i32 %42, %47
  br i1 %48, label %49, label %61

49:                                               ; preds = %32
  %50 = load i32, ptr @openbottom, align 4, !tbaa !16
  %51 = load i32, ptr @shootz, align 4, !tbaa !16
  %52 = sub nsw i32 %50, %51
  %53 = load i32, ptr %9, align 4, !tbaa !16
  %54 = call i32 @FixedDiv(i32 noundef %52, i32 noundef %53)
  store i32 %54, ptr %6, align 4, !tbaa !16
  %55 = load i32, ptr %6, align 4, !tbaa !16
  %56 = load i32, ptr @bottomslope, align 4, !tbaa !16
  %57 = icmp sgt i32 %55, %56
  br i1 %57, label %58, label %60

58:                                               ; preds = %49
  %59 = load i32, ptr %6, align 4, !tbaa !16
  store i32 %59, ptr @bottomslope, align 4, !tbaa !16
  br label %60

60:                                               ; preds = %58, %49
  br label %61

61:                                               ; preds = %60, %32
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.line_s, ptr %62, i32 0, i32 10
  %64 = load ptr, ptr %63, align 8, !tbaa !18
  %65 = getelementptr inbounds %struct.sector_t, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !24
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.line_s, ptr %67, i32 0, i32 11
  %69 = load ptr, ptr %68, align 8, !tbaa !23
  %70 = getelementptr inbounds %struct.sector_t, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !24
  %72 = icmp ne i32 %66, %71
  br i1 %72, label %73, label %85

73:                                               ; preds = %61
  %74 = load i32, ptr @opentop, align 4, !tbaa !16
  %75 = load i32, ptr @shootz, align 4, !tbaa !16
  %76 = sub nsw i32 %74, %75
  %77 = load i32, ptr %9, align 4, !tbaa !16
  %78 = call i32 @FixedDiv(i32 noundef %76, i32 noundef %77)
  store i32 %78, ptr %6, align 4, !tbaa !16
  %79 = load i32, ptr %6, align 4, !tbaa !16
  %80 = load i32, ptr @topslope, align 4, !tbaa !16
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %84

82:                                               ; preds = %73
  %83 = load i32, ptr %6, align 4, !tbaa !16
  store i32 %83, ptr @topslope, align 4, !tbaa !16
  br label %84

84:                                               ; preds = %82, %73
  br label %85

85:                                               ; preds = %84, %61
  %86 = load i32, ptr @topslope, align 4, !tbaa !16
  %87 = load i32, ptr @bottomslope, align 4, !tbaa !16
  %88 = icmp sle i32 %86, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %85
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

90:                                               ; preds = %85
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

91:                                               ; preds = %1
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.intercept_t, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !12
  store ptr %94, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = load ptr, ptr @shootthing, align 8, !tbaa !5
  %97 = icmp eq ptr %95, %96
  br i1 %97, label %98, label %99

98:                                               ; preds = %91
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

99:                                               ; preds = %91
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.mobj_s, ptr %100, i32 0, i32 24
  %102 = load i32, ptr %101, align 8, !tbaa !25
  %103 = and i32 %102, 4
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %106, label %105

105:                                              ; preds = %99
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

106:                                              ; preds = %99
  %107 = load i32, ptr @attackrange, align 4, !tbaa !16
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.intercept_t, ptr %108, i32 0, i32 0
  %110 = load i32, ptr %109, align 8, !tbaa !17
  %111 = call i32 @FixedMul(i32 noundef %107, i32 noundef %110)
  store i32 %111, ptr %9, align 4, !tbaa !16
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.mobj_s, ptr %112, i32 0, i32 3
  %114 = load i32, ptr %113, align 8, !tbaa !28
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.mobj_s, ptr %115, i32 0, i32 15
  %117 = load i32, ptr %116, align 4, !tbaa !29
  %118 = add nsw i32 %114, %117
  %119 = load i32, ptr @shootz, align 4, !tbaa !16
  %120 = sub nsw i32 %118, %119
  %121 = load i32, ptr %9, align 4, !tbaa !16
  %122 = call i32 @FixedDiv(i32 noundef %120, i32 noundef %121)
  store i32 %122, ptr %7, align 4, !tbaa !16
  %123 = load i32, ptr %7, align 4, !tbaa !16
  %124 = load i32, ptr @bottomslope, align 4, !tbaa !16
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %106
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

127:                                              ; preds = %106
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.mobj_s, ptr %128, i32 0, i32 3
  %130 = load i32, ptr %129, align 8, !tbaa !28
  %131 = load i32, ptr @shootz, align 4, !tbaa !16
  %132 = sub nsw i32 %130, %131
  %133 = load i32, ptr %9, align 4, !tbaa !16
  %134 = call i32 @FixedDiv(i32 noundef %132, i32 noundef %133)
  store i32 %134, ptr %8, align 4, !tbaa !16
  %135 = load i32, ptr %8, align 4, !tbaa !16
  %136 = load i32, ptr @topslope, align 4, !tbaa !16
  %137 = icmp sgt i32 %135, %136
  br i1 %137, label %138, label %139

138:                                              ; preds = %127
  store i32 1, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

139:                                              ; preds = %127
  %140 = load i32, ptr %7, align 4, !tbaa !16
  %141 = load i32, ptr @topslope, align 4, !tbaa !16
  %142 = icmp sgt i32 %140, %141
  br i1 %142, label %143, label %145

143:                                              ; preds = %139
  %144 = load i32, ptr @topslope, align 4, !tbaa !16
  store i32 %144, ptr %7, align 4, !tbaa !16
  br label %145

145:                                              ; preds = %143, %139
  %146 = load i32, ptr %8, align 4, !tbaa !16
  %147 = load i32, ptr @bottomslope, align 4, !tbaa !16
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %149, label %151

149:                                              ; preds = %145
  %150 = load i32, ptr @bottomslope, align 4, !tbaa !16
  store i32 %150, ptr %8, align 4, !tbaa !16
  br label %151

151:                                              ; preds = %149, %145
  %152 = load i32, ptr %7, align 4, !tbaa !16
  %153 = load i32, ptr %8, align 4, !tbaa !16
  %154 = add nsw i32 %152, %153
  %155 = sdiv i32 %154, 2
  store i32 %155, ptr @aimslope, align 4, !tbaa !16
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %156, ptr @linetarget, align 8, !tbaa !5
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %157

157:                                              ; preds = %151, %138, %126, %105, %98, %90, %89, %31, %25
  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 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %158 = load i32, ptr %2, align 4
  ret i32 %158
}

declare i32 @FixedDiv(i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #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, !11, i64 4}
!10 = !{!"", !11, i64 0, !11, i64 4, !7, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !15, i64 24}
!14 = !{!"line_s", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !15, i64 24, !15, i64 26, !15, i64 28, !7, i64 30, !7, i64 36, !11, i64 52, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80}
!15 = !{!"short", !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 0}
!18 = !{!14, !6, i64 56}
!19 = !{!20, !11, i64 0}
!20 = !{!"", !11, i64 0, !11, i64 4, !15, i64 8, !15, i64 10, !15, i64 12, !15, i64 14, !15, i64 16, !11, i64 20, !6, i64 24, !7, i64 32, !21, i64 48, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120}
!21 = !{!"", !22, i64 0, !11, i64 24, !11, i64 28, !11, i64 32}
!22 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!23 = !{!14, !6, i64 64}
!24 = !{!20, !11, i64 4}
!25 = !{!26, !11, i64 160}
!26 = !{!"mobj_s", !22, i64 0, !11, i64 24, !11, i64 28, !11, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !6, i64 72, !6, i64 80, !6, 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, !6, i64 136, !11, i64 144, !6, i64 152, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !6, i64 176, !11, i64 184, !11, i64 188, !6, i64 192, !11, i64 200, !27, i64 204, !6, i64 216}
!27 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!28 = !{!26, !11, i64 32}
!29 = !{!26, !11, i64 108}


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

@opentop = external local_unnamed_addr global i32, align 4
@openbottom = external local_unnamed_addr global i32, align 4
@attackrange = external dso_local local_unnamed_addr global i32, align 4
@shootz = external dso_local local_unnamed_addr global i32, align 4
@bottomslope = external local_unnamed_addr global i32, align 4
@topslope = external local_unnamed_addr global i32, align 4
@shootthing = external dso_local local_unnamed_addr global ptr, align 8
@aimslope = external dso_local local_unnamed_addr global i32, align 4
@linetarget = external dso_local local_unnamed_addr global ptr, align 8

declare void @P_LineOpening(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
define dso_local range(i32 0, 2) i32 @PTR_AimTraverse(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 4
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !10
  br i1 %.not, label %49, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %5, i64 24
  %8 = load i16, ptr %7, align 8, !tbaa !11
  %9 = and i16 %8, 4
  %.not41 = icmp eq i16 %9, 0
  br i1 %.not41, label %81, label %10

10:                                               ; preds = %6
  tail call void @P_LineOpening(ptr noundef nonnull %5) #4
  %11 = load i32, ptr @openbottom, align 4, !tbaa !15
  %12 = load i32, ptr @opentop, align 4, !tbaa !15
  %.not42 = icmp slt i32 %11, %12
  br i1 %.not42, label %13, label %81

13:                                               ; preds = %10
  %14 = load i32, ptr @attackrange, align 4, !tbaa !15
  %15 = load i32, ptr %0, align 8, !tbaa !16
  %16 = tail call i32 @FixedMul(i32 noundef %14, i32 noundef %15)
  %17 = getelementptr inbounds i8, ptr %5, i64 56
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = load i32, ptr %18, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %5, i64 64
  %21 = load ptr, ptr %20, align 8, !tbaa !22
  %22 = load i32, ptr %21, align 8, !tbaa !18
  %.not43 = icmp eq i32 %19, %22
  br i1 %.not43, label %31, label %23

23:                                               ; preds = %13
  %24 = load i32, ptr @openbottom, align 4, !tbaa !15
  %25 = load i32, ptr @shootz, align 4, !tbaa !15
  %26 = sub nsw i32 %24, %25
  %27 = tail call i32 @FixedDiv(i32 noundef %26, i32 noundef %16) #4
  %28 = load i32, ptr @bottomslope, align 4, !tbaa !15
  %29 = icmp sgt i32 %27, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %23
  store i32 %27, ptr @bottomslope, align 4, !tbaa !15
  br label %31

31:                                               ; preds = %23, %30, %13
  %32 = load ptr, ptr %17, align 8, !tbaa !17
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !23
  %35 = load ptr, ptr %20, align 8, !tbaa !22
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !23
  %.not44 = icmp eq i32 %34, %37
  br i1 %.not44, label %._crit_edge, label %38

._crit_edge:                                      ; preds = %31
  %.pre = load i32, ptr @topslope, align 4, !tbaa !15
  br label %46

38:                                               ; preds = %31
  %39 = load i32, ptr @opentop, align 4, !tbaa !15
  %40 = load i32, ptr @shootz, align 4, !tbaa !15
  %41 = sub nsw i32 %39, %40
  %42 = tail call i32 @FixedDiv(i32 noundef %41, i32 noundef %16) #4
  %43 = load i32, ptr @topslope, align 4, !tbaa !15
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %38
  store i32 %42, ptr @topslope, align 4, !tbaa !15
  br label %46

46:                                               ; preds = %._crit_edge, %38, %45
  %47 = phi i32 [ %.pre, %._crit_edge ], [ %43, %38 ], [ %42, %45 ]
  %48 = load i32, ptr @bottomslope, align 4, !tbaa !15
  %.not45 = icmp sgt i32 %47, %48
  %. = zext i1 %.not45 to i32
  br label %81

49:                                               ; preds = %1
  %50 = load ptr, ptr @shootthing, align 8, !tbaa !24
  %51 = icmp eq ptr %5, %50
  br i1 %51, label %81, label %52

52:                                               ; preds = %49
  %53 = getelementptr inbounds i8, ptr %5, i64 160
  %54 = load i32, ptr %53, align 8, !tbaa !25
  %55 = and i32 %54, 4
  %.not40 = icmp eq i32 %55, 0
  br i1 %.not40, label %81, label %56

56:                                               ; preds = %52
  %57 = load i32, ptr @attackrange, align 4, !tbaa !15
  %58 = load i32, ptr %0, align 8, !tbaa !16
  %59 = tail call i32 @FixedMul(i32 noundef %57, i32 noundef %58)
  %60 = getelementptr inbounds i8, ptr %5, i64 32
  %61 = load i32, ptr %60, align 8, !tbaa !28
  %62 = getelementptr inbounds i8, ptr %5, i64 108
  %63 = load i32, ptr %62, align 4, !tbaa !29
  %64 = add nsw i32 %63, %61
  %65 = load i32, ptr @shootz, align 4, !tbaa !15
  %66 = sub i32 %64, %65
  %67 = tail call i32 @FixedDiv(i32 noundef %66, i32 noundef %59) #4
  %68 = load i32, ptr @bottomslope, align 4, !tbaa !15
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %81, label %70

70:                                               ; preds = %56
  %71 = load i32, ptr %60, align 8, !tbaa !28
  %72 = load i32, ptr @shootz, align 4, !tbaa !15
  %73 = sub nsw i32 %71, %72
  %74 = tail call i32 @FixedDiv(i32 noundef %73, i32 noundef %59) #4
  %75 = load i32, ptr @topslope, align 4, !tbaa !15
  %76 = icmp sgt i32 %74, %75
  br i1 %76, label %81, label %77

77:                                               ; preds = %70
  %spec.select = tail call i32 @llvm.smin.i32(i32 %67, i32 %75)
  %78 = load i32, ptr @bottomslope, align 4, !tbaa !15
  %.0 = tail call i32 @llvm.smax.i32(i32 %74, i32 %78)
  %79 = add nsw i32 %.0, %spec.select
  %80 = sdiv i32 %79, 2
  store i32 %80, ptr @aimslope, align 4, !tbaa !15
  store ptr %5, ptr @linetarget, align 8, !tbaa !24
  br label %81

81:                                               ; preds = %70, %56, %52, %49, %46, %10, %6, %77
  %.032 = phi i32 [ 0, %77 ], [ 0, %6 ], [ 0, %10 ], [ %., %46 ], [ 1, %49 ], [ 1, %52 ], [ 1, %56 ], [ 1, %70 ]
  ret i32 %.032
}

declare i32 @FixedDiv(i32 noundef, i32 noundef) local_unnamed_addr #0

; 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.smax.i32(i32, i32) #3

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


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