; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15/TBVGG3 (aim)

; 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 [3 x [28 x [28 x float]]], align 16
@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: 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 i32 @qRand(float noundef, float noundef) #1

; 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 i64, align 8
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %11 = load ptr, ptr @d, align 8, !tbaa !9
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = load i32, ptr @x, align 4, !tbaa !11
  %14 = call i32 @qRand(float noundef -0.000000e+00, float noundef 0.000000e+00)
  %15 = add i32 %13, %14
  %16 = sub i32 %15, 14
  %17 = load i32, ptr @y, align 4, !tbaa !11
  %18 = call i32 @qRand(float noundef -0.000000e+00, float noundef 0.000000e+00)
  %19 = add i32 %17, %18
  %20 = sub i32 %19, 14
  %21 = call ptr @XGetImage(ptr noundef %11, i64 noundef %12, i32 noundef %16, i32 noundef %20, i32 noundef 28, i32 noundef 28, i64 noundef -1, i32 noundef 1)
  store ptr %21, ptr %3, align 8, !tbaa !9
  %22 = load ptr, ptr %3, align 8, !tbaa !9
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

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

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

26:                                               ; preds = %98, %25
  %27 = load i32, ptr %5, align 4, !tbaa !11
  %28 = icmp ult i32 %27, 28
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %101

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %94, %30
  %32 = load i32, ptr %6, align 4, !tbaa !11
  %33 = icmp ult i32 %32, 28
  br i1 %33, label %35, label %34

34:                                               ; preds = %31
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %97

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

94:                                               ; preds = %35
  %95 = load i32, ptr %6, align 4, !tbaa !11
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %6, align 4, !tbaa !11
  br label %31, !llvm.loop !22

97:                                               ; preds = %34
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !11
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !11
  br label %26, !llvm.loop !24

101:                                              ; preds = %29
  %102 = load ptr, ptr %3, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct._XImage, ptr %102, i32 0, i32 16
  %104 = getelementptr inbounds %struct.funcs, ptr %103, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8, !tbaa !25
  %106 = load ptr, ptr %3, align 8, !tbaa !9
  %107 = call i32 %105(ptr noundef %106)
  store i32 0, ptr %4, align 4
  br label %108

108:                                              ; preds = %101, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %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
}

declare ptr @XGetImage(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) #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 = { "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 = !{!"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 [3 x [28 x [28 x float]]], align 16
@d = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local i32 @qRand(float noundef, float noundef) local_unnamed_addr #0

; 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 = tail call i32 @qRand(float noundef -0.000000e+00, float noundef 0.000000e+00)
  %5 = add i32 %3, -14
  %6 = add i32 %5, %4
  %7 = load i32, ptr @y, align 4, !tbaa !9
  %8 = tail call i32 @qRand(float noundef -0.000000e+00, float noundef 0.000000e+00)
  %9 = add i32 %7, -14
  %10 = add i32 %9, %8
  %11 = tail call ptr @XGetImage(ptr noundef %2, i64 noundef %0, i32 noundef %6, i32 noundef %10, i32 noundef 28, i32 noundef 28, i64 noundef -1, i32 noundef 1) #2
  %12 = icmp eq ptr %11, null
  br i1 %12, label %50, label %.preheader28

.preheader28:                                     ; preds = %1
  %13 = getelementptr inbounds i8, ptr %11, i64 104
  %14 = getelementptr inbounds i8, ptr %11, i64 56
  %15 = getelementptr inbounds i8, ptr %11, i64 64
  %16 = getelementptr inbounds i8, ptr %11, i64 72
  br label %.preheader

.preheader:                                       ; preds = %.preheader28, %22
  %indvars.iv32 = phi i64 [ 0, %.preheader28 ], [ %indvars.iv.next33, %22 ]
  %17 = trunc nuw nsw i64 %indvars.iv32 to i32
  br label %23

18:                                               ; preds = %22
  %19 = getelementptr inbounds i8, ptr %11, i64 96
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  %21 = tail call i32 %20(ptr noundef nonnull %11) #2
  br label %50

22:                                               ; preds = %23
  %indvars.iv.next33 = add nuw nsw i64 %indvars.iv32, 1
  %exitcond35.not = icmp eq i64 %indvars.iv.next33, 28
  br i1 %exitcond35.not, label %18, label %.preheader, !llvm.loop !15

23:                                               ; preds = %.preheader, %23
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %23 ]
  %24 = load ptr, ptr %13, align 8, !tbaa !17
  %25 = trunc nuw nsw i64 %indvars.iv to i32
  %26 = tail call i64 %24(ptr noundef nonnull %11, i32 noundef %25, i32 noundef %17) #2
  %27 = load i64, ptr %14, align 8, !tbaa !18
  %28 = and i64 %27, %26
  %29 = lshr i64 %28, 16
  %30 = trunc i64 %29 to i8
  %31 = load i64, ptr %15, align 8, !tbaa !19
  %32 = and i64 %31, %26
  %33 = lshr i64 %32, 8
  %34 = trunc i64 %33 to i8
  %35 = load i64, ptr %16, align 8, !tbaa !20
  %36 = and i64 %35, %26
  %37 = trunc i64 %36 to i8
  %38 = uitofp i8 %30 to float
  %39 = fadd float %38, -1.275000e+02
  %40 = fmul float %39, 0x3F80101000000000
  %41 = getelementptr inbounds [28 x [28 x float]], ptr @input, i64 0, i64 %indvars.iv32, i64 %indvars.iv
  store float %40, ptr %41, align 4, !tbaa !21
  %42 = uitofp i8 %34 to float
  %43 = fadd float %42, -1.275000e+02
  %44 = fmul float %43, 0x3F80101000000000
  %45 = getelementptr inbounds [28 x [28 x float]], ptr getelementptr inbounds (i8, ptr @input, i64 3136), i64 0, i64 %indvars.iv32, i64 %indvars.iv
  store float %44, ptr %45, align 4, !tbaa !21
  %46 = uitofp i8 %37 to float
  %47 = fadd float %46, -1.275000e+02
  %48 = fmul float %47, 0x3F80101000000000
  %49 = getelementptr inbounds [28 x [28 x float]], ptr getelementptr inbounds (i8, ptr @input, i64 6272), i64 0, i64 %indvars.iv32, i64 %indvars.iv
  store float %48, ptr %49, align 4, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 28
  br i1 %exitcond.not, label %22, label %23, !llvm.loop !23

50:                                               ; preds = %1, %18
  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

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 = { 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 = distinct !{!23, !16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass