; LLVM IR from Stephane-D/SGDK :: src (joy)

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

@gport = external hidden global i16, align 2
@portType = external hidden global [2 x i8], align 1
@portSupport = external hidden global [2 x i8], align 1
@joyType = external hidden global [8 x i8], align 1
@joyState = external hidden global [8 x i16], align 16
@joyAxisX = external hidden global [8 x i16], align 16
@joyAxisY = external hidden global [8 x i16], align 16

; Function Attrs: noinline nounwind uwtable
define dso_local void @JOY_reset() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i8, align 1
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i16, align 2
  %6 = alloca i16, align 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #3
  store i16 -1, ptr @gport, align 2, !tbaa !5
  call void @SYS_disableInts()
  %7 = call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1)
  %8 = zext i8 %7 to i16
  store i16 %8, ptr %6, align 2, !tbaa !5
  store ptr inttoptr (i64 10551305 to ptr), ptr %1, align 8, !tbaa !9
  %9 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %9, align 1, !tbaa !11
  store ptr inttoptr (i64 10551307 to ptr), ptr %1, align 8, !tbaa !9
  %10 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 127, ptr %10, align 1, !tbaa !11
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %11 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %11, align 1, !tbaa !11
  store ptr inttoptr (i64 10551301 to ptr), ptr %1, align 8, !tbaa !9
  %12 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 12, ptr %12, align 1, !tbaa !11
  call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !12
  call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !13
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %13 = load ptr, ptr %1, align 8, !tbaa !9
  %14 = load volatile i8, ptr %13, align 1, !tbaa !11
  %15 = zext i8 %14 to i32
  %16 = and i32 %15, 3
  %17 = trunc i32 %16 to i8
  store i8 %17, ptr %2, align 1, !tbaa !11
  store ptr inttoptr (i64 10551301 to ptr), ptr %1, align 8, !tbaa !9
  %18 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 124, ptr %18, align 1, !tbaa !11
  call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !14
  call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !15
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %19 = load ptr, ptr %1, align 8, !tbaa !9
  %20 = load volatile i8, ptr %19, align 1, !tbaa !11
  %21 = zext i8 %20 to i32
  %22 = and i32 %21, 3
  %23 = trunc i32 %22 to i8
  store i8 %23, ptr %3, align 1, !tbaa !11
  %24 = load i16, ptr %6, align 2, !tbaa !5
  %25 = icmp ne i16 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %0
  call void @Z80_releaseBus()
  br label %27

27:                                               ; preds = %26, %0
  %28 = load i8, ptr %2, align 1, !tbaa !11
  %29 = zext i8 %28 to i32
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %57

31:                                               ; preds = %27
  %32 = load i8, ptr %3, align 1, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %57

35:                                               ; preds = %31
  store i8 16, ptr @portType, align 1, !tbaa !11
  store i8 16, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  store i8 6, ptr @portSupport, align 1, !tbaa !11
  store i8 0, ptr getelementptr inbounds ([2 x i8], ptr @portSupport, i64 0, i64 1), align 1, !tbaa !11
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %36

36:                                               ; preds = %53, %35
  %37 = load i16, ptr %5, align 2, !tbaa !5
  %38 = zext i16 %37 to i32
  %39 = icmp slt i32 %38, 8
  br i1 %39, label %40, label %56

40:                                               ; preds = %36
  %41 = load i16, ptr %5, align 2, !tbaa !5
  %42 = zext i16 %41 to i64
  %43 = getelementptr inbounds [8 x i8], ptr @joyType, i64 0, i64 %42
  store volatile i8 15, ptr %43, align 1, !tbaa !11
  %44 = load i16, ptr %5, align 2, !tbaa !5
  %45 = zext i16 %44 to i64
  %46 = getelementptr inbounds [8 x i16], ptr @joyState, i64 0, i64 %45
  store volatile i16 0, ptr %46, align 2, !tbaa !5
  %47 = load i16, ptr %5, align 2, !tbaa !5
  %48 = zext i16 %47 to i64
  %49 = getelementptr inbounds [8 x i16], ptr @joyAxisX, i64 0, i64 %48
  store volatile i16 0, ptr %49, align 2, !tbaa !5
  %50 = load i16, ptr %5, align 2, !tbaa !5
  %51 = zext i16 %50 to i64
  %52 = getelementptr inbounds [8 x i16], ptr @joyAxisY, i64 0, i64 %51
  store volatile i16 0, ptr %52, align 2, !tbaa !5
  br label %53

53:                                               ; preds = %40
  %54 = load i16, ptr %5, align 2, !tbaa !5
  %55 = add i16 %54, 1
  store i16 %55, ptr %5, align 2, !tbaa !5
  br label %36, !llvm.loop !16

56:                                               ; preds = %36
  br label %285

57:                                               ; preds = %31, %27
  %58 = call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1)
  %59 = zext i8 %58 to i16
  store i16 %59, ptr %6, align 2, !tbaa !5
  store ptr inttoptr (i64 10551305 to ptr), ptr %1, align 8, !tbaa !9
  %60 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %60, align 1, !tbaa !11
  %61 = load ptr, ptr %1, align 8, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %61, i64 2
  store ptr %62, ptr %1, align 8, !tbaa !9
  %63 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %63, align 1, !tbaa !11
  %64 = load ptr, ptr %1, align 8, !tbaa !9
  %65 = getelementptr inbounds i8, ptr %64, i64 2
  store ptr %65, ptr %1, align 8, !tbaa !9
  %66 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %66, align 1, !tbaa !11
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %67 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %67, align 1, !tbaa !11
  %68 = load ptr, ptr %1, align 8, !tbaa !9
  %69 = getelementptr inbounds i8, ptr %68, i64 2
  store ptr %69, ptr %1, align 8, !tbaa !9
  %70 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %70, align 1, !tbaa !11
  %71 = load ptr, ptr %1, align 8, !tbaa !9
  %72 = getelementptr inbounds i8, ptr %71, i64 2
  store ptr %72, ptr %1, align 8, !tbaa !9
  %73 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %73, align 1, !tbaa !11
  %74 = load i16, ptr %6, align 2, !tbaa !5
  %75 = icmp ne i16 %74, 0
  br i1 %75, label %77, label %76

76:                                               ; preds = %57
  call void @Z80_releaseBus()
  br label %77

77:                                               ; preds = %76, %57
  %78 = call zeroext i8 @VDP_waitVSync()
  %79 = call zeroext i8 @VDP_waitVSync()
  %80 = call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1)
  %81 = zext i8 %80 to i16
  store i16 %81, ptr %6, align 2, !tbaa !5
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %82 = load ptr, ptr %1, align 8, !tbaa !9
  %83 = load volatile i8, ptr %82, align 1, !tbaa !11
  store i8 %83, ptr %2, align 1, !tbaa !11
  %84 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 0, ptr %84, align 1, !tbaa !11
  %85 = load i8, ptr %2, align 1, !tbaa !11
  %86 = zext i8 %85 to i32
  %87 = and i32 %86, 8
  %88 = load i8, ptr %2, align 1, !tbaa !11
  %89 = zext i8 %88 to i32
  %90 = and i32 %89, 4
  %91 = or i32 %87, %90
  %92 = icmp ne i32 %91, 0
  %93 = zext i1 %92 to i64
  %94 = select i1 %92, i32 8, i32 0
  %95 = trunc i32 %94 to i8
  store i8 %95, ptr %4, align 1, !tbaa !11
  %96 = load i8, ptr %2, align 1, !tbaa !11
  %97 = zext i8 %96 to i32
  %98 = and i32 %97, 2
  %99 = load i8, ptr %2, align 1, !tbaa !11
  %100 = zext i8 %99 to i32
  %101 = and i32 %100, 1
  %102 = or i32 %98, %101
  %103 = icmp ne i32 %102, 0
  %104 = zext i1 %103 to i64
  %105 = select i1 %103, i32 4, i32 0
  %106 = load i8, ptr %4, align 1, !tbaa !11
  %107 = zext i8 %106 to i32
  %108 = or i32 %107, %105
  %109 = trunc i32 %108 to i8
  store i8 %109, ptr %4, align 1, !tbaa !11
  %110 = load ptr, ptr %1, align 8, !tbaa !9
  %111 = load volatile i8, ptr %110, align 1, !tbaa !11
  store i8 %111, ptr %2, align 1, !tbaa !11
  %112 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %112, align 1, !tbaa !11
  %113 = load i8, ptr %2, align 1, !tbaa !11
  %114 = zext i8 %113 to i32
  %115 = and i32 %114, 8
  %116 = load i8, ptr %2, align 1, !tbaa !11
  %117 = zext i8 %116 to i32
  %118 = and i32 %117, 4
  %119 = or i32 %115, %118
  %120 = icmp ne i32 %119, 0
  %121 = zext i1 %120 to i64
  %122 = select i1 %120, i32 2, i32 0
  %123 = load i8, ptr %4, align 1, !tbaa !11
  %124 = zext i8 %123 to i32
  %125 = or i32 %124, %122
  %126 = trunc i32 %125 to i8
  store i8 %126, ptr %4, align 1, !tbaa !11
  %127 = load i8, ptr %2, align 1, !tbaa !11
  %128 = zext i8 %127 to i32
  %129 = and i32 %128, 2
  %130 = load i8, ptr %2, align 1, !tbaa !11
  %131 = zext i8 %130 to i32
  %132 = and i32 %131, 1
  %133 = or i32 %129, %132
  %134 = icmp ne i32 %133, 0
  %135 = zext i1 %134 to i64
  %136 = select i1 %134, i32 1, i32 0
  %137 = load i8, ptr %4, align 1, !tbaa !11
  %138 = zext i8 %137 to i32
  %139 = or i32 %138, %136
  %140 = trunc i32 %139 to i8
  store i8 %140, ptr %4, align 1, !tbaa !11
  %141 = load i8, ptr %4, align 1, !tbaa !11
  store i8 %141, ptr @portType, align 1, !tbaa !11
  store ptr inttoptr (i64 10551301 to ptr), ptr %1, align 8, !tbaa !9
  %142 = load ptr, ptr %1, align 8, !tbaa !9
  %143 = load volatile i8, ptr %142, align 1, !tbaa !11
  store i8 %143, ptr %2, align 1, !tbaa !11
  %144 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 0, ptr %144, align 1, !tbaa !11
  %145 = load i8, ptr %2, align 1, !tbaa !11
  %146 = zext i8 %145 to i32
  %147 = and i32 %146, 8
  %148 = load i8, ptr %2, align 1, !tbaa !11
  %149 = zext i8 %148 to i32
  %150 = and i32 %149, 4
  %151 = or i32 %147, %150
  %152 = icmp ne i32 %151, 0
  %153 = zext i1 %152 to i64
  %154 = select i1 %152, i32 8, i32 0
  %155 = trunc i32 %154 to i8
  store i8 %155, ptr %4, align 1, !tbaa !11
  %156 = load i8, ptr %2, align 1, !tbaa !11
  %157 = zext i8 %156 to i32
  %158 = and i32 %157, 2
  %159 = load i8, ptr %2, align 1, !tbaa !11
  %160 = zext i8 %159 to i32
  %161 = and i32 %160, 1
  %162 = or i32 %158, %161
  %163 = icmp ne i32 %162, 0
  %164 = zext i1 %163 to i64
  %165 = select i1 %163, i32 4, i32 0
  %166 = load i8, ptr %4, align 1, !tbaa !11
  %167 = zext i8 %166 to i32
  %168 = or i32 %167, %165
  %169 = trunc i32 %168 to i8
  store i8 %169, ptr %4, align 1, !tbaa !11
  %170 = load ptr, ptr %1, align 8, !tbaa !9
  %171 = load volatile i8, ptr %170, align 1, !tbaa !11
  store i8 %171, ptr %2, align 1, !tbaa !11
  %172 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 64, ptr %172, align 1, !tbaa !11
  %173 = load i8, ptr %2, align 1, !tbaa !11
  %174 = zext i8 %173 to i32
  %175 = and i32 %174, 8
  %176 = load i8, ptr %2, align 1, !tbaa !11
  %177 = zext i8 %176 to i32
  %178 = and i32 %177, 4
  %179 = or i32 %175, %178
  %180 = icmp ne i32 %179, 0
  %181 = zext i1 %180 to i64
  %182 = select i1 %180, i32 2, i32 0
  %183 = load i8, ptr %4, align 1, !tbaa !11
  %184 = zext i8 %183 to i32
  %185 = or i32 %184, %182
  %186 = trunc i32 %185 to i8
  store i8 %186, ptr %4, align 1, !tbaa !11
  %187 = load i8, ptr %2, align 1, !tbaa !11
  %188 = zext i8 %187 to i32
  %189 = and i32 %188, 2
  %190 = load i8, ptr %2, align 1, !tbaa !11
  %191 = zext i8 %190 to i32
  %192 = and i32 %191, 1
  %193 = or i32 %189, %192
  %194 = icmp ne i32 %193, 0
  %195 = zext i1 %194 to i64
  %196 = select i1 %194, i32 1, i32 0
  %197 = load i8, ptr %4, align 1, !tbaa !11
  %198 = zext i8 %197 to i32
  %199 = or i32 %198, %196
  %200 = trunc i32 %199 to i8
  store i8 %200, ptr %4, align 1, !tbaa !11
  %201 = load i8, ptr %4, align 1, !tbaa !11
  store i8 %201, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %202 = load i16, ptr %6, align 2, !tbaa !5
  %203 = icmp ne i16 %202, 0
  br i1 %203, label %205, label %204

204:                                              ; preds = %77
  call void @Z80_releaseBus()
  br label %205

205:                                              ; preds = %204, %77
  store i8 0, ptr @portSupport, align 1, !tbaa !11
  store i8 0, ptr getelementptr inbounds ([2 x i8], ptr @portSupport, i64 0, i64 1), align 1, !tbaa !11
  store i16 0, ptr %5, align 2, !tbaa !5
  br label %206

206:                                              ; preds = %223, %205
  %207 = load i16, ptr %5, align 2, !tbaa !5
  %208 = zext i16 %207 to i32
  %209 = icmp slt i32 %208, 8
  br i1 %209, label %210, label %226

210:                                              ; preds = %206
  %211 = load i16, ptr %5, align 2, !tbaa !5
  %212 = zext i16 %211 to i64
  %213 = getelementptr inbounds [8 x i8], ptr @joyType, i64 0, i64 %212
  store volatile i8 15, ptr %213, align 1, !tbaa !11
  %214 = load i16, ptr %5, align 2, !tbaa !5
  %215 = zext i16 %214 to i64
  %216 = getelementptr inbounds [8 x i16], ptr @joyState, i64 0, i64 %215
  store volatile i16 0, ptr %216, align 2, !tbaa !5
  %217 = load i16, ptr %5, align 2, !tbaa !5
  %218 = zext i16 %217 to i64
  %219 = getelementptr inbounds [8 x i16], ptr @joyAxisX, i64 0, i64 %218
  store volatile i16 0, ptr %219, align 2, !tbaa !5
  %220 = load i16, ptr %5, align 2, !tbaa !5
  %221 = zext i16 %220 to i64
  %222 = getelementptr inbounds [8 x i16], ptr @joyAxisY, i64 0, i64 %221
  store volatile i16 0, ptr %222, align 2, !tbaa !5
  br label %223

223:                                              ; preds = %210
  %224 = load i16, ptr %5, align 2, !tbaa !5
  %225 = add i16 %224, 1
  store i16 %225, ptr %5, align 2, !tbaa !5
  br label %206, !llvm.loop !18

226:                                              ; preds = %206
  %227 = call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1)
  %228 = zext i8 %227 to i16
  store i16 %228, ptr %6, align 2, !tbaa !5
  %229 = load i8, ptr @portType, align 1, !tbaa !11
  %230 = zext i8 %229 to i32
  switch i32 %230, label %238 [
    i32 0, label %231
    i32 1, label %231
    i32 3, label %234
    i32 7, label %234
    i32 13, label %237
  ]

231:                                              ; preds = %226, %226
  store ptr inttoptr (i64 10551305 to ptr), ptr %1, align 8, !tbaa !9
  %232 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 48, ptr %232, align 1, !tbaa !11
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %233 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 48, ptr %233, align 1, !tbaa !11
  br label %238

234:                                              ; preds = %226, %226
  store ptr inttoptr (i64 10551305 to ptr), ptr %1, align 8, !tbaa !9
  %235 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 96, ptr %235, align 1, !tbaa !11
  store ptr inttoptr (i64 10551299 to ptr), ptr %1, align 8, !tbaa !9
  %236 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 96, ptr %236, align 1, !tbaa !11
  br label %238

237:                                              ; preds = %226
  store i8 2, ptr @portSupport, align 1, !tbaa !11
  br label %238

238:                                              ; preds = %237, %234, %231, %226
  %239 = load i8, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %240 = zext i8 %239 to i32
  switch i32 %240, label %248 [
    i32 0, label %241
    i32 1, label %241
    i32 3, label %244
    i32 7, label %244
    i32 13, label %247
  ]

241:                                              ; preds = %238, %238
  store ptr inttoptr (i64 10551307 to ptr), ptr %1, align 8, !tbaa !9
  %242 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 48, ptr %242, align 1, !tbaa !11
  store ptr inttoptr (i64 10551301 to ptr), ptr %1, align 8, !tbaa !9
  %243 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 48, ptr %243, align 1, !tbaa !11
  br label %248

244:                                              ; preds = %238, %238
  store ptr inttoptr (i64 10551307 to ptr), ptr %1, align 8, !tbaa !9
  %245 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 96, ptr %245, align 1, !tbaa !11
  store ptr inttoptr (i64 10551301 to ptr), ptr %1, align 8, !tbaa !9
  %246 = load ptr, ptr %1, align 8, !tbaa !9
  store volatile i8 96, ptr %246, align 1, !tbaa !11
  br label %248

247:                                              ; preds = %238
  store i8 2, ptr getelementptr inbounds ([2 x i8], ptr @portSupport, i64 0, i64 1), align 1, !tbaa !11
  br label %248

248:                                              ; preds = %247, %244, %241, %238
  %249 = load i16, ptr %6, align 2, !tbaa !5
  %250 = icmp ne i16 %249, 0
  br i1 %250, label %252, label %251

251:                                              ; preds = %248
  call void @Z80_releaseBus()
  br label %252

252:                                              ; preds = %251, %248
  %253 = load i8, ptr @portType, align 1, !tbaa !11
  %254 = zext i8 %253 to i32
  %255 = icmp ne i32 %254, 13
  br i1 %255, label %256, label %284

256:                                              ; preds = %252
  %257 = load i8, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %258 = zext i8 %257 to i32
  %259 = icmp ne i32 %258, 13
  br i1 %259, label %260, label %284

260:                                              ; preds = %256
  %261 = load i8, ptr @portType, align 1, !tbaa !11
  %262 = zext i8 %261 to i32
  %263 = icmp eq i32 %262, 7
  br i1 %263, label %264, label %265

264:                                              ; preds = %260
  call void @JOY_setSupport(i16 noundef zeroext 0, i16 noundef zeroext 5)
  br label %283

265:                                              ; preds = %260
  %266 = load i8, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %267 = zext i8 %266 to i32
  %268 = icmp eq i32 %267, 7
  br i1 %268, label %269, label %270

269:                                              ; preds = %265
  call void @JOY_setSupport(i16 noundef zeroext 1, i16 noundef zeroext 5)
  br label %282

270:                                              ; preds = %265
  %271 = load i8, ptr @portType, align 1, !tbaa !11
  %272 = zext i8 %271 to i32
  %273 = icmp eq i32 %272, 3
  br i1 %273, label %274, label %275

274:                                              ; preds = %270
  call void @JOY_setSupport(i16 noundef zeroext 0, i16 noundef zeroext 3)
  br label %281

275:                                              ; preds = %270
  %276 = load i8, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %277 = zext i8 %276 to i32
  %278 = icmp eq i32 %277, 3
  br i1 %278, label %279, label %280

279:                                              ; preds = %275
  call void @JOY_setSupport(i16 noundef zeroext 1, i16 noundef zeroext 3)
  br label %280

280:                                              ; preds = %279, %275
  br label %281

281:                                              ; preds = %280, %274
  br label %282

282:                                              ; preds = %281, %269
  br label %283

283:                                              ; preds = %282, %264
  br label %284

284:                                              ; preds = %283, %256, %252
  br label %285

285:                                              ; preds = %284, %56
  %286 = load i8, ptr @portType, align 1, !tbaa !11
  %287 = zext i8 %286 to i32
  %288 = icmp eq i32 %287, 13
  br i1 %288, label %289, label %294

289:                                              ; preds = %285
  %290 = load volatile i8, ptr @joyType, align 1, !tbaa !11
  %291 = zext i8 %290 to i32
  %292 = icmp eq i32 %291, 0
  br i1 %292, label %293, label %294

293:                                              ; preds = %289
  store i8 1, ptr @portSupport, align 1, !tbaa !11
  br label %294

294:                                              ; preds = %293, %289, %285
  %295 = load i8, ptr getelementptr inbounds ([2 x i8], ptr @portType, i64 0, i64 1), align 1, !tbaa !11
  %296 = zext i8 %295 to i32
  %297 = icmp eq i32 %296, 13
  br i1 %297, label %298, label %303

298:                                              ; preds = %294
  %299 = load volatile i8, ptr getelementptr inbounds ([8 x i8], ptr @joyType, i64 0, i64 1), align 1, !tbaa !11
  %300 = zext i8 %299 to i32
  %301 = icmp eq i32 %300, 0
  br i1 %301, label %302, label %303

302:                                              ; preds = %298
  store i8 1, ptr getelementptr inbounds ([2 x i8], ptr @portSupport, i64 0, i64 1), align 1, !tbaa !11
  br label %303

303:                                              ; preds = %302, %298, %294
  call void @SYS_enableInts()
  %304 = call zeroext i8 @SYS_doVBlankProcess()
  %305 = call zeroext i8 @SYS_doVBlankProcess()
  %306 = call zeroext i8 @SYS_doVBlankProcess()
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

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

declare void @SYS_disableInts() #2

declare zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext) #2

declare void @Z80_releaseBus() #2

declare zeroext i8 @VDP_waitVSync() #2

; Function Attrs: noinline nounwind uwtable
declare dso_local void @JOY_setSupport(i16 noundef zeroext, i16 noundef zeroext) #0

declare void @SYS_enableInts() #2

declare zeroext i8 @SYS_doVBlankProcess() #2

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

attributes #0 = { noinline 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{i64 1557}
!13 = !{i64 1584}
!14 = !{i64 1702}
!15 = !{i64 1729}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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

@gport = external hidden local_unnamed_addr global i16, align 2
@portType = external hidden local_unnamed_addr global [2 x i8], align 1
@portSupport = external hidden local_unnamed_addr global [2 x i8], align 1
@joyType = external hidden global [8 x i8], align 1
@joyState = external hidden global [8 x i16], align 16
@joyAxisX = external hidden global [8 x i16], align 16
@joyAxisY = external hidden global [8 x i16], align 16

; Function Attrs: noinline nounwind uwtable
define dso_local void @JOY_reset() local_unnamed_addr #0 {
  store i16 -1, ptr @gport, align 2, !tbaa !5
  tail call void @SYS_disableInts() #2
  %1 = tail call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1) #2
  store volatile i8 64, ptr inttoptr (i64 10551305 to ptr), align 1, !tbaa !9
  store volatile i8 127, ptr inttoptr (i64 10551307 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  store volatile i8 12, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !10
  tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !11
  %2 = load volatile i8, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  %3 = and i8 %2, 3
  store volatile i8 124, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !12
  tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() #2, !srcloc !13
  %4 = load volatile i8, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  %5 = and i8 %4, 3
  %.not = icmp eq i8 %1, 0
  br i1 %.not, label %6, label %7

6:                                                ; preds = %0
  tail call void @Z80_releaseBus() #2
  br label %7

7:                                                ; preds = %6, %0
  %8 = icmp ne i8 %3, 0
  %9 = icmp eq i8 %5, 0
  %or.cond = select i1 %8, i1 %9, i1 false
  br i1 %or.cond, label %thread-pre-split.loopexit, label %10

thread-pre-split.loopexit:                        ; preds = %7
  store i8 16, ptr @portType, align 1, !tbaa !9
  store i8 16, ptr getelementptr inbounds (i8, ptr @portType, i64 1), align 1, !tbaa !9
  store i8 6, ptr @portSupport, align 1, !tbaa !9
  store i8 0, ptr getelementptr inbounds (i8, ptr @portSupport, i64 1), align 1, !tbaa !9
  store volatile i8 15, ptr @joyType, align 1, !tbaa !9
  store volatile i16 0, ptr @joyState, align 16, !tbaa !5
  store volatile i16 0, ptr @joyAxisX, align 16, !tbaa !5
  store volatile i16 0, ptr @joyAxisY, align 16, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 1), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 2), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 2), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 2), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 2), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 4), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 4), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 4), align 4, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 3), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 6), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 6), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 6), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 4), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 8), align 8, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 8), align 8, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 8), align 8, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 5), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 10), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 10), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 10), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 6), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 12), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 12), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 12), align 4, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 7), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 14), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 14), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 14), align 2, !tbaa !5
  br label %thread-pre-split

10:                                               ; preds = %7
  %11 = tail call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1) #2
  store volatile i8 64, ptr inttoptr (i64 10551305 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551307 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551309 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551303 to ptr), align 1, !tbaa !9
  %.not81 = icmp eq i8 %11, 0
  br i1 %.not81, label %12, label %13

12:                                               ; preds = %10
  tail call void @Z80_releaseBus() #2
  br label %13

13:                                               ; preds = %12, %10
  %14 = tail call zeroext i8 @VDP_waitVSync() #2
  %15 = tail call zeroext i8 @VDP_waitVSync() #2
  %16 = tail call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1) #2
  %17 = load volatile i8, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  store volatile i8 0, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  %18 = zext i8 %17 to i32
  %19 = and i32 %18, 12
  %.not82 = icmp eq i32 %19, 0
  %20 = and i32 %18, 3
  %.not83 = icmp eq i32 %20, 0
  %21 = select i1 %.not83, i8 0, i8 4
  %22 = select i1 %.not82, i8 0, i8 8
  %23 = or disjoint i8 %22, %21
  %24 = load volatile i8, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  %25 = zext i8 %24 to i32
  %26 = and i32 %25, 12
  %.not84 = icmp eq i32 %26, 0
  %27 = select i1 %.not84, i8 0, i8 2
  %28 = or disjoint i8 %23, %27
  %29 = and i32 %25, 3
  %.not85 = icmp ne i32 %29, 0
  %30 = zext i1 %.not85 to i8
  %31 = or disjoint i8 %28, %30
  store i8 %31, ptr @portType, align 1, !tbaa !9
  %32 = load volatile i8, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  store volatile i8 0, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  %33 = zext i8 %32 to i32
  %34 = and i32 %33, 12
  %.not86 = icmp eq i32 %34, 0
  %35 = and i32 %33, 3
  %.not87 = icmp eq i32 %35, 0
  %36 = select i1 %.not87, i8 0, i8 4
  %37 = select i1 %.not86, i8 0, i8 8
  %38 = or disjoint i8 %37, %36
  %39 = load volatile i8, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  store volatile i8 64, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  %40 = zext i8 %39 to i32
  %41 = and i32 %40, 12
  %.not88 = icmp eq i32 %41, 0
  %42 = select i1 %.not88, i8 0, i8 2
  %43 = or disjoint i8 %38, %42
  %44 = and i32 %40, 3
  %.not89 = icmp ne i32 %44, 0
  %45 = zext i1 %.not89 to i8
  %46 = or disjoint i8 %43, %45
  store i8 %46, ptr getelementptr inbounds (i8, ptr @portType, i64 1), align 1, !tbaa !9
  %.not90 = icmp eq i8 %16, 0
  br i1 %.not90, label %47, label %48

47:                                               ; preds = %13
  tail call void @Z80_releaseBus() #2
  br label %48

48:                                               ; preds = %47, %13
  store i8 0, ptr @portSupport, align 1, !tbaa !9
  store i8 0, ptr getelementptr inbounds (i8, ptr @portSupport, i64 1), align 1, !tbaa !9
  store volatile i8 15, ptr @joyType, align 1, !tbaa !9
  store volatile i16 0, ptr @joyState, align 16, !tbaa !5
  store volatile i16 0, ptr @joyAxisX, align 16, !tbaa !5
  store volatile i16 0, ptr @joyAxisY, align 16, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 1), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 2), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 2), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 2), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 2), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 4), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 4), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 4), align 4, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 3), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 6), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 6), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 6), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 4), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 8), align 8, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 8), align 8, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 8), align 8, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 5), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 10), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 10), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 10), align 2, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 6), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 12), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 12), align 4, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 12), align 4, !tbaa !5
  store volatile i8 15, ptr getelementptr inbounds (i8, ptr @joyType, i64 7), align 1, !tbaa !9
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyState, i64 14), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisX, i64 14), align 2, !tbaa !5
  store volatile i16 0, ptr getelementptr inbounds (i8, ptr @joyAxisY, i64 14), align 2, !tbaa !5
  %49 = tail call zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext 1) #2
  %50 = load i8, ptr @portType, align 1, !tbaa !9
  switch i8 %50, label %54 [
    i8 0, label %51
    i8 1, label %51
    i8 3, label %52
    i8 7, label %52
    i8 13, label %53
  ]

51:                                               ; preds = %48, %48
  store volatile i8 48, ptr inttoptr (i64 10551305 to ptr), align 1, !tbaa !9
  store volatile i8 48, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  br label %54

52:                                               ; preds = %48, %48
  store volatile i8 96, ptr inttoptr (i64 10551305 to ptr), align 1, !tbaa !9
  store volatile i8 96, ptr inttoptr (i64 10551299 to ptr), align 1, !tbaa !9
  br label %54

53:                                               ; preds = %48
  store i8 2, ptr @portSupport, align 1, !tbaa !9
  br label %54

54:                                               ; preds = %53, %52, %51, %48
  %55 = load i8, ptr getelementptr inbounds (i8, ptr @portType, i64 1), align 1, !tbaa !9
  switch i8 %55, label %59 [
    i8 0, label %56
    i8 1, label %56
    i8 3, label %57
    i8 7, label %57
    i8 13, label %58
  ]

56:                                               ; preds = %54, %54
  store volatile i8 48, ptr inttoptr (i64 10551307 to ptr), align 1, !tbaa !9
  store volatile i8 48, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  br label %59

57:                                               ; preds = %54, %54
  store volatile i8 96, ptr inttoptr (i64 10551307 to ptr), align 1, !tbaa !9
  store volatile i8 96, ptr inttoptr (i64 10551301 to ptr), align 1, !tbaa !9
  br label %59

58:                                               ; preds = %54
  store i8 2, ptr getelementptr inbounds (i8, ptr @portSupport, i64 1), align 1, !tbaa !9
  br label %59

59:                                               ; preds = %58, %57, %56, %54
  %.not91 = icmp eq i8 %49, 0
  br i1 %.not91, label %60, label %61

60:                                               ; preds = %59
  tail call void @Z80_releaseBus() #2
  br label %61

61:                                               ; preds = %60, %59
  %62 = load i8, ptr @portType, align 1, !tbaa !9
  %63 = icmp ne i8 %62, 13
  %64 = load i8, ptr getelementptr inbounds (i8, ptr @portType, i64 1), align 1
  %65 = icmp ne i8 %64, 13
  %or.cond5 = select i1 %63, i1 %65, i1 false
  br i1 %or.cond5, label %66, label %78

66:                                               ; preds = %61
  %67 = icmp eq i8 %62, 7
  br i1 %67, label %68, label %69

68:                                               ; preds = %66
  tail call void @JOY_setSupport(i16 noundef zeroext 0, i16 noundef zeroext 5)
  br label %thread-pre-split

69:                                               ; preds = %66
  %70 = icmp eq i8 %64, 7
  br i1 %70, label %71, label %72

71:                                               ; preds = %69
  tail call void @JOY_setSupport(i16 noundef zeroext 1, i16 noundef zeroext 5)
  br label %thread-pre-split

72:                                               ; preds = %69
  %73 = icmp eq i8 %62, 3
  br i1 %73, label %74, label %75

74:                                               ; preds = %72
  tail call void @JOY_setSupport(i16 noundef zeroext 0, i16 noundef zeroext 3)
  br label %thread-pre-split

75:                                               ; preds = %72
  %76 = icmp eq i8 %64, 3
  br i1 %76, label %77, label %thread-pre-split

77:                                               ; preds = %75
  tail call void @JOY_setSupport(i16 noundef zeroext 1, i16 noundef zeroext 3)
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %thread-pre-split.loopexit, %68, %74, %77, %75, %71
  %.pr = load i8, ptr @portType, align 1, !tbaa !9
  br label %78

78:                                               ; preds = %thread-pre-split, %61
  %79 = phi i8 [ %.pr, %thread-pre-split ], [ %62, %61 ]
  %80 = icmp eq i8 %79, 13
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = load volatile i8, ptr @joyType, align 1, !tbaa !9
  %83 = icmp eq i8 %82, 0
  br i1 %83, label %84, label %85

84:                                               ; preds = %81
  store i8 1, ptr @portSupport, align 1, !tbaa !9
  br label %85

85:                                               ; preds = %84, %81, %78
  %86 = load i8, ptr getelementptr inbounds (i8, ptr @portType, i64 1), align 1, !tbaa !9
  %87 = icmp eq i8 %86, 13
  br i1 %87, label %88, label %92

88:                                               ; preds = %85
  %89 = load volatile i8, ptr getelementptr inbounds (i8, ptr @joyType, i64 1), align 1, !tbaa !9
  %90 = icmp eq i8 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %88
  store i8 1, ptr getelementptr inbounds (i8, ptr @portSupport, i64 1), align 1, !tbaa !9
  br label %92

92:                                               ; preds = %91, %88, %85
  tail call void @SYS_enableInts() #2
  %93 = tail call zeroext i8 @SYS_doVBlankProcess() #2
  %94 = tail call zeroext i8 @SYS_doVBlankProcess() #2
  %95 = tail call zeroext i8 @SYS_doVBlankProcess() #2
  ret void
}

declare void @SYS_disableInts() local_unnamed_addr #1

declare zeroext i8 @Z80_getAndRequestBus(i8 noundef zeroext) local_unnamed_addr #1

declare void @Z80_releaseBus() local_unnamed_addr #1

declare zeroext i8 @VDP_waitVSync() local_unnamed_addr #1

; Function Attrs: noinline nounwind uwtable
declare dso_local void @JOY_setSupport(i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #0

declare void @SYS_enableInts() local_unnamed_addr #1

declare zeroext i8 @SYS_doVBlankProcess() local_unnamed_addr #1

attributes #0 = { noinline 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 }

!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 = !{!7, !7, i64 0}
!10 = !{i64 1557}
!11 = !{i64 1584}
!12 = !{i64 1702}
!13 = !{i64 1729}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass