; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/descriptor (dog)

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

%class.ImageContent = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z13CheckDipPointfP12ImageContentff(float noundef %0, ptr noundef %1, float noundef %2, float noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store float %0, ptr %6, align 4, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !5
  store float %3, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %13 = load float, ptr %8, align 4, !tbaa !5
  %14 = fpext float %13 to double
  %15 = fadd double %14, 5.000000e-01
  %16 = fptosi double %15 to i32
  store i32 %16, ptr %10, align 4, !tbaa !11
  %17 = load float, ptr %9, align 4, !tbaa !5
  %18 = fpext float %17 to double
  %19 = fadd double %18, 5.000000e-01
  %20 = fptosi double %19 to i32
  store i32 %20, ptr %11, align 4, !tbaa !11
  %21 = load i32, ptr %10, align 4, !tbaa !11
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %36, label %23

23:                                               ; preds = %4
  %24 = load i32, ptr %11, align 4, !tbaa !11
  %25 = icmp slt i32 %24, 0
  br i1 %25, label %36, label %26

26:                                               ; preds = %23
  %27 = load i32, ptr %10, align 4, !tbaa !11
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  %29 = call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %28)
  %30 = icmp sge i32 %27, %29
  br i1 %30, label %36, label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %11, align 4, !tbaa !11
  %33 = load ptr, ptr %7, align 8, !tbaa !9
  %34 = call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %33)
  %35 = icmp sge i32 %32, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %31, %26, %23, %4
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %74

37:                                               ; preds = %31
  %38 = load float, ptr %6, align 4, !tbaa !5
  %39 = fpext float %38 to double
  %40 = fcmp ogt double %39, 0.000000e+00
  br i1 %40, label %41, label %57

41:                                               ; preds = %37
  %42 = load ptr, ptr %7, align 8, !tbaa !9
  %43 = getelementptr inbounds %class.ImageContent, ptr %42, i32 0, i32 4
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = load i32, ptr %10, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds ptr, ptr %44, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = load i32, ptr %11, align 4, !tbaa !11
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds float, ptr %48, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !5
  %53 = load float, ptr %6, align 4, !tbaa !5
  %54 = fcmp ogt float %52, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %41
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %74

56:                                               ; preds = %41
  br label %73

57:                                               ; preds = %37
  %58 = load ptr, ptr %7, align 8, !tbaa !9
  %59 = getelementptr inbounds %class.ImageContent, ptr %58, i32 0, i32 4
  %60 = load ptr, ptr %59, align 8, !tbaa !13
  %61 = load i32, ptr %10, align 4, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = load i32, ptr %11, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds float, ptr %64, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !5
  %69 = load float, ptr %6, align 4, !tbaa !5
  %70 = fcmp olt float %68, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %57
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %74

72:                                               ; preds = %57
  br label %73

73:                                               ; preds = %72, %56
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %74

74:                                               ; preds = %73, %71, %55, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %75 = load i32, ptr %5, align 4
  ret i32 %75
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple 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 16}
!14 = !{!"_ZTS12ImageContent", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z13CheckDipPointfP12ImageContentff(float noundef %0, ptr noundef %1, float noundef %2, float noundef %3) local_unnamed_addr #1 {
  %5 = insertelement <2 x float> poison, float %3, i64 0
  %6 = insertelement <2 x float> %5, float %2, i64 1
  %7 = fpext <2 x float> %6 to <2 x double>
  %8 = fadd <2 x double> %7, <double 5.000000e-01, double 5.000000e-01>
  %9 = fptosi <2 x double> %8 to <2 x i32>
  %10 = icmp slt <2 x i32> %9, zeroinitializer
  %11 = extractelement <2 x i1> %10, i64 0
  %12 = extractelement <2 x i1> %10, i64 1
  %or.cond = select i1 %12, i1 true, i1 %11
  br i1 %or.cond, label %34, label %13

13:                                               ; preds = %4
  %14 = tail call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %15 = extractelement <2 x i32> %9, i64 1
  %.not = icmp sgt i32 %14, %15
  br i1 %.not, label %16, label %34

16:                                               ; preds = %13
  %17 = tail call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %18 = extractelement <2 x i32> %9, i64 0
  %.not20 = icmp sgt i32 %17, %18
  br i1 %.not20, label %19, label %34

19:                                               ; preds = %16
  %20 = fcmp ogt float %0, 0.000000e+00
  %21 = getelementptr inbounds i8, ptr %1, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %23 = zext nneg i32 %15 to i64
  %24 = getelementptr inbounds ptr, ptr %22, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !11
  %26 = zext nneg i32 %18 to i64
  %27 = getelementptr inbounds float, ptr %25, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !12
  br i1 %20, label %29, label %31

29:                                               ; preds = %19
  %30 = fcmp ogt float %28, %0
  br i1 %30, label %34, label %33

31:                                               ; preds = %19
  %32 = fcmp olt float %28, %0
  br i1 %32, label %34, label %33

33:                                               ; preds = %31, %29
  br label %34

34:                                               ; preds = %31, %29, %4, %13, %16, %33
  %.0 = phi i32 [ 1, %33 ], [ 1, %16 ], [ 1, %13 ], [ 1, %4 ], [ 0, %29 ], [ 0, %31 ]
  ret i32 %.0
}

attributes #0 = { 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 #1 = { 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" }

!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, !10, i64 16}
!6 = !{!"_ZTS12ImageContent", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !8, i64 0}


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