; 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 = add i64 %10, 1373777115
  %12 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %11, ptr %12, align 8, !tbaa !9
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %13

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

19:                                               ; preds = %13
  %20 = load i64, ptr %6, align 8, !tbaa !9
  %21 = add i64 %20, 1
  store i64 %21, ptr %6, align 8, !tbaa !9
  br label %13, !llvm.loop !11

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

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

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

67:                                               ; preds = %23
  %68 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = xor i64 %69, 95286627
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds i64, ptr %71, i64 0
  store i64 %70, ptr %72, 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}


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

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

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

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.in = phi i64 [ %4, %.lr.ph.preheader.new ], [ %28, %.lr.ph ]
  %.117 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %29, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %8 = trunc i64 %.in to i8
  %9 = getelementptr inbounds [1 x i64], ptr %2, i64 0, i64 %.117
  %10 = getelementptr inbounds i8, ptr %9, i64 6
  %11 = load i8, ptr %10, align 2, !tbaa !9
  store i8 %11, ptr %2, align 8, !tbaa !9
  store i8 %8, ptr %10, align 2, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %9, i64 1
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %9, i64 7
  %15 = load i8, ptr %14, align 1, !tbaa !9
  store i8 %15, ptr %12, align 1, !tbaa !9
  store i8 %13, ptr %14, align 1, !tbaa !9
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = mul i64 %16, %16
  store i64 %17, ptr %2, align 8, !tbaa !5
  %18 = or disjoint i64 %.117, 1
  %19 = trunc i64 %17 to i8
  %20 = getelementptr inbounds [1 x i64], ptr %2, i64 0, i64 %18
  %21 = getelementptr inbounds i8, ptr %20, i64 6
  %22 = load i8, ptr %21, align 2, !tbaa !9
  store i8 %22, ptr %2, align 8, !tbaa !9
  store i8 %19, ptr %21, align 2, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %20, i64 1
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %20, i64 7
  %26 = load i8, ptr %25, align 1, !tbaa !9
  store i8 %26, ptr %23, align 1, !tbaa !9
  store i8 %24, ptr %25, align 1, !tbaa !9
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %28 = mul i64 %27, %27
  store i64 %28, ptr %2, align 8, !tbaa !5
  %29 = add nuw i64 %.117, 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 !10

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph.preheader ], [ %28, %.lr.ph ]
  %.in.unr = phi i64 [ %4, %.lr.ph.preheader ], [ %28, %.lr.ph ]
  %.117.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %29, %.lr.ph ]
  %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
  %30 = trunc i64 %.in.unr to i8
  %31 = getelementptr inbounds [1 x i64], ptr %2, i64 0, i64 %.117.unr
  %32 = getelementptr inbounds i8, ptr %31, i64 6
  %33 = load i8, ptr %32, align 2, !tbaa !9
  store i8 %33, ptr %2, align 8, !tbaa !9
  store i8 %30, ptr %32, align 2, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %31, i64 1
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %31, i64 7
  %37 = load i8, ptr %36, align 1, !tbaa !9
  store i8 %37, ptr %34, align 1, !tbaa !9
  store i8 %35, ptr %36, align 1, !tbaa !9
  %38 = load i64, ptr %2, align 8, !tbaa !5
  %39 = mul i64 %38, %38
  store i64 %39, ptr %2, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %.preheader
  %40 = phi i64 [ %4, %.preheader ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %39, %.lr.ph.epil ]
  %41 = xor i64 %40, 95286627
  store i64 %41, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #2
  ret void
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress 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 = !{!"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"}


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