; LLVM IR from OAID/AutoKernel :: autokernel_plugin/tests/common/tengine_operations.ll (Z9put_label5imagePKcfiiiii)

; 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.image = type { i32, i32, i32, 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9get_labelPKci(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10draw_label5imageiiS_PKf(ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef byval(%struct.image) align 8, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9put_label5imagePKcfiiiii(ptr noundef byval(%struct.image) align 8 %0, ptr noundef %1, float noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.image, align 8
  %17 = alloca [3 x float], align 4
  %18 = alloca %struct.image, align 8
  %19 = alloca %struct.image, align 8
  %20 = alloca %struct.image, align 8
  store ptr %1, ptr %9, align 8, !tbaa !5
  store float %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !11
  store i32 %4, ptr %12, align 4, !tbaa !11
  store i32 %5, ptr %13, align 4, !tbaa !11
  store i32 %6, ptr %14, align 4, !tbaa !11
  store i32 %7, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #4
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.image, ptr %0, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = sitofp i32 %23 to float
  %25 = load float, ptr %10, align 4, !tbaa !9
  %26 = fmul float %24, %25
  %27 = fptosi float %26 to i32
  call void @_Z9get_labelPKci(ptr dead_on_unwind writable sret(%struct.image) align 8 %16, ptr noundef %21, i32 noundef %27)
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #4
  %28 = load i32, ptr %13, align 4, !tbaa !11
  %29 = sitofp i32 %28 to float
  %30 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 0
  store float %29, ptr %30, align 4, !tbaa !9
  %31 = load i32, ptr %14, align 4, !tbaa !11
  %32 = sitofp i32 %31 to float
  %33 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 1
  store float %32, ptr %33, align 4, !tbaa !9
  %34 = load i32, ptr %15, align 4, !tbaa !11
  %35 = sitofp i32 %34 to float
  %36 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 2
  store float %35, ptr %36, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 %0, i64 24, i1 false), !tbaa.struct !15
  %37 = load i32, ptr %12, align 4, !tbaa !11
  %38 = load i32, ptr %11, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !15
  %39 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 0
  call void @_Z10draw_label5imageiiS_PKf(ptr noundef byval(%struct.image) align 8 %18, i32 noundef %37, i32 noundef %38, ptr noundef byval(%struct.image) align 8 %19, ptr noundef %39)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !15
  call void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8 %20)
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 4}
!14 = !{!"_ZTS5image", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16}
!15 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11, i64 16, i64 8, !5}


; 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.image = type { i32, i32, i32, ptr }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10free_image5image(ptr noundef byval(%struct.image) align 8) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9get_labelPKci(ptr dead_on_unwind noalias writable sret(%struct.image) align 8, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10draw_label5imageiiS_PKf(ptr noundef byval(%struct.image) align 8, i32 noundef, i32 noundef, ptr noundef byval(%struct.image) align 8, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9put_label5imagePKcfiiiii(ptr nocapture noundef readonly byval(%struct.image) align 8 %0, ptr noundef %1, float noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, i32 noundef %7) local_unnamed_addr #2 {
  %9 = alloca %struct.image, align 8
  %10 = alloca [3 x float], align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = sitofp i32 %12 to float
  %14 = fmul float %13, %2
  %15 = fptosi float %14 to i32
  call void @_Z9get_labelPKci(ptr dead_on_unwind nonnull writable sret(%struct.image) align 8 %9, ptr noundef %1, i32 noundef %15)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #3
  %16 = insertelement <2 x i32> poison, i32 %5, i64 0
  %17 = insertelement <2 x i32> %16, i32 %6, i64 1
  %18 = sitofp <2 x i32> %17 to <2 x float>
  store <2 x float> %18, ptr %10, align 8, !tbaa !11
  %19 = sitofp i32 %7 to float
  %20 = getelementptr inbounds i8, ptr %10, i64 8
  store float %19, ptr %20, align 8, !tbaa !11
  call void @_Z10draw_label5imageiiS_PKf(ptr noundef nonnull byval(%struct.image) align 8 %0, i32 noundef %4, i32 noundef %3, ptr noundef nonnull byval(%struct.image) align 8 %9, ptr noundef nonnull %10)
  call void @_Z10free_image5image(ptr noundef nonnull byval(%struct.image) align 8 %9)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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, !7, i64 4}
!6 = !{!"_ZTS5image", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !8, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass