; LLVM IR from luminousmen/ZUC :: ZUC.ll (Z16LFSRWithWorkModev)

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

@LFSR_S = external dso_local global [16 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4AddMjj(i32 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z16LFSRWithWorkModev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #2
  %4 = load i32, ptr @LFSR_S, align 16, !tbaa !5
  store i32 %4, ptr %1, align 4, !tbaa !5
  %5 = load i32, ptr @LFSR_S, align 16, !tbaa !5
  %6 = shl i32 %5, 8
  %7 = load i32, ptr @LFSR_S, align 16, !tbaa !5
  %8 = lshr i32 %7, 23
  %9 = or i32 %6, %8
  %10 = and i32 %9, 2147483647
  store i32 %10, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = call noundef i32 @_Z4AddMjj(i32 noundef %11, i32 noundef %12)
  store i32 %13, ptr %1, align 4, !tbaa !5
  %14 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 4), align 16, !tbaa !5
  %15 = shl i32 %14, 20
  %16 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 4), align 16, !tbaa !5
  %17 = lshr i32 %16, 11
  %18 = or i32 %15, %17
  %19 = and i32 %18, 2147483647
  store i32 %19, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = call noundef i32 @_Z4AddMjj(i32 noundef %20, i32 noundef %21)
  store i32 %22, ptr %1, align 4, !tbaa !5
  %23 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 10), align 8, !tbaa !5
  %24 = shl i32 %23, 21
  %25 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 10), align 8, !tbaa !5
  %26 = lshr i32 %25, 10
  %27 = or i32 %24, %26
  %28 = and i32 %27, 2147483647
  store i32 %28, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = call noundef i32 @_Z4AddMjj(i32 noundef %29, i32 noundef %30)
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 13), align 4, !tbaa !5
  %33 = shl i32 %32, 17
  %34 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 13), align 4, !tbaa !5
  %35 = lshr i32 %34, 14
  %36 = or i32 %33, %35
  %37 = and i32 %36, 2147483647
  store i32 %37, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = call noundef i32 @_Z4AddMjj(i32 noundef %38, i32 noundef %39)
  store i32 %40, ptr %1, align 4, !tbaa !5
  %41 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 15), align 4, !tbaa !5
  %42 = shl i32 %41, 15
  %43 = load i32, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 15), align 4, !tbaa !5
  %44 = lshr i32 %43, 16
  %45 = or i32 %42, %44
  %46 = and i32 %45, 2147483647
  store i32 %46, ptr %2, align 4, !tbaa !5
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = call noundef i32 @_Z4AddMjj(i32 noundef %47, i32 noundef %48)
  store i32 %49, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %63, %0
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = icmp slt i32 %51, 15
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  br label %66

54:                                               ; preds = %50
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [16 x i32], ptr @LFSR_S, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [16 x i32], ptr @LFSR_S, i64 0, i64 %61
  store i32 %59, ptr %62, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %54
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %3, align 4, !tbaa !5
  br label %50, !llvm.loop !9

66:                                               ; preds = %53
  %67 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %67, ptr getelementptr inbounds ([16 x i32], ptr @LFSR_S, i64 0, i64 15), align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #2
  ret void
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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

@LFSR_S = external dso_local local_unnamed_addr global [16 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4AddMjj(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z16LFSRWithWorkModev() local_unnamed_addr #0 {
  %1 = load i32, ptr @LFSR_S, align 16, !tbaa !5
  %2 = shl i32 %1, 8
  %3 = lshr i32 %1, 23
  %.masked = and i32 %2, 2147483392
  %4 = or i32 %.masked, %3
  %5 = tail call noundef i32 @_Z4AddMjj(i32 noundef %1, i32 noundef %4)
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @LFSR_S, i64 16), align 16, !tbaa !5
  %7 = shl i32 %6, 20
  %8 = lshr i32 %6, 11
  %.masked15 = and i32 %7, 2146435072
  %9 = or i32 %.masked15, %8
  %10 = tail call noundef i32 @_Z4AddMjj(i32 noundef %5, i32 noundef %9)
  %11 = load i32, ptr getelementptr inbounds (i8, ptr @LFSR_S, i64 40), align 8, !tbaa !5
  %12 = shl i32 %11, 21
  %13 = lshr i32 %11, 10
  %.masked16 = and i32 %12, 2145386496
  %14 = or i32 %.masked16, %13
  %15 = tail call noundef i32 @_Z4AddMjj(i32 noundef %10, i32 noundef %14)
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @LFSR_S, i64 52), align 4, !tbaa !5
  %17 = shl i32 %16, 17
  %18 = lshr i32 %16, 14
  %.masked17 = and i32 %17, 2147352576
  %19 = or i32 %.masked17, %18
  %20 = tail call noundef i32 @_Z4AddMjj(i32 noundef %15, i32 noundef %19)
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @LFSR_S, i64 60), align 4, !tbaa !5
  %22 = shl i32 %21, 15
  %23 = lshr i32 %21, 16
  %.masked18 = and i32 %22, 2147450880
  %24 = or i32 %.masked18, %23
  %25 = tail call noundef i32 @_Z4AddMjj(i32 noundef %20, i32 noundef %24)
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(60) @LFSR_S, ptr noundef nonnull align 4 dereferenceable(60) getelementptr inbounds (i8, ptr @LFSR_S, i64 4), i64 60, i1 false), !tbaa !5
  store i32 %25, ptr getelementptr inbounds (i8, ptr @LFSR_S, i64 60), align 4, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopIdiomRecognizePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass