; 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 i32], align 4
  %6 = alloca i32, align 4
  %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 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, 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 i32, ptr %8, i64 0
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = zext i32 %10 to i64
  %12 = add i64 %11, 51238316
  %13 = add i64 %12, 274866410
  %14 = trunc i64 %13 to i32
  %15 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %14, ptr %15, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %22, %2
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds i32, ptr %18, i64 1
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = icmp ult i32 %17, %20
  br i1 %21, label %22, label %46

22:                                               ; preds = %16
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %24
  %26 = getelementptr inbounds i8, ptr %25, i64 0
  %27 = load i8, ptr %26, align 1, !tbaa !11
  store i8 %27, ptr %7, align 1, !tbaa !11
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %29
  %31 = getelementptr inbounds i8, ptr %30, i64 3
  %32 = load i8, ptr %31, align 1, !tbaa !11
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %34
  %36 = getelementptr inbounds i8, ptr %35, i64 0
  store i8 %32, ptr %36, align 1, !tbaa !11
  %37 = load i8, ptr %7, align 1, !tbaa !11
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %39
  %41 = getelementptr inbounds i8, ptr %40, i64 3
  store i8 %37, ptr %41, align 1, !tbaa !11
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = zext i32 %42 to i64
  %44 = add i64 %43, 2
  %45 = trunc i64 %44 to i32
  store i32 %45, ptr %6, align 4, !tbaa !9
  br label %16, !llvm.loop !12

46:                                               ; preds = %16
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %53, %46
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds i32, ptr %49, i64 1
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = icmp ult i32 %48, %51
  br i1 %52, label %53, label %64

53:                                               ; preds = %47
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = add i32 %57, %59
  %61 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %60, ptr %61, align 4, !tbaa !9
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = add i32 %62, 1
  store i32 %63, ptr %6, align 4, !tbaa !9
  br label %47, !llvm.loop !14

64:                                               ; preds = %47
  %65 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 724560680
  %69 = trunc i64 %68 to i32
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds i32, ptr %70, i64 0
  store i32 %69, ptr %71, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !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 i32], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #2
  %4 = load i32, ptr %0, align 4, !tbaa !5
  %5 = add i32 %4, 326104726
  store i32 %5, ptr %3, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %invariant.gep = getelementptr inbounds i8, ptr %3, i64 3
  %8 = trunc i32 %5 to i8
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %.preheader.thread, label %.lr.ph.preheader

.preheader.thread:                                ; preds = %2
  store i8 %8, ptr %3, align 4, !tbaa !9
  %.promoted1624 = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge

.lr.ph.preheader:                                 ; preds = %2
  %9 = zext i32 %7 to i64
  %10 = add nsw i64 %9, -1
  %11 = lshr i64 %10, 1
  %12 = add nuw i64 %11, 1
  %xtraiter = and i64 %12, 3
  %13 = icmp ult i32 %7, 7
  br i1 %13, label %.preheader.unr-lcssa, label %.lr.ph.preheader.new

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

.preheader.unr-lcssa:                             ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa27.ph = phi i8 [ poison, %.lr.ph.preheader ], [ %21, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %.unr = phi i8 [ %8, %.lr.ph.preheader ], [ %21, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %.preheader.unr-lcssa ]
  %14 = phi i8 [ %15, %.lr.ph.epil ], [ %.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader.unr-lcssa ]
  %gep.epil = getelementptr inbounds [1 x i32], ptr %invariant.gep, i64 0, i64 %indvars.iv.epil
  %15 = load i8, ptr %gep.epil, align 1, !tbaa !9
  store i8 %14, ptr %gep.epil, align 1, !tbaa !9
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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 %.preheader, label %.lr.ph.epil, !llvm.loop !10

.preheader:                                       ; preds = %.lr.ph.epil, %.preheader.unr-lcssa
  %.lcssa27 = phi i8 [ %.lcssa27.ph, %.preheader.unr-lcssa ], [ %15, %.lr.ph.epil ]
  store i8 %.lcssa27, ptr %3, align 4, !tbaa !9
  %.promoted16 = load i32, ptr %3, align 4, !tbaa !5
  br i1 %.not, label %._crit_edge, label %.lr.ph19.preheader

.lr.ph19.preheader:                               ; preds = %.preheader
  %xtraiter29 = and i32 %7, 7
  %16 = icmp ult i32 %7, 8
  br i1 %16, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph19.preheader.new

.lr.ph19.preheader.new:                           ; preds = %.lr.ph19.preheader
  %unroll_iter34 = and i32 %7, -8
  br label %.lr.ph19

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %17 = phi i8 [ %8, %.lr.ph.preheader.new ], [ %21, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %gep = getelementptr inbounds [1 x i32], ptr %invariant.gep, i64 0, i64 %indvars.iv
  %18 = load i8, ptr %gep, align 1, !tbaa !9
  store i8 %17, ptr %gep, align 1, !tbaa !9
  %indvars.iv.next = or disjoint i64 %indvars.iv, 2
  %gep.1 = getelementptr inbounds [1 x i32], ptr %invariant.gep, i64 0, i64 %indvars.iv.next
  %19 = load i8, ptr %gep.1, align 1, !tbaa !9
  store i8 %18, ptr %gep.1, align 1, !tbaa !9
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 4
  %gep.2 = getelementptr inbounds [1 x i32], ptr %invariant.gep, i64 0, i64 %indvars.iv.next.1
  %20 = load i8, ptr %gep.2, align 1, !tbaa !9
  store i8 %19, ptr %gep.2, align 1, !tbaa !9
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 6
  %gep.3 = getelementptr inbounds [1 x i32], ptr %invariant.gep, i64 0, i64 %indvars.iv.next.2
  %21 = load i8, ptr %gep.3, align 1, !tbaa !9
  store i8 %20, ptr %gep.3, align 1, !tbaa !9
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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 %.preheader.unr-lcssa, label %.lr.ph, !llvm.loop !12

.lr.ph19:                                         ; preds = %.lr.ph19, %.lr.ph19.preheader.new
  %22 = phi i32 [ %.promoted16, %.lr.ph19.preheader.new ], [ %23, %.lr.ph19 ]
  %niter35 = phi i32 [ 0, %.lr.ph19.preheader.new ], [ %niter35.next.7, %.lr.ph19 ]
  %23 = shl i32 %22, 8
  %niter35.next.7 = add i32 %niter35, 8
  %niter35.ncmp.7 = icmp eq i32 %niter35.next.7, %unroll_iter34
  br i1 %niter35.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph19, !llvm.loop !14

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph19, %.lr.ph19.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph19.preheader ], [ %23, %.lr.ph19 ]
  %.unr31 = phi i32 [ %.promoted16, %.lr.ph19.preheader ], [ %23, %.lr.ph19 ]
  %lcmp.mod32.not = icmp eq i32 %xtraiter29, 0
  br i1 %lcmp.mod32.not, label %._crit_edge, label %.lr.ph19.epil

.lr.ph19.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph19.epil
  %24 = phi i32 [ %25, %.lr.ph19.epil ], [ %.unr31, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter30 = phi i32 [ %epil.iter30.next, %.lr.ph19.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %25 = shl i32 %24, 1
  %epil.iter30.next = add i32 %epil.iter30, 1
  %epil.iter30.cmp.not = icmp eq i32 %epil.iter30.next, %xtraiter29
  br i1 %epil.iter30.cmp.not, label %._crit_edge, label %.lr.ph19.epil, !llvm.loop !15

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph19.epil, %.preheader.thread, %.preheader
  %.lcssa17 = phi i32 [ %.promoted16, %.preheader ], [ %.promoted1624, %.preheader.thread ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %25, %.lr.ph19.epil ]
  %26 = add i32 %.lcssa17, 724560680
  store i32 %26, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !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.unroll.disable"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !11}


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