; LLVM IR from sfu-dis/mosaicdb :: dbcore/tests/w_rand.ll (ZN6w_randC2Ev)

; 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.w_rand = type { i32, [16 x i32] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6w_randC2Ev(ptr noundef nonnull align 4 dereferenceable(68) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca [5 x i32], align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %struct.w_rand, ptr %5, i32 0, i32 0
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = call noundef i64 @_ZN11stopwatch_t3nowEv()
  store i64 %7, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 20, ptr %4) #5
  %8 = getelementptr inbounds %struct.w_rand, ptr %5, i32 0, i32 0
  %9 = ptrtoint ptr %8 to i64
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr %4, align 4, !tbaa !14
  %11 = getelementptr inbounds i32, ptr %4, i64 1
  %12 = call i32 @getpid() #5
  store i32 %12, ptr %11, align 4, !tbaa !14
  %13 = getelementptr inbounds i32, ptr %4, i64 2
  %14 = call i64 @pthread_self() #6
  %15 = trunc i64 %14 to i32
  store i32 %15, ptr %13, align 4, !tbaa !14
  %16 = getelementptr inbounds i32, ptr %4, i64 3
  %17 = load i64, ptr %3, align 8, !tbaa !12
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr %16, align 4, !tbaa !14
  %19 = getelementptr inbounds i32, ptr %4, i64 4
  %20 = load i64, ptr %3, align 8, !tbaa !12
  %21 = lshr i64 %20, 32
  %22 = trunc i64 %21 to i32
  store i32 %22, ptr %19, align 4, !tbaa !14
  call void @_ZN6w_rand4seedILm5EEEvRAT__Kj(ptr noundef nonnull align 4 dereferenceable(68) %5, ptr noundef nonnull align 4 dereferenceable(20) %4)
  call void @llvm.lifetime.end.p0(i64 20, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11stopwatch_t3nowEv() #2 align 2

; Function Attrs: nounwind
declare i32 @getpid() #3

; Function Attrs: nounwind willreturn memory(none)
declare i64 @pthread_self() #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6w_rand4seedILm5EEEvRAT__Kj(ptr noundef nonnull align 4 dereferenceable(68), ptr noundef nonnull align 4 dereferenceable(20)) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync 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 = { 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 #4 = { nounwind willreturn memory(none) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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, !11, i64 0}
!10 = !{!"_ZTS6w_rand", !11, i64 0, !7, i64 4}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!11, !11, 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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6w_randC2Ev(ptr noundef nonnull align 4 dereferenceable(68) %0) unnamed_addr #0 align 2 {
  %2 = alloca [5 x i32], align 16
  store i32 0, ptr %0, align 4, !tbaa !5
  %3 = tail call noundef i64 @_ZN11stopwatch_t3nowEv()
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %2) #5
  %4 = ptrtoint ptr %0 to i64
  %5 = trunc i64 %4 to i32
  store i32 %5, ptr %2, align 16, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %2, i64 4
  %7 = tail call i32 @getpid() #5
  store i32 %7, ptr %6, align 4, !tbaa !10
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = tail call i64 @pthread_self() #6
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr %8, align 8, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %2, i64 12
  %12 = trunc i64 %3 to i32
  store i32 %12, ptr %11, align 4, !tbaa !10
  %13 = getelementptr inbounds i8, ptr %2, i64 16
  %14 = lshr i64 %3, 32
  %15 = trunc nuw i64 %14 to i32
  store i32 %15, ptr %13, align 16, !tbaa !10
  call void @_ZN6w_rand4seedILm5EEEvRAT__Kj(ptr noundef nonnull align 4 dereferenceable(68) %0, ptr noundef nonnull align 4 dereferenceable(20) %2)
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %2) #5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11stopwatch_t3nowEv() local_unnamed_addr #2 align 2

; Function Attrs: nounwind
declare i32 @getpid() local_unnamed_addr #3

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i64 @pthread_self() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6w_rand4seedILm5EEEvRAT__Kj(ptr noundef nonnull align 4 dereferenceable(68), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nosync 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 = { 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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 = !{!"_ZTS6w_rand", !7, i64 0, !8, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass