; 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 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 8, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 1, 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 = add i64 %11, 51238316
  %13 = add i64 %12, 274866410
  %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 = %61, %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 %64

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 %61

28:                                               ; preds = %22
  %29 = load i64, ptr %7, align 8, !tbaa !9
  %30 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %29
  %31 = getelementptr inbounds i8, ptr %30, i64 5
  %32 = load i8, ptr %31, align 1, !tbaa !11
  store i8 %32, ptr %8, align 1, !tbaa !11
  %33 = load i64, ptr %7, align 8, !tbaa !9
  %34 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %33
  %35 = getelementptr inbounds i8, ptr %34, i64 3
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %37
  %39 = getelementptr inbounds i8, ptr %38, i64 5
  store i8 %36, ptr %39, align 1, !tbaa !11
  %40 = load i8, ptr %8, align 1, !tbaa !11
  %41 = load i64, ptr %7, align 8, !tbaa !9
  %42 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %41
  %43 = getelementptr inbounds i8, ptr %42, i64 3
  store i8 %40, ptr %43, align 1, !tbaa !11
  %44 = load i64, ptr %7, align 8, !tbaa !9
  %45 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %44
  %46 = getelementptr inbounds i8, ptr %45, i64 3
  %47 = load i8, ptr %46, align 1, !tbaa !11
  store i8 %47, ptr %8, align 1, !tbaa !11
  %48 = load i64, ptr %7, align 8, !tbaa !9
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %48
  %50 = getelementptr inbounds i8, ptr %49, i64 2
  %51 = load i8, ptr %50, align 1, !tbaa !11
  %52 = load i64, ptr %7, align 8, !tbaa !9
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %52
  %54 = getelementptr inbounds i8, ptr %53, i64 3
  store i8 %51, ptr %54, align 1, !tbaa !11
  %55 = load i8, ptr %8, align 1, !tbaa !11
  %56 = load i64, ptr %7, align 8, !tbaa !9
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %56
  %58 = getelementptr inbounds i8, ptr %57, i64 2
  store i8 %55, ptr %58, align 1, !tbaa !11
  %59 = load i64, ptr %6, align 8, !tbaa !9
  %60 = add i64 %59, 1
  store i64 %60, ptr %6, align 8, !tbaa !9
  br label %22, !llvm.loop !12

61:                                               ; preds = %22
  %62 = load i64, ptr %7, align 8, !tbaa !9
  %63 = add i64 %62, 2
  store i64 %63, ptr %7, align 8, !tbaa !9
  br label %15, !llvm.loop !14

64:                                               ; preds = %15
  %65 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = add i64 %66, 709125895
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds i64, ptr %68, i64 0
  store i64 %67, ptr %69, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, 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 = !{!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: 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
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %8 = add i64 %7, 1
  %xtraiter = and i64 %8, 7
  %9 = icmp ult i64 %7, 7
  %unroll_iter = and i64 %8, -8
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.epilog-lcssa
  %.01722 = phi i64 [ %20, %.epilog-lcssa ], [ 0, %.preheader.preheader ]
  %10 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.01722
  %11 = getelementptr inbounds i8, ptr %10, i64 5
  %12 = getelementptr inbounds i8, ptr %10, i64 3
  %13 = getelementptr inbounds i8, ptr %10, i64 2
  %.promoted = load i8, ptr %11, align 1, !tbaa !9
  %.promoted18 = load i8, ptr %12, align 1, !tbaa !9
  %.promoted20 = load i8, ptr %13, align 2, !tbaa !9
  br i1 %9, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %14 = phi i8 [ %15, %.preheader.new ], [ %.promoted20, %.preheader ]
  %15 = phi i8 [ %16, %.preheader.new ], [ %.promoted18, %.preheader ]
  %16 = phi i8 [ %14, %.preheader.new ], [ %.promoted, %.preheader ]
  %niter = phi i64 [ %niter.next.7, %.preheader.new ], [ 0, %.preheader ]
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.unr-lcssa, label %.preheader.new, !llvm.loop !10

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.lcssa30.ph = phi i8 [ poison, %.preheader ], [ %16, %.preheader.new ]
  %.lcssa29.ph = phi i8 [ poison, %.preheader ], [ %14, %.preheader.new ]
  %.lcssa.ph = phi i8 [ poison, %.preheader ], [ %15, %.preheader.new ]
  %.unr = phi i8 [ %.promoted20, %.preheader ], [ %15, %.preheader.new ]
  %.unr31 = phi i8 [ %.promoted18, %.preheader ], [ %16, %.preheader.new ]
  %.unr32 = phi i8 [ %.promoted, %.preheader ], [ %14, %.preheader.new ]
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %17 = phi i8 [ %19, %.epil.preheader ], [ %.unr, %.unr-lcssa ]
  %18 = phi i8 [ %17, %.epil.preheader ], [ %.unr31, %.unr-lcssa ]
  %19 = phi i8 [ %18, %.epil.preheader ], [ %.unr32, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.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 %.epilog-lcssa, label %.epil.preheader, !llvm.loop !12

.epilog-lcssa:                                    ; preds = %.epil.preheader, %.unr-lcssa
  %.lcssa30 = phi i8 [ %.lcssa30.ph, %.unr-lcssa ], [ %17, %.epil.preheader ]
  %.lcssa29 = phi i8 [ %.lcssa29.ph, %.unr-lcssa ], [ %18, %.epil.preheader ]
  %.lcssa = phi i8 [ %.lcssa.ph, %.unr-lcssa ], [ %19, %.epil.preheader ]
  store i8 %.lcssa, ptr %11, align 1, !tbaa !9
  store i8 %.lcssa29, ptr %12, align 1, !tbaa !9
  store i8 %.lcssa30, ptr %13, align 2, !tbaa !9
  %20 = add nuw i64 %.01722, 2
  %21 = icmp ult i64 %20, %7
  br i1 %21, label %.preheader, label %._crit_edge.loopexit, !llvm.loop !14

._crit_edge.loopexit:                             ; preds = %.epilog-lcssa
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %22 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %5, %2 ]
  %23 = add i64 %22, 709125895
  store i64 %23, 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !11}


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