; 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 i16, align 2
  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 2, 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 = add i64 %10, 51238316
  %12 = add i64 %11, 274866410
  %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 %38

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

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

39:                                               ; preds = %45, %38
  %40 = load i64, ptr %6, align 8, !tbaa !9
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds i64, ptr %41, i64 1
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = icmp ult i64 %40, %43
  br i1 %44, label %45, label %55

45:                                               ; preds = %39
  %46 = load i64, ptr %6, align 8, !tbaa !9
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = add i64 %48, %50
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %51, ptr %52, align 8, !tbaa !9
  %53 = load i64, ptr %6, align 8, !tbaa !9
  %54 = add i64 %53, 1
  store i64 %54, ptr %6, align 8, !tbaa !9
  br label %39, !llvm.loop !15

55:                                               ; preds = %39
  %56 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = add i64 %57, 724560680
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds i64, ptr %59, i64 0
  store i64 %58, ptr %60, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, 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 = !{!"short", !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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; 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 #1 {
  %3 = alloca [1 x i64], align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #2
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = add i64 %4, 326104726
  store i64 %5, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %invariant.gep = getelementptr inbounds i8, ptr %3, i64 6
  %8 = trunc i64 %5 to i16
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %.preheader.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %9 = add i64 %7, -1
  %10 = lshr i64 %9, 1
  %11 = add nuw i64 %10, 1
  %xtraiter = and i64 %11, 3
  %12 = icmp ult i64 %7, 7
  br i1 %12, label %.lr.ph19.preheader.unr-lcssa, label %.lr.ph.preheader.new

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

.preheader.thread:                                ; preds = %2
  store i16 %8, ptr %3, align 8, !tbaa !9
  %.promoted1624 = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

.lr.ph19.preheader.unr-lcssa:                     ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa27.ph = phi i16 [ poison, %.lr.ph.preheader ], [ %24, %.lr.ph ]
  %.014.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %25, %.lr.ph ]
  %.unr = phi i16 [ %8, %.lr.ph.preheader ], [ %24, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph19.preheader, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.lr.ph19.preheader.unr-lcssa, %.lr.ph.epil
  %.014.epil = phi i64 [ %15, %.lr.ph.epil ], [ %.014.unr, %.lr.ph19.preheader.unr-lcssa ]
  %13 = phi i16 [ %14, %.lr.ph.epil ], [ %.unr, %.lr.ph19.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.lr.ph19.preheader.unr-lcssa ]
  %gep.epil = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.014.epil
  %14 = load i16, ptr %gep.epil, align 2, !tbaa !9
  store i16 %13, ptr %gep.epil, align 2, !tbaa !9
  %15 = add nuw i64 %.014.epil, 2
  %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 %.lr.ph19.preheader, label %.lr.ph.epil, !llvm.loop !11

.lr.ph19.preheader:                               ; preds = %.lr.ph.epil, %.lr.ph19.preheader.unr-lcssa
  %.lcssa27 = phi i16 [ %.lcssa27.ph, %.lr.ph19.preheader.unr-lcssa ], [ %14, %.lr.ph.epil ]
  store i16 %.lcssa27, ptr %3, align 8, !tbaa !9
  %.promoted16 = load i64, ptr %3, align 8, !tbaa !5
  %xtraiter29 = and i64 %7, 7
  %16 = icmp ult i64 %7, 8
  br i1 %16, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph19.preheader.new

.lr.ph19.preheader.new:                           ; preds = %.lr.ph19.preheader
  %unroll_iter34 = and i64 %7, -8
  br label %.lr.ph19

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.014 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %25, %.lr.ph ]
  %17 = phi i16 [ %8, %.lr.ph.preheader.new ], [ %24, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.014
  %18 = load i16, ptr %gep, align 2, !tbaa !9
  store i16 %17, ptr %gep, align 2, !tbaa !9
  %19 = or disjoint i64 %.014, 2
  %gep.1 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %19
  %20 = load i16, ptr %gep.1, align 2, !tbaa !9
  store i16 %18, ptr %gep.1, align 2, !tbaa !9
  %21 = or disjoint i64 %.014, 4
  %gep.2 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %21
  %22 = load i16, ptr %gep.2, align 2, !tbaa !9
  store i16 %20, ptr %gep.2, align 2, !tbaa !9
  %23 = or disjoint i64 %.014, 6
  %gep.3 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %23
  %24 = load i16, ptr %gep.3, align 2, !tbaa !9
  store i16 %22, ptr %gep.3, align 2, !tbaa !9
  %25 = add nuw i64 %.014, 8
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3.not = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3.not, label %.lr.ph19.preheader.unr-lcssa, label %.lr.ph, !llvm.loop !13

.lr.ph19:                                         ; preds = %.lr.ph19, %.lr.ph19.preheader.new
  %26 = phi i64 [ %.promoted16, %.lr.ph19.preheader.new ], [ %27, %.lr.ph19 ]
  %niter35 = phi i64 [ 0, %.lr.ph19.preheader.new ], [ %niter35.next.7, %.lr.ph19 ]
  %27 = shl i64 %26, 8
  %niter35.next.7 = add i64 %niter35, 8
  %niter35.ncmp.7 = icmp eq i64 %niter35.next.7, %unroll_iter34
  br i1 %niter35.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph19, !llvm.loop !15

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph19, %.lr.ph19.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph19.preheader ], [ %27, %.lr.ph19 ]
  %.unr31 = phi i64 [ %.promoted16, %.lr.ph19.preheader ], [ %27, %.lr.ph19 ]
  %lcmp.mod32.not = icmp eq i64 %xtraiter29, 0
  br i1 %lcmp.mod32.not, label %._crit_edge, label %.lr.ph19.epil

.lr.ph19.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph19.epil
  %28 = phi i64 [ %29, %.lr.ph19.epil ], [ %.unr31, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter30 = phi i64 [ %epil.iter30.next, %.lr.ph19.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %29 = shl i64 %28, 1
  %epil.iter30.next = add i64 %epil.iter30, 1
  %epil.iter30.cmp.not = icmp eq i64 %epil.iter30.next, %xtraiter29
  br i1 %epil.iter30.cmp.not, label %._crit_edge, label %.lr.ph19.epil, !llvm.loop !16

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph19.epil, %.preheader.thread
  %.lcssa17 = phi i64 [ %.promoted1624, %.preheader.thread ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %29, %.lr.ph19.epil ]
  %30 = add i64 %.lcssa17, 724560680
  store i64 %30, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #2
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !12}


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