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

; 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
define dso_local void @_ZN12ImageContent9initFloatEjj(ptr noundef nonnull align 8 dereferenceable(80) %0, i32 noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  %9 = load i32, ptr %6, align 4, !tbaa !9
  %10 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 0
  store i32 %9, ptr %10, align 8, !tbaa !11
  %11 = load i32, ptr %5, align 4, !tbaa !9
  %12 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 1
  store i32 %11, ptr %12, align 4, !tbaa !13
  %13 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = mul i32 %14, %16
  %18 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 2
  store i32 %17, ptr %18, align 8, !tbaa !14
  %19 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 1
  %20 = load i32, ptr %19, align 4, !tbaa !13
  %21 = zext i32 %20 to i64
  %22 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %21, i64 8)
  %23 = extractvalue { i64, i1 } %22, 1
  %24 = extractvalue { i64, i1 } %22, 0
  %25 = select i1 %23, i64 -1, i64 %24
  %26 = call noalias noundef nonnull ptr @_Znam(i64 noundef %25) #4
  %27 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 4
  store ptr %26, ptr %27, align 8, !tbaa !15
  %28 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 2
  %29 = load i32, ptr %28, align 8, !tbaa !14
  %30 = zext i32 %29 to i64
  %31 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %30, i64 4)
  %32 = extractvalue { i64, i1 } %31, 1
  %33 = extractvalue { i64, i1 } %31, 0
  %34 = select i1 %32, i64 -1, i64 %33
  %35 = call noalias noundef nonnull ptr @_Znam(i64 noundef %34) #4
  %36 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 4
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = getelementptr inbounds ptr, ptr %37, i64 0
  store ptr %35, ptr %38, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %61, %3
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = icmp ult i32 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %64

45:                                               ; preds = %39
  %46 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = getelementptr inbounds ptr, ptr %47, i64 0
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = load i32, ptr %7, align 4, !tbaa !9
  %51 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !11
  %53 = mul i32 %50, %52
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds float, ptr %49, i64 %54
  %56 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 4
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds ptr, ptr %57, i64 %59
  store ptr %55, ptr %60, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %45
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = add i32 %62, 1
  store i32 %63, ptr %7, align 4, !tbaa !9
  br label %39, !llvm.loop !16

64:                                               ; preds = %44
  %65 = getelementptr inbounds %class.ImageContent, ptr %8, i32 0, i32 3
  store i32 2, ptr %65, align 4, !tbaa !18
  ret void
}

; 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

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 = { 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 = { builtin allocsize(0) }
attributes #5 = { 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}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS12ImageContent", !10, i64 0, !10, i64 4, !10, i64 8, !10, 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}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !6, i64 16}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!12, !10, i64 12}


; 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
define dso_local void @_ZN12ImageContent9initFloatEjj(ptr nocapture noundef nonnull align 8 dereferenceable(80) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  store i32 %2, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %1, ptr %4, align 4, !tbaa !11
  %5 = mul i32 %2, %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %5, ptr %6, align 8, !tbaa !12
  %7 = zext i32 %1 to i64
  %8 = shl nuw nsw i64 %7, 3
  %9 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %8) #2
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %9, ptr %10, align 8, !tbaa !13
  %11 = zext i32 %5 to i64
  %12 = shl nuw nsw i64 %11, 2
  %13 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %12) #2
  store ptr %13, ptr %9, align 8, !tbaa !14
  %14 = icmp ugt i32 %1, 1
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %3
  %15 = add nsw i64 %7, -1
  %16 = add nsw i64 %7, -2
  %xtraiter = and i64 %15, 3
  %17 = icmp ult i64 %16, 3
  br i1 %17, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %15, -4
  br label %.lr.ph

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %18 = load ptr, ptr %10, align 8, !tbaa !13
  %19 = load ptr, ptr %18, align 8, !tbaa !14
  %20 = trunc nuw i64 %indvars.iv.epil to i32
  %21 = mul i32 %20, %2
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds float, ptr %19, i64 %22
  %24 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv.epil
  store ptr %23, ptr %24, align 8, !tbaa !14
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph.epil, !llvm.loop !15

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil, %3
  %25 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 2, ptr %25, align 4, !tbaa !17
  ret void

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %26 = load ptr, ptr %10, align 8, !tbaa !13
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = trunc nuw i64 %indvars.iv to i32
  %29 = mul i32 %28, %2
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds float, ptr %27, i64 %30
  %32 = getelementptr inbounds ptr, ptr %26, i64 %indvars.iv
  store ptr %31, ptr %32, align 8, !tbaa !14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load ptr, ptr %10, align 8, !tbaa !13
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  %35 = trunc nuw i64 %indvars.iv.next to i32
  %36 = mul i32 %35, %2
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds float, ptr %34, i64 %37
  %39 = getelementptr inbounds ptr, ptr %33, i64 %indvars.iv.next
  store ptr %38, ptr %39, align 8, !tbaa !14
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %40 = load ptr, ptr %10, align 8, !tbaa !13
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = trunc nuw i64 %indvars.iv.next.1 to i32
  %43 = mul i32 %42, %2
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds float, ptr %41, i64 %44
  %46 = getelementptr inbounds ptr, ptr %40, i64 %indvars.iv.next.1
  store ptr %45, ptr %46, align 8, !tbaa !14
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %47 = load ptr, ptr %10, align 8, !tbaa !13
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = trunc nuw i64 %indvars.iv.next.2 to i32
  %50 = mul i32 %49, %2
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds float, ptr %48, i64 %51
  %53 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv.next.2
  store ptr %52, ptr %53, align 8, !tbaa !14
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !18
}

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

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 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 #2 = { builtin allocsize(0) }

!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 = !{!"_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 8}
!13 = !{!6, !10, i64 16}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = !{!6, !7, i64 12}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass