; 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 %62

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 = sub 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 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = load i64, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = add i64 %58, %55
  store i64 %59, ptr %57, align 8, !tbaa !9
  %60 = load i64, ptr %6, align 8, !tbaa !9
  %61 = add i64 %60, 1
  store i64 %61, ptr %6, align 8, !tbaa !9
  br label %39, !llvm.loop !15

62:                                               ; preds = %39
  %63 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = add i64 %64, 745879451
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds i64, ptr %66, i64 0
  store i64 %65, ptr %67, 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 %.loopexit.loopexit.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
  %.promoted1823 = load i64, ptr %3, align 8, !tbaa !5
  %13 = add i64 %.promoted1823, 745879451
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.016 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %22, %.lr.ph ]
  %14 = phi i16 [ %8, %.lr.ph.preheader.new ], [ %21, %.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 %.016
  %15 = load i16, ptr %gep, align 2, !tbaa !9
  store i16 %14, ptr %gep, align 2, !tbaa !9
  %16 = or disjoint i64 %.016, 2
  %gep.1 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %16
  %17 = load i16, ptr %gep.1, align 2, !tbaa !9
  store i16 %15, ptr %gep.1, align 2, !tbaa !9
  %18 = or disjoint i64 %.016, 4
  %gep.2 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %18
  %19 = load i16, ptr %gep.2, align 2, !tbaa !9
  store i16 %17, ptr %gep.2, align 2, !tbaa !9
  %20 = or disjoint i64 %.016, 6
  %gep.3 = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %20
  %21 = load i16, ptr %gep.3, align 2, !tbaa !9
  store i16 %19, ptr %gep.3, align 2, !tbaa !9
  %22 = add nuw i64 %.016, 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 %.loopexit.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

.loopexit.loopexit.unr-lcssa:                     ; preds = %.lr.ph, %.lr.ph.preheader
  %.016.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %22, %.lr.ph ]
  %.unr = phi i16 [ %8, %.lr.ph.preheader ], [ %21, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph.epil

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

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.lr.ph.epil, %.preheader.thread
  %.lcssa = phi i64 [ %13, %.preheader.thread ], [ 745879451, %.lr.ph.epil ], [ 745879451, %.loopexit.loopexit.unr-lcssa ]
  store i64 %.lcssa, 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.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}


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