; LLVM IR from Stephane-D/SGDK :: sample/fx/hilight-shadow/src (main)

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

@background_tileset = external dso_local constant [16 x i64], align 16
@sprite_tileset = external dso_local constant [16 x i64], align 16
@background_palette = external dso_local constant <{ i16, i16, i16, i16, i16, [11 x i16] }>, align 16

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i16, align 2
  %3 = alloca i16, align 2
  %4 = alloca i16, align 2
  %5 = alloca i16, align 2
  %6 = alloca [224 x i16], align 16
  %7 = alloca [224 x i16], align 16
  %8 = alloca [224 x i16], align 16
  %9 = alloca [40 x i16], align 16
  %10 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 2, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 448, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 448, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 448, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 80, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %11

11:                                               ; preds = %19, %0
  %12 = load i16, ptr %5, align 2, !tbaa !5
  %13 = zext i16 %12 to i32
  %14 = icmp slt i32 %13, 224
  br i1 %14, label %15, label %22

15:                                               ; preds = %11
  %16 = load i16, ptr %5, align 2, !tbaa !5
  %17 = zext i16 %16 to i64
  %18 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 %17
  store i16 0, ptr %18, align 2, !tbaa !5
  br label %19

19:                                               ; preds = %15
  %20 = load i16, ptr %5, align 2, !tbaa !5
  %21 = add i16 %20, 1
  store i16 %21, ptr %5, align 2, !tbaa !5
  br label %11, !llvm.loop !9

22:                                               ; preds = %11
  %23 = getelementptr inbounds [224 x i16], ptr %7, i64 0, i64 0
  store i16 3, ptr %23, align 16, !tbaa !5
  store i16 1, ptr %5, align 2, !tbaa !5
  br label %24

24:                                               ; preds = %41, %22
  %25 = load i16, ptr %5, align 2, !tbaa !5
  %26 = zext i16 %25 to i32
  %27 = icmp slt i32 %26, 224
  br i1 %27, label %28, label %44

28:                                               ; preds = %24
  %29 = load i16, ptr %5, align 2, !tbaa !5
  %30 = zext i16 %29 to i32
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [224 x i16], ptr %7, i64 0, i64 %32
  %34 = load i16, ptr %33, align 2, !tbaa !5
  %35 = sext i16 %34 to i32
  %36 = add nsw i32 %35, 1
  %37 = trunc i32 %36 to i16
  %38 = load i16, ptr %5, align 2, !tbaa !5
  %39 = zext i16 %38 to i64
  %40 = getelementptr inbounds [224 x i16], ptr %7, i64 0, i64 %39
  store i16 %37, ptr %40, align 2, !tbaa !5
  br label %41

41:                                               ; preds = %28
  %42 = load i16, ptr %5, align 2, !tbaa !5
  %43 = add i16 %42, 1
  store i16 %43, ptr %5, align 2, !tbaa !5
  br label %24, !llvm.loop !11

44:                                               ; preds = %24
  call void @VDP_resetSprites()
  %45 = getelementptr inbounds [40 x i16], ptr %9, i64 0, i64 0
  store ptr %45, ptr %10, align 8, !tbaa !12
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %46

46:                                               ; preds = %108, %44
  %47 = load i16, ptr %5, align 2, !tbaa !5
  %48 = zext i16 %47 to i32
  %49 = icmp slt i32 %48, 20
  br i1 %49, label %50, label %111

50:                                               ; preds = %46
  %51 = load i16, ptr %5, align 2, !tbaa !5
  %52 = zext i16 %51 to i32
  %53 = mul nsw i32 %52, 10
  %54 = add nsw i32 20, %53
  %55 = trunc i32 %54 to i16
  %56 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 %55, ptr %56, align 2, !tbaa !5
  %57 = load i16, ptr %5, align 2, !tbaa !5
  %58 = zext i16 %57 to i32
  %59 = mul nsw i32 %58, 2
  %60 = add nsw i32 %59, 0
  %61 = trunc i32 %60 to i16
  %62 = load ptr, ptr %10, align 8, !tbaa !12
  %63 = load i16, ptr %62, align 2, !tbaa !5
  %64 = load i16, ptr %5, align 2, !tbaa !5
  %65 = zext i16 %64 to i32
  %66 = mul nsw i32 %65, 8
  %67 = add nsw i32 20, %66
  %68 = trunc i32 %67 to i16
  %69 = load i16, ptr %5, align 2, !tbaa !5
  %70 = zext i16 %69 to i32
  %71 = mul nsw i32 %70, 2
  %72 = add nsw i32 %71, 1
  %73 = trunc i32 %72 to i8
  call void @VDP_setSpriteFull(i16 noundef zeroext %61, i16 noundef signext %63, i16 noundef signext %68, i8 noundef zeroext 0, i16 noundef zeroext 24594, i8 noundef zeroext %73)
  %74 = load ptr, ptr %10, align 8, !tbaa !12
  %75 = getelementptr inbounds i16, ptr %74, i32 1
  store ptr %75, ptr %10, align 8, !tbaa !12
  %76 = load i16, ptr %5, align 2, !tbaa !5
  %77 = zext i16 %76 to i32
  %78 = mul nsw i32 %77, 10
  %79 = sub nsw i32 300, %78
  %80 = trunc i32 %79 to i16
  %81 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 %80, ptr %81, align 2, !tbaa !5
  %82 = load i16, ptr %5, align 2, !tbaa !5
  %83 = zext i16 %82 to i32
  %84 = mul nsw i32 %83, 2
  %85 = add nsw i32 %84, 1
  %86 = trunc i32 %85 to i16
  %87 = load ptr, ptr %10, align 8, !tbaa !12
  %88 = load i16, ptr %87, align 2, !tbaa !5
  %89 = load i16, ptr %5, align 2, !tbaa !5
  %90 = zext i16 %89 to i32
  %91 = mul nsw i32 %90, 8
  %92 = add nsw i32 20, %91
  %93 = trunc i32 %92 to i16
  %94 = load i16, ptr %5, align 2, !tbaa !5
  %95 = zext i16 %94 to i32
  %96 = icmp eq i32 %95, 19
  br i1 %96, label %97, label %98

97:                                               ; preds = %50
  br label %103

98:                                               ; preds = %50
  %99 = load i16, ptr %5, align 2, !tbaa !5
  %100 = zext i16 %99 to i32
  %101 = mul nsw i32 %100, 2
  %102 = add nsw i32 %101, 2
  br label %103

103:                                              ; preds = %98, %97
  %104 = phi i32 [ 0, %97 ], [ %102, %98 ]
  %105 = trunc i32 %104 to i8
  call void @VDP_setSpriteFull(i16 noundef zeroext %86, i16 noundef signext %88, i16 noundef signext %93, i8 noundef zeroext 0, i16 noundef zeroext 24595, i8 noundef zeroext %105)
  %106 = load ptr, ptr %10, align 8, !tbaa !12
  %107 = getelementptr inbounds i16, ptr %106, i32 1
  store ptr %107, ptr %10, align 8, !tbaa !12
  br label %108

108:                                              ; preds = %103
  %109 = load i16, ptr %5, align 2, !tbaa !5
  %110 = add i16 %109, 1
  store i16 %110, ptr %5, align 2, !tbaa !5
  br label %46, !llvm.loop !14

111:                                              ; preds = %46
  call void @VDP_setScrollingMode(i16 noundef zeroext 3, i16 noundef zeroext 0)
  call void @VDP_setHilightShadow(i8 noundef zeroext 1)
  call void @PAL_setPalette(i16 noundef zeroext 0, ptr noundef @background_palette, i32 noundef 0)
  call void @VDP_loadTileData(ptr noundef @background_tileset, i16 noundef zeroext 16, i16 noundef zeroext 2, i32 noundef 1)
  call void @VDP_loadTileData(ptr noundef @sprite_tileset, i16 noundef zeroext 18, i16 noundef zeroext 2, i32 noundef 1)
  call void @VDP_updateSprites(i16 noundef zeroext 20, i32 noundef 1)
  store i16 0, ptr %2, align 2, !tbaa !5
  br label %112

112:                                              ; preds = %148, %111
  %113 = load i16, ptr %2, align 2, !tbaa !5
  %114 = zext i16 %113 to i32
  %115 = icmp slt i32 %114, 28
  br i1 %115, label %116, label %153

116:                                              ; preds = %112
  store i16 0, ptr %3, align 2, !tbaa !5
  br label %117

117:                                              ; preds = %142, %116
  %118 = load i16, ptr %3, align 2, !tbaa !5
  %119 = zext i16 %118 to i32
  %120 = icmp slt i32 %119, 40
  br i1 %120, label %121, label %147

121:                                              ; preds = %117
  %122 = load i16, ptr %3, align 2, !tbaa !5
  %123 = load i16, ptr %2, align 2, !tbaa !5
  call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 16, i16 noundef zeroext %122, i16 noundef zeroext %123)
  %124 = load i16, ptr %3, align 2, !tbaa !5
  %125 = zext i16 %124 to i32
  %126 = add nsw i32 %125, 1
  %127 = trunc i32 %126 to i16
  %128 = load i16, ptr %2, align 2, !tbaa !5
  call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 17, i16 noundef zeroext %127, i16 noundef zeroext %128)
  %129 = load i16, ptr %3, align 2, !tbaa !5
  %130 = load i16, ptr %2, align 2, !tbaa !5
  %131 = zext i16 %130 to i32
  %132 = add nsw i32 %131, 1
  %133 = trunc i32 %132 to i16
  call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 17, i16 noundef zeroext %129, i16 noundef zeroext %133)
  %134 = load i16, ptr %3, align 2, !tbaa !5
  %135 = zext i16 %134 to i32
  %136 = add nsw i32 %135, 1
  %137 = trunc i32 %136 to i16
  %138 = load i16, ptr %2, align 2, !tbaa !5
  %139 = zext i16 %138 to i32
  %140 = add nsw i32 %139, 1
  %141 = trunc i32 %140 to i16
  call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 16, i16 noundef zeroext %137, i16 noundef zeroext %141)
  br label %142

142:                                              ; preds = %121
  %143 = load i16, ptr %3, align 2, !tbaa !5
  %144 = zext i16 %143 to i32
  %145 = add nsw i32 %144, 2
  %146 = trunc i32 %145 to i16
  store i16 %146, ptr %3, align 2, !tbaa !5
  br label %117, !llvm.loop !15

147:                                              ; preds = %117
  br label %148

148:                                              ; preds = %147
  %149 = load i16, ptr %2, align 2, !tbaa !5
  %150 = zext i16 %149 to i32
  %151 = add nsw i32 %150, 2
  %152 = trunc i32 %151 to i16
  store i16 %152, ptr %2, align 2, !tbaa !5
  br label %112, !llvm.loop !16

153:                                              ; preds = %112
  store i16 0, ptr %2, align 2, !tbaa !5
  br label %154

154:                                              ; preds = %192, %153
  %155 = load i16, ptr %2, align 2, !tbaa !5
  %156 = zext i16 %155 to i32
  %157 = icmp slt i32 %156, 28
  br i1 %157, label %158, label %195

158:                                              ; preds = %154
  store i16 0, ptr %3, align 2, !tbaa !5
  br label %159

159:                                              ; preds = %188, %158
  %160 = load i16, ptr %3, align 2, !tbaa !5
  %161 = zext i16 %160 to i32
  %162 = icmp slt i32 %161, 5
  br i1 %162, label %163, label %191

163:                                              ; preds = %159
  store i16 0, ptr %4, align 2, !tbaa !5
  br label %164

164:                                              ; preds = %184, %163
  %165 = load i16, ptr %4, align 2, !tbaa !5
  %166 = zext i16 %165 to i32
  %167 = icmp slt i32 %166, 8
  br i1 %167, label %168, label %187

168:                                              ; preds = %164
  %169 = load i16, ptr %3, align 2, !tbaa !5
  %170 = zext i16 %169 to i32
  %171 = srem i32 %170, 2
  %172 = shl i32 %171, 15
  %173 = add nsw i32 0, %172
  %174 = add nsw i32 %173, 0
  %175 = trunc i32 %174 to i16
  %176 = load i16, ptr %3, align 2, !tbaa !5
  %177 = zext i16 %176 to i32
  %178 = mul nsw i32 %177, 8
  %179 = load i16, ptr %4, align 2, !tbaa !5
  %180 = zext i16 %179 to i32
  %181 = add nsw i32 %178, %180
  %182 = trunc i32 %181 to i16
  %183 = load i16, ptr %2, align 2, !tbaa !5
  call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext %175, i16 noundef zeroext %182, i16 noundef zeroext %183)
  br label %184

184:                                              ; preds = %168
  %185 = load i16, ptr %4, align 2, !tbaa !5
  %186 = add i16 %185, 1
  store i16 %186, ptr %4, align 2, !tbaa !5
  br label %164, !llvm.loop !17

187:                                              ; preds = %164
  br label %188

188:                                              ; preds = %187
  %189 = load i16, ptr %3, align 2, !tbaa !5
  %190 = add i16 %189, 1
  store i16 %190, ptr %3, align 2, !tbaa !5
  br label %159, !llvm.loop !18

191:                                              ; preds = %159
  br label %192

192:                                              ; preds = %191
  %193 = load i16, ptr %2, align 2, !tbaa !5
  %194 = add i16 %193, 1
  store i16 %194, ptr %2, align 2, !tbaa !5
  br label %154, !llvm.loop !19

195:                                              ; preds = %154
  br label %196

196:                                              ; preds = %319, %195
  br label %197

197:                                              ; preds = %196
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %198

198:                                              ; preds = %244, %197
  %199 = load i16, ptr %5, align 2, !tbaa !5
  %200 = zext i16 %199 to i32
  %201 = icmp slt i32 %200, 224
  br i1 %201, label %202, label %247

202:                                              ; preds = %198
  %203 = load i16, ptr %5, align 2, !tbaa !5
  %204 = zext i16 %203 to i64
  %205 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 %204
  %206 = load i16, ptr %205, align 2, !tbaa !5
  %207 = sext i16 %206 to i32
  %208 = load i16, ptr %5, align 2, !tbaa !5
  %209 = zext i16 %208 to i64
  %210 = getelementptr inbounds [224 x i16], ptr %7, i64 0, i64 %209
  %211 = load i16, ptr %210, align 2, !tbaa !5
  %212 = sext i16 %211 to i32
  %213 = add nsw i32 %207, %212
  %214 = trunc i32 %213 to i16
  %215 = load i16, ptr %5, align 2, !tbaa !5
  %216 = zext i16 %215 to i64
  %217 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 %216
  store i16 %214, ptr %217, align 2, !tbaa !5
  %218 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 223
  %219 = load i16, ptr %218, align 2, !tbaa !5
  %220 = sext i16 %219 to i32
  %221 = icmp sge i32 %220, 3200
  br i1 %221, label %227, label %222

