; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/ImageContent/ImageConten_2d663557 (ZN12ImageContent10char2floatEv)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN12ImageContent9initFloatEjj(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef, i32 noundef) #1 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ImageContent10char2floatEv(ptr noundef nonnull align 8 dereferenceable(80) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 3
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %8, label %53

8:                                                ; preds = %1
  %9 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 1
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %11 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !13
  call void @_ZN12ImageContent9initFloatEjj(ptr noundef nonnull align 8 dereferenceable(80) %4, i32 noundef %10, i32 noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !14
  br label %13

13:                                               ; preds = %36, %8
  %14 = load i32, ptr %3, align 4, !tbaa !14
  %15 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 2
  %16 = load i32, ptr %15, align 8, !tbaa !15
  %17 = icmp ult i32 %14, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %39

19:                                               ; preds = %13
  %20 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 8
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %22 = getelementptr inbounds ptr, ptr %21, i64 0
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = load i32, ptr %3, align 4, !tbaa !14
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !17
  %28 = uitofp i8 %27 to float
  %29 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds ptr, ptr %30, i64 0
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = load i32, ptr %3, align 4, !tbaa !14
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds float, ptr %32, i64 %34
  store float %28, ptr %35, align 4, !tbaa !19
  br label %36

36:                                               ; preds = %19
  %37 = load i32, ptr %3, align 4, !tbaa !14
  %38 = add i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !14
  br label %13, !llvm.loop !21

39:                                               ; preds = %18
  %40 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 8
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = getelementptr inbounds ptr, ptr %41, i64 0
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %46, label %45

45:                                               ; preds = %39
  call void @_ZdaPv(ptr noundef %43) #4
  br label %46

46:                                               ; preds = %45, %39
  %47 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 8
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  %49 = icmp eq ptr %48, null
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @_ZdaPv(ptr noundef %48) #4
  br label %51

51:                                               ; preds = %50, %46
  %52 = getelementptr inbounds %class.ImageContent, ptr %4, i32 0, i32 3
  store i32 2, ptr %52, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %51, %1
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind }
attributes #4 = { 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, !11, i64 12}
!10 = !{!"_ZTS12ImageContent", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!10, !6, i64 48}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !6, i64 16}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"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 uwtable
declare dso_local void @_ZN12ImageContent9initFloatEjj(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12ImageContent10char2floatEv(ptr noundef nonnull align 8 dereferenceable(80) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %5, label %51

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = load i32, ptr %0, align 8, !tbaa !12
  tail call void @_ZN12ImageContent9initFloatEjj(ptr noundef nonnull align 8 dereferenceable(80) %0, i32 noundef %7, i32 noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !13
  %.not = icmp eq i32 %10, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 48
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !14
  %.pre8 = load ptr, ptr %.pre, align 8, !tbaa !15
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %wide.trip.count = zext i32 %10 to i64
  %min.iters.check = icmp ult i32 %10, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %scalar.ph.prol ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %14 = getelementptr inbounds i8, ptr %.pre8, i64 %indvars.iv.prol
  %15 = load i8, ptr %14, align 1, !tbaa !17
  %16 = uitofp i8 %15 to float
  %17 = getelementptr inbounds float, ptr %13, i64 %indvars.iv.prol
  store float %16, ptr %17, align 4, !tbaa !18
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !20

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %scalar.ph.preheader ], [ %indvars.iv.next.prol, %scalar.ph.prol ]
  %18 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %19 = icmp ugt i64 %18, -4
  br i1 %19, label %._crit_edge.thread, label %scalar.ph

vector.memcheck:                                  ; preds = %.lr.ph
  %20 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr %13, i64 %20
  %scevgep9 = getelementptr i8, ptr %.pre8, i64 %wide.trip.count
  %bound0 = icmp ult ptr %13, %scevgep9
  %bound1 = icmp ult ptr %.pre8, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %21 = getelementptr inbounds i8, ptr %.pre8, i64 %index
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  %wide.load = load <4 x i8>, ptr %21, align 1, !tbaa !17, !alias.scope !22
  %wide.load10 = load <4 x i8>, ptr %22, align 1, !tbaa !17, !alias.scope !22
  %23 = uitofp <4 x i8> %wide.load to <4 x float>
  %24 = uitofp <4 x i8> %wide.load10 to <4 x float>
  %25 = getelementptr inbounds float, ptr %13, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x float> %23, ptr %25, align 4, !tbaa !18, !alias.scope !25, !noalias !22
  store <4 x float> %24, ptr %26, align 4, !tbaa !18, !alias.scope !25, !noalias !22
  %index.next = add nuw i64 %index, 8
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !27

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge.thread, label %scalar.ph.preheader

._crit_edge:                                      ; preds = %5
  %28 = icmp eq ptr %.pre8, null
  br i1 %28, label %46, label %._crit_edge.thread

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %scalar.ph ], [ %indvars.iv.unr, %scalar.ph.prol.loopexit ]
  %29 = getelementptr inbounds i8, ptr %.pre8, i64 %indvars.iv
  %30 = load i8, ptr %29, align 1, !tbaa !17
  %31 = uitofp i8 %30 to float
  %32 = getelementptr inbounds float, ptr %13, i64 %indvars.iv
  store float %31, ptr %32, align 4, !tbaa !18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = getelementptr inbounds i8, ptr %.pre8, i64 %indvars.iv.next
  %34 = load i8, ptr %33, align 1, !tbaa !17
  %35 = uitofp i8 %34 to float
  %36 = getelementptr inbounds float, ptr %13, i64 %indvars.iv.next
  store float %35, ptr %36, align 4, !tbaa !18
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %37 = getelementptr inbounds i8, ptr %.pre8, i64 %indvars.iv.next.1
  %38 = load i8, ptr %37, align 1, !tbaa !17
  %39 = uitofp i8 %38 to float
  %40 = getelementptr inbounds float, ptr %13, i64 %indvars.iv.next.1
  store float %39, ptr %40, align 4, !tbaa !18
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %41 = getelementptr inbounds i8, ptr %.pre8, i64 %indvars.iv.next.2
  %42 = load i8, ptr %41, align 1, !tbaa !17
  %43 = uitofp i8 %42 to float
  %44 = getelementptr inbounds float, ptr %13, i64 %indvars.iv.next.2
  store float %43, ptr %44, align 4, !tbaa !18
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge.thread, label %scalar.ph, !llvm.loop !31

._crit_edge.thread:                               ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %._crit_edge
  %45 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZdaPv(ptr noundef nonnull %.pre8) #2
  %.pr = load ptr, ptr %45, align 8, !tbaa !14
  br label %46

46:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %47 = phi ptr [ %.pr, %._crit_edge.thread ], [ %.pre, %._crit_edge ]
  %48 = icmp eq ptr %47, null
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  tail call void @_ZdaPv(ptr noundef nonnull %47) #2
  br label %50

50:                                               ; preds = %49, %46
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %50, %1
  ret void
}

attributes #0 = { 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 #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 = { 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, !7, i64 12}
!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 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 48}
!15 = !{!10, !10, i64 0}
!16 = !{!6, !10, i64 16}
!17 = !{!8, !8, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !8, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = !{!23}
!23 = distinct !{!23, !24}
!24 = distinct !{!24, !"LVerDomain"}
!25 = !{!26}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !28, !29, !30}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!"llvm.loop.isvectorized", i32 1}
!30 = !{!"llvm.loop.unroll.runtime.disable"}
!31 = distinct !{!31, !28, !29}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass