; 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 = 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 = %50, %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 %53

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 ult i64 %22, %23
  br i1 %24, label %25, label %41

25:                                               ; preds = %20
  %26 = load i64, ptr %6, align 8, !tbaa !9
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %26
  %28 = getelementptr inbounds i32, ptr %27, i64 1
  %29 = load i32, ptr %28, align 4, !tbaa !11
  store i32 %29, ptr %7, align 4, !tbaa !11
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %30
  %32 = getelementptr inbounds i32, ptr %31, i64 0
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = load i64, ptr %6, align 8, !tbaa !9
  %35 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %34
  %36 = getelementptr inbounds i32, ptr %35, i64 1
  store i32 %33, ptr %36, align 4, !tbaa !11
  %37 = load i32, ptr %7, align 4, !tbaa !11
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %38
  %40 = getelementptr inbounds i32, ptr %39, i64 0
  store i32 %37, ptr %40, align 4, !tbaa !11
  br label %50

41:                                               ; preds = %20
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = mul i64 %44, %47
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %48, ptr %49, align 8, !tbaa !9
  br label %50

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

53:                                               ; preds = %14
  %54 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = add i64 %55, 1626444070
  %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 = 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 4
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %8 = add i64 %7, -1
  %9 = icmp ult i64 %7, 3
  br i1 %9, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %10 = lshr i64 %8, 1
  %11 = add nuw i64 %10, 1
  %unroll_iter = and i64 %11, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %27, %.lr.ph.preheader.new
  %.012 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %28, %27 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %27 ]
  %12 = load i64, ptr %3, align 8
  %13 = icmp ult i64 %12, %.012
  br i1 %13, label %14, label %17

14:                                               ; preds = %.lr.ph
  %15 = trunc i64 %12 to i32
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.012
  %16 = load i32, ptr %gep, align 4, !tbaa !9
  store i32 %15, ptr %gep, align 4, !tbaa !9
  store i32 %16, ptr %3, align 8, !tbaa !9
  br label %.lr.ph.1

17:                                               ; preds = %.lr.ph
  %18 = mul i64 %12, %12
  store i64 %18, ptr %3, align 8, !tbaa !5
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %17, %14
  %19 = or disjoint i64 %.012, 2
  %20 = load i64, ptr %3, align 8
  %21 = icmp ult i64 %20, %19
  br i1 %21, label %24, label %22

22:                                               ; preds = %.lr.ph.1
  %23 = mul i64 %20, %20
  store i64 %23, ptr %3, align 8, !tbaa !5
  br label %27

24:                                               ; preds = %.lr.ph.1
  %25 = trunc i64 %20 to i32
  %gep.1 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %19
  %26 = load i32, ptr %gep.1, align 4, !tbaa !9
  store i32 %25, ptr %gep.1, align 4, !tbaa !9
  store i32 %26, ptr %3, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %24, %22
  %28 = add nuw i64 %.012, 4
  %niter.next.1 = add nuw i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %27, %.lr.ph.preheader
  %.012.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %28, %27 ]
  %29 = and i64 %8, 2
  %lcmp.mod.not.not = icmp eq i64 %29, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph.epil, label %._crit_edge.loopexit

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %30 = load i64, ptr %3, align 8
  %31 = icmp ult i64 %30, %.012.unr
  br i1 %31, label %34, label %32

32:                                               ; preds = %.lr.ph.epil
  %33 = mul i64 %30, %30
  store i64 %33, ptr %3, align 8, !tbaa !5
  br label %._crit_edge.loopexit

34:                                               ; preds = %.lr.ph.epil
  %35 = trunc i64 %30 to i32
  %gep.epil = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.012.unr
  %36 = load i32, ptr %gep.epil, align 4, !tbaa !9
  store i32 %35, ptr %gep.epil, align 4, !tbaa !9
  store i32 %36, ptr %3, align 8, !tbaa !9
  br label %._crit_edge.loopexit

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %37 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %5, %2 ]
  %38 = add i64 %37, 1626444070
  store i64 %38, 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.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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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