222:                                              ; preds = %202
  %223 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 223
  %224 = load i16, ptr %223, align 2, !tbaa !5
  %225 = sext i16 %224 to i32
  %226 = icmp sle i32 %225, -3200
  br i1 %226, label %227, label %235

227:                                              ; preds = %222, %202
  %228 = load i16, ptr %5, align 2, !tbaa !5
  %229 = zext i16 %228 to i64
  %230 = getelementptr inbounds [224 x i16], ptr %7, i64 0, i64 %229
  %231 = load i16, ptr %230, align 2, !tbaa !5
  %232 = sext i16 %231 to i32
  %233 = mul nsw i32 %232, -1
  %234 = trunc i32 %233 to i16
  store i16 %234, ptr %230, align 2, !tbaa !5
  br label %235

235:                                              ; preds = %227, %222
  %236 = load i16, ptr %5, align 2, !tbaa !5
  %237 = zext i16 %236 to i64
  %238 = getelementptr inbounds [224 x i16], ptr %6, i64 0, i64 %237
  %239 = load i16, ptr %238, align 2, !tbaa !5
  %240 = call signext i16 @F16_toInt(i16 noundef signext %239)
  %241 = load i16, ptr %5, align 2, !tbaa !5
  %242 = zext i16 %241 to i64
  %243 = getelementptr inbounds [224 x i16], ptr %8, i64 0, i64 %242
  store i16 %240, ptr %243, align 2, !tbaa !5
  br label %244

244:                                              ; preds = %235
  %245 = load i16, ptr %5, align 2, !tbaa !5
  %246 = add i16 %245, 1
  store i16 %246, ptr %5, align 2, !tbaa !5
  br label %198, !llvm.loop !20

247:                                              ; preds = %198
  %248 = getelementptr inbounds [40 x i16], ptr %9, i64 0, i64 0
  store ptr %248, ptr %10, align 8, !tbaa !12
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %249

249:                                              ; preds = %316, %247
  %250 = load i16, ptr %5, align 2, !tbaa !5
  %251 = zext i16 %250 to i32
  %252 = icmp slt i32 %251, 20
  br i1 %252, label %253, label %319

253:                                              ; preds = %249
  %254 = load ptr, ptr %10, align 8, !tbaa !12
  %255 = load i16, ptr %254, align 2, !tbaa !5
  %256 = sext i16 %255 to i32
  %257 = load i16, ptr %5, align 2, !tbaa !5
  %258 = zext i16 %257 to i32
  %259 = ashr i32 %258, 2
  %260 = add nsw i32 1, %259
  %261 = add nsw i32 %256, %260
  %262 = trunc i32 %261 to i16
  %263 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 %262, ptr %263, align 2, !tbaa !5
  %264 = load ptr, ptr %10, align 8, !tbaa !12
  %265 = load i16, ptr %264, align 2, !tbaa !5
  %266 = sext i16 %265 to i32
  %267 = icmp sgt i32 %266, 300
  br i1 %267, label %268, label %270

268:                                              ; preds = %253
  %269 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 20, ptr %269, align 2, !tbaa !5
  br label %270

270:                                              ; preds = %268, %253
  %271 = load i16, ptr %5, align 2, !tbaa !5
  %272 = zext i16 %271 to i32
  %273 = mul nsw i32 %272, 2
  %274 = add nsw i32 %273, 0
  %275 = trunc i32 %274 to i16
  %276 = load ptr, ptr %10, align 8, !tbaa !12
  %277 = load i16, ptr %276, align 2, !tbaa !5
  %278 = load i16, ptr %5, align 2, !tbaa !5
  %279 = zext i16 %278 to i32
  %280 = mul nsw i32 %279, 8
  %281 = add nsw i32 20, %280
  %282 = trunc i32 %281 to i16
  call void @VDP_setSpritePosition(i16 noundef zeroext %275, i16 noundef signext %277, i16 noundef signext %282)
  %283 = load ptr, ptr %10, align 8, !tbaa !12
  %284 = getelementptr inbounds i16, ptr %283, i32 1
  store ptr %284, ptr %10, align 8, !tbaa !12
  %285 = load ptr, ptr %10, align 8, !tbaa !12
  %286 = load i16, ptr %285, align 2, !tbaa !5
  %287 = sext i16 %286 to i32
  %288 = load i16, ptr %5, align 2, !tbaa !5
  %289 = zext i16 %288 to i32
  %290 = ashr i32 %289, 2
  %291 = add nsw i32 1, %290
  %292 = sub nsw i32 %287, %291
  %293 = trunc i32 %292 to i16
  %294 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 %293, ptr %294, align 2, !tbaa !5
  %295 = load ptr, ptr %10, align 8, !tbaa !12
  %296 = load i16, ptr %295, align 2, !tbaa !5
  %297 = sext i16 %296 to i32
  %298 = icmp slt i32 %297, 20
  br i1 %298, label %299, label %301

299:                                              ; preds = %270
  %300 = load ptr, ptr %10, align 8, !tbaa !12
  store i16 300, ptr %300, align 2, !tbaa !5
  br label %301

301:                                              ; preds = %299, %270
  %302 = load i16, ptr %5, align 2, !tbaa !5
  %303 = zext i16 %302 to i32
  %304 = mul nsw i32 %303, 2
  %305 = add nsw i32 %304, 1
  %306 = trunc i32 %305 to i16
  %307 = load ptr, ptr %10, align 8, !tbaa !12
  %308 = load i16, ptr %307, align 2, !tbaa !5
  %309 = load i16, ptr %5, align 2, !tbaa !5
  %310 = zext i16 %309 to i32
  %311 = mul nsw i32 %310, 8
  %312 = add nsw i32 20, %311
  %313 = trunc i32 %312 to i16
  call void @VDP_setSpritePosition(i16 noundef zeroext %306, i16 noundef signext %308, i16 noundef signext %313)
  %314 = load ptr, ptr %10, align 8, !tbaa !12
  %315 = getelementptr inbounds i16, ptr %314, i32 1
  store ptr %315, ptr %10, align 8, !tbaa !12
  br label %316

316:                                              ; preds = %301
  %317 = load i16, ptr %5, align 2, !tbaa !5
  %318 = add i16 %317, 1
  store i16 %318, ptr %5, align 2, !tbaa !5
  br label %249, !llvm.loop !21

319:                                              ; preds = %249
  call void @VDP_updateSprites(i16 noundef zeroext 20, i32 noundef 1)
  %320 = call zeroext i8 @SYS_doVBlankProcess()
  %321 = getelementptr inbounds [224 x i16], ptr %8, i64 0, i64 0
  call void @VDP_setHorizontalScrollLine(i32 noundef 0, i16 noundef zeroext 0, ptr noundef %321, i16 noundef zeroext 224, i32 noundef 1)
  br label %196
}

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

declare void @VDP_resetSprites() #2

declare void @VDP_setSpriteFull(i16 noundef zeroext, i16 noundef signext, i16 noundef signext, i8 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) #2

declare void @VDP_setScrollingMode(i16 noundef zeroext, i16 noundef zeroext) #2

declare void @VDP_setHilightShadow(i8 noundef zeroext) #2

declare void @PAL_setPalette(i16 noundef zeroext, ptr noundef, i32 noundef) #2

declare void @VDP_loadTileData(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i32 noundef) #2

declare void @VDP_updateSprites(i16 noundef zeroext, i32 noundef) #2

declare void @VDP_setTileMapXY(i32 noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) #2

declare signext i16 @F16_toInt(i16 noundef signext) #2

declare void @VDP_setSpritePosition(i16 noundef zeroext, i16 noundef signext, i16 noundef signext) #2

declare zeroext i8 @SYS_doVBlankProcess() #2

declare void @VDP_setHorizontalScrollLine(i32 noundef, i16 noundef zeroext, ptr noundef, i16 noundef zeroext, i32 noundef) #2

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

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


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

@background_tileset = external dso_local constant [16 x i64], align 16
@sprite_tileset = external dso_local constant [16 x i64], align 16
@background_palette = external dso_local constant <{ i16, i16, i16, i16, i16, [11 x i16] }>, align 16

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
vector.ph:
  %0 = alloca [224 x i16], align 16
  %1 = alloca [224 x i16], align 16
  %2 = alloca [224 x i16], align 16
  %3 = alloca [40 x i16], align 16
  call void @llvm.lifetime.start.p0(i64 448, ptr nonnull %0) #4
  call void @llvm.lifetime.start.p0(i64 448, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 448, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(448) %0, i8 0, i64 448, i1 false), !tbaa !5
  store i16 3, ptr %1, align 16, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 2
  %5 = getelementptr inbounds i8, ptr %1, i64 18
  store <8 x i16> <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11>, ptr %4, align 2, !tbaa !5
  store <8 x i16> <i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>, ptr %5, align 2, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 34
  %7 = getelementptr inbounds i8, ptr %1, i64 50
  store <8 x i16> <i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27>, ptr %6, align 2, !tbaa !5
  store <8 x i16> <i16 28, i16 29, i16 30, i16 31, i16 32, i16 33, i16 34, i16 35>, ptr %7, align 2, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 66
  %9 = getelementptr inbounds i8, ptr %1, i64 82
  store <8 x i16> <i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43>, ptr %8, align 2, !tbaa !5
  store <8 x i16> <i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51>, ptr %9, align 2, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 98
  %11 = getelementptr inbounds i8, ptr %1, i64 114
  store <8 x i16> <i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59>, ptr %10, align 2, !tbaa !5
  store <8 x i16> <i16 60, i16 61, i16 62, i16 63, i16 64, i16 65, i16 66, i16 67>, ptr %11, align 2, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 130
  %13 = getelementptr inbounds i8, ptr %1, i64 146
  store <8 x i16> <i16 68, i16 69, i16 70, i16 71, i16 72, i16 73, i16 74, i16 75>, ptr %12, align 2, !tbaa !5
  store <8 x i16> <i16 76, i16 77, i16 78, i16 79, i16 80, i16 81, i16 82, i16 83>, ptr %13, align 2, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 162
  %15 = getelementptr inbounds i8, ptr %1, i64 178
  store <8 x i16> <i16 84, i16 85, i16 86, i16 87, i16 88, i16 89, i16 90, i16 91>, ptr %14, align 2, !tbaa !5
  store <8 x i16> <i16 92, i16 93, i16 94, i16 95, i16 96, i16 97, i16 98, i16 99>, ptr %15, align 2, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 194
  %17 = getelementptr inbounds i8, ptr %1, i64 210
  store <8 x i16> <i16 100, i16 101, i16 102, i16 103, i16 104, i16 105, i16 106, i16 107>, ptr %16, align 2, !tbaa !5
  store <8 x i16> <i16 108, i16 109, i16 110, i16 111, i16 112, i16 113, i16 114, i16 115>, ptr %17, align 2, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %1, i64 226
  %19 = getelementptr inbounds i8, ptr %1, i64 242
  store <8 x i16> <i16 116, i16 117, i16 118, i16 119, i16 120, i16 121, i16 122, i16 123>, ptr %18, align 2, !tbaa !5
  store <8 x i16> <i16 124, i16 125, i16 126, i16 127, i16 128, i16 129, i16 130, i16 131>, ptr %19, align 2, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %1, i64 258
  %21 = getelementptr inbounds i8, ptr %1, i64 274
  store <8 x i16> <i16 132, i16 133, i16 134, i16 135, i16 136, i16 137, i16 138, i16 139>, ptr %20, align 2, !tbaa !5
  store <8 x i16> <i16 140, i16 141, i16 142, i16 143, i16 144, i16 145, i16 146, i16 147>, ptr %21, align 2, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %1, i64 290
  %23 = getelementptr inbounds i8, ptr %1, i64 306
  store <8 x i16> <i16 148, i16 149, i16 150, i16 151, i16 152, i16 153, i16 154, i16 155>, ptr %22, align 2, !tbaa !5
  store <8 x i16> <i16 156, i16 157, i16 158, i16 159, i16 160, i16 161, i16 162, i16 163>, ptr %23, align 2, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 322
  %25 = getelementptr inbounds i8, ptr %1, i64 338
  store <8 x i16> <i16 164, i16 165, i16 166, i16 167, i16 168, i16 169, i16 170, i16 171>, ptr %24, align 2, !tbaa !5
  store <8 x i16> <i16 172, i16 173, i16 174, i16 175, i16 176, i16 177, i16 178, i16 179>, ptr %25, align 2, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %1, i64 354
  %27 = getelementptr inbounds i8, ptr %1, i64 370
  store <8 x i16> <i16 180, i16 181, i16 182, i16 183, i16 184, i16 185, i16 186, i16 187>, ptr %26, align 2, !tbaa !5
  store <8 x i16> <i16 188, i16 189, i16 190, i16 191, i16 192, i16 193, i16 194, i16 195>, ptr %27, align 2, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %1, i64 386
  %29 = getelementptr inbounds i8, ptr %1, i64 402
  store <8 x i16> <i16 196, i16 197, i16 198, i16 199, i16 200, i16 201, i16 202, i16 203>, ptr %28, align 2, !tbaa !5
  store <8 x i16> <i16 204, i16 205, i16 206, i16 207, i16 208, i16 209, i16 210, i16 211>, ptr %29, align 2, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %1, i64 418
  store i16 212, ptr %30, align 2, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %1, i64 420
  store i16 213, ptr %31, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %1, i64 422
  store i16 214, ptr %32, align 2, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %1, i64 424
  store i16 215, ptr %33, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %1, i64 426
  store i16 216, ptr %34, align 2, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %1, i64 428
  store i16 217, ptr %35, align 4, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %1, i64 430
  store i16 218, ptr %36, align 2, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 432
  store i16 219, ptr %37, align 16, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %1, i64 434
  store i16 220, ptr %38, align 2, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %1, i64 436
  store i16 221, ptr %39, align 4, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %1, i64 438
  store i16 222, ptr %40, align 2, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %1, i64 440
  store i16 223, ptr %41, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %1, i64 442
  store i16 224, ptr %42, align 2, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %1, i64 444
  store i16 225, ptr %43, align 4, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %1, i64 446
  store i16 226, ptr %44, align 2, !tbaa !5
  tail call void @VDP_resetSprites() #4
  br label %45

45:                                               ; preds = %vector.ph, %45
  %.099 = phi ptr [ %3, %vector.ph ], [ %59, %45 ]
  %.298 = phi i16 [ 0, %vector.ph ], [ %60, %45 ]
  %46 = mul nuw nsw i16 %.298, 10
  %47 = add nuw nsw i16 %46, 20
  store i16 %47, ptr %.099, align 2, !tbaa !5
  %48 = shl nuw nsw i16 %.298, 1
  %49 = shl nuw nsw i16 %.298, 3
  %50 = add nuw nsw i16 %49, 20
  %51 = or disjoint i16 %48, 1
  %52 = trunc nuw i16 %51 to i8
  tail call void @VDP_setSpriteFull(i16 noundef zeroext %48, i16 noundef signext %47, i16 noundef signext %50, i8 noundef zeroext 0, i16 noundef zeroext 24594, i8 noundef zeroext %52) #4
  %53 = getelementptr inbounds i8, ptr %.099, i64 2
  %54 = sub nuw nsw i16 300, %46
  store i16 %54, ptr %53, align 2, !tbaa !5
  %55 = icmp eq i16 %.298, 19
  %56 = trunc nuw i16 %48 to i8
  %57 = add nuw nsw i8 %56, 2
  %58 = select i1 %55, i8 0, i8 %57
  tail call void @VDP_setSpriteFull(i16 noundef zeroext %51, i16 noundef signext %54, i16 noundef signext %50, i8 noundef zeroext 0, i16 noundef zeroext 24595, i8 noundef zeroext %58) #4
  %59 = getelementptr inbounds i8, ptr %.099, i64 4
  %60 = add nuw nsw i16 %.298, 1
  %exitcond110.not = icmp eq i16 %60, 20
  br i1 %exitcond110.not, label %61, label %45, !llvm.loop !9

61:                                               ; preds = %45
  tail call void @VDP_setScrollingMode(i16 noundef zeroext 3, i16 noundef zeroext 0) #4
  tail call void @VDP_setHilightShadow(i8 noundef zeroext 1) #4
  tail call void @PAL_setPalette(i16 noundef zeroext 0, ptr noundef nonnull @background_palette, i32 noundef 0) #4
  tail call void @VDP_loadTileData(ptr noundef nonnull @background_tileset, i16 noundef zeroext 16, i16 noundef zeroext 2, i32 noundef 1) #4
  tail call void @VDP_loadTileData(ptr noundef nonnull @sprite_tileset, i16 noundef zeroext 18, i16 noundef zeroext 2, i32 noundef 1) #4
  tail call void @VDP_updateSprites(i16 noundef zeroext 20, i32 noundef 1) #4
  br label %.preheader95

.preheader95:                                     ; preds = %61, %66
  %.081101 = phi i16 [ 0, %61 ], [ %67, %66 ]
  %62 = or disjoint i16 %.081101, 1
  br label %63

63:                                               ; preds = %.preheader95, %63
  %.079100 = phi i16 [ 0, %.preheader95 ], [ %narrow, %63 ]
  tail call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 16, i16 noundef zeroext %.079100, i16 noundef zeroext %.081101) #4
  %64 = or disjoint i16 %.079100, 1
  tail call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 17, i16 noundef zeroext %64, i16 noundef zeroext %.081101) #4
  tail call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 17, i16 noundef zeroext %.079100, i16 noundef zeroext %62) #4
  tail call void @VDP_setTileMapXY(i32 noundef 1, i16 noundef zeroext 16, i16 noundef zeroext %64, i16 noundef zeroext %62) #4
  %narrow = add nuw nsw i16 %.079100, 2
  %65 = icmp ult i16 %.079100, 38
  br i1 %65, label %63, label %66, !llvm.loop !11

66:                                               ; preds = %63
  %67 = add nuw nsw i16 %.081101, 2
  %68 = icmp ult i16 %.081101, 26
  br i1 %68, label %.preheader95, label %.preheader93, !llvm.loop !12

.preheader93:                                     ; preds = %66, %.preheader93
  %.182104 = phi i16 [ %69, %.preheader93 ], [ 0, %66 ]
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 0, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 1, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 2, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 3, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 4, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 5, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 6, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 7, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 8, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 9, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 10, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 11, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 12, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 13, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 14, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 15, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 16, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 17, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 18, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 19, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 20, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 21, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 22, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 23, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 24, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 25, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 26, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 27, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 28, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 29, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 30, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext -32768, i16 noundef zeroext 31, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 32, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 33, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 34, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 35, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 36, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 37, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 38, i16 noundef zeroext %.182104) #4
  tail call void @VDP_setTileMapXY(i32 noundef 0, i16 noundef zeroext 0, i16 noundef zeroext 39, i16 noundef zeroext %.182104) #4
  %69 = add nuw nsw i16 %.182104, 1
  %exitcond113.not = icmp eq i16 %69, 28
  br i1 %exitcond113.not, label %.preheader91, label %.preheader93, !llvm.loop !13

.preheader91:                                     ; preds = %.preheader93
  %70 = getelementptr inbounds i8, ptr %0, i64 446
  br label %71

71:                                               ; preds = %.backedge, %.preheader91
  %indvars.iv114 = phi i64 [ 0, %.preheader91 ], [ %indvars.iv114.be, %.backedge ]
  %72 = getelementptr inbounds [224 x i16], ptr %0, i64 0, i64 %indvars.iv114
  %73 = load i16, ptr %72, align 2, !tbaa !5
  %74 = getelementptr inbounds [224 x i16], ptr %1, i64 0, i64 %indvars.iv114
  %75 = load i16, ptr %74, align 2, !tbaa !5
  %76 = add i16 %75, %73
  store i16 %76, ptr %72, align 2, !tbaa !5
  %77 = load i16, ptr %70, align 2
  %78 = add i16 %77, -3200
  %or.cond = icmp ult i16 %78, -6399
  br i1 %or.cond, label %79, label %81

79:                                               ; preds = %71
  %80 = sub i16 0, %75
  store i16 %80, ptr %74, align 2, !tbaa !5
  br label %81

81:                                               ; preds = %71, %79
  %82 = call signext i16 @F16_toInt(i16 noundef signext %76) #4
  %83 = getelementptr inbounds [224 x i16], ptr %2, i64 0, i64 %indvars.iv114
  store i16 %82, ptr %83, align 2, !tbaa !5
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next115, 224
  br i1 %exitcond117.not, label %.preheader, label %.backedge

.backedge:                                        ; preds = %81, %99
  %indvars.iv114.be = phi i64 [ %indvars.iv.next115, %81 ], [ 0, %99 ]
  br label %71, !llvm.loop !14

.preheader:                                       ; preds = %81, %.preheader
  %.1107 = phi ptr [ %97, %.preheader ], [ %3, %81 ]
  %.4106 = phi i16 [ %98, %.preheader ], [ 0, %81 ]
  %84 = load i16, ptr %.1107, align 2, !tbaa !5
  %85 = lshr i16 %.4106, 2
  %86 = add nuw nsw i16 %85, 1
  %87 = add i16 %84, %86
  %88 = icmp sgt i16 %87, 300
  %spec.select = select i1 %88, i16 20, i16 %87
  store i16 %spec.select, ptr %.1107, align 2, !tbaa !5
  %89 = shl nuw nsw i16 %.4106, 1
  %90 = shl nuw nsw i16 %.4106, 3
  %91 = add nuw nsw i16 %90, 20
  call void @VDP_setSpritePosition(i16 noundef zeroext %89, i16 noundef signext %spec.select, i16 noundef signext %91) #4
  %92 = getelementptr inbounds i8, ptr %.1107, i64 2
  %93 = load i16, ptr %92, align 2, !tbaa !5
  %94 = sub i16 %93, %86
  %95 = icmp slt i16 %94, 20
  %storemerge90 = select i1 %95, i16 300, i16 %94
  store i16 %storemerge90, ptr %92, align 2, !tbaa !5
  %96 = or disjoint i16 %89, 1
  call void @VDP_setSpritePosition(i16 noundef zeroext %96, i16 noundef signext %storemerge90, i16 noundef signext %91) #4
  %97 = getelementptr inbounds i8, ptr %.1107, i64 4
  %98 = add nuw nsw i16 %.4106, 1
  %exitcond118.not = icmp eq i16 %98, 20
  br i1 %exitcond118.not, label %99, label %.preheader, !llvm.loop !15

99:                                               ; preds = %.preheader
  call void @VDP_updateSprites(i16 noundef zeroext 20, i32 noundef 1) #4
  %100 = call zeroext i8 @SYS_doVBlankProcess() #4
  call void @VDP_setHorizontalScrollLine(i32 noundef 0, i16 noundef zeroext 0, ptr noundef nonnull %2, i16 noundef zeroext 224, i32 noundef 1) #4
  br label %.backedge
}

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

declare void @VDP_resetSprites() local_unnamed_addr #2

declare void @VDP_setSpriteFull(i16 noundef zeroext, i16 noundef signext, i16 noundef signext, i8 noundef zeroext, i16 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2

declare void @VDP_setScrollingMode(i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

declare void @VDP_setHilightShadow(i8 noundef zeroext) local_unnamed_addr #2

declare void @PAL_setPalette(i16 noundef zeroext, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @VDP_loadTileData(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

declare void @VDP_updateSprites(i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

declare void @VDP_setTileMapXY(i32 noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

declare signext i16 @F16_toInt(i16 noundef signext) local_unnamed_addr #2

declare void @VDP_setSpritePosition(i16 noundef zeroext, i16 noundef signext, i16 noundef signext) local_unnamed_addr #2

declare zeroext i8 @SYS_doVBlankProcess() local_unnamed_addr #2

declare void @VDP_setHorizontalScrollLine(i32 noundef, i16 noundef zeroext, ptr noundef, i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { noreturn 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass