; LLVM IR from lzyrapx/Competitive-Programming :: LibreOJ/106（Splay）（104基础上加区间）.ll (Z6Rotatei)

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

@fa = external dso_local global [1500300 x i32], align 16
@tree = external dso_local global [1500300 x [2 x i32]], align 16

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6Rotatei(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %10, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = call noundef i32 @_Z4sideii(i32 noundef %11, i32 noundef %12)
  store i32 %13, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = xor i32 %17, 1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [2 x i32], ptr %16, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  store i32 %21, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = call noundef i32 @_Z4sideii(i32 noundef %22, i32 noundef %26)
  store i32 %27, ptr %6, align 4, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %40
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2 x i32], ptr %41, i64 0, i64 %43
  store i32 %35, ptr %44, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2 x i32], ptr %52, i64 0, i64 %54
  store i32 %49, ptr %55, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %62
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = xor i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2 x i32], ptr %63, i64 0, i64 %66
  store i32 %60, ptr %67, align 4, !tbaa !5
  %68 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z6Updatei(i32 noundef %68)
  %69 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z6Updatei(i32 noundef %69)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 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"}


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

@fa = external dso_local local_unnamed_addr global [1500300 x i32], align 16
@tree = external dso_local local_unnamed_addr global [1500300 x [2 x i32]], align 16

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6Rotatei(i32 noundef %0) local_unnamed_addr #0 {
  %2 = sext i32 %0 to i64
  %3 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %2
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = tail call noundef i32 @_Z4sideii(i32 noundef %0, i32 noundef %4)
  %6 = xor i32 %5, 1
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %2, i64 %7
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = sext i32 %4 to i64
  %11 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = tail call noundef i32 @_Z4sideii(i32 noundef %4, i32 noundef %12)
  %14 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %14, ptr %3, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = sext i32 %13 to i64
  %17 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %15, i64 %16
  store i32 %0, ptr %17, align 4, !tbaa !5
  %18 = sext i32 %9 to i64
  %19 = getelementptr inbounds [1500300 x i32], ptr @fa, i64 0, i64 %18
  store i32 %4, ptr %19, align 4, !tbaa !5
  %20 = sext i32 %5 to i64
  %21 = getelementptr inbounds [1500300 x [2 x i32]], ptr @tree, i64 0, i64 %10, i64 %20
  store i32 %9, ptr %21, align 4, !tbaa !5
  store i32 %0, ptr %11, align 4, !tbaa !5
  store i32 %4, ptr %8, align 4, !tbaa !5
  tail call void @_Z6Updatei(i32 noundef %4)
  tail call void @_Z6Updatei(i32 noundef %0)
  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" }

!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,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass