; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15/StandaloneFNN (aim2)

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

@input = external dso_local global [784 x float], align 16
@twin = external dso_local global i64, align 8
@aim_model_layer0 = external dso_local constant [6280 x float], align 16
@aim_model_layer1 = external dso_local constant [9 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local float @processModel() #0 {
  %1 = alloca [8 x float], align 16
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  %7 = load i64, ptr @twin, align 8, !tbaa !5
  call void @processScanArea(i64 noundef %7)
  call void @llvm.lifetime.start.p0(i64 32, ptr %1) #7
  call void @llvm.memset.p0.i64(ptr align 16 %1, i8 0, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %52, %0
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 6280
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %55

12:                                               ; preds = %8
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = icmp sgt i32 %13, 784
  br i1 %14, label %15, label %35

15:                                               ; preds = %12
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [6280 x float], ptr @aim_model_layer0, i64 0, i64 %17
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = load i32, ptr %2, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %21
  %23 = load float, ptr %22, align 4, !tbaa !11
  %24 = fadd float %23, %19
  store float %24, ptr %22, align 4, !tbaa !11
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !11
  %29 = call float @tanhf(float noundef %28) #7
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %31
  store float %29, ptr %32, align 4, !tbaa !11
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !9
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %51

35:                                               ; preds = %12
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [784 x float], ptr @input, i64 0, i64 %37
  %39 = load float, ptr %38, align 4, !tbaa !11
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [6280 x float], ptr @aim_model_layer0, i64 0, i64 %41
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = load i32, ptr %2, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !11
  %48 = call float @llvm.fmuladd.f32(float %39, float %43, float %47)
  store float %48, ptr %46, align 4, !tbaa !11
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %35, %15
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %4, align 4, !tbaa !9
  br label %8, !llvm.loop !13

55:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store float 0.000000e+00, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %71, %55
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = icmp slt i32 %57, 8
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %74

60:                                               ; preds = %56
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %62
  %64 = load float, ptr %63, align 4, !tbaa !11
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [9 x float], ptr @aim_model_layer1, i64 0, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !11
  %69 = load float, ptr %5, align 4, !tbaa !11
  %70 = call float @llvm.fmuladd.f32(float %64, float %68, float %69)
  store float %70, ptr %5, align 4, !tbaa !11
  br label %71

71:                                               ; preds = %60
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %6, align 4, !tbaa !9
  br label %56, !llvm.loop !15

74:                                               ; preds = %59
  %75 = load float, ptr getelementptr inbounds ([9 x float], ptr @aim_model_layer1, i64 0, i64 8), align 16, !tbaa !11
  %76 = load float, ptr %5, align 4, !tbaa !11
  %77 = fadd float %76, %75
  store float %77, ptr %5, align 4, !tbaa !11
  %78 = load float, ptr %5, align 4, !tbaa !11
  %79 = call float @sigmoid(float noundef %78)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #7
  ret float %79
}

; Function Attrs: alwaysinline nounwind uwtable
declare dso_local void @processScanArea(i64 noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: nounwind
declare float @tanhf(float noundef) #4

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @sigmoid(float noundef) #6

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 = { alwaysinline 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 willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { inlinehint 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 #7 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@input = external dso_local local_unnamed_addr global [784 x float], align 16
@twin = external dso_local local_unnamed_addr global i64, align 8
@aim_model_layer0 = external dso_local local_unnamed_addr constant [6280 x float], align 16
@aim_model_layer1 = external dso_local local_unnamed_addr constant [9 x float], align 16

; Function Attrs: nounwind uwtable
define dso_local float @processModel() local_unnamed_addr #0 {
  %1 = alloca [8 x float], align 16
  %2 = load i64, ptr @twin, align 8, !tbaa !5
  tail call void @processScanArea(i64 noundef %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %1, i8 0, i64 32, i1 false)
  br label %3

3:                                                ; preds = %0, %25
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %25 ]
  %.02024 = phi i32 [ 0, %0 ], [ %.1, %25 ]
  %.02123 = phi i32 [ 0, %0 ], [ %.122, %25 ]
  %4 = icmp sgt i32 %.02024, 784
  br i1 %4, label %5, label %14

5:                                                ; preds = %3
  %6 = getelementptr inbounds [6280 x float], ptr @aim_model_layer0, i64 0, i64 %indvars.iv
  %7 = load float, ptr %6, align 4, !tbaa !9
  %8 = sext i32 %.02123 to i64
  %9 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %8
  %10 = load float, ptr %9, align 4, !tbaa !9
  %11 = fadd float %7, %10
  %12 = tail call float @tanhf(float noundef %11) #7
  store float %12, ptr %9, align 4, !tbaa !9
  %13 = add nsw i32 %.02123, 1
  br label %25

14:                                               ; preds = %3
  %15 = sext i32 %.02024 to i64
  %16 = getelementptr inbounds [784 x float], ptr @input, i64 0, i64 %15
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = getelementptr inbounds [6280 x float], ptr @aim_model_layer0, i64 0, i64 %indvars.iv
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = sext i32 %.02123 to i64
  %21 = getelementptr inbounds [8 x float], ptr %1, i64 0, i64 %20
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = tail call float @llvm.fmuladd.f32(float %17, float %19, float %22)
  store float %23, ptr %21, align 4, !tbaa !9
  %24 = add nsw i32 %.02024, 1
  br label %25

25:                                               ; preds = %5, %14
  %.122 = phi i32 [ %13, %5 ], [ %.02123, %14 ]
  %.1 = phi i32 [ 0, %5 ], [ %24, %14 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 6280
  br i1 %exitcond.not, label %.preheader.preheader, label %3, !llvm.loop !11

.preheader.preheader:                             ; preds = %25
  %26 = load float, ptr %1, align 16, !tbaa !9
  %27 = load float, ptr @aim_model_layer1, align 16, !tbaa !9
  %28 = tail call float @llvm.fmuladd.f32(float %26, float %27, float 0.000000e+00)
  %29 = getelementptr inbounds i8, ptr %1, i64 4
  %30 = load float, ptr %29, align 4, !tbaa !9
  %31 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 4), align 4, !tbaa !9
  %32 = tail call float @llvm.fmuladd.f32(float %30, float %31, float %28)
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  %34 = load float, ptr %33, align 8, !tbaa !9
  %35 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 8), align 8, !tbaa !9
  %36 = tail call float @llvm.fmuladd.f32(float %34, float %35, float %32)
  %37 = getelementptr inbounds i8, ptr %1, i64 12
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 12), align 4, !tbaa !9
  %40 = tail call float @llvm.fmuladd.f32(float %38, float %39, float %36)
  %41 = getelementptr inbounds i8, ptr %1, i64 16
  %42 = load float, ptr %41, align 16, !tbaa !9
  %43 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 16), align 16, !tbaa !9
  %44 = tail call float @llvm.fmuladd.f32(float %42, float %43, float %40)
  %45 = getelementptr inbounds i8, ptr %1, i64 20
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 20), align 4, !tbaa !9
  %48 = tail call float @llvm.fmuladd.f32(float %46, float %47, float %44)
  %49 = getelementptr inbounds i8, ptr %1, i64 24
  %50 = load float, ptr %49, align 8, !tbaa !9
  %51 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 24), align 8, !tbaa !9
  %52 = tail call float @llvm.fmuladd.f32(float %50, float %51, float %48)
  %53 = getelementptr inbounds i8, ptr %1, i64 28
  %54 = load float, ptr %53, align 4, !tbaa !9
  %55 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 28), align 4, !tbaa !9
  %56 = tail call float @llvm.fmuladd.f32(float %54, float %55, float %52)
  %57 = load float, ptr getelementptr inbounds (i8, ptr @aim_model_layer1, i64 32), align 16, !tbaa !9
  %58 = fadd float %56, %57
  %59 = tail call float @sigmoid(float noundef %58)
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  ret float %59
}

; Function Attrs: alwaysinline nounwind uwtable
declare dso_local void @processScanArea(i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @tanhf(float noundef) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @sigmoid(float noundef) local_unnamed_addr #6

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 = { alwaysinline 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 willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { inlinehint 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 #7 = { 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 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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