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

; 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.visplane_t = type { i32, i32, i32, i32, i32, i16, [320 x i16], i16, i16, [320 x i16], i16 }

@walllights = external dso_local global ptr, align 8
@maskedtexturecol = external dso_local global ptr, align 8
@rw_scalestep = external dso_local global i32, align 4
@dc_texturemid = external global i32, align 4
@dc_colormap = external global ptr, align 8
@dc_x = external global i32, align 4
@dc_iscale = external global i32, align 4
@rw_x = external dso_local global i32, align 4
@rw_stopx = external dso_local global i32, align 4
@topfrac = external dso_local global i32, align 4
@ceilingclip = external global [320 x i16], align 16
@markceiling = external dso_local global i32, align 4
@floorclip = external global [320 x i16], align 16
@ceilingplane = external global ptr, align 8
@bottomfrac = external dso_local global i32, align 4
@markfloor = external dso_local global i32, align 4
@floorplane = external global ptr, align 8
@segtextured = external dso_local global i32, align 4
@rw_centerangle = external dso_local global i32, align 4
@xtoviewangle = external global [321 x i32], align 16
@rw_offset = external dso_local global i32, align 4
@finetangent = external global [4096 x i32], align 16
@rw_distance = external dso_local global i32, align 4
@rw_scale = external dso_local global i32, align 4
@midtexture = external dso_local global i32, align 4
@dc_yl = external global i32, align 4
@dc_yh = external global i32, align 4
@rw_midtexturemid = external dso_local global i32, align 4
@dc_source = external global ptr, align 8
@colfunc = external global ptr, align 8
@viewheight = external global i32, align 4
@toptexture = external dso_local global i32, align 4
@pixhigh = external dso_local global i32, align 4
@pixhighstep = external dso_local global i32, align 4
@rw_toptexturemid = external dso_local global i32, align 4
@bottomtexture = external dso_local global i32, align 4
@pixlow = external dso_local global i32, align 4
@pixlowstep = external dso_local global i32, align 4
@rw_bottomtexturemid = external dso_local global i32, align 4
@maskedtexture = external dso_local global i32, align 4
@topstep = external dso_local global i32, align 4
@bottomstep = 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @R_RenderSegLoop() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  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
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %337, %0
  %10 = load i32, ptr @rw_x, align 4, !tbaa !5
  %11 = load i32, ptr @rw_stopx, align 4, !tbaa !5
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %13, label %340

13:                                               ; preds = %9
  %14 = load i32, ptr @topfrac, align 4, !tbaa !5
  %15 = add nsw i32 %14, 4096
  %16 = sub nsw i32 %15, 1
  %17 = ashr i32 %16, 12
  store i32 %17, ptr %3, align 4, !tbaa !5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr @rw_x, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %20
  %22 = load i16, ptr %21, align 2, !tbaa !9
  %23 = sext i16 %22 to i32
  %24 = add nsw i32 %23, 1
  %25 = icmp slt i32 %18, %24
  br i1 %25, label %26, label %33

26:                                               ; preds = %13
  %27 = load i32, ptr @rw_x, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %28
  %30 = load i16, ptr %29, align 2, !tbaa !9
  %31 = sext i16 %30 to i32
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %3, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %26, %13
  %34 = load i32, ptr @markceiling, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %79

36:                                               ; preds = %33
  %37 = load i32, ptr @rw_x, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %38
  %40 = load i16, ptr %39, align 2, !tbaa !9
  %41 = sext i16 %40 to i32
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %7, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  store i32 %44, ptr %8, align 4, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = load i32, ptr @rw_x, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %47
  %49 = load i16, ptr %48, align 2, !tbaa !9
  %50 = sext i16 %49 to i32
  %51 = icmp sge i32 %45, %50
  br i1 %51, label %52, label %59

52:                                               ; preds = %36
  %53 = load i32, ptr @rw_x, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %54
  %56 = load i16, ptr %55, align 2, !tbaa !9
  %57 = sext i16 %56 to i32
  %58 = sub nsw i32 %57, 1
  store i32 %58, ptr %8, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %52, %36
  %60 = load i32, ptr %7, align 4, !tbaa !5
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %63, label %78

63:                                               ; preds = %59
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = trunc i32 %64 to i16
  %66 = load ptr, ptr @ceilingplane, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct.visplane_t, ptr %66, i32 0, i32 6
  %68 = load i32, ptr @rw_x, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [320 x i16], ptr %67, i64 0, i64 %69
  store i16 %65, ptr %70, align 2, !tbaa !9
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = trunc i32 %71 to i16
  %73 = load ptr, ptr @ceilingplane, align 8, !tbaa !11
  %74 = getelementptr inbounds %struct.visplane_t, ptr %73, i32 0, i32 9
  %75 = load i32, ptr @rw_x, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [320 x i16], ptr %74, i64 0, i64 %76
  store i16 %72, ptr %77, align 2, !tbaa !9
  br label %78

78:                                               ; preds = %63, %59
  br label %79

79:                                               ; preds = %78, %33
  %80 = load i32, ptr @bottomfrac, align 4, !tbaa !5
  %81 = ashr i32 %80, 12
  store i32 %81, ptr %4, align 4, !tbaa !5
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = load i32, ptr @rw_x, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %84
  %86 = load i16, ptr %85, align 2, !tbaa !9
  %87 = sext i16 %86 to i32
  %88 = icmp sge i32 %82, %87
  br i1 %88, label %89, label %96

89:                                               ; preds = %79
  %90 = load i32, ptr @rw_x, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %91
  %93 = load i16, ptr %92, align 2, !tbaa !9
  %94 = sext i16 %93 to i32
  %95 = sub nsw i32 %94, 1
  store i32 %95, ptr %4, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %89, %79
  %97 = load i32, ptr @markfloor, align 4, !tbaa !5
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %142

99:                                               ; preds = %96
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr @rw_x, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %103
  %105 = load i16, ptr %104, align 2, !tbaa !9
  %106 = sext i16 %105 to i32
  %107 = sub nsw i32 %106, 1
  store i32 %107, ptr %8, align 4, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = load i32, ptr @rw_x, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %110
  %112 = load i16, ptr %111, align 2, !tbaa !9
  %113 = sext i16 %112 to i32
  %114 = icmp sle i32 %108, %113
  br i1 %114, label %115, label %122

115:                                              ; preds = %99
  %116 = load i32, ptr @rw_x, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %117
  %119 = load i16, ptr %118, align 2, !tbaa !9
  %120 = sext i16 %119 to i32
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %7, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %115, %99
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = icmp sle i32 %123, %124
  br i1 %125, label %126, label %141

126:                                              ; preds = %122
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = trunc i32 %127 to i16
  %129 = load ptr, ptr @floorplane, align 8, !tbaa !11
  %130 = getelementptr inbounds %struct.visplane_t, ptr %129, i32 0, i32 6
  %131 = load i32, ptr @rw_x, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [320 x i16], ptr %130, i64 0, i64 %132
  store i16 %128, ptr %133, align 2, !tbaa !9
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = trunc i32 %134 to i16
  %136 = load ptr, ptr @floorplane, align 8, !tbaa !11
  %137 = getelementptr inbounds %struct.visplane_t, ptr %136, i32 0, i32 9
  %138 = load i32, ptr @rw_x, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [320 x i16], ptr %137, i64 0, i64 %139
  store i16 %135, ptr %140, align 2, !tbaa !9
  br label %141

141:                                              ; preds = %126, %122
  br label %142

142:                                              ; preds = %141, %96
  %143 = load i32, ptr @segtextured, align 4, !tbaa !5
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %177

145:                                              ; preds = %142
  %146 = load i32, ptr @rw_centerangle, align 4, !tbaa !5
  %147 = load i32, ptr @rw_x, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [321 x i32], ptr @xtoviewangle, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = add i32 %146, %150
  %152 = lshr i32 %151, 19
  store i32 %152, ptr %1, align 4, !tbaa !5
  %153 = load i32, ptr @rw_offset, align 4, !tbaa !5
  %154 = load i32, ptr %1, align 4, !tbaa !5
  %155 = zext i32 %154 to i64
  %156 = getelementptr inbounds [4096 x i32], ptr @finetangent, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr @rw_distance, align 4, !tbaa !5
  %159 = call i32 @FixedMul(i32 noundef %157, i32 noundef %158)
  %160 = sub nsw i32 %153, %159
  store i32 %160, ptr %6, align 4, !tbaa !5
  %161 = load i32, ptr %6, align 4, !tbaa !5
  %162 = ashr i32 %161, 16
  store i32 %162, ptr %6, align 4, !tbaa !5
  %163 = load i32, ptr @rw_scale, align 4, !tbaa !5
  %164 = ashr i32 %163, 12
  store i32 %164, ptr %2, align 4, !tbaa !5
  %165 = load i32, ptr %2, align 4, !tbaa !5
  %166 = icmp uge i32 %165, 48
  br i1 %166, label %167, label %168

167:                                              ; preds = %145
  store i32 47, ptr %2, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %167, %145
  %169 = load ptr, ptr @walllights, align 8, !tbaa !11
  %170 = load i32, ptr %2, align 4, !tbaa !5
  %171 = zext i32 %170 to i64
  %172 = getelementptr inbounds ptr, ptr %169, i64 %171
  %173 = load ptr, ptr %172, align 8, !tbaa !11
  store ptr %173, ptr @dc_colormap, align 8, !tbaa !11
  %174 = load i32, ptr @rw_x, align 4, !tbaa !5
  store i32 %174, ptr @dc_x, align 4, !tbaa !5
  %175 = load i32, ptr @rw_scale, align 4, !tbaa !5
  %176 = udiv i32 -1, %175
  store i32 %176, ptr @dc_iscale, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %168, %142
  %178 = load i32, ptr @midtexture, align 4, !tbaa !5
  %179 = icmp ne i32 %178, 0
  br i1 %179, label %180, label %196

180:                                              ; preds = %177
  %181 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %181, ptr @dc_yl, align 4, !tbaa !5
  %182 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %182, ptr @dc_yh, align 4, !tbaa !5
  %183 = load i32, ptr @rw_midtexturemid, align 4, !tbaa !5
  store i32 %183, ptr @dc_texturemid, align 4, !tbaa !5
  %184 = load i32, ptr @midtexture, align 4, !tbaa !5
  %185 = load i32, ptr %6, align 4, !tbaa !5
  %186 = call ptr @R_GetColumn(i32 noundef %184, i32 noundef %185)
  store ptr %186, ptr @dc_source, align 8, !tbaa !11
  %187 = load ptr, ptr @colfunc, align 8, !tbaa !11
  call void %187()
  %188 = load i32, ptr @viewheight, align 4, !tbaa !5
  %189 = trunc i32 %188 to i16
  %190 = load i32, ptr @rw_x, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %191
  store i16 %189, ptr %192, align 2, !tbaa !9
  %193 = load i32, ptr @rw_x, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %194
  store i16 -1, ptr %195, align 2, !tbaa !9
  br label %327

196:                                              ; preds = %177
  %197 = load i32, ptr @toptexture, align 4, !tbaa !5
  %198 = icmp ne i32 %197, 0
  br i1 %198, label %199, label %244

199:                                              ; preds = %196
  %200 = load i32, ptr @pixhigh, align 4, !tbaa !5
  %201 = ashr i32 %200, 12
  store i32 %201, ptr %5, align 4, !tbaa !5
  %202 = load i32, ptr @pixhighstep, align 4, !tbaa !5
  %203 = load i32, ptr @pixhigh, align 4, !tbaa !5
  %204 = add nsw i32 %203, %202
  store i32 %204, ptr @pixhigh, align 4, !tbaa !5
  %205 = load i32, ptr %5, align 4, !tbaa !5
  %206 = load i32, ptr @rw_x, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %207
  %209 = load i16, ptr %208, align 2, !tbaa !9
  %210 = sext i16 %209 to i32
  %211 = icmp sge i32 %205, %210
  br i1 %211, label %212, label %219

212:                                              ; preds = %199
  %213 = load i32, ptr @rw_x, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %214
  %216 = load i16, ptr %215, align 2, !tbaa !9
  %217 = sext i16 %216 to i32
  %218 = sub nsw i32 %217, 1
  store i32 %218, ptr %5, align 4, !tbaa !5
  br label %219

219:                                              ; preds = %212, %199
  %220 = load i32, ptr %5, align 4, !tbaa !5
  %221 = load i32, ptr %3, align 4, !tbaa !5
  %222 = icmp sge i32 %220, %221
  br i1 %222, label %223, label %236

223:                                              ; preds = %219
  %224 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %224, ptr @dc_yl, align 4, !tbaa !5
  %225 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %225, ptr @dc_yh, align 4, !tbaa !5
  %226 = load i32, ptr @rw_toptexturemid, align 4, !tbaa !5
  store i32 %226, ptr @dc_texturemid, align 4, !tbaa !5
  %227 = load i32, ptr @toptexture, align 4, !tbaa !5
  %228 = load i32, ptr %6, align 4, !tbaa !5
  %229 = call ptr @R_GetColumn(i32 noundef %227, i32 noundef %228)
  store ptr %229, ptr @dc_source, align 8, !tbaa !11
  %230 = load ptr, ptr @colfunc, align 8, !tbaa !11
  call void %230()
  %231 = load i32, ptr %5, align 4, !tbaa !5
  %232 = trunc i32 %231 to i16
  %233 = load i32, ptr @rw_x, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %234
  store i16 %232, ptr %235, align 2, !tbaa !9
  br label %243

236:                                              ; preds = %219
  %237 = load i32, ptr %3, align 4, !tbaa !5
  %238 = sub nsw i32 %237, 1
  %239 = trunc i32 %238 to i16
  %240 = load i32, ptr @rw_x, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %241
  store i16 %239, ptr %242, align 2, !tbaa !9
  br label %243

243:                                              ; preds = %236, %223
  br label %255

244:                                              ; preds = %196
  %245 = load i32, ptr @markceiling, align 4, !tbaa !5
  %246 = icmp ne i32 %245, 0
  br i1 %246, label %247, label %254

247:                                              ; preds = %244
  %248 = load i32, ptr %3, align 4, !tbaa !5
  %249 = sub nsw i32 %248, 1
  %250 = trunc i32 %249 to i16
  %251 = load i32, ptr @rw_x, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %252
  store i16 %250, ptr %253, align 2, !tbaa !9
  br label %254

254:                                              ; preds = %247, %244
  br label %255

255:                                              ; preds = %254, %243
  %256 = load i32, ptr @bottomtexture, align 4, !tbaa !5
  %257 = icmp ne i32 %256, 0
  br i1 %257, label %258, label %305

258:                                              ; preds = %255
  %259 = load i32, ptr @pixlow, align 4, !tbaa !5
  %260 = add nsw i32 %259, 4096
  %261 = sub nsw i32 %260, 1
  %262 = ashr i32 %261, 12
  store i32 %262, ptr %5, align 4, !tbaa !5
  %263 = load i32, ptr @pixlowstep, align 4, !tbaa !5
  %264 = load i32, ptr @pixlow, align 4, !tbaa !5
  %265 = add nsw i32 %264, %263
  store i32 %265, ptr @pixlow, align 4, !tbaa !5
  %266 = load i32, ptr %5, align 4, !tbaa !5
  %267 = load i32, ptr @rw_x, align 4, !tbaa !5
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %268
  %270 = load i16, ptr %269, align 2, !tbaa !9
  %271 = sext i16 %270 to i32
  %272 = icmp sle i32 %266, %271
  br i1 %272, label %273, label %280

273:                                              ; preds = %258
  %274 = load i32, ptr @rw_x, align 4, !tbaa !5
  %275 = sext i32 %274 to i64
  %276 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %275
  %277 = load i16, ptr %276, align 2, !tbaa !9
  %278 = sext i16 %277 to i32
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %5, align 4, !tbaa !5
  br label %280

280:                                              ; preds = %273, %258
  %281 = load i32, ptr %5, align 4, !tbaa !5
  %282 = load i32, ptr %4, align 4, !tbaa !5
  %283 = icmp sle i32 %281, %282
  br i1 %283, label %284, label %297

284:                                              ; preds = %280
  %285 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %285, ptr @dc_yl, align 4, !tbaa !5
  %286 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %286, ptr @dc_yh, align 4, !tbaa !5
  %287 = load i32, ptr @rw_bottomtexturemid, align 4, !tbaa !5
  store i32 %287, ptr @dc_texturemid, align 4, !tbaa !5
  %288 = load i32, ptr @bottomtexture, align 4, !tbaa !5
  %289 = load i32, ptr %6, align 4, !tbaa !5
  %290 = call ptr @R_GetColumn(i32 noundef %288, i32 noundef %289)
  store ptr %290, ptr @dc_source, align 8, !tbaa !11
  %291 = load ptr, ptr @colfunc, align 8, !tbaa !11
  call void %291()
  %292 = load i32, ptr %5, align 4, !tbaa !5
  %293 = trunc i32 %292 to i16
  %294 = load i32, ptr @rw_x, align 4, !tbaa !5
  %295 = sext i32 %294 to i64
  %296 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %295
  store i16 %293, ptr %296, align 2, !tbaa !9
  br label %304

297:                                              ; preds = %280
  %298 = load i32, ptr %4, align 4, !tbaa !5
  %299 = add nsw i32 %298, 1
  %300 = trunc i32 %299 to i16
  %301 = load i32, ptr @rw_x, align 4, !tbaa !5
  %302 = sext i32 %301 to i64
  %303 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %302
  store i16 %300, ptr %303, align 2, !tbaa !9
  br label %304

304:                                              ; preds = %297, %284
  br label %316

305:                                              ; preds = %255
  %306 = load i32, ptr @markfloor, align 4, !tbaa !5
  %307 = icmp ne i32 %306, 0
  br i1 %307, label %308, label %315

308:                                              ; preds = %305
  %309 = load i32, ptr %4, align 4, !tbaa !5
  %310 = add nsw i32 %309, 1
  %311 = trunc i32 %310 to i16
  %312 = load i32, ptr @rw_x, align 4, !tbaa !5
  %313 = sext i32 %312 to i64
  %314 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %313
  store i16 %311, ptr %314, align 2, !tbaa !9
  br label %315

315:                                              ; preds = %308, %305
  br label %316

316:                                              ; preds = %315, %304
  %317 = load i32, ptr @maskedtexture, align 4, !tbaa !5
  %318 = icmp ne i32 %317, 0
  br i1 %318, label %319, label %326

319:                                              ; preds = %316
  %320 = load i32, ptr %6, align 4, !tbaa !5
  %321 = trunc i32 %320 to i16
  %322 = load ptr, ptr @maskedtexturecol, align 8, !tbaa !11
  %323 = load i32, ptr @rw_x, align 4, !tbaa !5
  %324 = sext i32 %323 to i64
  %325 = getelementptr inbounds i16, ptr %322, i64 %324
  store i16 %321, ptr %325, align 2, !tbaa !9
  br label %326

326:                                              ; preds = %319, %316
  br label %327

327:                                              ; preds = %326, %180
  %328 = load i32, ptr @rw_scalestep, align 4, !tbaa !5
  %329 = load i32, ptr @rw_scale, align 4, !tbaa !5
  %330 = add nsw i32 %329, %328
  store i32 %330, ptr @rw_scale, align 4, !tbaa !5
  %331 = load i32, ptr @topstep, align 4, !tbaa !5
  %332 = load i32, ptr @topfrac, align 4, !tbaa !5
  %333 = add nsw i32 %332, %331
  store i32 %333, ptr @topfrac, align 4, !tbaa !5
  %334 = load i32, ptr @bottomstep, align 4, !tbaa !5
  %335 = load i32, ptr @bottomfrac, align 4, !tbaa !5
  %336 = add nsw i32 %335, %334
  store i32 %336, ptr @bottomfrac, align 4, !tbaa !5
  br label %337

337:                                              ; preds = %327
  %338 = load i32, ptr @rw_x, align 4, !tbaa !5
  %339 = add nsw i32 %338, 1
  store i32 %339, ptr @rw_x, align 4, !tbaa !5
  br label %9, !llvm.loop !13

340:                                              ; preds = %9
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

@walllights = external dso_local local_unnamed_addr global ptr, align 8
@maskedtexturecol = external dso_local local_unnamed_addr global ptr, align 8
@rw_scalestep = external dso_local local_unnamed_addr global i32, align 4
@dc_texturemid = external local_unnamed_addr global i32, align 4
@dc_colormap = external local_unnamed_addr global ptr, align 8
@dc_x = external local_unnamed_addr global i32, align 4
@dc_iscale = external local_unnamed_addr global i32, align 4
@rw_x = external dso_local local_unnamed_addr global i32, align 4
@rw_stopx = external dso_local local_unnamed_addr global i32, align 4
@topfrac = external dso_local local_unnamed_addr global i32, align 4
@ceilingclip = external local_unnamed_addr global [320 x i16], align 16
@markceiling = external dso_local local_unnamed_addr global i32, align 4
@floorclip = external local_unnamed_addr global [320 x i16], align 16
@ceilingplane = external local_unnamed_addr global ptr, align 8
@bottomfrac = external dso_local local_unnamed_addr global i32, align 4
@markfloor = external dso_local local_unnamed_addr global i32, align 4
@floorplane = external local_unnamed_addr global ptr, align 8
@segtextured = external dso_local local_unnamed_addr global i32, align 4
@rw_centerangle = external dso_local local_unnamed_addr global i32, align 4
@xtoviewangle = external local_unnamed_addr global [321 x i32], align 16
@rw_offset = external dso_local local_unnamed_addr global i32, align 4
@finetangent = external local_unnamed_addr global [4096 x i32], align 16
@rw_distance = external dso_local local_unnamed_addr global i32, align 4
@rw_scale = external dso_local local_unnamed_addr global i32, align 4
@midtexture = external dso_local local_unnamed_addr global i32, align 4
@dc_yl = external local_unnamed_addr global i32, align 4
@dc_yh = external local_unnamed_addr global i32, align 4
@rw_midtexturemid = external dso_local local_unnamed_addr global i32, align 4
@dc_source = external local_unnamed_addr global ptr, align 8
@colfunc = external local_unnamed_addr global ptr, align 8
@viewheight = external local_unnamed_addr global i32, align 4
@toptexture = external dso_local local_unnamed_addr global i32, align 4
@pixhigh = external dso_local local_unnamed_addr global i32, align 4
@pixhighstep = external dso_local local_unnamed_addr global i32, align 4
@rw_toptexturemid = external dso_local local_unnamed_addr global i32, align 4
@bottomtexture = external dso_local local_unnamed_addr global i32, align 4
@pixlow = external dso_local local_unnamed_addr global i32, align 4
@pixlowstep = external dso_local local_unnamed_addr global i32, align 4
@rw_bottomtexturemid = external dso_local local_unnamed_addr global i32, align 4
@maskedtexture = external dso_local local_unnamed_addr global i32, align 4
@topstep = external dso_local local_unnamed_addr global i32, align 4
@bottomstep = external dso_local local_unnamed_addr global i32, align 4

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

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

; Function Attrs: nounwind uwtable
define dso_local void @R_RenderSegLoop() local_unnamed_addr #2 {
  %1 = load i32, ptr @rw_x, align 4, !tbaa !5
  %2 = load i32, ptr @rw_stopx, align 4, !tbaa !5
  %3 = icmp slt i32 %1, %2
  br i1 %3, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %.pre = load i32, ptr @topfrac, align 4, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %142
  %4 = phi i32 [ %149, %142 ], [ %.pre, %.lr.ph.preheader ]
  %5 = phi i32 [ %153, %142 ], [ %1, %.lr.ph.preheader ]
  %.04184 = phi i32 [ %.1, %142 ], [ 0, %.lr.ph.preheader ]
  %6 = add nsw i32 %4, 4095
  %7 = ashr i32 %6, 12
  %8 = sext i32 %5 to i64
  %9 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %8
  %10 = load i16, ptr %9, align 2, !tbaa !9
  %11 = sext i16 %10 to i32
  %.not = icmp sgt i32 %7, %11
  %12 = add nsw i32 %11, 1
  %spec.select = select i1 %.not, i32 %7, i32 %12
  %13 = load i32, ptr @markceiling, align 4, !tbaa !5
  %.not61 = icmp eq i32 %13, 0
  %.phi.trans.insert = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %8
  %.pre85 = load i16, ptr %.phi.trans.insert, align 2, !tbaa !9
  %.pre86 = sext i16 %.pre85 to i32
  br i1 %.not61, label %.lr.ph._crit_edge, label %14

14:                                               ; preds = %.lr.ph
  %spec.select79 = tail call i32 @llvm.smin.i32(i32 %spec.select, i32 %.pre86)
  %.0 = add nsw i32 %spec.select79, -1
  %.not63.not = icmp sgt i32 %.0, %11
  br i1 %.not63.not, label %15, label %.lr.ph._crit_edge

15:                                               ; preds = %14
  %16 = add i16 %10, 1
  %17 = load ptr, ptr @ceilingplane, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %17, i64 22
  %19 = getelementptr inbounds [320 x i16], ptr %18, i64 0, i64 %8
  store i16 %16, ptr %19, align 2, !tbaa !9
  %20 = trunc nsw i32 %.0 to i16
  %21 = getelementptr inbounds i8, ptr %17, i64 666
  %22 = getelementptr inbounds [320 x i16], ptr %21, i64 0, i64 %8
  store i16 %20, ptr %22, align 2, !tbaa !9
  br label %.lr.ph._crit_edge

.lr.ph._crit_edge:                                ; preds = %.lr.ph, %14, %15
  %23 = load i32, ptr @bottomfrac, align 4, !tbaa !5
  %24 = ashr i32 %23, 12
  %.not64 = icmp slt i32 %24, %.pre86
  %25 = add nsw i32 %.pre86, -1
  %spec.select80 = select i1 %.not64, i32 %24, i32 %25
  %26 = load i32, ptr @markfloor, align 4, !tbaa !5
  %.not65 = icmp eq i32 %26, 0
  br i1 %.not65, label %37, label %27

27:                                               ; preds = %.lr.ph._crit_edge
  %spec.select81 = tail call i32 @llvm.smax.i32(i32 %spec.select80, i32 %11)
  %.not67.not = icmp slt i32 %spec.select81, %25
  br i1 %.not67.not, label %28, label %37

28:                                               ; preds = %27
  %29 = trunc i32 %spec.select81 to i16
  %30 = add nsw i16 %29, 1
  %31 = load ptr, ptr @floorplane, align 8, !tbaa !11
  %32 = getelementptr inbounds i8, ptr %31, i64 22
  %33 = getelementptr inbounds [320 x i16], ptr %32, i64 0, i64 %8
  store i16 %30, ptr %33, align 2, !tbaa !9
  %34 = trunc nsw i32 %25 to i16
  %35 = getelementptr inbounds i8, ptr %31, i64 666
  %36 = getelementptr inbounds [320 x i16], ptr %35, i64 0, i64 %8
  store i16 %34, ptr %36, align 2, !tbaa !9
  br label %37

37:                                               ; preds = %27, %28, %.lr.ph._crit_edge
  %38 = load i32, ptr @segtextured, align 4, !tbaa !5
  %.not68 = icmp eq i32 %38, 0
  br i1 %.not68, label %61, label %39

39:                                               ; preds = %37
  %40 = load i32, ptr @rw_centerangle, align 4, !tbaa !5
  %41 = getelementptr inbounds [321 x i32], ptr @xtoviewangle, i64 0, i64 %8
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add i32 %42, %40
  %44 = lshr i32 %43, 19
  %45 = load i32, ptr @rw_offset, align 4, !tbaa !5
  %46 = zext nneg i32 %44 to i64
  %47 = getelementptr inbounds [4096 x i32], ptr @finetangent, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = load i32, ptr @rw_distance, align 4, !tbaa !5
  %50 = tail call i32 @FixedMul(i32 noundef %48, i32 noundef %49)
  %51 = sub nsw i32 %45, %50
  %52 = ashr i32 %51, 16
  %53 = load i32, ptr @rw_scale, align 4, !tbaa !5
  %54 = ashr i32 %53, 12
  %spec.store.select = tail call i32 @llvm.umin.i32(i32 %54, i32 47)
  %55 = load ptr, ptr @walllights, align 8, !tbaa !11
  %56 = zext nneg i32 %spec.store.select to i64
  %57 = getelementptr inbounds ptr, ptr %55, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  store ptr %58, ptr @dc_colormap, align 8, !tbaa !11
  %59 = load i32, ptr @rw_x, align 4, !tbaa !5
  store i32 %59, ptr @dc_x, align 4, !tbaa !5
  %60 = udiv i32 -1, %53
  store i32 %60, ptr @dc_iscale, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %39, %37
  %62 = phi i32 [ %59, %39 ], [ %5, %37 ]
  %.1 = phi i32 [ %52, %39 ], [ %.04184, %37 ]
  %63 = load i32, ptr @midtexture, align 4, !tbaa !5
  %.not69 = icmp eq i32 %63, 0
  br i1 %.not69, label %74, label %64

64:                                               ; preds = %61
  store i32 %spec.select, ptr @dc_yl, align 4, !tbaa !5
  store i32 %spec.select80, ptr @dc_yh, align 4, !tbaa !5
  %65 = load i32, ptr @rw_midtexturemid, align 4, !tbaa !5
  store i32 %65, ptr @dc_texturemid, align 4, !tbaa !5
  %66 = tail call ptr @R_GetColumn(i32 noundef %63, i32 noundef %.1) #4
  store ptr %66, ptr @dc_source, align 8, !tbaa !11
  %67 = load ptr, ptr @colfunc, align 8, !tbaa !11
  tail call void %67() #4
  %68 = load i32, ptr @viewheight, align 4, !tbaa !5
  %69 = trunc i32 %68 to i16
  %70 = load i32, ptr @rw_x, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %71
  store i16 %69, ptr %72, align 2, !tbaa !9
  %73 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %71
  store i16 -1, ptr %73, align 2, !tbaa !9
  br label %142

74:                                               ; preds = %61
  %75 = load i32, ptr @toptexture, align 4, !tbaa !5
  %.not70 = icmp eq i32 %75, 0
  br i1 %.not70, label %96, label %76

76:                                               ; preds = %74
  %77 = load i32, ptr @pixhigh, align 4, !tbaa !5
  %78 = ashr i32 %77, 12
  %79 = load i32, ptr @pixhighstep, align 4, !tbaa !5
  %80 = add nsw i32 %79, %77
  store i32 %80, ptr @pixhigh, align 4, !tbaa !5
  %81 = sext i32 %62 to i64
  %82 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %81
  %83 = load i16, ptr %82, align 2, !tbaa !9
  %84 = sext i16 %83 to i32
  %.not72 = icmp slt i32 %78, %84
  %85 = add nsw i32 %84, -1
  %spec.select82 = select i1 %.not72, i32 %78, i32 %85
  %.not73 = icmp slt i32 %spec.select82, %spec.select
  br i1 %.not73, label %93, label %86

86:                                               ; preds = %76
  store i32 %spec.select, ptr @dc_yl, align 4, !tbaa !5
  store i32 %spec.select82, ptr @dc_yh, align 4, !tbaa !5
  %87 = load i32, ptr @rw_toptexturemid, align 4, !tbaa !5
  store i32 %87, ptr @dc_texturemid, align 4, !tbaa !5
  %88 = tail call ptr @R_GetColumn(i32 noundef %75, i32 noundef %.1) #4
  store ptr %88, ptr @dc_source, align 8, !tbaa !11
  %89 = load ptr, ptr @colfunc, align 8, !tbaa !11
  tail call void %89() #4
  %90 = trunc nsw i32 %spec.select82 to i16
  %91 = load i32, ptr @rw_x, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  br label %.sink.split

93:                                               ; preds = %76
  %94 = trunc i32 %spec.select to i16
  %95 = add i16 %94, -1
  br label %.sink.split

96:                                               ; preds = %74
  %97 = load i32, ptr @markceiling, align 4, !tbaa !5
  %.not71 = icmp eq i32 %97, 0
  br i1 %.not71, label %103, label %98

98:                                               ; preds = %96
  %99 = trunc i32 %spec.select to i16
  %100 = add i16 %99, -1
  %101 = sext i32 %62 to i64
  br label %.sink.split

.sink.split:                                      ; preds = %93, %86, %98
  %.sink88 = phi i64 [ %101, %98 ], [ %92, %86 ], [ %81, %93 ]
  %.sink = phi i16 [ %100, %98 ], [ %90, %86 ], [ %95, %93 ]
  %.ph = phi i32 [ %62, %98 ], [ %91, %86 ], [ %62, %93 ]
  %102 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %.sink88
  store i16 %.sink, ptr %102, align 2, !tbaa !9
  br label %103

103:                                              ; preds = %.sink.split, %96
  %104 = phi i32 [ %62, %96 ], [ %.ph, %.sink.split ]
  %105 = load i32, ptr @bottomtexture, align 4, !tbaa !5
  %.not74 = icmp eq i32 %105, 0
  br i1 %.not74, label %127, label %106

106:                                              ; preds = %103
  %107 = load i32, ptr @pixlow, align 4, !tbaa !5
  %108 = add nsw i32 %107, 4095
  %109 = ashr i32 %108, 12
  %110 = load i32, ptr @pixlowstep, align 4, !tbaa !5
  %111 = add nsw i32 %110, %107
  store i32 %111, ptr @pixlow, align 4, !tbaa !5
  %112 = sext i32 %104 to i64
  %113 = getelementptr inbounds [320 x i16], ptr @ceilingclip, i64 0, i64 %112
  %114 = load i16, ptr %113, align 2, !tbaa !9
  %115 = sext i16 %114 to i32
  %.not76 = icmp sgt i32 %109, %115
  %116 = add nsw i32 %115, 1
  %spec.select83 = select i1 %.not76, i32 %109, i32 %116
  %.not77 = icmp sgt i32 %spec.select83, %spec.select80
  br i1 %.not77, label %124, label %117

117:                                              ; preds = %106
  store i32 %spec.select83, ptr @dc_yl, align 4, !tbaa !5
  store i32 %spec.select80, ptr @dc_yh, align 4, !tbaa !5
  %118 = load i32, ptr @rw_bottomtexturemid, align 4, !tbaa !5
  store i32 %118, ptr @dc_texturemid, align 4, !tbaa !5
  %119 = tail call ptr @R_GetColumn(i32 noundef %105, i32 noundef %.1) #4
  store ptr %119, ptr @dc_source, align 8, !tbaa !11
  %120 = load ptr, ptr @colfunc, align 8, !tbaa !11
  tail call void %120() #4
  %121 = trunc nsw i32 %spec.select83 to i16
  %122 = load i32, ptr @rw_x, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  br label %.sink.split89

124:                                              ; preds = %106
  %125 = trunc i32 %spec.select80 to i16
  %126 = add i16 %125, 1
  br label %.sink.split89

127:                                              ; preds = %103
  %128 = load i32, ptr @markfloor, align 4, !tbaa !5
  %.not75 = icmp eq i32 %128, 0
  br i1 %.not75, label %134, label %129

129:                                              ; preds = %127
  %130 = trunc i32 %spec.select80 to i16
  %131 = add i16 %130, 1
  %132 = sext i32 %104 to i64
  br label %.sink.split89

.sink.split89:                                    ; preds = %124, %117, %129
  %.sink93 = phi i64 [ %132, %129 ], [ %123, %117 ], [ %112, %124 ]
  %.sink91 = phi i16 [ %131, %129 ], [ %121, %117 ], [ %126, %124 ]
  %.ph90 = phi i32 [ %104, %129 ], [ %122, %117 ], [ %104, %124 ]
  %133 = getelementptr inbounds [320 x i16], ptr @floorclip, i64 0, i64 %.sink93
  store i16 %.sink91, ptr %133, align 2, !tbaa !9
  br label %134

134:                                              ; preds = %.sink.split89, %127
  %135 = phi i32 [ %104, %127 ], [ %.ph90, %.sink.split89 ]
  %136 = load i32, ptr @maskedtexture, align 4, !tbaa !5
  %.not78 = icmp eq i32 %136, 0
  br i1 %.not78, label %142, label %137

137:                                              ; preds = %134
  %138 = trunc nsw i32 %.1 to i16
  %139 = load ptr, ptr @maskedtexturecol, align 8, !tbaa !11
  %140 = sext i32 %135 to i64
  %141 = getelementptr inbounds i16, ptr %139, i64 %140
  store i16 %138, ptr %141, align 2, !tbaa !9
  br label %142

142:                                              ; preds = %134, %137, %64
  %143 = phi i32 [ %135, %134 ], [ %135, %137 ], [ %70, %64 ]
  %144 = load i32, ptr @rw_scalestep, align 4, !tbaa !5
  %145 = load i32, ptr @rw_scale, align 4, !tbaa !5
  %146 = add nsw i32 %145, %144
  store i32 %146, ptr @rw_scale, align 4, !tbaa !5
  %147 = load i32, ptr @topstep, align 4, !tbaa !5
  %148 = load i32, ptr @topfrac, align 4, !tbaa !5
  %149 = add nsw i32 %148, %147
  store i32 %149, ptr @topfrac, align 4, !tbaa !5
  %150 = load i32, ptr @bottomstep, align 4, !tbaa !5
  %151 = load i32, ptr @bottomfrac, align 4, !tbaa !5
  %152 = add nsw i32 %151, %150
  store i32 %152, ptr @bottomfrac, align 4, !tbaa !5
  %153 = add nsw i32 %143, 1
  store i32 %153, ptr @rw_x, align 4, !tbaa !5
  %154 = load i32, ptr @rw_stopx, align 4, !tbaa !5
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %142, %0
  ret void
}

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

; 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 = { 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 = { "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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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