; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseWarpAffine)

; 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.Simd::WarpAffParam" = type { i32, [6 x float], [6 x float], [4 x i8], i64, i64, i64, i64, i64, i64, i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd12WarpAffParamC2EmmmmmmmPKf19SimdWarpAffineFlagsPKhm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, i64 noundef %5, i64 noundef %6, i64 noundef %7, ptr noundef %8, i32 noundef %9, ptr noundef %10, i64 noundef %11) unnamed_addr #0 align 2 {
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  store ptr %0, ptr %13, align 8, !tbaa !5
  store i64 %1, ptr %14, align 8, !tbaa !9
  store i64 %2, ptr %15, align 8, !tbaa !9
  store i64 %3, ptr %16, align 8, !tbaa !9
  store i64 %4, ptr %17, align 8, !tbaa !9
  store i64 %5, ptr %18, align 8, !tbaa !9
  store i64 %6, ptr %19, align 8, !tbaa !9
  store i64 %7, ptr %20, align 8, !tbaa !9
  store ptr %8, ptr %21, align 8, !tbaa !5
  store i32 %9, ptr %22, align 4, !tbaa !11
  store ptr %10, ptr %23, align 8, !tbaa !5
  store i64 %11, ptr %24, align 8, !tbaa !9
  %25 = load ptr, ptr %13, align 8
  %26 = load i64, ptr %14, align 8, !tbaa !9
  %27 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 4
  store i64 %26, ptr %27, align 8, !tbaa !13
  %28 = load i64, ptr %15, align 8, !tbaa !9
  %29 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 5
  store i64 %28, ptr %29, align 8, !tbaa !15
  %30 = load i64, ptr %16, align 8, !tbaa !9
  %31 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 6
  store i64 %30, ptr %31, align 8, !tbaa !16
  %32 = load i64, ptr %17, align 8, !tbaa !9
  %33 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 7
  store i64 %32, ptr %33, align 8, !tbaa !17
  %34 = load i64, ptr %18, align 8, !tbaa !9
  %35 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 8
  store i64 %34, ptr %35, align 8, !tbaa !18
  %36 = load i64, ptr %19, align 8, !tbaa !9
  %37 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 9
  store i64 %36, ptr %37, align 8, !tbaa !19
  %38 = load i64, ptr %20, align 8, !tbaa !9
  %39 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 10
  store i64 %38, ptr %39, align 8, !tbaa !20
  %40 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 1
  %41 = getelementptr inbounds [6 x float], ptr %40, i64 0, i64 0
  %42 = load ptr, ptr %21, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %42, i64 24, i1 false)
  %43 = load i32, ptr %22, align 4, !tbaa !11
  %44 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 0
  store i32 %43, ptr %44, align 8, !tbaa !21
  %45 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 3
  %46 = getelementptr inbounds [4 x i8], ptr %45, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %46, i8 0, i64 4, i1 false)
  %47 = load ptr, ptr %23, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %58

49:                                               ; preds = %12
  %50 = load i32, ptr %22, align 4, !tbaa !11
  %51 = and i32 %50, 4
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %58

53:                                               ; preds = %49
  %54 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 3
  %55 = getelementptr inbounds [4 x i8], ptr %54, i64 0, i64 0
  %56 = load ptr, ptr %23, align 8, !tbaa !5
  %57 = call noundef i64 @_ZNK4Simd12WarpAffParam9PixelSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %25)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 1 %56, i64 %57, i1 false)
  br label %58

58:                                               ; preds = %53, %49, %12
  %59 = load i64, ptr %24, align 8, !tbaa !9
  %60 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 11
  store i64 %59, ptr %60, align 8, !tbaa !22
  %61 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 1
  %62 = getelementptr inbounds [6 x float], ptr %61, i64 0, i64 0
  %63 = getelementptr inbounds %"struct.Simd::WarpAffParam", ptr %25, i32 0, i32 2
  %64 = getelementptr inbounds [6 x float], ptr %63, i64 0, i64 0
  call void @_ZN4SimdL6SetInvEPKfPf(ptr noundef %62, ptr noundef %64)
  ret void
}

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK4Simd12WarpAffParam9PixelSizeEv(ptr noundef nonnull align 8 dereferenceable(120)) #0 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden void @_ZN4SimdL6SetInvEPKfPf(ptr noundef, ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { alwaysinline 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" }

!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, !12, i64 0}
!12 = !{!"_ZTS19SimdWarpAffineFlags", !7, i64 0}
!13 = !{!14, !10, i64 56}
!14 = !{!"_ZTSN4Simd12WarpAffParamE", !12, i64 0, !7, i64 4, !7, i64 28, !7, i64 52, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112}
!15 = !{!14, !10, i64 64}
!16 = !{!14, !10, i64 72}
!17 = !{!14, !10, i64 80}
!18 = !{!14, !10, i64 88}
!19 = !{!14, !10, i64 96}
!20 = !{!14, !10, i64 104}
!21 = !{!14, !12, i64 0}
!22 = !{!14, !10, i64 112}


; 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 @_ZN4Simd12WarpAffParamC2EmmmmmmmPKf19SimdWarpAffineFlagsPKhm(ptr noundef nonnull align 8 dereferenceable(120) %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, i64 noundef %5, i64 noundef %6, i64 noundef %7, ptr nocapture noundef readonly %8, i32 noundef %9, ptr noundef readonly %10, i64 noundef %11) unnamed_addr #0 align 2 {
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  store i64 %1, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 64
  store i64 %2, ptr %14, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %3, ptr %15, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %0, i64 80
  store i64 %4, ptr %16, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %0, i64 88
  store i64 %5, ptr %17, align 8, !tbaa !14
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  store i64 %6, ptr %18, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 104
  store i64 %7, ptr %19, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %0, i64 4
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(24) %8, i64 24, i1 false)
  store i32 %9, ptr %0, align 8, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 0, ptr %21, align 4
  %.not = icmp ne ptr %10, null
  %22 = and i32 %9, 4
  %23 = icmp eq i32 %22, 0
  %or.cond = and i1 %.not, %23
  br i1 %or.cond, label %24, label %26

24:                                               ; preds = %12
  %25 = tail call noundef i64 @_ZNK4Simd12WarpAffParam9PixelSizeEv(ptr noundef nonnull align 8 dereferenceable(120) %0)
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %21, ptr nonnull align 1 %10, i64 %25, i1 false)
  br label %26

26:                                               ; preds = %24, %12
  %27 = getelementptr inbounds i8, ptr %0, i64 112
  store i64 %11, ptr %27, align 8, !tbaa !18
  %28 = getelementptr inbounds i8, ptr %0, i64 28
  tail call void @_ZN4SimdL6SetInvEPKfPf(ptr noundef nonnull %20, ptr noundef nonnull %28)
  ret void
}

; Function Attrs: mustprogress 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 uwtable
declare dso_local noundef i64 @_ZNK4Simd12WarpAffParam9PixelSizeEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #0 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden void @_ZN4SimdL6SetInvEPKfPf(ptr noundef, ptr noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline 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" }

!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, !10, i64 56}
!6 = !{!"_ZTSN4Simd12WarpAffParamE", !7, i64 0, !8, i64 4, !8, i64 28, !8, i64 52, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112}
!7 = !{!"_ZTS19SimdWarpAffineFlags", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 64}
!12 = !{!6, !10, i64 72}
!13 = !{!6, !10, i64 80}
!14 = !{!6, !10, i64 88}
!15 = !{!6, !10, i64 96}
!16 = !{!6, !10, i64 104}
!17 = !{!6, !7, i64 0}
!18 = !{!6, !10, i64 112}


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