; LLVM IR from QiaoLiuHit/LSOTB-TIR :: vlfeat-0.9.19/vl (scalespace)

; 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._VlScaleSpaceGeometry = type { i64, i64, i64, i64, i64, i64, i64, double, double }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry = external hidden unnamed_addr constant [74 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @vl_scalespace_get_default_geometry(ptr dead_on_unwind noalias writable sret(%struct._VlScaleSpaceGeometry) align 8 %0, i64 noundef %1, i64 noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  store i64 %1, ptr %4, align 8, !tbaa !5
  store i64 %2, ptr %5, align 8, !tbaa !5
  %6 = load i64, ptr %4, align 8, !tbaa !5
  %7 = icmp uge i64 %6, 1
  br i1 %7, label %8, label %9

8:                                                ; preds = %3
  br label %10

9:                                                ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 309, ptr noundef @__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry) #5
  unreachable

10:                                               ; preds = %8
  %11 = load i64, ptr %5, align 8, !tbaa !5
  %12 = icmp uge i64 %11, 1
  br i1 %12, label %13, label %14

13:                                               ; preds = %10
  br label %15

14:                                               ; preds = %10
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 310, ptr noundef @__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry) #5
  unreachable

15:                                               ; preds = %13
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 0
  store i64 %16, ptr %17, align 8, !tbaa !9
  %18 = load i64, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 1
  store i64 %18, ptr %19, align 8, !tbaa !12
  %20 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 2
  store i64 0, ptr %20, align 8, !tbaa !13
  %21 = load i64, ptr %4, align 8, !tbaa !5
  %22 = load i64, ptr %5, align 8, !tbaa !5
  %23 = icmp ult i64 %21, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %15
  %25 = load i64, ptr %4, align 8, !tbaa !5
  br label %28

26:                                               ; preds = %15
  %27 = load i64, ptr %5, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %26, %24
  %29 = phi i64 [ %25, %24 ], [ %27, %26 ]
  %30 = uitofp i64 %29 to double
  %31 = call double @vl_log2_d(double noundef %30)
  %32 = call double @llvm.floor.f64(double %31)
  %33 = fsub double %32, 3.000000e+00
  %34 = fcmp ogt double %33, 0.000000e+00
  br i1 %34, label %35, label %49

35:                                               ; preds = %28
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = icmp ult i64 %36, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %35
  %40 = load i64, ptr %4, align 8, !tbaa !5
  br label %43

41:                                               ; preds = %35
  %42 = load i64, ptr %5, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %41, %39
  %44 = phi i64 [ %40, %39 ], [ %42, %41 ]
  %45 = uitofp i64 %44 to double
  %46 = call double @vl_log2_d(double noundef %45)
  %47 = call double @llvm.floor.f64(double %46)
  %48 = fsub double %47, 3.000000e+00
  br label %50

49:                                               ; preds = %28
  br label %50

50:                                               ; preds = %49, %43
  %51 = phi double [ %48, %43 ], [ 0.000000e+00, %49 ]
  %52 = fptosi double %51 to i64
  %53 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 3
  store i64 %52, ptr %53, align 8, !tbaa !14
  %54 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 4
  store i64 3, ptr %54, align 8, !tbaa !15
  %55 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 5
  store i64 0, ptr %55, align 8, !tbaa !16
  %56 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 4
  %57 = load i64, ptr %56, align 8, !tbaa !15
  %58 = sub i64 %57, 1
  %59 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 6
  store i64 %58, ptr %59, align 8, !tbaa !17
  %60 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 4
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = uitofp i64 %61 to double
  %63 = fdiv double 1.000000e+00, %62
  %64 = call double @pow(double noundef 2.000000e+00, double noundef %63) #6
  %65 = fmul double 1.600000e+00, %64
  %66 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 7
  store double %65, ptr %66, align 8, !tbaa !18
  %67 = getelementptr inbounds %struct._VlScaleSpaceGeometry, ptr %0, i32 0, i32 8
  store double 5.000000e-01, ptr %67, align 8, !tbaa !19
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @vl_log2_d(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #3

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

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 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { noreturn nounwind }
attributes #6 = { 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_VlScaleSpaceGeometry", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 64}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !11, i64 56}
!19 = !{!10, !11, i64 64}


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

%struct._VlScaleSpaceGeometry = type { i64, i64, i64, i64, i64, i64, i64, double, double }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry = external hidden unnamed_addr constant [74 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @vl_scalespace_get_default_geometry(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct._VlScaleSpaceGeometry) align 8 %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 309, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry) #5
  unreachable

5:                                                ; preds = %3
  %.not13 = icmp eq i64 %2, 0
  br i1 %.not13, label %6, label %7

6:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 310, ptr noundef nonnull @__PRETTY_FUNCTION__.vl_scalespace_get_default_geometry) #5
  unreachable

7:                                                ; preds = %5
  store i64 %1, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %2, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %9, align 8, !tbaa !12
  %10 = tail call i64 @llvm.umin.i64(i64 %1, i64 %2)
  %11 = uitofp i64 %10 to double
  %12 = tail call double @vl_log2_d(double noundef %11)
  %13 = tail call double @llvm.floor.f64(double %12)
  %14 = fadd double %13, -3.000000e+00
  %15 = fcmp ogt double %14, 0.000000e+00
  br i1 %15, label %16, label %21

16:                                               ; preds = %7
  %17 = tail call double @vl_log2_d(double noundef %11)
  %18 = tail call double @llvm.floor.f64(double %17)
  %19 = fadd double %18, -3.000000e+00
  %20 = fptosi double %19 to i64
  br label %21

21:                                               ; preds = %7, %16
  %22 = phi i64 [ %20, %16 ], [ 0, %7 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %22, ptr %23, align 8, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 3, ptr %24, align 8, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 0, ptr %25, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %0, i64 48
  store i64 2, ptr %26, align 8, !tbaa !16
  %27 = getelementptr inbounds i8, ptr %0, i64 56
  store <2 x double> <double 0x40002082613DF53C, double 5.000000e-01>, ptr %27, align 8, !tbaa !17
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden double @vl_log2_d(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4

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 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !7, i64 0}
!6 = !{!"_VlScaleSpaceGeometry", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 16}
!13 = !{!6, !7, i64 24}
!14 = !{!6, !7, i64 32}
!15 = !{!6, !7, i64 40}
!16 = !{!6, !7, i64 48}
!17 = !{!10, !10, i64 0}


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