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

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

23:                                               ; preds = %17
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 0
  %28 = load i8, ptr %27, align 1, !tbaa !11
  store i8 %28, ptr %7, align 1, !tbaa !11
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %30
  %32 = getelementptr inbounds i8, ptr %31, i64 3
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %35
  %37 = getelementptr inbounds i8, ptr %36, i64 0
  store i8 %33, ptr %37, align 1, !tbaa !11
  %38 = load i8, ptr %7, align 1, !tbaa !11
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %40
  %42 = getelementptr inbounds i8, ptr %41, i64 3
  store i8 %38, ptr %42, align 1, !tbaa !11
  %43 = load i32, ptr %6, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %44
  %46 = getelementptr inbounds i16, ptr %45, i64 1
  %47 = load i16, ptr %46, align 2, !tbaa !12
  store i16 %47, ptr %8, align 2, !tbaa !12
  %48 = load i32, ptr %6, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %49
  %51 = getelementptr inbounds i16, ptr %50, i64 0
  %52 = load i16, ptr %51, align 2, !tbaa !12
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %54
  %56 = getelementptr inbounds i16, ptr %55, i64 1
  store i16 %52, ptr %56, align 2, !tbaa !12
  %57 = load i16, ptr %8, align 2, !tbaa !12
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %59
  %61 = getelementptr inbounds i16, ptr %60, i64 0
  store i16 %57, ptr %61, align 2, !tbaa !12
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = add i64 %63, 2
  %65 = trunc i64 %64 to i32
  store i32 %65, ptr %6, align 4, !tbaa !9
  br label %17, !llvm.loop !14

66:                                               ; preds = %17
  %67 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = add i64 %69, 499253623
  %71 = add i64 %70, 1100076386
  %72 = trunc i64 %71 to i32
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds i32, ptr %73, i64 0
  store i32 %72, ptr %74, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #2
  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 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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: 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
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %8 = trunc i32 %5 to i8
  %9 = zext i32 %7 to i64
  %10 = add nsw i64 %9, -1
  %11 = icmp ult i32 %7, 3
  br i1 %11, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

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

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.unr = phi i8 [ %8, %.lr.ph.preheader ], [ %28, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %29 = and i64 %10, 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 = getelementptr inbounds [1 x i32], ptr %3, i64 0, i64 %indvars.iv.unr
  %31 = getelementptr inbounds i8, ptr %30, i64 3
  %32 = load i8, ptr %31, align 1, !tbaa !9
  store i8 %32, ptr %3, align 4, !tbaa !9
  store i8 %.unr, ptr %31, align 1, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %30, i64 2
  %34 = load i16, ptr %33, align 2, !tbaa !10
  %35 = load i16, ptr %3, align 4, !tbaa !10
  store i16 %35, ptr %33, align 2, !tbaa !10
  store i16 %34, ptr %3, align 4, !tbaa !10
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge

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


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