; 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 = xor i32 %11, 700325083
  %13 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %12, ptr %13, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %14

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

20:                                               ; preds = %14
  %21 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp ne i32 %22, %23
  br i1 %24, label %37, label %25

25:                                               ; preds = %20
  %26 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %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 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %30 = getelementptr inbounds i8, ptr %29, i64 1
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %33 = getelementptr inbounds i8, ptr %32, i64 0
  store i8 %31, ptr %33, align 1, !tbaa !11
  %34 = load i8, ptr %7, align 1, !tbaa !11
  %35 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %36 = getelementptr inbounds i8, ptr %35, i64 1
  store i8 %34, ptr %36, align 1, !tbaa !11
  br label %37

37:                                               ; preds = %25, %20
  %38 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = icmp ule i32 %39, %40
  br i1 %41, label %42, label %65

42:                                               ; preds = %37
  %43 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %44 = getelementptr inbounds i16, ptr %43, i64 0
  %45 = load i16, ptr %44, align 2, !tbaa !12
  store i16 %45, ptr %8, align 2, !tbaa !12
  %46 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %47 = getelementptr inbounds i16, ptr %46, i64 1
  %48 = load i16, ptr %47, align 2, !tbaa !12
  %49 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %50 = getelementptr inbounds i16, ptr %49, i64 0
  store i16 %48, ptr %50, align 2, !tbaa !12
  %51 = load i16, ptr %8, align 2, !tbaa !12
  %52 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %53 = getelementptr inbounds i16, ptr %52, i64 1
  store i16 %51, ptr %53, align 2, !tbaa !12
  %54 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %55 = getelementptr inbounds i16, ptr %54, i64 1
  %56 = load i16, ptr %55, align 2, !tbaa !12
  store i16 %56, ptr %8, align 2, !tbaa !12
  %57 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %58 = getelementptr inbounds i16, ptr %57, i64 0
  %59 = load i16, ptr %58, align 2, !tbaa !12
  %60 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %61 = getelementptr inbounds i16, ptr %60, i64 1
  store i16 %59, ptr %61, align 2, !tbaa !12
  %62 = load i16, ptr %8, align 2, !tbaa !12
  %63 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %64 = getelementptr inbounds i16, ptr %63, i64 0
  store i16 %62, ptr %64, align 2, !tbaa !12
  br label %65

65:                                               ; preds = %42, %37
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = zext i32 %66 to i64
  %68 = add i64 %67, 2
  %69 = trunc i64 %68 to i32
  store i32 %69, ptr %6, align 4, !tbaa !9
  br label %14, !llvm.loop !14

70:                                               ; preds = %14
  %71 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = xor i32 %72, 910028
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds i32, ptr %74, i64 0
  store i32 %73, ptr %75, 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: 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 = load i32, ptr %0, align 4, !tbaa !5
  %4 = xor i32 %3, 700325083
  %.sroa.0.sroa.0.0.extract.trunc34 = trunc i32 %4 to i8
  %.sroa.0.sroa.12.0.extract.shift5066 = lshr i32 %4, 8
  %.sroa.0.sroa.12.0.extract.trunc51 = trunc i32 %.sroa.0.sroa.12.0.extract.shift5066 to i8
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not73 = icmp eq i32 %6, 0
  %.pre = and i32 %4, -65536
  br i1 %.not73, label %._crit_edge, label %.lr.ph.preheader

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

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %9 = lshr i32 %7, 1
  %10 = add nuw i32 %9, 1
  %unroll_iter = and i32 %10, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.sroa.0.sroa.12.071 = phi i8 [ %.sroa.0.sroa.12.0.extract.trunc51, %.lr.ph.preheader.new ], [ %spec.select68.1, %.lr.ph ]
  %.sroa.0.sroa.0.070 = phi i8 [ %.sroa.0.sroa.0.0.extract.trunc34, %.lr.ph.preheader.new ], [ %spec.select.1, %.lr.ph ]
  %.069 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %12, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %.sroa.0.sroa.12.0.insert.ext52 = zext i8 %.sroa.0.sroa.12.071 to i32
  %.sroa.0.sroa.12.0.insert.shift53 = shl nuw nsw i32 %.sroa.0.sroa.12.0.insert.ext52, 8
  %.sroa.0.sroa.0.0.insert.ext35 = zext i8 %.sroa.0.sroa.0.070 to i32
  %.sroa.0.sroa.0.0.insert.insert37 = or disjoint i32 %.sroa.0.sroa.12.0.insert.shift53, %.sroa.0.sroa.0.0.insert.ext35
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.0.sroa.0.0.insert.insert37, %.pre
  %.not = icmp eq i32 %.sroa.0.0.insert.insert, %.069
  %spec.select = select i1 %.not, i8 %.sroa.0.sroa.12.071, i8 %.sroa.0.sroa.0.070
  %spec.select68 = select i1 %.not, i8 %.sroa.0.sroa.0.070, i8 %.sroa.0.sroa.12.071
  %11 = or disjoint i32 %.069, 2
  %.sroa.0.sroa.12.0.insert.ext52.1 = zext i8 %spec.select68 to i32
  %.sroa.0.sroa.12.0.insert.shift53.1 = shl nuw nsw i32 %.sroa.0.sroa.12.0.insert.ext52.1, 8
  %.sroa.0.sroa.0.0.insert.ext35.1 = zext i8 %spec.select to i32
  %.sroa.0.sroa.0.0.insert.insert37.1 = or disjoint i32 %.sroa.0.sroa.12.0.insert.shift53.1, %.sroa.0.sroa.0.0.insert.ext35.1
  %.sroa.0.0.insert.insert.1 = or disjoint i32 %.sroa.0.sroa.0.0.insert.insert37.1, %.pre
  %.not.1 = icmp eq i32 %.sroa.0.0.insert.insert.1, %11
  %spec.select.1 = select i1 %.not.1, i8 %spec.select68, i8 %spec.select
  %spec.select68.1 = select i1 %.not.1, i8 %spec.select, i8 %spec.select68
  %12 = add nuw i32 %.069, 4
  %niter.next.1 = add nuw i32 %niter, 2
  %niter.ncmp.1.not = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %spec.select.lcssa.ph = phi i8 [ poison, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %spec.select68.lcssa.ph = phi i8 [ poison, %.lr.ph.preheader ], [ %spec.select68.1, %.lr.ph ]
  %.sroa.0.sroa.12.071.unr = phi i8 [ %.sroa.0.sroa.12.0.extract.trunc51, %.lr.ph.preheader ], [ %spec.select68.1, %.lr.ph ]
  %.sroa.0.sroa.0.070.unr = phi i8 [ %.sroa.0.sroa.0.0.extract.trunc34, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %.069.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %12, %.lr.ph ]
  %13 = and i32 %7, 2
  %lcmp.mod.not.not = icmp eq i32 %13, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph.epil, label %._crit_edge

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %.sroa.0.sroa.12.0.insert.ext52.epil = zext i8 %.sroa.0.sroa.12.071.unr to i32
  %.sroa.0.sroa.12.0.insert.shift53.epil = shl nuw nsw i32 %.sroa.0.sroa.12.0.insert.ext52.epil, 8
  %.sroa.0.sroa.0.0.insert.ext35.epil = zext i8 %.sroa.0.sroa.0.070.unr to i32
  %.sroa.0.sroa.0.0.insert.insert37.epil = or disjoint i32 %.sroa.0.sroa.12.0.insert.shift53.epil, %.sroa.0.sroa.0.0.insert.ext35.epil
  %.sroa.0.0.insert.insert.epil = or disjoint i32 %.sroa.0.sroa.0.0.insert.insert37.epil, %.pre
  %.not.epil = icmp eq i32 %.sroa.0.0.insert.insert.epil, %.069.unr
  %spec.select.epil = select i1 %.not.epil, i8 %.sroa.0.sroa.12.071.unr, i8 %.sroa.0.sroa.0.070.unr
  %spec.select68.epil = select i1 %.not.epil, i8 %.sroa.0.sroa.0.070.unr, i8 %.sroa.0.sroa.12.071.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %2
  %.sroa.0.sroa.0.0.lcssa = phi i8 [ %.sroa.0.sroa.0.0.extract.trunc34, %2 ], [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph.epil ]
  %.sroa.0.sroa.12.0.lcssa = phi i8 [ %.sroa.0.sroa.12.0.extract.trunc51, %2 ], [ %spec.select68.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select68.epil, %.lr.ph.epil ]
  %.sroa.0.sroa.12.0.insert.ext60 = zext i8 %.sroa.0.sroa.12.0.lcssa to i32
  %.sroa.0.sroa.12.0.insert.shift61 = shl nuw nsw i32 %.sroa.0.sroa.12.0.insert.ext60, 8
  %.sroa.0.sroa.0.0.insert.ext41 = zext i8 %.sroa.0.sroa.0.0.lcssa to i32
  %.sroa.0.sroa.0.0.insert.insert43 = or disjoint i32 %.sroa.0.sroa.12.0.insert.shift61, %.sroa.0.sroa.0.0.insert.ext41
  %.sroa.0.0.insert.insert17 = or disjoint i32 %.sroa.0.sroa.0.0.insert.insert43, %.pre
  %14 = xor i32 %.sroa.0.0.insert.insert17, 910028
  store i32 %14, ptr %1, align 4, !tbaa !5
  ret void
}

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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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