; LLVM IR from tum-i4/obfuscation-benchmarks :: tigress-generated-programs (RandomFunc)

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

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

; Function Attrs: nounwind uwtable
define dso_local void @RandomFunc(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [1 x i64], align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds i64, ptr %9, i64 0
  %11 = load i64, ptr %10, align 8, !tbaa !9
  %12 = and i64 %11, 914778474
  %13 = shl i64 %12, 7
  %14 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %13, ptr %14, align 8, !tbaa !9
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %53, %2
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds i64, ptr %17, i64 1
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = icmp ult i64 %16, %19
  br i1 %20, label %21, label %56

21:                                               ; preds = %15
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %28, %21
  %23 = load i64, ptr %6, align 8, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds i64, ptr %24, i64 1
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = icmp ult i64 %23, %26
  br i1 %27, label %28, label %53

28:                                               ; preds = %22
  %29 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = lshr i64 %33, 1
  %35 = and i64 %34, 7
  %36 = or i64 %35, 1
  %37 = shl i64 %30, %36
  %38 = load i64, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %38
  store i64 %37, ptr %39, align 8, !tbaa !9
  %40 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %41 = getelementptr inbounds i32, ptr %40, i64 0
  %42 = load i32, ptr %41, align 4, !tbaa !11
  store i32 %42, ptr %8, align 4, !tbaa !11
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %44 = getelementptr inbounds i32, ptr %43, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %47 = getelementptr inbounds i32, ptr %46, i64 0
  store i32 %45, ptr %47, align 4, !tbaa !11
  %48 = load i32, ptr %8, align 4, !tbaa !11
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %50 = getelementptr inbounds i32, ptr %49, i64 1
  store i32 %48, ptr %50, align 4, !tbaa !11
  %51 = load i64, ptr %6, align 8, !tbaa !9
  %52 = add i64 %51, 2
  store i64 %52, ptr %6, align 8, !tbaa !9
  br label %22, !llvm.loop !13

53:                                               ; preds = %22
  %54 = load i64, ptr %7, align 8, !tbaa !9
  %55 = add i64 %54, 1
  store i64 %55, ptr %7, align 8, !tbaa !9
  br label %15, !llvm.loop !15

56:                                               ; preds = %15
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = or i64 %58, 964964849
  %60 = xor i64 %59, 176836258
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds i64, ptr %61, i64 0
  store i64 %60, ptr %62, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/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: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @RandomFunc(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = load i64, ptr %0, align 8, !tbaa !5
  %4 = shl i64 %3, 7
  %5 = and i64 %4, 117091644672
  %.sroa.8.0.extract.shift = lshr i64 %5, 32
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %8 = add i64 %7, -1
  %9 = lshr i64 %8, 1
  %10 = add nuw i64 %9, 1
  %11 = icmp ult i64 %7, 3
  %unroll_iter = and i64 %10, -2
  %12 = and i64 %8, 2
  %lcmp.mod.not.not = icmp eq i64 %12, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %25
  %.01029 = phi i64 [ %26, %25 ], [ 0, %.preheader.preheader ]
  %.sroa.0.028 = phi i64 [ %.sroa.8.0.extract.shift22.lcssa, %25 ], [ %5, %.preheader.preheader ]
  %.sroa.8.027 = phi i64 [ %.lcssa, %25 ], [ %.sroa.8.0.extract.shift, %.preheader.preheader ]
  br i1 %11, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %.sroa.0.125 = phi i64 [ %.sroa.8.0.extract.shift22.1, %.preheader.new ], [ %.sroa.0.028, %.preheader ]
  %.sroa.8.124 = phi i64 [ %20, %.preheader.new ], [ %.sroa.8.027, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %.preheader.new ], [ 0, %.preheader ]
  %.sroa.8.0.insert.ext = shl i64 %.sroa.8.124, 32
  %.sroa.0.0.insert.ext = and i64 %.sroa.0.125, 4294967295
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.8.0.insert.ext, %.sroa.0.0.insert.ext
  %13 = lshr i64 %.sroa.0.125, 1
  %14 = and i64 %13, 6
  %15 = or disjoint i64 %14, 1
  %16 = shl i64 %.sroa.0.0.insert.insert, %15
  %.sroa.0.0.insert.insert.1 = tail call i64 @llvm.fshl.i64(i64 %16, i64 %16, i64 32)
  %17 = lshr i64 %16, 33
  %18 = and i64 %17, 6
  %19 = or disjoint i64 %18, 1
  %20 = shl i64 %.sroa.0.0.insert.insert.1, %19
  %.sroa.8.0.extract.shift22.1 = lshr i64 %20, 32
  %niter.next.1 = add nuw i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %.unr-lcssa, label %.preheader.new, !llvm.loop !9

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.lcssa.ph = phi i64 [ poison, %.preheader ], [ %20, %.preheader.new ]
  %.sroa.8.0.extract.shift22.lcssa.ph = phi i64 [ poison, %.preheader ], [ %.sroa.8.0.extract.shift22.1, %.preheader.new ]
  %.sroa.0.125.unr = phi i64 [ %.sroa.0.028, %.preheader ], [ %.sroa.8.0.extract.shift22.1, %.preheader.new ]
  %.sroa.8.124.unr = phi i64 [ %.sroa.8.027, %.preheader ], [ %20, %.preheader.new ]
  br i1 %lcmp.mod.not.not, label %.epilog-lcssa, label %25

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %.sroa.8.0.insert.ext.epil = shl i64 %.sroa.8.124.unr, 32
  %.sroa.0.0.insert.ext.epil = and i64 %.sroa.0.125.unr, 4294967295
  %.sroa.0.0.insert.insert.epil = or disjoint i64 %.sroa.8.0.insert.ext.epil, %.sroa.0.0.insert.ext.epil
  %21 = lshr i64 %.sroa.0.125.unr, 1
  %22 = and i64 %21, 6
  %23 = or disjoint i64 %22, 1
  %24 = shl i64 %.sroa.0.0.insert.insert.epil, %23
  %.sroa.8.0.extract.shift22.epil = lshr i64 %24, 32
  br label %25

25:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %.lcssa = phi i64 [ %.lcssa.ph, %.unr-lcssa ], [ %24, %.epilog-lcssa ]
  %.sroa.8.0.extract.shift22.lcssa = phi i64 [ %.sroa.8.0.extract.shift22.lcssa.ph, %.unr-lcssa ], [ %.sroa.8.0.extract.shift22.epil, %.epilog-lcssa ]
  %26 = add nuw i64 %.01029, 1
  %exitcond.not = icmp eq i64 %26, %7
  br i1 %exitcond.not, label %._crit_edge, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %25, %2
  %.sroa.8.0.lcssa = phi i64 [ %.sroa.8.0.extract.shift, %2 ], [ %.lcssa, %25 ]
  %.sroa.0.0.lcssa = phi i64 [ %5, %2 ], [ %.sroa.8.0.extract.shift22.lcssa, %25 ]
  %.sroa.8.0.insert.ext18 = shl i64 %.sroa.8.0.lcssa, 32
  %.sroa.0.0.insert.ext13.masked = and i64 %.sroa.0.0.lcssa, 3330002446
  %27 = or disjoint i64 %.sroa.0.0.insert.ext13.masked, %.sroa.8.0.insert.ext18
  %28 = xor i64 %27, 856588115
  store i64 %28, ptr %1, align 8, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.fshl.i64(i64, i64, i64) #1

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass