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

; 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] }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@__PRETTY_FUNCTION__._ZN4Node14incrementDeltaEif = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Node14incrementDeltaEif(ptr noundef nonnull align 8 dereferenceable(132) %0, i32 noundef %1, float noundef %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !11
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %class.Node, ptr %7, i32 0, i32 2
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = load i32, ptr %5, align 4, !tbaa !9
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds %struct.train, ptr %9, i64 %11
  %13 = getelementptr inbounds %struct.train, ptr %12, i32 0, i32 3
  %14 = load i32, ptr %13, align 4, !tbaa !17
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %16, label %17

16:                                               ; preds = %3
  br label %19

17:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__._ZN4Node14incrementDeltaEif) #2
  unreachable

18:                                               ; No predecessors!
  br label %19

19:                                               ; preds = %18, %16
  %20 = getelementptr inbounds %class.Node, ptr %7, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds %struct.train, ptr %21, i64 %23
  %25 = getelementptr inbounds %struct.train, ptr %24, i32 0, i32 1
  %26 = load float, ptr %25, align 4, !tbaa !19
  %27 = fcmp ogt float %26, 0.000000e+00
  br i1 %27, label %28, label %38

28:                                               ; preds = %19
  %29 = load float, ptr %6, align 4, !tbaa !11
  %30 = getelementptr inbounds %class.Node, ptr %7, i32 0, i32 2
  %31 = load ptr, ptr %30, align 8, !tbaa !13
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds %struct.train, ptr %31, i64 %33
  %35 = getelementptr inbounds %struct.train, ptr %34, i32 0, i32 0
  %36 = load float, ptr %35, align 64, !tbaa !20
  %37 = fadd float %36, %29
  store float %37, ptr %35, align 64, !tbaa !20
  br label %38

38:                                               ; preds = %28, %19
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

attributes #0 = { 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 #1 = { noreturn 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 = { noreturn 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, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 8}
!14 = !{!"_ZTS4Node", !10, i64 0, !15, i64 4, !6, i64 8, !10, i64 16, !16, i64 24, !16, i64 32, !16, 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, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128}
!15 = !{!"_ZTS8NodeType", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !10, i64 12}
!18 = !{!"_ZTS5train", !12, i64 0, !12, i64 4, !12, i64 8, !10, i64 12}
!19 = !{!18, !12, i64 4}
!20 = !{!18, !12, i64 0}


; 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] }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@__PRETTY_FUNCTION__._ZN4Node14incrementDeltaEif = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Node14incrementDeltaEif(ptr nocapture noundef nonnull readonly align 8 dereferenceable(132) %0, i32 noundef %1, float noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = sext i32 %1 to i64
  %7 = getelementptr inbounds %struct.train, ptr %5, i64 %6
  %8 = getelementptr inbounds i8, ptr %7, i64 12
  %9 = load i32, ptr %8, align 4, !tbaa !14
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %12, label %11

11:                                               ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 73, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4Node14incrementDeltaEif) #2
  unreachable

12:                                               ; preds = %3
  %13 = getelementptr inbounds i8, ptr %7, i64 4
  %14 = load float, ptr %13, align 4, !tbaa !16
  %15 = fcmp ogt float %14, 0.000000e+00
  br i1 %15, label %16, label %19

16:                                               ; preds = %12
  %17 = load float, ptr %7, align 64, !tbaa !17
  %18 = fadd float %17, %2
  store float %18, ptr %7, align 64, !tbaa !17
  br label %19

19:                                               ; preds = %16, %12
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { noreturn 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 = { noreturn 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, !11, i64 8}
!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 = !{!15, !7, i64 12}
!15 = !{!"_ZTS5train", !13, i64 0, !13, i64 4, !13, i64 8, !7, i64 12}
!16 = !{!15, !13, i64 4}
!17 = !{!15, !13, i64 0}


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