; LLVM IR from mrbid/CSGO_TENSOR_TRIGGER :: GOBOT15/KERAS2C/include (k2c_activations)

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

; 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
define dso_local void @k2c_ReLU(ptr noundef %0, i64 noundef %1, float noundef %2, float noundef %3, float noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !11
  store float %3, ptr %9, align 4, !tbaa !11
  store float %4, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %50, %5
  %13 = load i64, ptr %11, align 8, !tbaa !9
  %14 = load i64, ptr %7, align 8, !tbaa !9
  %15 = icmp ult i64 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  br label %53

17:                                               ; preds = %12
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = load i64, ptr %11, align 8, !tbaa !9
  %20 = getelementptr inbounds float, ptr %18, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !11
  %22 = load float, ptr %8, align 4, !tbaa !11
  %23 = fcmp oge float %21, %22
  br i1 %23, label %24, label %29

24:                                               ; preds = %17
  %25 = load float, ptr %8, align 4, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i64, ptr %11, align 8, !tbaa !9
  %28 = getelementptr inbounds float, ptr %26, i64 %27
  store float %25, ptr %28, align 4, !tbaa !11
  br label %49

29:                                               ; preds = %17
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr %11, align 8, !tbaa !9
  %32 = getelementptr inbounds float, ptr %30, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !11
  %34 = load float, ptr %10, align 4, !tbaa !11
  %35 = fcmp olt float %33, %34
  br i1 %35, label %36, label %48

36:                                               ; preds = %29
  %37 = load float, ptr %9, align 4, !tbaa !11
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i64, ptr %11, align 8, !tbaa !9
  %40 = getelementptr inbounds float, ptr %38, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !11
  %42 = load float, ptr %10, align 4, !tbaa !11
  %43 = fsub float %41, %42
  %44 = fmul float %37, %43
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load i64, ptr %11, align 8, !tbaa !9
  %47 = getelementptr inbounds float, ptr %45, i64 %46
  store float %44, ptr %47, align 4, !tbaa !11
  br label %48

48:                                               ; preds = %36, %29
  br label %49

49:                                               ; preds = %48, %24
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr %11, align 8, !tbaa !9
  %52 = add i64 %51, 1
  store i64 %52, ptr %11, align 8, !tbaa !9
  br label %12, !llvm.loop !13

53:                                               ; preds = %16
  ret void
}

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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @k2c_ReLU(ptr nocapture noundef %0, i64 noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #0 {
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %5
  %min.iters.check = icmp ult i64 %1, 8
  br i1 %min.iters.check, label %.lr.ph.preheader41, label %vector.ph

.lr.ph.preheader41:                               ; preds = %middle.block, %.lr.ph.preheader
  %.020.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %1, -8
  %broadcast.splatinsert = insertelement <4 x float> poison, float %2, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert22 = insertelement <4 x float> poison, float %4, i64 0
  %broadcast.splat23 = shufflevector <4 x float> %broadcast.splatinsert22, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert24 = insertelement <4 x float> poison, float %3, i64 0
  %broadcast.splat25 = shufflevector <4 x float> %broadcast.splatinsert24, <4 x float> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %pred.store.continue40, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %pred.store.continue40 ]
  %6 = or disjoint i64 %index, 4
  %7 = getelementptr inbounds float, ptr %0, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %wide.load = load <4 x float>, ptr %7, align 4, !tbaa !5
  %wide.load21 = load <4 x float>, ptr %8, align 4, !tbaa !5
  %9 = fcmp ult <4 x float> %wide.load, %broadcast.splat
  %10 = fcmp ult <4 x float> %wide.load21, %broadcast.splat
  %11 = fcmp olt <4 x float> %wide.load, %broadcast.splat23
  %12 = fcmp olt <4 x float> %wide.load21, %broadcast.splat23
  %13 = select <4 x i1> %9, <4 x i1> %11, <4 x i1> zeroinitializer
  %14 = select <4 x i1> %10, <4 x i1> %12, <4 x i1> zeroinitializer
  %15 = fsub <4 x float> %wide.load, %broadcast.splat23
  %16 = fsub <4 x float> %wide.load21, %broadcast.splat23
  %17 = fmul <4 x float> %15, %broadcast.splat25
  %18 = fmul <4 x float> %16, %broadcast.splat25
  %19 = xor <4 x i1> %9, <i1 true, i1 true, i1 true, i1 true>
  %20 = xor <4 x i1> %10, <i1 true, i1 true, i1 true, i1 true>
  %21 = or <4 x i1> %13, %19
  %22 = or <4 x i1> %14, %20
  %predphi = select <4 x i1> %9, <4 x float> %17, <4 x float> %broadcast.splat
  %predphi26 = select <4 x i1> %10, <4 x float> %18, <4 x float> %broadcast.splat
  %23 = extractelement <4 x i1> %21, i64 0
  br i1 %23, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  %24 = getelementptr inbounds float, ptr %0, i64 %index
  %25 = extractelement <4 x float> %predphi, i64 0
  store float %25, ptr %24, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %26 = extractelement <4 x i1> %21, i64 1
  br i1 %26, label %pred.store.if27, label %pred.store.continue28

pred.store.if27:                                  ; preds = %pred.store.continue
  %27 = or disjoint i64 %index, 1
  %28 = getelementptr inbounds float, ptr %0, i64 %27
  %29 = extractelement <4 x float> %predphi, i64 1
  store float %29, ptr %28, align 4, !tbaa !5
  br label %pred.store.continue28

pred.store.continue28:                            ; preds = %pred.store.if27, %pred.store.continue
  %30 = extractelement <4 x i1> %21, i64 2
  br i1 %30, label %pred.store.if29, label %pred.store.continue30

pred.store.if29:                                  ; preds = %pred.store.continue28
  %31 = or disjoint i64 %index, 2
  %32 = getelementptr inbounds float, ptr %0, i64 %31
  %33 = extractelement <4 x float> %predphi, i64 2
  store float %33, ptr %32, align 4, !tbaa !5
  br label %pred.store.continue30

pred.store.continue30:                            ; preds = %pred.store.if29, %pred.store.continue28
  %34 = extractelement <4 x i1> %21, i64 3
  br i1 %34, label %pred.store.if31, label %pred.store.continue32

pred.store.if31:                                  ; preds = %pred.store.continue30
  %35 = or disjoint i64 %index, 3
  %36 = getelementptr inbounds float, ptr %0, i64 %35
  %37 = extractelement <4 x float> %predphi, i64 3
  store float %37, ptr %36, align 4, !tbaa !5
  br label %pred.store.continue32

pred.store.continue32:                            ; preds = %pred.store.if31, %pred.store.continue30
  %38 = extractelement <4 x i1> %22, i64 0
  br i1 %38, label %pred.store.if33, label %pred.store.continue34

pred.store.if33:                                  ; preds = %pred.store.continue32
  %39 = getelementptr inbounds float, ptr %0, i64 %6
  %40 = extractelement <4 x float> %predphi26, i64 0
  store float %40, ptr %39, align 4, !tbaa !5
  br label %pred.store.continue34

pred.store.continue34:                            ; preds = %pred.store.if33, %pred.store.continue32
  %41 = extractelement <4 x i1> %22, i64 1
  br i1 %41, label %pred.store.if35, label %pred.store.continue36

pred.store.if35:                                  ; preds = %pred.store.continue34
  %42 = or disjoint i64 %index, 5
  %43 = getelementptr inbounds float, ptr %0, i64 %42
  %44 = extractelement <4 x float> %predphi26, i64 1
  store float %44, ptr %43, align 4, !tbaa !5
  br label %pred.store.continue36

pred.store.continue36:                            ; preds = %pred.store.if35, %pred.store.continue34
  %45 = extractelement <4 x i1> %22, i64 2
  br i1 %45, label %pred.store.if37, label %pred.store.continue38

pred.store.if37:                                  ; preds = %pred.store.continue36
  %46 = or disjoint i64 %index, 6
  %47 = getelementptr inbounds float, ptr %0, i64 %46
  %48 = extractelement <4 x float> %predphi26, i64 2
  store float %48, ptr %47, align 4, !tbaa !5
  br label %pred.store.continue38

pred.store.continue38:                            ; preds = %pred.store.if37, %pred.store.continue36
  %49 = extractelement <4 x i1> %22, i64 3
  br i1 %49, label %pred.store.if39, label %pred.store.continue40

pred.store.if39:                                  ; preds = %pred.store.continue38
  %50 = or disjoint i64 %index, 7
  %51 = getelementptr inbounds float, ptr %0, i64 %50
  %52 = extractelement <4 x float> %predphi26, i64 3
  store float %52, ptr %51, align 4, !tbaa !5
  br label %pred.store.continue40

pred.store.continue40:                            ; preds = %pred.store.if39, %pred.store.continue38
  %index.next = add nuw i64 %index, 8
  %53 = icmp eq i64 %index.next, %n.vec
  br i1 %53, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %pred.store.continue40
  %cmp.n = icmp eq i64 %n.vec, %1
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader41

._crit_edge:                                      ; preds = %62, %middle.block, %5
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader41, %62
  %.020 = phi i64 [ %63, %62 ], [ %.020.ph, %.lr.ph.preheader41 ]
  %54 = getelementptr inbounds float, ptr %0, i64 %.020
  %55 = load float, ptr %54, align 4, !tbaa !5
  %56 = fcmp ult float %55, %2
  br i1 %56, label %57, label %.sink.split

57:                                               ; preds = %.lr.ph
  %58 = fcmp olt float %55, %4
  br i1 %58, label %59, label %62

59:                                               ; preds = %57
  %60 = fsub float %55, %4
  %61 = fmul float %60, %3
  br label %.sink.split

.sink.split:                                      ; preds = %.lr.ph, %59
  %.sink = phi float [ %61, %59 ], [ %2, %.lr.ph ]
  store float %.sink, ptr %54, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %.sink.split, %57
  %63 = add nuw i64 %.020, 1
  %exitcond.not = icmp eq i64 %63, %1
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13
}

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass