; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15/KERAS2C/CNN (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 [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: nounwind uwtable
define dso_local void @processScanArea(i64 noundef %0) #0 {
  %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 = call i32 @qRand(float noundef -1.000000e+00, float noundef 1.000000e+00)
  %16 = add i32 %14, %15
  %17 = sub i32 %16, 14
  %18 = load i32, ptr @y, align 4, !tbaa !11
  %19 = call i32 @qRand(float noundef -1.000000e+00, float noundef 1.000000e+00)
  %20 = add i32 %18, %19
  %21 = sub i32 %20, 14
  %22 = call ptr @XGetImage(ptr noundef %12, i64 noundef %13, i32 noundef %17, i32 noundef %21, i32 noundef 28, i32 noundef 28, i64 noundef -1, i32 noundef 1)
  store ptr %22, ptr %3, align 8, !tbaa !9
  %23 = load ptr, ptr %3, align 8, !tbaa !9
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %1
  store i32 1, ptr %4, align 4
  br label %112

26:                                               ; 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 %27

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

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

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

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

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

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

96:                                               ; preds = %36
  %97 = load i32, ptr %7, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %7, align 4, !tbaa !11
  br label %32, !llvm.loop !22

99:                                               ; preds = %35
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %6, align 4, !tbaa !11
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %6, align 4, !tbaa !11
  br label %27, !llvm.loop !24

103:                                              ; preds = %30
  %104 = load ptr, ptr %3, align 8, !tbaa !9
  %105 = getelementptr inbounds %struct._XImage, ptr %104, i32 0, i32 16
  %106 = getelementptr inbounds %struct.funcs, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !25
  %108 = load ptr, ptr %3, align 8, !tbaa !9
  %109 = call i32 %107(ptr noundef %108)
  %110 = load i32, ptr @sps, align 4, !tbaa !11
  %111 = add i32 %110, 1
  store i32 %111, 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 %112

112:                                              ; preds = %103, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  %113 = load i32, ptr %4, align 4
  switch i32 %113, label %115 [
    i32 0, label %114
    i32 1, label %114
  ]

114:                                              ; preds = %112, %112
  ret void

115:                                              ; preds = %112
  unreachable
}

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

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

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { "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 #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 = tail call i32 @qRand(float noundef -1.000000e+00, float noundef 1.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 -1.000000e+00, float noundef 1.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) #3
  %12 = icmp eq ptr %11, null
  br i1 %12, label %57, label %.preheader29

.preheader29:                                     ; 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 = %.preheader29, %24
  %.033 = phi i64 [ 0, %.preheader29 ], [ %indvars.iv.next, %24 ]
  %.02632 = phi i32 [ 0, %.preheader29 ], [ %25, %24 ]
  %sext = shl i64 %.033, 32
  %17 = ashr exact i64 %sext, 32
  br label %26

18:                                               ; preds = %24
  %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) #3
  %22 = load i32, ptr @sps, align 4, !tbaa !9
  %23 = add i32 %22, 1
  store i32 %23, ptr @sps, align 4, !tbaa !9
  br label %57

24:                                               ; preds = %26
  %25 = add nuw nsw i32 %.02632, 1
  %exitcond35.not = icmp eq i32 %25, 28
  br i1 %exitcond35.not, label %18, label %.preheader, !llvm.loop !15

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

57:                                               ; preds = %1, %18
  ret void
}

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

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

declare ptr @XGetImage(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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