; 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: nounwind uwtable
define dso_local void @RandomFunc(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [1 x i64], align 8
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %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 1, 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 = add i64 %11, 914778474
  %13 = sub i64 %12, 981234615
  %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 %6, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %66, %2
  %16 = load i64, ptr %6, 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 %69

21:                                               ; preds = %15
  %22 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp ult i64 %23, %24
  br i1 %25, label %26, label %50

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = icmp ne i64 %28, %29
  br i1 %30, label %31, label %37

31:                                               ; preds = %26
  %32 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = add i64 %35, %33
  store i64 %36, ptr %34, align 8, !tbaa !9
  br label %49

37:                                               ; preds = %26
  %38 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  %40 = load i8, ptr %39, align 1, !tbaa !11
  store i8 %40, ptr %7, align 1, !tbaa !11
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i8, ptr %41, i64 7
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  store i8 %43, ptr %45, align 1, !tbaa !11
  %46 = load i8, ptr %7, align 1, !tbaa !11
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i8, ptr %47, i64 7
  store i8 %46, ptr %48, align 1, !tbaa !11
  br label %49

49:                                               ; preds = %37, %31
  br label %66

50:                                               ; preds = %21
  %51 = load i64, ptr %6, align 8, !tbaa !9
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %51
  %53 = getelementptr inbounds i8, ptr %52, i64 1
  %54 = load i8, ptr %53, align 1, !tbaa !11
  store i8 %54, ptr %8, align 1, !tbaa !11
  %55 = load i64, ptr %6, align 8, !tbaa !9
  %56 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %55
  %57 = getelementptr inbounds i8, ptr %56, i64 6
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = load i64, ptr %6, align 8, !tbaa !9
  %60 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %59
  %61 = getelementptr inbounds i8, ptr %60, i64 1
  store i8 %58, ptr %61, align 1, !tbaa !11
  %62 = load i8, ptr %8, align 1, !tbaa !11
  %63 = load i64, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %63
  %65 = getelementptr inbounds i8, ptr %64, i64 6
  store i8 %62, ptr %65, align 1, !tbaa !11
  br label %66

66:                                               ; preds = %50, %49
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = add i64 %67, 1
  store i64 %68, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !12

69:                                               ; preds = %15
  %70 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = sub i64 %71, 1029146479
  %73 = add i64 %72, 838866500
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds i64, ptr %74, i64 0
  store i64 %73, ptr %75, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 1, 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.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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"}


; 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 = 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, -66456141
  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
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i64 %7, 1
  br i1 %8, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

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

.lr.ph:                                           ; preds = %29, %.lr.ph.preheader.new
  %.013 = phi i64 [ 0, %.lr.ph.preheader.new ], [ %30, %29 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %29 ]
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = icmp ult i64 %9, %.013
  br i1 %10, label %11, label %13

11:                                               ; preds = %.lr.ph
  %12 = shl i64 %9, 1
  store i64 %12, ptr %3, align 8, !tbaa !5
  br label %.lr.ph.1

13:                                               ; preds = %.lr.ph
  %14 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.013
  %15 = getelementptr inbounds i8, ptr %14, i64 1
  %16 = load i8, ptr %15, align 1, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %14, i64 6
  %18 = load i8, ptr %17, align 2, !tbaa !9
  store i8 %18, ptr %15, align 1, !tbaa !9
  store i8 %16, ptr %17, align 2, !tbaa !9
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %11, %13
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %.not14 = icmp ugt i64 %19, %.013
  br i1 %.not14, label %20, label %27

20:                                               ; preds = %.lr.ph.1
  %21 = or disjoint i64 %.013, 1
  %22 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %21
  %23 = getelementptr inbounds i8, ptr %22, i64 1
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %22, i64 6
  %26 = load i8, ptr %25, align 2, !tbaa !9
  store i8 %26, ptr %23, align 1, !tbaa !9
  store i8 %24, ptr %25, align 2, !tbaa !9
  br label %29

27:                                               ; preds = %.lr.ph.1
  %28 = shl i64 %19, 1
  store i64 %28, ptr %3, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %27, %20
  %30 = add nuw i64 %.013, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !10

._crit_edge.loopexit.unr-lcssa:                   ; preds = %29, %.lr.ph.preheader
  %.013.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %30, %29 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %31 = load i64, ptr %3, align 8, !tbaa !5
  %32 = icmp ult i64 %31, %.013.unr
  br i1 %32, label %39, label %33

33:                                               ; preds = %.lr.ph.epil
  %34 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.013.unr
  %35 = getelementptr inbounds i8, ptr %34, i64 1
  %36 = load i8, ptr %35, align 1, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %34, i64 6
  %38 = load i8, ptr %37, align 2, !tbaa !9
  store i8 %38, ptr %35, align 1, !tbaa !9
  store i8 %36, ptr %37, align 2, !tbaa !9
  br label %._crit_edge.loopexit

39:                                               ; preds = %.lr.ph.epil
  %40 = shl i64 %31, 1
  store i64 %40, ptr %3, align 8, !tbaa !5
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %33, %39, %._crit_edge.loopexit.unr-lcssa
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %41 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %5, %2 ]
  %42 = add i64 %41, -190279979
  store i64 %42, 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.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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"}


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