; 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: nounwind uwtable
define dso_local void @RandomFunc(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [1 x i64], align 8
  %6 = alloca i64, align 8
  %7 = 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 4, ptr %7) #2
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds i64, ptr %8, i64 0
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = and i64 %10, 914778474
  %12 = shl i64 %11, 7
  %13 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %12, ptr %13, align 8, !tbaa !9
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %14

14:                                               ; preds = %49, %2
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds i64, ptr %16, i64 1
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = icmp ult i64 %15, %18
  br i1 %19, label %20, label %52

20:                                               ; preds = %14
  %21 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = load i64, ptr %6, align 8, !tbaa !9
  %24 = icmp ugt i64 %22, %23
  br i1 %24, label %25, label %37

25:                                               ; preds = %20
  %26 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = load i64, ptr %6, align 8, !tbaa !9
  %29 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = lshr i64 %30, 1
  %32 = and i64 %31, 7
  %33 = or i64 %32, 1
  %34 = shl i64 %27, %33
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %35
  store i64 %34, ptr %36, align 8, !tbaa !9
  br label %49

37:                                               ; preds = %20
  %38 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i32, ptr %38, i64 0
  %40 = load i32, ptr %39, align 4, !tbaa !11
  store i32 %40, ptr %7, align 4, !tbaa !11
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i32, ptr %41, i64 1
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i32, ptr %44, i64 0
  store i32 %43, ptr %45, align 4, !tbaa !11
  %46 = load i32, ptr %7, align 4, !tbaa !11
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i32, ptr %47, i64 1
  store i32 %46, ptr %48, align 4, !tbaa !11
  br label %49

49:                                               ; preds = %37, %25
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = add i64 %50, 1
  store i64 %51, ptr %6, align 8, !tbaa !9
  br label %14, !llvm.loop !13

52:                                               ; preds = %14
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = and i64 %54, 690137161
  %56 = shl i64 %55, 3
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds i64, ptr %57, i64 0
  store i64 %56, ptr %58, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, 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.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 = { 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 = !{!"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"}


; 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.0.0.extract.trunc = trunc i64 %5 to i32
  %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 %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %.sroa.9.0.extract.shift = lshr i64 %5, 32
  %.sroa.9.0.extract.trunc = trunc nuw nsw i64 %.sroa.9.0.extract.shift to i32
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i64 %7, 1
  br i1 %8, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %7, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %22, %.lr.ph.preheader.new
  %.033 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %23, %22 ]
  %.sroa.0.032 = phi i32 [ %.sroa.0.0.extract.trunc, %.lr.ph.preheader.new ], [ %.sroa.0.1.1, %22 ]
  %.sroa.9.031 = phi i32 [ %.sroa.9.0.extract.trunc, %.lr.ph.preheader.new ], [ %.sroa.9.1.1, %22 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %22 ]
  %.sroa.9.0.insert.ext = zext i32 %.sroa.9.031 to i64
  %.sroa.9.0.insert.shift = shl nuw i64 %.sroa.9.0.insert.ext, 32
  %.sroa.0.0.insert.ext = zext i32 %.sroa.0.032 to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.shift, %.sroa.0.0.insert.ext
  %9 = icmp ugt i64 %.sroa.0.0.insert.insert, %.033
  br i1 %9, label %10, label %.lr.ph.1

10:                                               ; preds = %.lr.ph
  %11 = lshr i64 %.sroa.0.0.insert.ext, 1
  %12 = and i64 %11, 6
  %13 = or disjoint i64 %12, 1
  %14 = shl i64 %.sroa.0.0.insert.insert, %13
  %.sroa.0.0.extract.trunc18 = trunc i64 %14 to i32
  %.sroa.9.0.extract.shift29 = lshr i64 %14, 32
  %.sroa.9.0.extract.trunc30 = trunc nuw i64 %.sroa.9.0.extract.shift29 to i32
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.lr.ph, %10
  %.sroa.9.1 = phi i32 [ %.sroa.9.0.extract.trunc30, %10 ], [ %.sroa.0.032, %.lr.ph ]
  %.sroa.0.1 = phi i32 [ %.sroa.0.0.extract.trunc18, %10 ], [ %.sroa.9.031, %.lr.ph ]
  %15 = or disjoint i64 %.033, 1
  %.sroa.9.0.insert.ext.1 = zext i32 %.sroa.9.1 to i64
  %.sroa.9.0.insert.shift.1 = shl nuw i64 %.sroa.9.0.insert.ext.1, 32
  %.sroa.0.0.insert.ext.1 = zext i32 %.sroa.0.1 to i64
  %.sroa.0.0.insert.insert.1 = or disjoint i64 %.sroa.9.0.insert.shift.1, %.sroa.0.0.insert.ext.1
  %16 = icmp ugt i64 %.sroa.0.0.insert.insert.1, %15
  br i1 %16, label %17, label %22

17:                                               ; preds = %.lr.ph.1
  %18 = lshr i64 %.sroa.0.0.insert.ext.1, 1
  %19 = and i64 %18, 6
  %20 = or disjoint i64 %19, 1
  %21 = shl i64 %.sroa.0.0.insert.insert.1, %20
  %.sroa.0.0.extract.trunc18.1 = trunc i64 %21 to i32
  %.sroa.9.0.extract.shift29.1 = lshr i64 %21, 32
  %.sroa.9.0.extract.trunc30.1 = trunc nuw i64 %.sroa.9.0.extract.shift29.1 to i32
  br label %22

22:                                               ; preds = %17, %.lr.ph.1
  %.sroa.9.1.1 = phi i32 [ %.sroa.9.0.extract.trunc30.1, %17 ], [ %.sroa.0.1, %.lr.ph.1 ]
  %.sroa.0.1.1 = phi i32 [ %.sroa.0.0.extract.trunc18.1, %17 ], [ %.sroa.9.1, %.lr.ph.1 ]
  %23 = add nuw i64 %.033, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %22, %.lr.ph.preheader
  %.sroa.0.1.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.sroa.0.1.1, %22 ]
  %.033.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %23, %22 ]
  %.sroa.0.032.unr = phi i32 [ %.sroa.0.0.extract.trunc, %.lr.ph.preheader ], [ %.sroa.0.1.1, %22 ]
  %.sroa.9.031.unr = phi i32 [ %.sroa.9.0.extract.trunc, %.lr.ph.preheader ], [ %.sroa.9.1.1, %22 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %.sroa.9.0.insert.ext.epil = zext i32 %.sroa.9.031.unr to i64
  %.sroa.9.0.insert.shift.epil = shl nuw i64 %.sroa.9.0.insert.ext.epil, 32
  %.sroa.0.0.insert.ext.epil = zext i32 %.sroa.0.032.unr to i64
  %.sroa.0.0.insert.insert.epil = or disjoint i64 %.sroa.9.0.insert.shift.epil, %.sroa.0.0.insert.ext.epil
  %24 = icmp ugt i64 %.sroa.0.0.insert.insert.epil, %.033.unr
  %25 = lshr i32 %.sroa.0.032.unr, 1
  %26 = and i32 %25, 6
  %27 = or disjoint i32 %26, 1
  %.sroa.0.0.extract.trunc18.epil = shl i32 %.sroa.0.032.unr, %27
  %.sroa.0.1.epil = select i1 %24, i32 %.sroa.0.0.extract.trunc18.epil, i32 %.sroa.9.031.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %2
  %.sroa.0.0.lcssa = phi i32 [ %.sroa.0.0.extract.trunc, %2 ], [ %.sroa.0.1.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.sroa.0.1.epil, %.lr.ph.epil ]
  %.sroa.0.0.insert.ext11 = zext i32 %.sroa.0.0.lcssa to i64
  %28 = shl nuw nsw i64 %.sroa.0.0.insert.ext11, 3
  %29 = and i64 %28, 5521097288
  store i64 %29, ptr %1, align 8, !tbaa !5
  ret void
}

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

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


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