; 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 i8, align 1
  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 1, 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 = sub i64 %10, 51238316
  %12 = sub i64 %11, 339126204
  %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 = %20, %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 %34

20:                                               ; preds = %14
  %21 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %22 = getelementptr inbounds i8, ptr %21, i64 0
  %23 = load i8, ptr %22, align 1, !tbaa !11
  store i8 %23, ptr %7, align 1, !tbaa !11
  %24 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %25 = getelementptr inbounds i8, ptr %24, i64 5
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %28 = getelementptr inbounds i8, ptr %27, i64 0
  store i8 %26, ptr %28, align 1, !tbaa !11
  %29 = load i8, ptr %7, align 1, !tbaa !11
  %30 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %31 = getelementptr inbounds i8, ptr %30, i64 5
  store i8 %29, ptr %31, align 1, !tbaa !11
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = add i64 %32, 1
  store i64 %33, ptr %6, align 8, !tbaa !9
  br label %14, !llvm.loop !12

34:                                               ; preds = %14
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %41, %34
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds i64, ptr %37, i64 1
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = icmp ult i64 %36, %39
  br i1 %40, label %41, label %49

41:                                               ; preds = %35
  %42 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %45 = load i64, ptr %44, align 8, !tbaa !9
  %46 = add i64 %45, %43
  store i64 %46, ptr %44, align 8, !tbaa !9
  %47 = load i64, ptr %6, align 8, !tbaa !9
  %48 = add i64 %47, 1
  store i64 %48, ptr %6, align 8, !tbaa !9
  br label %35, !llvm.loop !14

49:                                               ; preds = %35
  %50 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = add i64 %51, 198594862
  %53 = add i64 %52, 6485183463767864226
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds i64, ptr %54, i64 0
  store i64 %53, ptr %55, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; 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 = add i64 %3, -390364520
  %.sroa.0.0.extract.trunc = trunc i64 %4 to i8
  %.sroa.927.0.extract.shift = lshr i64 %4, 40
  %.sroa.927.0.extract.trunc = trunc i64 %.sroa.927.0.extract.shift to i8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = add i64 %6, 1
  %xtraiter = and i64 %7, 7
  %8 = icmp ult i64 %6, 7
  br i1 %8, label %.preheader.unr-lcssa, label %.new

.new:                                             ; preds = %2
  %unroll_iter = and i64 %7, -8
  br label %9

9:                                                ; preds = %9, %.new
  %niter = phi i64 [ 0, %.new ], [ %niter.next.7, %9 ]
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.preheader.unr-lcssa, label %9, !llvm.loop !9

.preheader.unr-lcssa:                             ; preds = %9, %2
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.epil.preheader

.epil.preheader:                                  ; preds = %.preheader.unr-lcssa, %.epil.preheader
  %.sroa.927.0.epil = phi i8 [ %.sroa.0.0.epil, %.epil.preheader ], [ %.sroa.927.0.extract.trunc, %.preheader.unr-lcssa ]
  %.sroa.0.0.epil = phi i8 [ %.sroa.927.0.epil, %.epil.preheader ], [ %.sroa.0.0.extract.trunc, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.preheader.unr-lcssa ]
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.epil.preheader, !llvm.loop !11

.preheader:                                       ; preds = %.epil.preheader, %.preheader.unr-lcssa
  %.sroa.927.0.lcssa = phi i8 [ %.sroa.0.0.extract.trunc, %.preheader.unr-lcssa ], [ %.sroa.927.0.epil, %.epil.preheader ]
  %.sroa.0.0.lcssa = phi i8 [ %.sroa.927.0.extract.trunc, %.preheader.unr-lcssa ], [ %.sroa.0.0.epil, %.epil.preheader ]
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %xtraiter64 = and i64 %6, 1
  %10 = icmp eq i64 %6, 1
  br i1 %10, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.sroa.0.157 = phi i8 [ %.sroa.0.0.lcssa, %.lr.ph.preheader.new ], [ %.sroa.0.0.extract.trunc10.1, %.lr.ph ]
  %.sroa.9.0.in.in56 = phi i64 [ %4, %.lr.ph.preheader.new ], [ %15, %.lr.ph ]
  %.sroa.927.155 = phi i8 [ %.sroa.927.0.lcssa, %.lr.ph.preheader.new ], [ %.sroa.927.0.extract.trunc34.1, %.lr.ph ]
  %niter71 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter71.next.1, %.lr.ph ]
  %.sroa.927.0.insert.ext = zext i8 %.sroa.927.155 to i64
  %.sroa.927.0.insert.shift = shl nuw nsw i64 %.sroa.927.0.insert.ext, 40
  %11 = and i64 %.sroa.9.0.in.in56, 9223091661389692672
  %.sroa.9.0.insert.insert = or disjoint i64 %11, %.sroa.927.0.insert.shift
  %.sroa.0.0.insert.ext = zext i8 %.sroa.0.157 to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.insert, %.sroa.0.0.insert.ext
  %12 = shl nuw i64 %.sroa.0.0.insert.insert, 1
  %13 = shl nuw i64 %.sroa.9.0.insert.insert, 1
  %.sroa.927.0.insert.shift.1 = and i64 %13, 280375465082880
  %14 = and i64 %12, 9223091661389692672
  %.sroa.9.0.insert.insert.1 = or disjoint i64 %14, %.sroa.927.0.insert.shift.1
  %.sroa.0.0.insert.ext.1 = and i64 %12, 254
  %.sroa.0.0.insert.insert.1 = or disjoint i64 %.sroa.9.0.insert.insert.1, %.sroa.0.0.insert.ext.1
  %15 = shl nuw i64 %.sroa.0.0.insert.insert.1, 1
  %.sroa.0.0.extract.trunc10.1 = trunc i64 %15 to i8
  %.sroa.927.0.extract.shift33.1 = lshr i64 %.sroa.9.0.insert.insert.1, 39
  %.sroa.927.0.extract.trunc34.1 = trunc i64 %.sroa.927.0.extract.shift33.1 to i8
  %niter71.next.1 = add i64 %niter71, 2
  %niter71.ncmp.1 = icmp eq i64 %niter71.next.1, %unroll_iter70
  br i1 %niter71.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !13

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph.preheader ], [ %15, %.lr.ph ]
  %.sroa.0.0.extract.trunc10.lcssa.ph = phi i8 [ poison, %.lr.ph.preheader ], [ %.sroa.0.0.extract.trunc10.1, %.lr.ph ]
  %.sroa.927.0.extract.trunc34.lcssa.ph = phi i8 [ poison, %.lr.ph.preheader ], [ %.sroa.927.0.extract.trunc34.1, %.lr.ph ]
  %.sroa.0.157.unr = phi i8 [ %.sroa.0.0.lcssa, %.lr.ph.preheader ], [ %.sroa.0.0.extract.trunc10.1, %.lr.ph ]
  %.sroa.9.0.in.in56.unr = phi i64 [ %4, %.lr.ph.preheader ], [ %15, %.lr.ph ]
  %.sroa.927.155.unr = phi i8 [ %.sroa.927.0.lcssa, %.lr.ph.preheader ], [ %.sroa.927.0.extract.trunc34.1, %.lr.ph ]
  %lcmp.mod66.not = icmp eq i64 %xtraiter64, 0
  br i1 %lcmp.mod66.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %.sroa.927.0.insert.ext.epil = zext i8 %.sroa.927.155.unr to i64
  %.sroa.927.0.insert.shift.epil = shl nuw nsw i64 %.sroa.927.0.insert.ext.epil, 40
  %16 = and i64 %.sroa.9.0.in.in56.unr, 9223091661389692672
  %.sroa.9.0.insert.insert.epil = or disjoint i64 %16, %.sroa.927.0.insert.shift.epil
  %.sroa.0.0.insert.ext.epil = zext i8 %.sroa.0.157.unr to i64
  %.sroa.0.0.insert.insert.epil = or disjoint i64 %.sroa.9.0.insert.insert.epil, %.sroa.0.0.insert.ext.epil
  %17 = shl nuw i64 %.sroa.0.0.insert.insert.epil, 1
  %.sroa.0.0.extract.trunc10.epil = trunc i64 %17 to i8
  %.sroa.927.0.extract.shift33.epil = lshr i64 %.sroa.9.0.insert.insert.epil, 39
  %.sroa.927.0.extract.trunc34.epil = trunc i64 %.sroa.927.0.extract.shift33.epil to i8
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %.preheader
  %.sroa.927.1.lcssa = phi i8 [ %.sroa.927.0.lcssa, %.preheader ], [ %.sroa.927.0.extract.trunc34.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.sroa.927.0.extract.trunc34.epil, %.lr.ph.epil ]
  %.sroa.9.0.in.in.lcssa = phi i64 [ %4, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %17, %.lr.ph.epil ]
  %.sroa.0.1.lcssa = phi i8 [ %.sroa.0.0.lcssa, %.preheader ], [ %.sroa.0.0.extract.trunc10.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.sroa.0.0.extract.trunc10.epil, %.lr.ph.epil ]
  %.sroa.927.0.insert.ext36 = zext i8 %.sroa.927.1.lcssa to i64
  %.sroa.927.0.insert.shift37 = shl nuw nsw i64 %.sroa.927.0.insert.ext36, 40
  %18 = and i64 %.sroa.9.0.in.in.lcssa, -280375465083136
  %.sroa.0.0.insert.ext12 = zext i8 %.sroa.0.1.lcssa to i64
  %.sroa.0.0.insert.insert14 = or disjoint i64 %.sroa.927.0.insert.shift37, 6485183463966459088
  %.sroa.9.0.insert.insert26 = add i64 %.sroa.0.0.insert.insert14, %18
  %19 = add i64 %.sroa.9.0.insert.insert26, %.sroa.0.0.insert.ext12
  store i64 %19, 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"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10}


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