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

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

22:                                               ; preds = %16
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %29, %22
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds i64, ptr %25, i64 1
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = icmp ult i64 %24, %27
  br i1 %28, label %29, label %77

29:                                               ; preds = %23
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %30
  %32 = getelementptr inbounds i32, ptr %31, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !11
  store i32 %33, ptr %8, align 4, !tbaa !11
  %34 = load i64, ptr %6, align 8, !tbaa !9
  %35 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %34
  %36 = getelementptr inbounds i32, ptr %35, i64 0
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %38
  %40 = getelementptr inbounds i32, ptr %39, i64 1
  store i32 %37, ptr %40, align 4, !tbaa !11
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %42
  %44 = getelementptr inbounds i32, ptr %43, i64 0
  store i32 %41, ptr %44, align 4, !tbaa !11
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %45
  %47 = getelementptr inbounds i8, ptr %46, i64 6
  %48 = load i8, ptr %47, align 1, !tbaa !13
  store i8 %48, ptr %9, align 1, !tbaa !13
  %49 = load i64, ptr %6, align 8, !tbaa !9
  %50 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %49
  %51 = getelementptr inbounds i8, ptr %50, i64 3
  %52 = load i8, ptr %51, align 1, !tbaa !13
  %53 = load i64, ptr %6, align 8, !tbaa !9
  %54 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %53
  %55 = getelementptr inbounds i8, ptr %54, i64 6
  store i8 %52, ptr %55, align 1, !tbaa !13
  %56 = load i8, ptr %9, align 1, !tbaa !13
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %57
  %59 = getelementptr inbounds i8, ptr %58, i64 3
  store i8 %56, ptr %59, align 1, !tbaa !13
  %60 = load i64, ptr %6, align 8, !tbaa !9
  %61 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %60
  %62 = getelementptr inbounds i8, ptr %61, i64 2
  %63 = load i8, ptr %62, align 1, !tbaa !13
  store i8 %63, ptr %9, align 1, !tbaa !13
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %64
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  %67 = load i8, ptr %66, align 1, !tbaa !13
  %68 = load i64, ptr %6, align 8, !tbaa !9
  %69 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %68
  %70 = getelementptr inbounds i8, ptr %69, i64 2
  store i8 %67, ptr %70, align 1, !tbaa !13
  %71 = load i8, ptr %9, align 1, !tbaa !13
  %72 = load i64, ptr %6, align 8, !tbaa !9
  %73 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %72
  %74 = getelementptr inbounds i8, ptr %73, i64 4
  store i8 %71, ptr %74, align 1, !tbaa !13
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = add i64 %75, 1
  store i64 %76, ptr %6, align 8, !tbaa !9
  br label %23, !llvm.loop !14

77:                                               ; preds = %23
  %78 = load i64, ptr %7, align 8, !tbaa !9
  %79 = add i64 %78, 2
  store i64 %79, ptr %7, align 8, !tbaa !9
  br label %16, !llvm.loop !16

80:                                               ; preds = %16
  %81 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %82 = load i64, ptr %81, align 8, !tbaa !9
  %83 = add i64 %82, 736209367
  %84 = sub i64 %83, 2136477086
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds i64, ptr %85, i64 0
  store i64 %84, ptr %86, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 4, 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.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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; 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, 326104726
  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 %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i64 %7, 1
  %unroll_iter = and i64 %7, -2
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %47
  %.02224 = phi i64 [ %48, %47 ], [ 0, %.preheader.preheader ]
  br i1 %8, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %.023 = phi i64 [ %34, %.preheader.new ], [ 0, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %.preheader.new ], [ 0, %.preheader ]
  %9 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.023
  %10 = getelementptr inbounds i8, ptr %9, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = load i32, ptr %3, align 8, !tbaa !9
  store i32 %12, ptr %10, align 4, !tbaa !9
  store i32 %11, ptr %3, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %9, i64 6
  %14 = lshr i32 %12, 16
  %15 = trunc i32 %14 to i8
  %16 = getelementptr inbounds i8, ptr %9, i64 3
  %17 = load i8, ptr %16, align 1, !tbaa !11
  store i8 %17, ptr %13, align 2, !tbaa !11
  store i8 %15, ptr %16, align 1, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %9, i64 2
  %19 = load i8, ptr %18, align 2, !tbaa !11
  %20 = trunc i32 %12 to i8
  store i8 %20, ptr %18, align 2, !tbaa !11
  store i8 %19, ptr %10, align 4, !tbaa !11
  %21 = or disjoint i64 %.023, 1
  %22 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %21
  %23 = getelementptr inbounds i8, ptr %22, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = load i32, ptr %3, align 8, !tbaa !9
  store i32 %25, ptr %23, align 4, !tbaa !9
  store i32 %24, ptr %3, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %22, i64 6
  %27 = lshr i32 %25, 16
  %28 = trunc i32 %27 to i8
  %29 = getelementptr inbounds i8, ptr %22, i64 3
  %30 = load i8, ptr %29, align 1, !tbaa !11
  store i8 %30, ptr %26, align 2, !tbaa !11
  store i8 %28, ptr %29, align 1, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %22, i64 2
  %32 = load i8, ptr %31, align 2, !tbaa !11
  %33 = trunc i32 %25 to i8
  store i8 %33, ptr %31, align 2, !tbaa !11
  store i8 %32, ptr %23, align 4, !tbaa !11
  %34 = add nuw i64 %.023, 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 %.unr-lcssa, label %.preheader.new, !llvm.loop !12

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.023.unr = phi i64 [ 0, %.preheader ], [ %34, %.preheader.new ]
  br i1 %lcmp.mod.not, label %47, label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %35 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.023.unr
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = load i32, ptr %3, align 8, !tbaa !9
  store i32 %38, ptr %36, align 4, !tbaa !9
  store i32 %37, ptr %3, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %35, i64 6
  %40 = lshr i32 %38, 16
  %41 = trunc i32 %40 to i8
  %42 = getelementptr inbounds i8, ptr %35, i64 3
  %43 = load i8, ptr %42, align 1, !tbaa !11
  store i8 %43, ptr %39, align 2, !tbaa !11
  store i8 %41, ptr %42, align 1, !tbaa !11
  %44 = getelementptr inbounds i8, ptr %35, i64 2
  %45 = load i8, ptr %44, align 2, !tbaa !11
  %46 = trunc i32 %38 to i8
  store i8 %46, ptr %44, align 2, !tbaa !11
  store i8 %45, ptr %36, align 4, !tbaa !11
  br label %47

47:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %48 = add nuw i64 %.02224, 2
  %49 = icmp ult i64 %48, %7
  br i1 %49, label %.preheader, label %._crit_edge.loopexit, !llvm.loop !14

._crit_edge.loopexit:                             ; preds = %47
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %50 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %5, %2 ]
  %51 = add i64 %50, -1400267719
  store i64 %51, 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 = !{!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}


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