; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15 (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"

%struct._XImage = type { i32, i32, i32, i32, ptr, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, ptr, %struct.funcs }
%struct.funcs = type { ptr, ptr, ptr, ptr, ptr, ptr }

@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@input = external dso_local global [784 x float], align 16
@pgmbytes = external dso_local global [784 x i8], align 16
@sps = external dso_local global i32, align 4
@d = external dso_local 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: nounwind uwtable
define dso_local void @processScanArea(i64 noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %12 = load ptr, ptr @d, align 8, !tbaa !9
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = load i32, ptr @x, align 4, !tbaa !11
  %15 = sub i32 %14, 14
  %16 = load i32, ptr @y, align 4, !tbaa !11
  %17 = sub i32 %16, 14
  %18 = call ptr @XGetImage(ptr noundef %12, i64 noundef %13, i32 noundef %15, i32 noundef %17, i32 noundef 28, i32 noundef 28, i64 noundef -1, i32 noundef 1)
  store ptr %18, ptr %3, align 8, !tbaa !9
  %19 = load ptr, ptr %3, align 8, !tbaa !9
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %1
  store i32 1, ptr %4, align 4
  br label %108

22:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %96, %22
  %24 = load i32, ptr %6, align 4, !tbaa !11
  %25 = icmp ult i32 %24, 28
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %99

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %92, %27
  %29 = load i32, ptr %7, align 4, !tbaa !11
  %30 = icmp ult i32 %29, 28
  br i1 %30, label %32, label %31

31:                                               ; preds = %28
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %95

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %33 = load ptr, ptr %3, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct._XImage, ptr %33, i32 0, i32 16
  %35 = getelementptr inbounds %struct.funcs, ptr %34, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = load i32, ptr %7, align 4, !tbaa !11
  %39 = load i32, ptr %6, align 4, !tbaa !11
  %40 = call i64 %36(ptr noundef %37, i32 noundef %38, i32 noundef %39)
  store i64 %40, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct._XImage, ptr %42, i32 0, i32 12
  %44 = load i64, ptr %43, align 8, !tbaa !16
  %45 = and i64 %41, %44
  %46 = lshr i64 %45, 16
  %47 = trunc i64 %46 to i8
  store i8 %47, ptr %9, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %48 = load i64, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %3, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct._XImage, ptr %49, i32 0, i32 13
  %51 = load i64, ptr %50, align 8, !tbaa !18
  %52 = and i64 %48, %51
  %53 = lshr i64 %52, 8
  %54 = trunc i64 %53 to i8
  store i8 %54, ptr %10, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  %55 = load i64, ptr %8, align 8, !tbaa !5
  %56 = load ptr, ptr %3, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct._XImage, ptr %56, i32 0, i32 14
  %58 = load i64, ptr %57, align 8, !tbaa !19
  %59 = and i64 %55, %58
  %60 = trunc i64 %59 to i8
  store i8 %60, ptr %11, align 1, !tbaa !17
  %61 = load i8, ptr %9, align 1, !tbaa !17
  %62 = zext i8 %61 to i32
  %63 = sitofp i32 %62 to float
  %64 = load i8, ptr %10, align 1, !tbaa !17
  %65 = zext i8 %64 to i32
  %66 = sitofp i32 %65 to float
  %67 = fmul float %66, 0x3F70101020000000
  %68 = call float @llvm.fmuladd.f32(float %63, float 0x3F70101020000000, float %67)
  %69 = load i8, ptr %11, align 1, !tbaa !17
  %70 = zext i8 %69 to i32
  %71 = sitofp i32 %70 to float
  %72 = call float @llvm.fmuladd.f32(float %71, float 0x3F70101020000000, float %68)
  %73 = fmul float %72, 0x3FD5555560000000
  %74 = load i32, ptr %5, align 4, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [784 x float], ptr @input, i64 0, i64 %75
  store float %73, ptr %76, align 4, !tbaa !20
  %77 = load i8, ptr %9, align 1, !tbaa !17
  %78 = zext i8 %77 to i32
  %79 = load i8, ptr %10, align 1, !tbaa !17
  %80 = zext i8 %79 to i32
  %81 = add nsw i32 %78, %80
  %82 = load i8, ptr %11, align 1, !tbaa !17
  %83 = zext i8 %82 to i32
  %84 = add nsw i32 %81, %83
  %85 = sdiv i32 %84, 3
  %86 = trunc i32 %85 to i8
  %87 = load i32, ptr %5, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [784 x i8], ptr @pgmbytes, i64 0, i64 %88
  store i8 %86, ptr %89, align 1, !tbaa !17
  %90 = load i32, ptr %5, align 4, !tbaa !11
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  br label %92

92:                                               ; preds = %32
  %93 = load i32, ptr %7, align 4, !tbaa !11
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %7, align 4, !tbaa !11
  br label %28, !llvm.loop !22

95:                                               ; preds = %31
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %6, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %6, align 4, !tbaa !11
  br label %23, !llvm.loop !24

99:                                               ; preds = %26
  %100 = load ptr, ptr %3, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct._XImage, ptr %100, i32 0, i32 16
  %102 = getelementptr inbounds %struct.funcs, ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !25
  %104 = load ptr, ptr %3, align 8, !tbaa !9
  %105 = call i32 %103(ptr noundef %104)
  %106 = load i32, ptr @sps, align 4, !tbaa !11
  %107 = add i32 %106, 1
  store i32 %107, ptr @sps, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  store i32 0, ptr %4, align 4
  br label %108

108:                                              ; preds = %99, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %109 = load i32, ptr %4, align 4
  switch i32 %109, label %111 [
    i32 0, label %110
    i32 1, label %110
  ]

110:                                              ; preds = %108, %108
  ret void

111:                                              ; preds = %108
  unreachable
}

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

declare ptr @XGetImage(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) #2

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 104}
!14 = !{!"_XImage", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !10, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !10, i64 80, !15, i64 88}
!15 = !{!"funcs", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!16 = !{!14, !6, i64 56}
!17 = !{!7, !7, i64 0}
!18 = !{!14, !6, i64 64}
!19 = !{!14, !6, i64 72}
!20 = !{!21, !21, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!14, !10, i64 96}


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

@x = external dso_local local_unnamed_addr global i32, align 4
@y = external dso_local local_unnamed_addr global i32, align 4
@input = external dso_local local_unnamed_addr global [784 x float], align 16
@pgmbytes = external dso_local local_unnamed_addr global [784 x i8], align 16
@sps = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local void @processScanArea(i64 noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @d, align 8, !tbaa !5
  %3 = load i32, ptr @x, align 4, !tbaa !9
  %4 = add i32 %3, -14
  %5 = load i32, ptr @y, align 4, !tbaa !9
  %6 = add i32 %5, -14
  %7 = tail call ptr @XGetImage(ptr noundef %2, i64 noundef %0, i32 noundef %4, i32 noundef %6, i32 noundef 28, i32 noundef 28, i64 noundef -1, i32 noundef 1) #3
  %8 = icmp eq ptr %7, null
  br i1 %8, label %53, label %.preheader29

.preheader29:                                     ; preds = %1
  %9 = getelementptr inbounds i8, ptr %7, i64 104
  %10 = getelementptr inbounds i8, ptr %7, i64 56
  %11 = getelementptr inbounds i8, ptr %7, i64 64
  %12 = getelementptr inbounds i8, ptr %7, i64 72
  br label %.preheader

.preheader:                                       ; preds = %.preheader29, %20
  %.033 = phi i64 [ 0, %.preheader29 ], [ %indvars.iv.next, %20 ]
  %.02632 = phi i32 [ 0, %.preheader29 ], [ %21, %20 ]
  %sext = shl i64 %.033, 32
  %13 = ashr exact i64 %sext, 32
  br label %22

14:                                               ; preds = %20
  %15 = getelementptr inbounds i8, ptr %7, i64 96
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = tail call i32 %16(ptr noundef nonnull %7) #3
  %18 = load i32, ptr @sps, align 4, !tbaa !9
  %19 = add i32 %18, 1
  store i32 %19, ptr @sps, align 4, !tbaa !9
  br label %53

20:                                               ; preds = %22
  %21 = add nuw nsw i32 %.02632, 1
  %exitcond35.not = icmp eq i32 %21, 28
  br i1 %exitcond35.not, label %14, label %.preheader, !llvm.loop !15

22:                                               ; preds = %.preheader, %22
  %indvars.iv = phi i64 [ %13, %.preheader ], [ %indvars.iv.next, %22 ]
  %.02730 = phi i32 [ 0, %.preheader ], [ %52, %22 ]
  %23 = load ptr, ptr %9, align 8, !tbaa !17
  %24 = tail call i64 %23(ptr noundef nonnull %7, i32 noundef %.02730, i32 noundef %.02632) #3
  %25 = load i64, ptr %10, align 8, !tbaa !18
  %26 = and i64 %25, %24
  %27 = trunc i64 %26 to i32
  %28 = lshr i32 %27, 16
  %29 = load i64, ptr %11, align 8, !tbaa !19
  %30 = and i64 %29, %24
  %31 = trunc i64 %30 to i32
  %32 = lshr i32 %31, 8
  %33 = load i64, ptr %12, align 8, !tbaa !20
  %34 = and i64 %33, %24
  %35 = trunc i64 %34 to i32
  %36 = and i32 %28, 255
  %37 = uitofp nneg i32 %36 to float
  %38 = and i32 %32, 255
  %39 = uitofp nneg i32 %38 to float
  %40 = fmul float %39, 0x3F70101020000000
  %41 = tail call float @llvm.fmuladd.f32(float %37, float 0x3F70101020000000, float %40)
  %42 = and i32 %35, 255
  %43 = uitofp nneg i32 %42 to float
  %44 = tail call float @llvm.fmuladd.f32(float %43, float 0x3F70101020000000, float %41)
  %45 = fmul float %44, 0x3FD5555560000000
  %46 = getelementptr inbounds [784 x float], ptr @input, i64 0, i64 %indvars.iv
  store float %45, ptr %46, align 4, !tbaa !21
  %47 = add nuw nsw i32 %38, %36
  %48 = add nuw nsw i32 %47, %42
  %.lhs.trunc = trunc nuw nsw i32 %48 to i16
  %49 = udiv i16 %.lhs.trunc, 3
  %50 = trunc nuw i16 %49 to i8
  %51 = getelementptr inbounds [784 x i8], ptr @pgmbytes, i64 0, i64 %indvars.iv
  store i8 %50, ptr %51, align 1, !tbaa !23
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %52 = add nuw nsw i32 %.02730, 1
  %exitcond.not = icmp eq i32 %52, 28
  br i1 %exitcond.not, label %20, label %22, !llvm.loop !24

53:                                               ; preds = %1, %14
  ret void
}

declare ptr @XGetImage(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 96}
!12 = !{!"_XImage", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !6, i64 80, !14, i64 88}
!13 = !{!"long", !7, i64 0}
!14 = !{!"funcs", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!12, !6, i64 104}
!18 = !{!12, !13, i64 56}
!19 = !{!12, !13, i64 64}
!20 = !{!12, !13, i64 72}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass