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

; 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: 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: mustprogress uwtable
define dso_local void @_ZN6w_rand4seedEPKjm(ptr noundef nonnull align 4 dereferenceable(68) %0, ptr noundef %1, i64 noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %10

10:                                               ; preds = %31, %3
  %11 = load i64, ptr %6, align 8, !tbaa !9
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %13, label %16

13:                                               ; preds = %10
  %14 = load i64, ptr %7, align 8, !tbaa !9
  %15 = icmp ult i64 %14, 16
  br label %16

16:                                               ; preds = %13, %10
  %17 = phi i1 [ false, %10 ], [ %15, %13 ]
  br i1 %17, label %19, label %18

18:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %34

19:                                               ; preds = %16
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i64, ptr %7, align 8, !tbaa !9
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = urem i64 %21, %22
  %24 = getelementptr inbounds i32, ptr %20, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = getelementptr inbounds %struct.w_rand, ptr %9, i32 0, i32 1
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = sub i64 16, %27
  %29 = and i64 %28, 15
  %30 = getelementptr inbounds [16 x i32], ptr %26, i64 0, i64 %29
  store i32 %25, ptr %30, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %19
  %32 = load i64, ptr %7, align 8, !tbaa !9
  %33 = add i64 %32, 1
  store i64 %33, ptr %7, align 8, !tbaa !9
  br label %10, !llvm.loop !13

34:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %41, %34
  %36 = load i32, ptr %8, align 4, !tbaa !11
  %37 = icmp slt i32 %36, 100
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %44

39:                                               ; preds = %35
  %40 = call noundef i32 @_ZN6w_rand4randEv(ptr noundef nonnull align 4 dereferenceable(68) %9)
  br label %41

41:                                               ; preds = %39
  %42 = load i32, ptr %8, align 4, !tbaa !11
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %8, align 4, !tbaa !11
  br label %35, !llvm.loop !15

44:                                               ; preds = %38
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6w_rand4randEv(ptr noundef nonnull align 4 dereferenceable(68)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 }

!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 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 nounwind uwtable
define dso_local void @_ZN6w_rand4seedEPKjm(ptr noundef nonnull align 4 dereferenceable(68) %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #0 align 2 {
  %.not = icmp eq i64 %2, 0
  br i1 %.not, label %.preheader.preheader, label %.lr.ph

.preheader.preheader:                             ; preds = %.lr.ph, %3
  br label %.preheader

.lr.ph:                                           ; preds = %3
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  %5 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %5, ptr %4, align 4, !tbaa !5
  %6 = icmp ne i64 %2, 1
  %7 = zext i1 %6 to i64
  %8 = getelementptr inbounds i32, ptr %1, i64 %7
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 64
  store i32 %9, ptr %10, align 4, !tbaa !5
  %11 = urem i64 2, %2
  %12 = getelementptr inbounds i32, ptr %1, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 60
  store i32 %13, ptr %14, align 4, !tbaa !5
  %15 = urem i64 3, %2
  %16 = getelementptr inbounds i32, ptr %1, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %17, ptr %18, align 4, !tbaa !5
  %19 = urem i64 4, %2
  %20 = getelementptr inbounds i32, ptr %1, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 %21, ptr %22, align 4, !tbaa !5
  %23 = urem i64 5, %2
  %24 = getelementptr inbounds i32, ptr %1, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %25, ptr %26, align 4, !tbaa !5
  %27 = urem i64 6, %2
  %28 = getelementptr inbounds i32, ptr %1, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %29, ptr %30, align 4, !tbaa !5
  %31 = urem i64 7, %2
  %32 = getelementptr inbounds i32, ptr %1, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %33, ptr %34, align 4, !tbaa !5
  %35 = urem i64 8, %2
  %36 = getelementptr inbounds i32, ptr %1, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %37, ptr %38, align 4, !tbaa !5
  %39 = urem i64 9, %2
  %40 = getelementptr inbounds i32, ptr %1, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %41, ptr %42, align 4, !tbaa !5
  %43 = urem i64 10, %2
  %44 = getelementptr inbounds i32, ptr %1, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %45, ptr %46, align 4, !tbaa !5
  %47 = urem i64 11, %2
  %48 = getelementptr inbounds i32, ptr %1, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %49, ptr %50, align 4, !tbaa !5
  %51 = urem i64 12, %2
  %52 = getelementptr inbounds i32, ptr %1, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %53, ptr %54, align 4, !tbaa !5
  %55 = urem i64 13, %2
  %56 = getelementptr inbounds i32, ptr %1, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %57, ptr %58, align 4, !tbaa !5
  %59 = urem i64 14, %2
  %60 = getelementptr inbounds i32, ptr %1, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %61, ptr %62, align 4, !tbaa !5
  %63 = urem i64 15, %2
  %64 = getelementptr inbounds i32, ptr %1, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %65, ptr %66, align 4, !tbaa !5
  br label %.preheader.preheader

67:                                               ; preds = %.preheader
  ret void

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %.012 = phi i32 [ %69, %.preheader ], [ 0, %.preheader.preheader ]
  %68 = tail call noundef i32 @_ZN6w_rand4randEv(ptr noundef nonnull align 4 dereferenceable(68) %0)
  %69 = add nuw nsw i32 %.012, 1
  %exitcond.not = icmp eq i32 %69, 100
  br i1 %exitcond.not, label %67, label %.preheader, !llvm.loop !9
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN6w_rand4randEv(ptr noundef nonnull align 4 dereferenceable(68)) local_unnamed_addr #0 align 2

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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass