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

; 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.CornerDescriptor = type <{ %class.Corner, ptr, i32, float, i64, i32, [4 x i8] }>
%class.Corner = type { i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, i32, i32, float, i32, i32 }

; 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: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16CornerDescriptor14write_databaseERSt14basic_ofstreamIcSt11char_traitsIcEEm(ptr noundef nonnull align 8 dereferenceable(116) %0, ptr noundef nonnull align 8 dereferenceable(248) %1, i64 noundef %2) #4 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = getelementptr inbounds %class.CornerDescriptor, ptr %9, i32 0, i32 4
  store i64 %10, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %12 = getelementptr inbounds %class.CornerDescriptor, ptr %9, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !16
  %14 = add nsw i32 %13, 10
  %15 = sext i32 %14 to i64
  %16 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %15, i64 4)
  %17 = extractvalue { i64, i1 } %16, 1
  %18 = extractvalue { i64, i1 } %16, 0
  %19 = select i1 %17, i64 -1, i64 %18
  %20 = call noalias noundef nonnull ptr @_Znam(i64 noundef %19) #6
  store ptr %20, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.CornerDescriptor, ptr %9, i32 0, i32 4
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = uitofp i64 %22 to float
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds float, ptr %24, i64 0
  store float %23, ptr %25, align 4, !tbaa !17
  %26 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 1
  %27 = load float, ptr %26, align 4, !tbaa !18
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds float, ptr %28, i64 1
  store float %27, ptr %29, align 4, !tbaa !17
  %30 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 2
  %31 = load float, ptr %30, align 8, !tbaa !19
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds float, ptr %32, i64 2
  store float %31, ptr %33, align 4, !tbaa !17
  %34 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 13
  %35 = load float, ptr %34, align 4, !tbaa !20
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds float, ptr %36, i64 3
  store float %35, ptr %37, align 4, !tbaa !17
  %38 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 14
  %39 = load float, ptr %38, align 8, !tbaa !21
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds float, ptr %40, i64 4
  store float %39, ptr %41, align 4, !tbaa !17
  %42 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 19
  %43 = load float, ptr %42, align 4, !tbaa !22
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds float, ptr %44, i64 5
  store float %43, ptr %45, align 4, !tbaa !17
  %46 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 9
  %47 = load float, ptr %46, align 4, !tbaa !23
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds float, ptr %48, i64 6
  store float %47, ptr %49, align 4, !tbaa !17
  %50 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 10
  %51 = load float, ptr %50, align 8, !tbaa !24
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds float, ptr %52, i64 7
  store float %51, ptr %53, align 4, !tbaa !17
  %54 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 11
  %55 = load float, ptr %54, align 4, !tbaa !25
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds float, ptr %56, i64 8
  store float %55, ptr %57, align 4, !tbaa !17
  %58 = getelementptr inbounds %class.Corner, ptr %9, i32 0, i32 12
  %59 = load float, ptr %58, align 8, !tbaa !26
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds float, ptr %60, i64 9
  store float %59, ptr %61, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !27
  br label %62

62:                                               ; preds = %80, %3
  %63 = load i32, ptr %8, align 4, !tbaa !27
  %64 = getelementptr inbounds %class.CornerDescriptor, ptr %9, i32 0, i32 2
  %65 = load i32, ptr %64, align 8, !tbaa !16
  %66 = icmp slt i32 %63, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %83

68:                                               ; preds = %62
  %69 = getelementptr inbounds %class.CornerDescriptor, ptr %9, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !28
  %71 = load i32, ptr %8, align 4, !tbaa !27
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %70, i64 %72
  %74 = load float, ptr %73, align 4, !tbaa !17
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load i32, ptr %8, align 4, !tbaa !27
  %77 = add nsw i32 %76, 10
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds float, ptr %75, i64 %78
  store float %74, ptr %79, align 4, !tbaa !17
  br label %80

80:                                               ; preds = %68
  %81 = load i32, ptr %8, align 4, !tbaa !27
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !27
  br label %62, !llvm.loop !29

83:                                               ; preds = %67
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = icmp eq ptr %84, null
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  call void @_ZdaPv(ptr noundef %84) #7
  br label %87

87:                                               ; preds = %86, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nobuiltin allocsize(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 = { 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 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 104}
!12 = !{!"_ZTS16CornerDescriptor", !13, i64 0, !6, i64 88, !14, i64 96, !15, i64 100, !10, i64 104, !14, i64 112}
!13 = !{!"_ZTS6Corner", !14, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !14, i64 68, !14, i64 72, !15, i64 76, !14, i64 80, !14, i64 84}
!14 = !{!"int", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!12, !14, i64 96}
!17 = !{!15, !15, i64 0}
!18 = !{!13, !15, i64 4}
!19 = !{!13, !15, i64 8}
!20 = !{!13, !15, i64 52}
!21 = !{!13, !15, i64 56}
!22 = !{!13, !15, i64 76}
!23 = !{!13, !15, i64 36}
!24 = !{!13, !15, i64 40}
!25 = !{!13, !15, i64 44}
!26 = !{!13, !15, i64 48}
!27 = !{!14, !14, i64 0}
!28 = !{!12, !6, i64 88}
!29 = distinct !{!29, !30}
!30 = !{!"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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN16CornerDescriptor14write_databaseERSt14basic_ofstreamIcSt11char_traitsIcEEm(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(116) %0, ptr nocapture noundef nonnull readnone align 8 dereferenceable(248) %1, i64 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  store i64 %2, ptr %4, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !13, i64 104}
!6 = !{!"_ZTS16CornerDescriptor", !7, i64 0, !12, i64 88, !8, i64 96, !11, i64 100, !13, i64 104, !8, i64 112}
!7 = !{!"_ZTS6Corner", !8, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !8, i64 68, !8, i64 72, !11, i64 76, !8, i64 80, !8, i64 84}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"float", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"long", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass