; LLVM IR from keroro824/HashingDeepLearning :: SLIDE/Node.ll (ZN4Node6UpdateEiii8NodeTypeiPffS1_S1_P5train)

; 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.Node = type <{ i32, i32, ptr, i32, [4 x i8], i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, float, float, float, float, float, [4 x i8] }>
%struct.train = type { float, float, float, i32, [48 x i8] }

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #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
define dso_local void @_ZN4Node6UpdateEiii8NodeTypeiPffS1_S1_P5train(ptr noundef nonnull align 8 dereferenceable(132) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, float noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10) #3 align 2 {
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca float, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  store ptr %0, ptr %12, align 8, !tbaa !5
  store i32 %1, ptr %13, align 4, !tbaa !9
  store i32 %2, ptr %14, align 4, !tbaa !9
  store i32 %3, ptr %15, align 4, !tbaa !9
  store i32 %4, ptr %16, align 4, !tbaa !11
  store i32 %5, ptr %17, align 4, !tbaa !9
  store ptr %6, ptr %18, align 8, !tbaa !5
  store float %7, ptr %19, align 4, !tbaa !13
  store ptr %8, ptr %20, align 8, !tbaa !5
  store ptr %9, ptr %21, align 8, !tbaa !5
  store ptr %10, ptr %22, align 8, !tbaa !5
  %23 = load ptr, ptr %12, align 8
  %24 = load i32, ptr %13, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 5
  store i64 %25, ptr %26, align 8, !tbaa !15
  %27 = load i32, ptr %14, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 7
  store i64 %28, ptr %29, align 8, !tbaa !18
  %30 = load i32, ptr %16, align 4, !tbaa !11
  %31 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 1
  store i32 %30, ptr %31, align 4, !tbaa !19
  %32 = load i32, ptr %15, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 6
  store i64 %33, ptr %34, align 8, !tbaa !20
  %35 = load i32, ptr %17, align 4, !tbaa !9
  %36 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 3
  store i32 %35, ptr %36, align 8, !tbaa !21
  %37 = load ptr, ptr %20, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 12
  store ptr %37, ptr %38, align 8, !tbaa !22
  %39 = load ptr, ptr %21, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 13
  store ptr %39, ptr %40, align 8, !tbaa !23
  %41 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 5
  %42 = load i64, ptr %41, align 8, !tbaa !15
  %43 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %42, i64 4)
  %44 = extractvalue { i64, i1 } %43, 1
  %45 = extractvalue { i64, i1 } %43, 0
  %46 = select i1 %44, i64 -1, i64 %45
  %47 = call noalias noundef nonnull ptr @_Znam(i64 noundef %46) #4
  call void @llvm.memset.p0.i64(ptr align 4 %47, i8 0, i64 %46, i1 false)
  %48 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 14
  store ptr %47, ptr %48, align 8, !tbaa !24
  %49 = load ptr, ptr %22, align 8, !tbaa !5
  %50 = load i32, ptr %14, align 4, !tbaa !9
  %51 = load i32, ptr %17, align 4, !tbaa !9
  %52 = mul nsw i32 %50, %51
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %struct.train, ptr %49, i64 %53
  %55 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 2
  store ptr %54, ptr %55, align 8, !tbaa !25
  %56 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 0
  store i32 0, ptr %56, align 8, !tbaa !26
  %57 = load ptr, ptr %18, align 8, !tbaa !5
  %58 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 10
  store ptr %57, ptr %58, align 8, !tbaa !27
  %59 = load float, ptr %19, align 4, !tbaa !13
  %60 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 16
  store float %59, ptr %60, align 8, !tbaa !28
  %61 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 16
  %62 = load float, ptr %61, align 8, !tbaa !28
  %63 = getelementptr inbounds %class.Node, ptr %23, i32 0, i32 20
  store float %62, ptr %63, align 8, !tbaa !29
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !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, !12, i64 0}
!12 = !{!"_ZTS8NodeType", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !17, i64 24}
!16 = !{!"_ZTS4Node", !10, i64 0, !12, i64 4, !6, i64 8, !10, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !14, i64 112, !14, i64 116, !14, i64 120, !14, i64 124, !14, i64 128}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !17, i64 40}
!19 = !{!16, !12, i64 4}
!20 = !{!16, !17, i64 32}
!21 = !{!16, !10, i64 16}
!22 = !{!16, !6, i64 80}
!23 = !{!16, !6, i64 88}
!24 = !{!16, !6, i64 96}
!25 = !{!16, !6, i64 8}
!26 = !{!16, !10, i64 0}
!27 = !{!16, !6, i64 64}
!28 = !{!16, !14, i64 112}
!29 = !{!16, !14, i64 128}


; 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.train = type { float, float, float, i32, [48 x i8] }

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Node6UpdateEiii8NodeTypeiPffS1_S1_P5train(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(132) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6, float noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10) local_unnamed_addr #2 align 2 {
  %12 = sext i32 %1 to i64
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %12, ptr %13, align 8, !tbaa !5
  %14 = sext i32 %2 to i64
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  store i64 %14, ptr %15, align 8, !tbaa !14
  %16 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %4, ptr %16, align 4, !tbaa !15
  %17 = sext i32 %3 to i64
  %18 = getelementptr inbounds i8, ptr %0, i64 32
  store i64 %17, ptr %18, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %5, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %0, i64 80
  store ptr %8, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %9, ptr %21, align 8, !tbaa !19
  %22 = icmp slt i32 %1, 0
  %23 = shl nuw nsw i64 %12, 2
  %24 = select i1 %22, i64 -1, i64 %23
  %25 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %24) #3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 %25, i8 0, i64 %24, i1 false)
  %26 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr %25, ptr %26, align 8, !tbaa !20
  %27 = mul nsw i32 %5, %2
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds %struct.train, ptr %10, i64 %28
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %29, ptr %30, align 8, !tbaa !21
  store i32 0, ptr %0, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %6, ptr %31, align 8, !tbaa !23
  %32 = getelementptr inbounds i8, ptr %0, i64 112
  store float %7, ptr %32, align 8, !tbaa !24
  %33 = getelementptr inbounds i8, ptr %0, i64 128
  store float %7, ptr %33, align 8, !tbaa !25
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !12, i64 24}
!6 = !{!"_ZTS4Node", !7, i64 0, !10, i64 4, !11, i64 8, !7, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !13, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS8NodeType", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = !{!6, !12, i64 40}
!15 = !{!6, !10, i64 4}
!16 = !{!6, !12, i64 32}
!17 = !{!6, !7, i64 16}
!18 = !{!6, !11, i64 80}
!19 = !{!6, !11, i64 88}
!20 = !{!6, !11, i64 96}
!21 = !{!6, !11, i64 8}
!22 = !{!6, !7, i64 0}
!23 = !{!6, !11, i64 64}
!24 = !{!6, !13, i64 112}
!25 = !{!6, !13, i64 128}


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