; LLVM IR from huawei-noah/bolt :: inference/examples/automatic_speech_recognition/vad.ll (Z6verify6TensorS_)

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

@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1

; 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
declare i64 @syscall(i64 noundef, ...) #1

declare i32 @printf(ptr noundef, ...) #2

declare i32 @fflush(ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z6verify6TensorS_(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %9 = call noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  store i32 %9, ptr %6, align 4, !tbaa !9
  %10 = load i32, ptr %6, align 4, !tbaa !9
  %11 = icmp eq i32 2, %10
  br i1 %11, label %22, label %12

12:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %13 = call i64 (i64, ...) @syscall(i64 noundef 186) #6
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %7, align 4, !tbaa !9
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = call i32 @fflush(ptr noundef %17)
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %20 = load ptr, ptr @stdout, align 8, !tbaa !5
  %21 = call i32 @fflush(ptr noundef %20)
  call void @exit(i32 noundef 1) #7
  unreachable

22:                                               ; preds = %2
  %23 = call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 0)
  %24 = fpext float %23 to double
  %25 = fsub double %24, 0x3FEFF8AF3E468CAC
  %26 = call noundef double @_ZSt3absd(double noundef %25)
  %27 = fcmp oge double %26, 5.000000e-04
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %28, %22
  %30 = call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 1)
  %31 = fpext float %30 to double
  %32 = fsub double %31, 9.000000e-04
  %33 = call noundef double @_ZSt3absd(double noundef %32)
  %34 = fcmp oge double %33, 5.000000e-04
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %35, %29
  %37 = call noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  store i32 %37, ptr %6, align 4, !tbaa !9
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = icmp eq i32 2, %38
  br i1 %39, label %50, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %41 = call i64 (i64, ...) @syscall(i64 noundef 186) #6
  %42 = trunc i64 %41 to i32
  store i32 %42, ptr %8, align 4, !tbaa !9
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %43)
  %45 = load ptr, ptr @stdout, align 8, !tbaa !5
  %46 = call i32 @fflush(ptr noundef %45)
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %48 = load ptr, ptr @stdout, align 8, !tbaa !5
  %49 = call i32 @fflush(ptr noundef %48)
  call void @exit(i32 noundef 1) #7
  unreachable

50:                                               ; preds = %36
  %51 = call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 0)
  %52 = fsub float %51, 1.000000e+00
  %53 = call noundef float @_ZSt3absf(float noundef %52)
  %54 = fpext float %53 to double
  %55 = fcmp oge double %54, 5.000000e-04
  br i1 %55, label %56, label %57

56:                                               ; preds = %50
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %56, %50
  %58 = call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 1)
  %59 = fpext float %58 to double
  %60 = fsub double %59, 1.400000e-08
  %61 = call noundef double @_ZSt3absd(double noundef %60)
  %62 = fcmp oge double %61, 5.000000e-04
  br i1 %62, label %63, label %64

63:                                               ; preds = %57
  store i32 1, ptr %5, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %63, %57
  %65 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret i32 %65
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { noreturn 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 #4 = { mustprogress 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 #5 = { inlinehint mustprogress 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 #6 = { nounwind }
attributes #7 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1

; Function Attrs: nounwind
declare i64 @syscall(i64 noundef, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z6verify6TensorS_(ptr noundef nonnull %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = tail call noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %4 = icmp eq i32 %3, 2
  br i1 %4, label %14, label %5

5:                                                ; preds = %2
  %6 = tail call i64 (i64, ...) @syscall(i64 noundef 186) #5
  %7 = trunc i64 %6 to i32
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = tail call i32 @fflush(ptr noundef %9)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %12 = load ptr, ptr @stdout, align 8, !tbaa !5
  %13 = tail call i32 @fflush(ptr noundef %12)
  tail call void @exit(i32 noundef 1) #6
  unreachable

14:                                               ; preds = %2
  %15 = tail call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 0)
  %16 = fpext float %15 to double
  %17 = fadd double %16, 0xBFEFF8AF3E468CAC
  %18 = tail call noundef double @_ZSt3absd(double noundef %17)
  %19 = tail call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 1)
  %20 = fpext float %19 to double
  %21 = fadd double %20, -9.000000e-04
  %22 = tail call noundef double @_ZSt3absd(double noundef %21)
  %23 = tail call noundef i32 @_ZN6Tensor6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %34, label %25

25:                                               ; preds = %14
  %26 = tail call i64 (i64, ...) @syscall(i64 noundef 186) #5
  %27 = trunc i64 %26 to i32
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %27)
  %29 = load ptr, ptr @stdout, align 8, !tbaa !5
  %30 = tail call i32 @fflush(ptr noundef %29)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %32 = load ptr, ptr @stdout, align 8, !tbaa !5
  %33 = tail call i32 @fflush(ptr noundef %32)
  tail call void @exit(i32 noundef 1) #6
  unreachable

34:                                               ; preds = %14
  %35 = fcmp oge double %22, 5.000000e-04
  %36 = fcmp oge double %18, 5.000000e-04
  %narrow = or i1 %36, %35
  %37 = tail call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 0)
  %38 = fadd float %37, -1.000000e+00
  %39 = tail call noundef float @_ZSt3absf(float noundef %38)
  %40 = fpext float %39 to double
  %41 = fcmp oge double %40, 5.000000e-04
  %narrow5 = or i1 %narrow, %41
  %42 = tail call noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef 1)
  %43 = fpext float %42 to double
  %44 = fadd double %43, -1.400000e-08
  %45 = tail call noundef double @_ZSt3absd(double noundef %44)
  %46 = fcmp oge double %45, 5.000000e-04
  %narrow6 = or i1 %46, %narrow5
  %.3 = zext i1 %narrow6 to i32
  ret i32 %.3
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN6Tensor7elementEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) local_unnamed_addr #4

attributes #0 = { 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 #1 = { nofree 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 #2 = { noreturn 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 #3 = { mustprogress 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 #4 = { inlinehint mustprogress 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 #5 = { nounwind }
attributes #6 = { noreturn 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++ TBAA"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass