; 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.divline_t = type { i32, i32, i32, i32 }
%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
@shootthing = external dso_local global ptr, align 8
@aimslope = external dso_local global i32, align 4
@trace = external global %struct.divline_t, align 4
@skyflatnum = external global i32, align 4
@la_damage = external dso_local 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

declare void @P_DamageMobj(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; 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

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

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

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

27:                                               ; preds = %19
  %28 = load ptr, ptr @shootthing, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  call void @P_ShootSpecialLine(ptr noundef %28, ptr noundef %29)
  br label %30

30:                                               ; preds = %27, %19
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.line_s, ptr %31, i32 0, i32 4
  %33 = load i16, ptr %32, align 8, !tbaa !16
  %34 = sext i16 %33 to i32
  %35 = and i32 %34, 4
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  br label %91

38:                                               ; preds = %30
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  call void @P_LineOpening(ptr noundef %39)
  %40 = load i32, ptr @attackrange, align 4, !tbaa !17
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.intercept_t, ptr %41, i32 0, i32 0
  %43 = load i32, ptr %42, align 8, !tbaa !18
  %44 = call i32 @FixedMul(i32 noundef %40, i32 noundef %43)
  store i32 %44, ptr %11, align 4, !tbaa !17
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.line_s, ptr %45, i32 0, i32 10
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  %48 = getelementptr inbounds %struct.sector_t, ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !20
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.line_s, ptr %50, i32 0, i32 11
  %52 = load ptr, ptr %51, align 8, !tbaa !24
  %53 = getelementptr inbounds %struct.sector_t, ptr %52, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !20
  %55 = icmp ne i32 %49, %54
  br i1 %55, label %56, label %67

56:                                               ; preds = %38
  %57 = load i32, ptr @openbottom, align 4, !tbaa !17
  %58 = load i32, ptr @shootz, align 4, !tbaa !17
  %59 = sub nsw i32 %57, %58
  %60 = load i32, ptr %11, align 4, !tbaa !17
  %61 = call i32 @FixedDiv(i32 noundef %59, i32 noundef %60)
  store i32 %61, ptr %10, align 4, !tbaa !17
  %62 = load i32, ptr %10, align 4, !tbaa !17
  %63 = load i32, ptr @aimslope, align 4, !tbaa !17
  %64 = icmp sgt i32 %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %56
  br label %91

66:                                               ; preds = %56
  br label %67

67:                                               ; preds = %66, %38
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.line_s, ptr %68, i32 0, i32 10
  %70 = load ptr, ptr %69, align 8, !tbaa !19
  %71 = getelementptr inbounds %struct.sector_t, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !25
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.line_s, ptr %73, i32 0, i32 11
  %75 = load ptr, ptr %74, align 8, !tbaa !24
  %76 = getelementptr inbounds %struct.sector_t, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 4, !tbaa !25
  %78 = icmp ne i32 %72, %77
  br i1 %78, label %79, label %90

79:                                               ; preds = %67
  %80 = load i32, ptr @opentop, align 4, !tbaa !17
  %81 = load i32, ptr @shootz, align 4, !tbaa !17
  %82 = sub nsw i32 %80, %81
  %83 = load i32, ptr %11, align 4, !tbaa !17
  %84 = call i32 @FixedDiv(i32 noundef %82, i32 noundef %83)
  store i32 %84, ptr %10, align 4, !tbaa !17
  %85 = load i32, ptr %10, align 4, !tbaa !17
  %86 = load i32, ptr @aimslope, align 4, !tbaa !17
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %79
  br label %91

89:                                               ; preds = %79
  br label %90

90:                                               ; preds = %89, %67
  store i32 1, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

91:                                               ; preds = %88, %65, %37
  %92 = load ptr, ptr %3, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.intercept_t, ptr %92, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !18
  %95 = load i32, ptr @attackrange, align 4, !tbaa !17
  %96 = call i32 @FixedDiv(i32 noundef 262144, i32 noundef %95)
  %97 = sub nsw i32 %94, %96
  store i32 %97, ptr %7, align 4, !tbaa !17
  %98 = load i32, ptr @trace, align 4, !tbaa !26
  %99 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 2), align 4, !tbaa !28
  %100 = load i32, ptr %7, align 4, !tbaa !17
  %101 = call i32 @FixedMul(i32 noundef %99, i32 noundef %100)
  %102 = add nsw i32 %98, %101
  store i32 %102, ptr %4, align 4, !tbaa !17
  %103 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 1), align 4, !tbaa !29
  %104 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 3), align 4, !tbaa !30
  %105 = load i32, ptr %7, align 4, !tbaa !17
  %106 = call i32 @FixedMul(i32 noundef %104, i32 noundef %105)
  %107 = add nsw i32 %103, %106
  store i32 %107, ptr %5, align 4, !tbaa !17
  %108 = load i32, ptr @shootz, align 4, !tbaa !17
  %109 = load i32, ptr @aimslope, align 4, !tbaa !17
  %110 = load i32, ptr %7, align 4, !tbaa !17
  %111 = load i32, ptr @attackrange, align 4, !tbaa !17
  %112 = call i32 @FixedMul(i32 noundef %110, i32 noundef %111)
  %113 = call i32 @FixedMul(i32 noundef %109, i32 noundef %112)
  %114 = add nsw i32 %108, %113
  store i32 %114, ptr %6, align 4, !tbaa !17
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.line_s, ptr %115, i32 0, i32 10
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = getelementptr inbounds %struct.sector_t, ptr %117, i32 0, i32 3
  %119 = load i16, ptr %118, align 2, !tbaa !31
  %120 = sext i16 %119 to i32
  %121 = load i32, ptr @skyflatnum, align 4, !tbaa !17
  %122 = icmp eq i32 %120, %121
  br i1 %122, label %123, label %148

123:                                              ; preds = %91
  %124 = load i32, ptr %6, align 4, !tbaa !17
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.line_s, ptr %125, i32 0, i32 10
  %127 = load ptr, ptr %126, align 8, !tbaa !19
  %128 = getelementptr inbounds %struct.sector_t, ptr %127, i32 0, i32 1
  %129 = load i32, ptr %128, align 4, !tbaa !25
  %130 = icmp sgt i32 %124, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %123
  store i32 0, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

132:                                              ; preds = %123
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.line_s, ptr %133, i32 0, i32 11
  %135 = load ptr, ptr %134, align 8, !tbaa !24
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %147

137:                                              ; preds = %132
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.line_s, ptr %138, i32 0, i32 11
  %140 = load ptr, ptr %139, align 8, !tbaa !24
  %141 = getelementptr inbounds %struct.sector_t, ptr %140, i32 0, i32 3
  %142 = load i16, ptr %141, align 2, !tbaa !31
  %143 = sext i16 %142 to i32
  %144 = load i32, ptr @skyflatnum, align 4, !tbaa !17
  %145 = icmp eq i32 %143, %144
  br i1 %145, label %146, label %147

146:                                              ; preds = %137
  store i32 0, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

147:                                              ; preds = %137, %132
  br label %148

148:                                              ; preds = %147, %91
  %149 = load i32, ptr %4, align 4, !tbaa !17
  %150 = load i32, ptr %5, align 4, !tbaa !17
  %151 = load i32, ptr %6, align 4, !tbaa !17
  call void @P_SpawnPuff(i32 noundef %149, i32 noundef %150, i32 noundef %151)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

152:                                              ; preds = %1
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.intercept_t, ptr %153, i32 0, i32 2
  %155 = load ptr, ptr %154, align 8, !tbaa !12
  store ptr %155, ptr %9, align 8, !tbaa !5
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  %157 = load ptr, ptr @shootthing, align 8, !tbaa !5
  %158 = icmp eq ptr %156, %157
  br i1 %158, label %159, label %160

159:                                              ; preds = %152
  store i32 1, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

160:                                              ; preds = %152
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.mobj_s, ptr %161, i32 0, i32 24
  %163 = load i32, ptr %162, align 8, !tbaa !32
  %164 = and i32 %163, 4
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %167, label %166

166:                                              ; preds = %160
  store i32 1, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

167:                                              ; preds = %160
  %168 = load i32, ptr @attackrange, align 4, !tbaa !17
  %169 = load ptr, ptr %3, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.intercept_t, ptr %169, i32 0, i32 0
  %171 = load i32, ptr %170, align 8, !tbaa !18
  %172 = call i32 @FixedMul(i32 noundef %168, i32 noundef %171)
  store i32 %172, ptr %11, align 4, !tbaa !17
  %173 = load ptr, ptr %9, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.mobj_s, ptr %173, i32 0, i32 3
  %175 = load i32, ptr %174, align 8, !tbaa !35
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.mobj_s, ptr %176, i32 0, i32 15
  %178 = load i32, ptr %177, align 4, !tbaa !36
  %179 = add nsw i32 %175, %178
  %180 = load i32, ptr @shootz, align 4, !tbaa !17
  %181 = sub nsw i32 %179, %180
  %182 = load i32, ptr %11, align 4, !tbaa !17
  %183 = call i32 @FixedDiv(i32 noundef %181, i32 noundef %182)
  store i32 %183, ptr %12, align 4, !tbaa !17
  %184 = load i32, ptr %12, align 4, !tbaa !17
  %185 = load i32, ptr @aimslope, align 4, !tbaa !17
  %186 = icmp slt i32 %184, %185
  br i1 %186, label %187, label %188

187:                                              ; preds = %167
  store i32 1, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

188:                                              ; preds = %167
  %189 = load ptr, ptr %9, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.mobj_s, ptr %189, i32 0, i32 3
  %191 = load i32, ptr %190, align 8, !tbaa !35
  %192 = load i32, ptr @shootz, align 4, !tbaa !17
  %193 = sub nsw i32 %191, %192
  %194 = load i32, ptr %11, align 4, !tbaa !17
  %195 = call i32 @FixedDiv(i32 noundef %193, i32 noundef %194)
  store i32 %195, ptr %13, align 4, !tbaa !17
  %196 = load i32, ptr %13, align 4, !tbaa !17
  %197 = load i32, ptr @aimslope, align 4, !tbaa !17
  %198 = icmp sgt i32 %196, %197
  br i1 %198, label %199, label %200

199:                                              ; preds = %188
  store i32 1, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

200:                                              ; preds = %188
  %201 = load ptr, ptr %3, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.intercept_t, ptr %201, i32 0, i32 0
  %203 = load i32, ptr %202, align 8, !tbaa !18
  %204 = load i32, ptr @attackrange, align 4, !tbaa !17
  %205 = call i32 @FixedDiv(i32 noundef 655360, i32 noundef %204)
  %206 = sub nsw i32 %203, %205
  store i32 %206, ptr %7, align 4, !tbaa !17
  %207 = load i32, ptr @trace, align 4, !tbaa !26
  %208 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 2), align 4, !tbaa !28
  %209 = load i32, ptr %7, align 4, !tbaa !17
  %210 = call i32 @FixedMul(i32 noundef %208, i32 noundef %209)
  %211 = add nsw i32 %207, %210
  store i32 %211, ptr %4, align 4, !tbaa !17
  %212 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 1), align 4, !tbaa !29
  %213 = load i32, ptr getelementptr inbounds (%struct.divline_t, ptr @trace, i32 0, i32 3), align 4, !tbaa !30
  %214 = load i32, ptr %7, align 4, !tbaa !17
  %215 = call i32 @FixedMul(i32 noundef %213, i32 noundef %214)
  %216 = add nsw i32 %212, %215
  store i32 %216, ptr %5, align 4, !tbaa !17
  %217 = load i32, ptr @shootz, align 4, !tbaa !17
  %218 = load i32, ptr @aimslope, align 4, !tbaa !17
  %219 = load i32, ptr %7, align 4, !tbaa !17
  %220 = load i32, ptr @attackrange, align 4, !tbaa !17
  %221 = call i32 @FixedMul(i32 noundef %219, i32 noundef %220)
  %222 = call i32 @FixedMul(i32 noundef %218, i32 noundef %221)
  %223 = add nsw i32 %217, %222
  store i32 %223, ptr %6, align 4, !tbaa !17
  %224 = load ptr, ptr %3, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.intercept_t, ptr %224, i32 0, i32 2
  %226 = load ptr, ptr %225, align 8, !tbaa !12
  %227 = getelementptr inbounds %struct.mobj_s, ptr %226, i32 0, i32 24
  %228 = load i32, ptr %227, align 8, !tbaa !32
  %229 = and i32 %228, 524288
  %230 = icmp ne i32 %229, 0
  br i1 %230, label %231, label %235

231:                                              ; preds = %200
  %232 = load i32, ptr %4, align 4, !tbaa !17
  %233 = load i32, ptr %5, align 4, !tbaa !17
  %234 = load i32, ptr %6, align 4, !tbaa !17
  call void @P_SpawnPuff(i32 noundef %232, i32 noundef %233, i32 noundef %234)
  br label %240

235:                                              ; preds = %200
  %236 = load i32, ptr %4, align 4, !tbaa !17
  %237 = load i32, ptr %5, align 4, !tbaa !17
  %238 = load i32, ptr %6, align 4, !tbaa !17
  %239 = load i32, ptr @la_damage, align 4, !tbaa !17
  call void @P_SpawnBlood(i32 noundef %236, i32 noundef %237, i32 noundef %238, i32 noundef %239)
  br label %240

240:                                              ; preds = %235, %231
  %241 = load i32, ptr @la_damage, align 4, !tbaa !17
  %242 = icmp ne i32 %241, 0
  br i1 %242, label %243, label %248

243:                                              ; preds = %240
  %244 = load ptr, ptr %9, align 8, !tbaa !5
  %245 = load ptr, ptr @shootthing, align 8, !tbaa !5
  %246 = load ptr, ptr @shootthing, align 8, !tbaa !5
  %247 = load i32, ptr @la_damage, align 4, !tbaa !17
  call void @P_DamageMobj(ptr noundef %244, ptr noundef %245, ptr noundef %246, i32 noundef %247)
  br label %248

248:                                              ; preds = %243, %240
  store i32 0, ptr %2, align 4
  store i32 1, ptr %14, align 4
  br label %249

249:                                              ; preds = %248, %199, %187, %166, %159, %148, %146, %131, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, 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
  %250 = load i32, ptr %2, align 4
  ret i32 %250
}

declare void @P_ShootSpecialLine(ptr noundef, ptr noundef) #1

declare void @P_SpawnPuff(i32 noundef, i32 noundef, i32 noundef) #1

declare void @P_SpawnBlood(i32 noundef, i32 noundef, 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 26}
!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 = !{!14, !15, i64 24}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !11, i64 0}
!19 = !{!14, !6, i64 56}
!20 = !{!21, !11, i64 0}
!21 = !{!"", !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, !22, i64 48, !11, i64 88, !6, i64 96, !6, i64 104, !11, i64 112, !6, i64 120}
!22 = !{!"", !23, i64 0, !11, i64 24, !11, i64 28, !11, i64 32}
!23 = !{!"thinker_s", !6, i64 0, !6, i64 8, !7, i64 16}
!24 = !{!14, !6, i64 64}
!25 = !{!21, !11, i64 4}
!26 = !{!27, !11, i64 0}
!27 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!28 = !{!27, !11, i64 8}
!29 = !{!27, !11, i64 4}
!30 = !{!27, !11, i64 12}
!31 = !{!21, !15, i64 10}
!32 = !{!33, !11, i64 160}
!33 = !{!"mobj_s", !23, 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, !34, i64 204, !6, i64 216}
!34 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!35 = !{!33, !11, i64 32}
!36 = !{!33, !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"

%struct.divline_t = type { i32, i32, i32, i32 }

@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
@shootthing = external dso_local local_unnamed_addr global ptr, align 8
@aimslope = external dso_local local_unnamed_addr global i32, align 4
@trace = external local_unnamed_addr global %struct.divline_t, align 4
@skyflatnum = external local_unnamed_addr global i32, align 4
@la_damage = external dso_local local_unnamed_addr global i32, align 4

declare void @P_DamageMobj(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @PTR_ShootTraverse(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 %84, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %5, i64 26
  %8 = load i16, ptr %7, align 2, !tbaa !11
  %.not57 = icmp eq i16 %8, 0
  br i1 %.not57, label %11, label %9

9:                                                ; preds = %6
  %10 = load ptr, ptr @shootthing, align 8, !tbaa !15
  tail call void @P_ShootSpecialLine(ptr noundef %10, ptr noundef nonnull %5) #3
  br label %11

11:                                               ; preds = %9, %6
  %12 = getelementptr inbounds i8, ptr %5, i64 24
  %13 = load i16, ptr %12, align 8, !tbaa !16
  %14 = and i16 %13, 4
  %.not58 = icmp eq i16 %14, 0
  br i1 %.not58, label %46, label %15

15:                                               ; preds = %11
  tail call void @P_LineOpening(ptr noundef nonnull %5) #3
  %16 = load i32, ptr @attackrange, align 4, !tbaa !17
  %17 = load i32, ptr %0, align 8, !tbaa !18
  %18 = tail call i32 @FixedMul(i32 noundef %16, i32 noundef %17)
  %19 = getelementptr inbounds i8, ptr %5, i64 56
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = load i32, ptr %20, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %5, i64 64
  %23 = load ptr, ptr %22, align 8, !tbaa !24
  %24 = load i32, ptr %23, align 8, !tbaa !20
  %.not59 = icmp eq i32 %21, %24
  br i1 %.not59, label %32, label %25

25:                                               ; preds = %15
  %26 = load i32, ptr @openbottom, align 4, !tbaa !17
  %27 = load i32, ptr @shootz, align 4, !tbaa !17
  %28 = sub nsw i32 %26, %27
  %29 = tail call i32 @FixedDiv(i32 noundef %28, i32 noundef %18) #3
  %30 = load i32, ptr @aimslope, align 4, !tbaa !17
  %31 = icmp sgt i32 %29, %30
  br i1 %31, label %46, label %._crit_edge

._crit_edge:                                      ; preds = %25
  %.pre = load ptr, ptr %19, align 8, !tbaa !19
  %.pre62 = load ptr, ptr %22, align 8, !tbaa !24
  br label %32

32:                                               ; preds = %._crit_edge, %15
  %33 = phi ptr [ %.pre62, %._crit_edge ], [ %23, %15 ]
  %34 = phi ptr [ %.pre, %._crit_edge ], [ %20, %15 ]
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !25
  %37 = getelementptr inbounds i8, ptr %33, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !25
  %.not60 = icmp eq i32 %36, %38
  br i1 %.not60, label %142, label %39

39:                                               ; preds = %32
  %40 = load i32, ptr @opentop, align 4, !tbaa !17
  %41 = load i32, ptr @shootz, align 4, !tbaa !17
  %42 = sub nsw i32 %40, %41
  %43 = tail call i32 @FixedDiv(i32 noundef %42, i32 noundef %18) #3
  %44 = load i32, ptr @aimslope, align 4, !tbaa !17
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %142

46:                                               ; preds = %39, %25, %11
  %47 = load i32, ptr %0, align 8, !tbaa !18
  %48 = load i32, ptr @attackrange, align 4, !tbaa !17
  %49 = tail call i32 @FixedDiv(i32 noundef 262144, i32 noundef %48) #3
  %50 = sub nsw i32 %47, %49
  %51 = load i32, ptr @trace, align 4, !tbaa !26
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 8), align 4, !tbaa !28
  %53 = tail call i32 @FixedMul(i32 noundef %52, i32 noundef %50)
  %54 = add nsw i32 %53, %51
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 4), align 4, !tbaa !29
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 12), align 4, !tbaa !30
  %57 = tail call i32 @FixedMul(i32 noundef %56, i32 noundef %50)
  %58 = add nsw i32 %57, %55
  %59 = load i32, ptr @shootz, align 4, !tbaa !17
  %60 = load i32, ptr @aimslope, align 4, !tbaa !17
  %61 = load i32, ptr @attackrange, align 4, !tbaa !17
  %62 = tail call i32 @FixedMul(i32 noundef %50, i32 noundef %61)
  %63 = tail call i32 @FixedMul(i32 noundef %60, i32 noundef %62)
  %64 = add nsw i32 %63, %59
  %65 = getelementptr inbounds i8, ptr %5, i64 56
  %66 = load ptr, ptr %65, align 8, !tbaa !19
  %67 = getelementptr inbounds i8, ptr %66, i64 10
  %68 = load i16, ptr %67, align 2, !tbaa !31
  %69 = sext i16 %68 to i32
  %70 = load i32, ptr @skyflatnum, align 4, !tbaa !17
  %71 = icmp eq i32 %70, %69
  br i1 %71, label %72, label %83

72:                                               ; preds = %46
  %73 = getelementptr inbounds i8, ptr %66, i64 4
  %74 = load i32, ptr %73, align 4, !tbaa !25
  %75 = icmp sgt i32 %64, %74
  br i1 %75, label %142, label %76

76:                                               ; preds = %72
  %77 = getelementptr inbounds i8, ptr %5, i64 64
  %78 = load ptr, ptr %77, align 8, !tbaa !24
  %.not61 = icmp eq ptr %78, null
  br i1 %.not61, label %83, label %79

79:                                               ; preds = %76
  %80 = getelementptr inbounds i8, ptr %78, i64 10
  %81 = load i16, ptr %80, align 2, !tbaa !31
  %82 = icmp eq i16 %68, %81
  br i1 %82, label %142, label %83

83:                                               ; preds = %76, %79, %46
  tail call void @P_SpawnPuff(i32 noundef %54, i32 noundef %58, i32 noundef %64) #3
  br label %142

84:                                               ; preds = %1
  %85 = load ptr, ptr @shootthing, align 8, !tbaa !15
  %86 = icmp eq ptr %5, %85
  br i1 %86, label %142, label %87

87:                                               ; preds = %84
  %88 = getelementptr inbounds i8, ptr %5, i64 160
  %89 = load i32, ptr %88, align 8, !tbaa !32
  %90 = and i32 %89, 4
  %.not54 = icmp eq i32 %90, 0
  br i1 %.not54, label %142, label %91

91:                                               ; preds = %87
  %92 = load i32, ptr @attackrange, align 4, !tbaa !17
  %93 = load i32, ptr %0, align 8, !tbaa !18
  %94 = tail call i32 @FixedMul(i32 noundef %92, i32 noundef %93)
  %95 = getelementptr inbounds i8, ptr %5, i64 32
  %96 = load i32, ptr %95, align 8, !tbaa !35
  %97 = getelementptr inbounds i8, ptr %5, i64 108
  %98 = load i32, ptr %97, align 4, !tbaa !36
  %99 = add nsw i32 %98, %96
  %100 = load i32, ptr @shootz, align 4, !tbaa !17
  %101 = sub i32 %99, %100
  %102 = tail call i32 @FixedDiv(i32 noundef %101, i32 noundef %94) #3
  %103 = load i32, ptr @aimslope, align 4, !tbaa !17
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %142, label %105

105:                                              ; preds = %91
  %106 = load i32, ptr %95, align 8, !tbaa !35
  %107 = load i32, ptr @shootz, align 4, !tbaa !17
  %108 = sub nsw i32 %106, %107
  %109 = tail call i32 @FixedDiv(i32 noundef %108, i32 noundef %94) #3
  %110 = load i32, ptr @aimslope, align 4, !tbaa !17
  %111 = icmp sgt i32 %109, %110
  br i1 %111, label %142, label %112

112:                                              ; preds = %105
  %113 = load i32, ptr %0, align 8, !tbaa !18
  %114 = load i32, ptr @attackrange, align 4, !tbaa !17
  %115 = tail call i32 @FixedDiv(i32 noundef 655360, i32 noundef %114) #3
  %116 = sub nsw i32 %113, %115
  %117 = load i32, ptr @trace, align 4, !tbaa !26
  %118 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 8), align 4, !tbaa !28
  %119 = tail call i32 @FixedMul(i32 noundef %118, i32 noundef %116)
  %120 = add nsw i32 %119, %117
  %121 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 4), align 4, !tbaa !29
  %122 = load i32, ptr getelementptr inbounds (i8, ptr @trace, i64 12), align 4, !tbaa !30
  %123 = tail call i32 @FixedMul(i32 noundef %122, i32 noundef %116)
  %124 = add nsw i32 %123, %121
  %125 = load i32, ptr @shootz, align 4, !tbaa !17
  %126 = load i32, ptr @aimslope, align 4, !tbaa !17
  %127 = load i32, ptr @attackrange, align 4, !tbaa !17
  %128 = tail call i32 @FixedMul(i32 noundef %116, i32 noundef %127)
  %129 = tail call i32 @FixedMul(i32 noundef %126, i32 noundef %128)
  %130 = add nsw i32 %129, %125
  %131 = load ptr, ptr %4, align 8, !tbaa !10
  %132 = getelementptr inbounds i8, ptr %131, i64 160
  %133 = load i32, ptr %132, align 8, !tbaa !32
  %134 = and i32 %133, 524288
  %.not55 = icmp eq i32 %134, 0
  br i1 %.not55, label %136, label %135

135:                                              ; preds = %112
  tail call void @P_SpawnPuff(i32 noundef %120, i32 noundef %124, i32 noundef %130) #3
  br label %138

136:                                              ; preds = %112
  %137 = load i32, ptr @la_damage, align 4, !tbaa !17
  tail call void @P_SpawnBlood(i32 noundef %120, i32 noundef %124, i32 noundef %130, i32 noundef %137) #3
  br label %138

138:                                              ; preds = %136, %135
  %139 = load i32, ptr @la_damage, align 4, !tbaa !17
  %.not56 = icmp eq i32 %139, 0
  br i1 %.not56, label %142, label %140

140:                                              ; preds = %138
  %141 = load ptr, ptr @shootthing, align 8, !tbaa !15
  tail call void @P_DamageMobj(ptr noundef nonnull %5, ptr noundef %141, ptr noundef %141, i32 noundef %139) #3
  br label %142

142:                                              ; preds = %138, %140, %105, %91, %87, %84, %79, %72, %32, %39, %83
  %.0 = phi i32 [ 0, %83 ], [ 1, %39 ], [ 1, %32 ], [ 0, %72 ], [ 0, %79 ], [ 1, %84 ], [ 1, %87 ], [ 1, %91 ], [ 1, %105 ], [ 0, %140 ], [ 0, %138 ]
  ret i32 %.0
}

declare void @P_ShootSpecialLine(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @P_SpawnPuff(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @P_SpawnBlood(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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 = { 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 26}
!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 = !{!13, !13, i64 0}
!16 = !{!12, !14, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 0}
!19 = !{!12, !13, i64 56}
!20 = !{!21, !7, i64 0}
!21 = !{!"", !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, !22, i64 48, !7, i64 88, !13, i64 96, !13, i64 104, !7, i64 112, !13, i64 120}
!22 = !{!"", !23, i64 0, !7, i64 24, !7, i64 28, !7, i64 32}
!23 = !{!"thinker_s", !13, i64 0, !13, i64 8, !8, i64 16}
!24 = !{!12, !13, i64 64}
!25 = !{!21, !7, i64 4}
!26 = !{!27, !7, i64 0}
!27 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!28 = !{!27, !7, i64 8}
!29 = !{!27, !7, i64 4}
!30 = !{!27, !7, i64 12}
!31 = !{!21, !14, i64 10}
!32 = !{!33, !7, i64 160}
!33 = !{!"mobj_s", !23, 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, !34, i64 204, !13, i64 216}
!34 = !{!"", !14, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!35 = !{!33, !7, i64 32}
!36 = !{!33, !7, i64 108}


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