; 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 = or i64 %11, 51238316
  %13 = lshr i64 %12, 3
  %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 4
  %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 7
  %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 4
  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 7
  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 7
  %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 0
  %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 7
  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 0
  store i8 %55, ptr %58, align 1, !tbaa !11
  %59 = load i64, ptr %6, align 8, !tbaa !9
  %60 = add i64 %59, 2
  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 = xor i64 %66, 454761159
  %68 = or i64 %67, 596350280
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds i64, ptr %69, i64 0
  store i64 %68, ptr %70, 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 = lshr i64 %4, 3
  %6 = or i64 %5, 6404789
  store i64 %6, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %9 = trunc i64 %6 to i8
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %10 = add i64 %8, 1
  %11 = lshr i64 %10, 1
  %12 = add nuw i64 %11, 1
  %xtraiter = and i64 %12, 7
  %13 = icmp ult i64 %10, 14
  %unroll_iter = and i64 %12, -8
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.epilog-lcssa
  %.01725 = phi i64 [ %23, %.epilog-lcssa ], [ 0, %.preheader.preheader ]
  %.lcssa212324 = phi i8 [ %.lcssa33, %.epilog-lcssa ], [ %9, %.preheader.preheader ]
  %14 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.01725
  %15 = getelementptr inbounds i8, ptr %14, i64 4
  %16 = getelementptr inbounds i8, ptr %14, i64 7
  %.promoted = load i8, ptr %15, align 4, !tbaa !9
  %.promoted18 = load i8, ptr %16, align 1, !tbaa !9
  br i1 %13, label %.unr-lcssa, label %.preheader.new

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

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.lcssa33.ph = phi i8 [ poison, %.preheader ], [ %19, %.preheader.new ]
  %.lcssa32.ph = phi i8 [ poison, %.preheader ], [ %17, %.preheader.new ]
  %.lcssa.ph = phi i8 [ poison, %.preheader ], [ %18, %.preheader.new ]
  %.unr = phi i8 [ %.lcssa212324, %.preheader ], [ %18, %.preheader.new ]
  %.unr34 = phi i8 [ %.promoted18, %.preheader ], [ %19, %.preheader.new ]
  %.unr35 = phi i8 [ %.promoted, %.preheader ], [ %17, %.preheader.new ]
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %20 = phi i8 [ %22, %.epil.preheader ], [ %.unr, %.unr-lcssa ]
  %21 = phi i8 [ %20, %.epil.preheader ], [ %.unr34, %.unr-lcssa ]
  %22 = phi i8 [ %21, %.epil.preheader ], [ %.unr35, %.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
  %.lcssa33 = phi i8 [ %.lcssa33.ph, %.unr-lcssa ], [ %20, %.epil.preheader ]
  %.lcssa32 = phi i8 [ %.lcssa32.ph, %.unr-lcssa ], [ %21, %.epil.preheader ]
  %.lcssa = phi i8 [ %.lcssa.ph, %.unr-lcssa ], [ %22, %.epil.preheader ]
  store i8 %.lcssa, ptr %15, align 4, !tbaa !9
  store i8 %.lcssa32, ptr %16, align 1, !tbaa !9
  %23 = add nuw i64 %.01725, 2
  %24 = icmp ult i64 %23, %8
  br i1 %24, label %.preheader, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.epilog-lcssa, %2
  %.lcssa2123.lcssa = phi i8 [ %9, %2 ], [ %.lcssa33, %.epilog-lcssa ]
  store i8 %.lcssa2123.lcssa, ptr %3, align 8, !tbaa !9
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = and i64 %25, -596350281
  %27 = xor i64 %26, 1000054735
  store i64 %27, 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: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass