; LLVM IR from blat-blatnik/GPU-Life :: main (onMouseMove)

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

@pressedButton = external dso_local global i32, align 4
@scale = external dso_local global float, align 4
@scaleX = external dso_local global float, align 4
@scaleY = external dso_local global float, align 4
@offsetX = external dso_local global float, align 4
@offsetY = external dso_local global float, align 4
@glad_glBindTexture = external global ptr, align 8
@glad_glBindFramebuffer = external global ptr, align 8
@numCellsX = external dso_local global i32, align 4
@numCellsY = external dso_local global i32, align 4
@cellsRead = external dso_local global i32, align 4
@cellsReadFramebuffer = external dso_local global i32, align 4
@windowWidth = external dso_local global i32, align 4
@windowHeight = external dso_local global i32, align 4
@mouseX = external dso_local global double, align 8
@mouseY = external dso_local global double, align 8
@glad_glReadPixels = external global ptr, align 8
@glad_glTexSubImage2D = external global ptr, align 8

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @keyModsArePressed() #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
define dso_local void @onMouseMove(ptr noundef %0, double noundef %1, double noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i8, align 1
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store double %2, ptr %6, align 8, !tbaa !9
  %28 = load i32, ptr @windowHeight, align 4, !tbaa !11
  %29 = sitofp i32 %28 to double
  %30 = load double, ptr %6, align 8, !tbaa !9
  %31 = fsub double %29, %30
  store double %31, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %32 = load double, ptr @mouseX, align 8, !tbaa !9
  store double %32, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %33 = load double, ptr @mouseY, align 8, !tbaa !9
  store double %33, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %34 = load double, ptr %5, align 8, !tbaa !9
  %35 = load double, ptr %7, align 8, !tbaa !9
  %36 = fsub double %34, %35
  store double %36, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %37 = load double, ptr %6, align 8, !tbaa !9
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = fsub double %37, %38
  store double %39, ptr %10, align 8, !tbaa !9
  %40 = load double, ptr %5, align 8, !tbaa !9
  store double %40, ptr @mouseX, align 8, !tbaa !9
  %41 = load double, ptr %6, align 8, !tbaa !9
  store double %41, ptr @mouseY, align 8, !tbaa !9
  %42 = load i32, ptr @pressedButton, align 4, !tbaa !11
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %51

44:                                               ; preds = %3
  %45 = load i32, ptr @pressedButton, align 4, !tbaa !11
  %46 = icmp ne i32 %45, 1
  br i1 %46, label %47, label %51

47:                                               ; preds = %44
  %48 = load i32, ptr @pressedButton, align 4, !tbaa !11
  %49 = icmp ne i32 %48, 2
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  store i32 1, ptr %11, align 4
  br label %246

51:                                               ; preds = %47, %44, %3
  %52 = load i32, ptr @pressedButton, align 4, !tbaa !11
  %53 = icmp eq i32 %52, 2
  br i1 %53, label %58, label %54

54:                                               ; preds = %51
  %55 = call zeroext i8 @keyModsArePressed()
  %56 = zext i8 %55 to i32
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %81

58:                                               ; preds = %54, %51
  %59 = load float, ptr @scale, align 4, !tbaa !13
  %60 = load float, ptr @scaleX, align 4, !tbaa !13
  %61 = fmul float %59, %60
  %62 = load double, ptr %9, align 8, !tbaa !9
  %63 = load i32, ptr @windowWidth, align 4, !tbaa !11
  %64 = sitofp i32 %63 to double
  %65 = fdiv double %62, %64
  %66 = fptrunc double %65 to float
  %67 = load float, ptr @offsetX, align 4, !tbaa !13
  %68 = fneg float %61
  %69 = call float @llvm.fmuladd.f32(float %68, float %66, float %67)
  store float %69, ptr @offsetX, align 4, !tbaa !13
  %70 = load float, ptr @scale, align 4, !tbaa !13
  %71 = load float, ptr @scaleY, align 4, !tbaa !13
  %72 = fmul float %70, %71
  %73 = load double, ptr %10, align 8, !tbaa !9
  %74 = load i32, ptr @windowHeight, align 4, !tbaa !11
  %75 = sitofp i32 %74 to double
  %76 = fdiv double %73, %75
  %77 = fptrunc double %76 to float
  %78 = load float, ptr @offsetY, align 4, !tbaa !13
  %79 = fneg float %72
  %80 = call float @llvm.fmuladd.f32(float %79, float %77, float %78)
  store float %80, ptr @offsetY, align 4, !tbaa !13
  store i32 1, ptr %11, align 4
  br label %246

81:                                               ; preds = %54
  %82 = load ptr, ptr @glad_glBindFramebuffer, align 8, !tbaa !5
  %83 = load i32, ptr @cellsReadFramebuffer, align 4, !tbaa !11
  call void %82(i32 noundef 36160, i32 noundef %83)
  %84 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !5
  %85 = load i32, ptr @cellsRead, align 4, !tbaa !11
  call void %84(i32 noundef 3553, i32 noundef %85)
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #3
  store i8 0, ptr %12, align 1, !tbaa !15
  %86 = load i32, ptr @pressedButton, align 4, !tbaa !11
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %81
  store i8 -1, ptr %12, align 1, !tbaa !15
  br label %89

89:                                               ; preds = %88, %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %90 = load double, ptr %7, align 8, !tbaa !9
  %91 = load i32, ptr @windowWidth, align 4, !tbaa !11
  %92 = sitofp i32 %91 to double
  %93 = fdiv double %90, %92
  %94 = fptrunc double %93 to float
  store float %94, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %95 = load double, ptr %8, align 8, !tbaa !9
  %96 = load i32, ptr @windowHeight, align 4, !tbaa !11
  %97 = sitofp i32 %96 to double
  %98 = fdiv double %95, %97
  %99 = fptrunc double %98 to float
  store float %99, ptr %14, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %100 = load double, ptr %5, align 8, !tbaa !9
  %101 = load i32, ptr @windowWidth, align 4, !tbaa !11
  %102 = sitofp i32 %101 to double
  %103 = fdiv double %100, %102
  %104 = fptrunc double %103 to float
  store float %104, ptr %15, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %105 = load double, ptr %6, align 8, !tbaa !9
  %106 = load i32, ptr @windowHeight, align 4, !tbaa !11
  %107 = sitofp i32 %106 to double
  %108 = fdiv double %105, %107
  %109 = fptrunc double %108 to float
  store float %109, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %110 = load i32, ptr @numCellsX, align 4, !tbaa !11
  %111 = sitofp i32 %110 to float
  %112 = load float, ptr @offsetX, align 4, !tbaa !13
  %113 = load float, ptr %13, align 4, !tbaa !13
  %114 = load float, ptr @scaleX, align 4, !tbaa !13
  %115 = fmul float %113, %114
  %116 = load float, ptr @scale, align 4, !tbaa !13
  %117 = call float @llvm.fmuladd.f32(float %115, float %116, float %112)
  %118 = fmul float %111, %117
  %119 = fptosi float %118 to i32
  store i32 %119, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %120 = load i32, ptr @numCellsY, align 4, !tbaa !11
  %121 = sitofp i32 %120 to float
  %122 = load float, ptr @offsetY, align 4, !tbaa !13
  %123 = load float, ptr %14, align 4, !tbaa !13
  %124 = load float, ptr @scaleY, align 4, !tbaa !13
  %125 = fmul float %123, %124
  %126 = load float, ptr @scale, align 4, !tbaa !13
  %127 = call float @llvm.fmuladd.f32(float %125, float %126, float %122)
  %128 = fmul float %121, %127
  %129 = fptosi float %128 to i32
  store i32 %129, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %130 = load i32, ptr @numCellsX, align 4, !tbaa !11
  %131 = sitofp i32 %130 to float
  %132 = load float, ptr @offsetX, align 4, !tbaa !13
  %133 = load float, ptr %15, align 4, !tbaa !13
  %134 = load float, ptr @scaleX, align 4, !tbaa !13
  %135 = fmul float %133, %134
  %136 = load float, ptr @scale, align 4, !tbaa !13
  %137 = call float @llvm.fmuladd.f32(float %135, float %136, float %132)
  %138 = fmul float %131, %137
  %139 = fptosi float %138 to i32
  store i32 %139, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %140 = load i32, ptr @numCellsY, align 4, !tbaa !11
  %141 = sitofp i32 %140 to float
  %142 = load float, ptr @offsetY, align 4, !tbaa !13
  %143 = load float, ptr %16, align 4, !tbaa !13
  %144 = load float, ptr @scaleY, align 4, !tbaa !13
  %145 = fmul float %143, %144
  %146 = load float, ptr @scale, align 4, !tbaa !13
  %147 = call float @llvm.fmuladd.f32(float %145, float %146, float %142)
  %148 = fmul float %141, %147
  %149 = fptosi float %148 to i32
  store i32 %149, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %150 = load i32, ptr %19, align 4, !tbaa !11
  %151 = load i32, ptr %17, align 4, !tbaa !11
  %152 = sub nsw i32 %150, %151
  %153 = call i32 @llvm.abs.i32(i32 %152, i1 true)
  store i32 %153, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %154 = load i32, ptr %20, align 4, !tbaa !11
  %155 = load i32, ptr %18, align 4, !tbaa !11
  %156 = sub nsw i32 %154, %155
  %157 = call i32 @llvm.abs.i32(i32 %156, i1 true)
  %158 = sub nsw i32 0, %157
  store i32 %158, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %159 = load i32, ptr %17, align 4, !tbaa !11
  %160 = load i32, ptr %19, align 4, !tbaa !11
  %161 = icmp slt i32 %159, %160
  %162 = zext i1 %161 to i64
  %163 = select i1 %161, i32 1, i32 -1
  store i32 %163, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %164 = load i32, ptr %18, align 4, !tbaa !11
  %165 = load i32, ptr %20, align 4, !tbaa !11
  %166 = icmp slt i32 %164, %165
  %167 = zext i1 %166 to i64
  %168 = select i1 %166, i32 1, i32 -1
  store i32 %168, ptr %24, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %169 = load i32, ptr %21, align 4, !tbaa !11
  %170 = load i32, ptr %22, align 4, !tbaa !11
  %171 = add nsw i32 %169, %170
  store i32 %171, ptr %25, align 4, !tbaa !11
  br label %172

172:                                              ; preds = %244, %89
  %173 = load i32, ptr %17, align 4, !tbaa !11
  %174 = icmp sge i32 %173, 0
  br i1 %174, label %175, label %211

175:                                              ; preds = %172
  %176 = load i32, ptr %17, align 4, !tbaa !11
  %177 = load i32, ptr @numCellsX, align 4, !tbaa !11
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %179, label %211

179:                                              ; preds = %175
  %180 = load i32, ptr %18, align 4, !tbaa !11
  %181 = icmp sge i32 %180, 0
  br i1 %181, label %182, label %211

182:                                              ; preds = %179
  %183 = load i32, ptr %18, align 4, !tbaa !11
  %184 = load i32, ptr @numCellsY, align 4, !tbaa !11
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %186, label %211

186:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  %187 = load ptr, ptr @glad_glReadPixels, align 8, !tbaa !5
  %188 = load i32, ptr %17, align 4, !tbaa !11
  %189 = load i32, ptr %18, align 4, !tbaa !11
  %190 = sdiv i32 %189, 32
  call void %187(i32 noundef %188, i32 noundef %190, i32 noundef 1, i32 noundef 1, i32 noundef 36244, i32 noundef 5125, ptr noundef %26)
  %191 = load i8, ptr %12, align 1, !tbaa !15
  %192 = icmp ne i8 %191, 0
  br i1 %192, label %193, label %199

193:                                              ; preds = %186
  %194 = load i32, ptr %18, align 4, !tbaa !11
  %195 = and i32 %194, 31
  %196 = shl i32 1, %195
  %197 = load i32, ptr %26, align 4, !tbaa !11
  %198 = or i32 %197, %196
  store i32 %198, ptr %26, align 4, !tbaa !11
  br label %206

199:                                              ; preds = %186
  %200 = load i32, ptr %18, align 4, !tbaa !11
  %201 = and i32 %200, 31
  %202 = shl i32 1, %201
  %203 = xor i32 %202, -1
  %204 = load i32, ptr %26, align 4, !tbaa !11
  %205 = and i32 %204, %203
  store i32 %205, ptr %26, align 4, !tbaa !11
  br label %206

206:                                              ; preds = %199, %193
  %207 = load ptr, ptr @glad_glTexSubImage2D, align 8, !tbaa !5
  %208 = load i32, ptr %17, align 4, !tbaa !11
  %209 = load i32, ptr %18, align 4, !tbaa !11
  %210 = sdiv i32 %209, 32
  call void %207(i32 noundef 3553, i32 noundef 0, i32 noundef %208, i32 noundef %210, i32 noundef 1, i32 noundef 1, i32 noundef 36244, i32 noundef 5125, ptr noundef %26)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  br label %211

211:                                              ; preds = %206, %182, %179, %175, %172
  %212 = load i32, ptr %17, align 4, !tbaa !11
  %213 = load i32, ptr %19, align 4, !tbaa !11
  %214 = icmp eq i32 %212, %213
  br i1 %214, label %215, label %220

215:                                              ; preds = %211
  %216 = load i32, ptr %18, align 4, !tbaa !11
  %217 = load i32, ptr %20, align 4, !tbaa !11
  %218 = icmp eq i32 %216, %217
  br i1 %218, label %219, label %220

219:                                              ; preds = %215
  br label %245

220:                                              ; preds = %215, %211
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  %221 = load i32, ptr %25, align 4, !tbaa !11
  %222 = mul nsw i32 2, %221
  store i32 %222, ptr %27, align 4, !tbaa !11
  %223 = load i32, ptr %27, align 4, !tbaa !11
  %224 = load i32, ptr %22, align 4, !tbaa !11
  %225 = icmp sge i32 %223, %224
  br i1 %225, label %226, label %233

226:                                              ; preds = %220
  %227 = load i32, ptr %22, align 4, !tbaa !11
  %228 = load i32, ptr %25, align 4, !tbaa !11
  %229 = add nsw i32 %228, %227
  store i32 %229, ptr %25, align 4, !tbaa !11
  %230 = load i32, ptr %23, align 4, !tbaa !11
  %231 = load i32, ptr %17, align 4, !tbaa !11
  %232 = add nsw i32 %231, %230
  store i32 %232, ptr %17, align 4, !tbaa !11
  br label %233

233:                                              ; preds = %226, %220
  %234 = load i32, ptr %27, align 4, !tbaa !11
  %235 = load i32, ptr %21, align 4, !tbaa !11
  %236 = icmp sle i32 %234, %235
  br i1 %236, label %237, label %244

237:                                              ; preds = %233
  %238 = load i32, ptr %21, align 4, !tbaa !11
  %239 = load i32, ptr %25, align 4, !tbaa !11
  %240 = add nsw i32 %239, %238
  store i32 %240, ptr %25, align 4, !tbaa !11
  %241 = load i32, ptr %24, align 4, !tbaa !11
  %242 = load i32, ptr %18, align 4, !tbaa !11
  %243 = add nsw i32 %242, %241
  store i32 %243, ptr %18, align 4, !tbaa !11
  br label %244

244:                                              ; preds = %237, %233
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  br label %172

245:                                              ; preds = %219
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #3
  store i32 0, ptr %11, align 4
  br label %246

246:                                              ; preds = %245, %58, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %247 = load i32, ptr %11, align 4
  switch i32 %247, label %249 [
    i32 0, label %248
    i32 1, label %248
  ]

248:                                              ; preds = %246, %246
  ret void

249:                                              ; preds = %246
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!7, !7, i64 0}


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

@pressedButton = external dso_local local_unnamed_addr global i32, align 4
@scale = external dso_local local_unnamed_addr global float, align 4
@scaleX = external dso_local local_unnamed_addr global float, align 4
@scaleY = external dso_local local_unnamed_addr global float, align 4
@offsetX = external dso_local local_unnamed_addr global float, align 4
@offsetY = external dso_local local_unnamed_addr global float, align 4
@glad_glBindTexture = external local_unnamed_addr global ptr, align 8
@glad_glBindFramebuffer = external local_unnamed_addr global ptr, align 8
@numCellsX = external dso_local local_unnamed_addr global i32, align 4
@numCellsY = external dso_local local_unnamed_addr global i32, align 4
@cellsRead = external dso_local local_unnamed_addr global i32, align 4
@cellsReadFramebuffer = external dso_local local_unnamed_addr global i32, align 4
@windowWidth = external dso_local local_unnamed_addr global i32, align 4
@windowHeight = external dso_local local_unnamed_addr global i32, align 4
@mouseX = external dso_local local_unnamed_addr global double, align 8
@mouseY = external dso_local local_unnamed_addr global double, align 8
@glad_glReadPixels = external local_unnamed_addr global ptr, align 8
@glad_glTexSubImage2D = external local_unnamed_addr global ptr, align 8

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @keyModsArePressed() local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
define dso_local void @onMouseMove(ptr nocapture noundef readnone %0, double noundef %1, double noundef %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  %5 = load i32, ptr @windowHeight, align 4, !tbaa !5
  %6 = sitofp i32 %5 to double
  %7 = fsub double %6, %2
  %8 = load double, ptr @mouseX, align 8, !tbaa !9
  %9 = load double, ptr @mouseY, align 8, !tbaa !9
  %10 = fsub double %1, %8
  %11 = fsub double %7, %9
  store double %1, ptr @mouseX, align 8, !tbaa !9
  store double %7, ptr @mouseY, align 8, !tbaa !9
  %12 = load i32, ptr @pressedButton, align 4
  %or.cond3 = icmp ugt i32 %12, 2
  br i1 %or.cond3, label %.loopexit, label %13

13:                                               ; preds = %3
  %14 = icmp eq i32 %12, 2
  br i1 %14, label %17, label %15

15:                                               ; preds = %13
  %16 = tail call zeroext i8 @keyModsArePressed()
  %.not = icmp eq i8 %16, 0
  br i1 %.not, label %34, label %._crit_edge

._crit_edge:                                      ; preds = %15
  %.pre = load i32, ptr @windowHeight, align 4, !tbaa !5
  %.pre69 = sitofp i32 %.pre to double
  br label %17

17:                                               ; preds = %._crit_edge, %13
  %.pre-phi = phi double [ %.pre69, %._crit_edge ], [ %6, %13 ]
  %18 = load float, ptr @scale, align 4, !tbaa !11
  %19 = load float, ptr @scaleX, align 4, !tbaa !11
  %20 = load i32, ptr @windowWidth, align 4, !tbaa !5
  %21 = sitofp i32 %20 to double
  %22 = fdiv double %10, %21
  %23 = fptrunc double %22 to float
  %24 = load float, ptr @offsetX, align 4, !tbaa !11
  %25 = fneg float %18
  %26 = fmul float %19, %25
  %27 = tail call float @llvm.fmuladd.f32(float %26, float %23, float %24)
  store float %27, ptr @offsetX, align 4, !tbaa !11
  %28 = load float, ptr @scaleY, align 4, !tbaa !11
  %29 = fdiv double %11, %.pre-phi
  %30 = fptrunc double %29 to float
  %31 = load float, ptr @offsetY, align 4, !tbaa !11
  %32 = fmul float %28, %25
  %33 = tail call float @llvm.fmuladd.f32(float %32, float %30, float %31)
  store float %33, ptr @offsetY, align 4, !tbaa !11
  br label %.loopexit

34:                                               ; preds = %15
  %35 = load ptr, ptr @glad_glBindFramebuffer, align 8, !tbaa !13
  %36 = load i32, ptr @cellsReadFramebuffer, align 4, !tbaa !5
  tail call void %35(i32 noundef 36160, i32 noundef %36) #4
  %37 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !13
  %38 = load i32, ptr @cellsRead, align 4, !tbaa !5
  tail call void %37(i32 noundef 3553, i32 noundef %38) #4
  %39 = load i32, ptr @pressedButton, align 4, !tbaa !5
  %40 = icmp eq i32 %39, 0
  %41 = load i32, ptr @windowWidth, align 4, !tbaa !5
  %42 = load i32, ptr @windowHeight, align 4, !tbaa !5
  %43 = load i32, ptr @numCellsX, align 4, !tbaa !5
  %44 = load float, ptr @offsetX, align 4, !tbaa !11
  %45 = load float, ptr @scaleX, align 4, !tbaa !11
  %46 = load float, ptr @scale, align 4, !tbaa !11
  %47 = load i32, ptr @numCellsY, align 4, !tbaa !5
  %48 = load float, ptr @offsetY, align 4, !tbaa !11
  %49 = load float, ptr @scaleY, align 4, !tbaa !11
  %50 = insertelement <2 x i32> poison, i32 %42, i64 0
  %51 = insertelement <2 x i32> %50, i32 %41, i64 1
  %52 = sitofp <2 x i32> %51 to <2 x double>
  %53 = insertelement <2 x double> poison, double %9, i64 0
  %54 = insertelement <2 x double> %53, double %8, i64 1
  %55 = fdiv <2 x double> %54, %52
  %56 = fptrunc <2 x double> %55 to <2 x float>
  %57 = insertelement <2 x double> poison, double %7, i64 0
  %58 = insertelement <2 x double> %57, double %1, i64 1
  %59 = fdiv <2 x double> %58, %52
  %60 = fptrunc <2 x double> %59 to <2 x float>
  %61 = insertelement <2 x i32> poison, i32 %47, i64 0
  %62 = insertelement <2 x i32> %61, i32 %43, i64 1
  %63 = sitofp <2 x i32> %62 to <2 x float>
  %64 = insertelement <2 x float> poison, float %49, i64 0
  %65 = insertelement <2 x float> %64, float %45, i64 1
  %66 = fmul <2 x float> %65, %56
  %67 = insertelement <2 x float> poison, float %46, i64 0
  %68 = shufflevector <2 x float> %67, <2 x float> poison, <2 x i32> zeroinitializer
  %69 = insertelement <2 x float> poison, float %48, i64 0
  %70 = insertelement <2 x float> %69, float %44, i64 1
  %71 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %66, <2 x float> %68, <2 x float> %70)
  %72 = fmul <2 x float> %71, %63
  %73 = fptosi <2 x float> %72 to <2 x i32>
  %74 = fmul <2 x float> %65, %60
  %75 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %74, <2 x float> %68, <2 x float> %70)
  %76 = fmul <2 x float> %75, %63
  %77 = fptosi <2 x float> %76 to <2 x i32>
  %78 = sub nsw <2 x i32> %77, %73
  %79 = tail call <2 x i32> @llvm.abs.v2i32(<2 x i32> %78, i1 true)
  %80 = extractelement <2 x i32> %79, i64 0
  %81 = sub nsw i32 0, %80
  %82 = icmp slt <2 x i32> %73, %77
  %83 = select <2 x i1> %82, <2 x i32> <i32 1, i32 1>, <2 x i32> <i32 -1, i32 -1>
  %84 = extractelement <2 x i32> %79, i64 1
  %85 = sub nsw i32 %84, %80
  br label %86

86:                                               ; preds = %115, %34
  %.0 = phi i32 [ %85, %34 ], [ %.2, %115 ]
  %87 = phi <2 x i32> [ %73, %34 ], [ %125, %115 ]
  %88 = extractelement <2 x i32> %87, i64 1
  %89 = icmp sgt i32 %88, -1
  br i1 %89, label %90, label %111

90:                                               ; preds = %86
  %91 = load i32, ptr @numCellsX, align 4, !tbaa !5
  %92 = icmp slt i32 %88, %91
  %93 = extractelement <2 x i32> %87, i64 0
  %94 = icmp sgt i32 %93, -1
  %or.cond5 = select i1 %92, i1 %94, i1 false
  %95 = load i32, ptr @numCellsY, align 4
  %96 = icmp slt i32 %93, %95
  %or.cond = select i1 %or.cond5, i1 %96, i1 false
  br i1 %or.cond, label %97, label %111

97:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %98 = load ptr, ptr @glad_glReadPixels, align 8, !tbaa !13
  %99 = lshr i32 %93, 5
  call void %98(i32 noundef %88, i32 noundef %99, i32 noundef 1, i32 noundef 1, i32 noundef 36244, i32 noundef 5125, ptr noundef nonnull %4) #4
  %100 = and i32 %93, 31
  %101 = shl nuw i32 1, %100
  br i1 %40, label %102, label %105

102:                                              ; preds = %97
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = or i32 %103, %101
  br label %109

105:                                              ; preds = %97
  %106 = xor i32 %101, -1
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = and i32 %107, %106
  br label %109

109:                                              ; preds = %105, %102
  %storemerge = phi i32 [ %108, %105 ], [ %104, %102 ]
  store i32 %storemerge, ptr %4, align 4, !tbaa !5
  %110 = load ptr, ptr @glad_glTexSubImage2D, align 8, !tbaa !13
  call void %110(i32 noundef 3553, i32 noundef 0, i32 noundef %88, i32 noundef %99, i32 noundef 1, i32 noundef 1, i32 noundef 36244, i32 noundef 5125, ptr noundef nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br label %111

111:                                              ; preds = %109, %90, %86
  %112 = icmp eq <2 x i32> %87, %77
  %113 = extractelement <2 x i1> %112, i64 0
  %114 = extractelement <2 x i1> %112, i64 1
  %or.cond68 = select i1 %114, i1 %113, i1 false
  br i1 %or.cond68, label %.loopexit, label %115

115:                                              ; preds = %111
  %116 = shl nsw i32 %.0, 1
  %117 = insertelement <2 x i32> poison, i32 %116, i64 0
  %118 = insertelement <2 x i32> %117, i32 %81, i64 1
  %119 = insertelement <2 x i32> poison, i32 %116, i64 1
  %120 = shufflevector <2 x i32> %119, <2 x i32> %79, <2 x i32> <i32 3, i32 1>
  %121 = icmp sgt <2 x i32> %118, %120
  %122 = select <2 x i1> %121, <2 x i32> zeroinitializer, <2 x i32> %83
  %123 = extractelement <2 x i1> %121, i64 1
  %124 = select i1 %123, i32 0, i32 %80
  %.1 = sub i32 %.0, %124
  %125 = add nsw <2 x i32> %122, %87
  %126 = extractelement <2 x i1> %121, i64 0
  %127 = select i1 %126, i32 0, i32 %84
  %.2 = add nsw i32 %.1, %127
  br label %86

.loopexit:                                        ; preds = %111, %3, %17
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x i32> @llvm.abs.v2i32(<2 x i32>, i1 immarg) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}


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