; 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 i16, align 2
  %9 = 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 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 2, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 2, 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, -10089659
  %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 %7, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %66, %2
  %16 = load i64, ptr %7, 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
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %22

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

28:                                               ; preds = %22
  %29 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = load i64, ptr %7, align 8, !tbaa !9
  %33 = add i64 %31, %32
  %34 = icmp ugt i64 %30, %33
  br i1 %34, label %35, label %51

35:                                               ; preds = %28
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %36
  %38 = getelementptr inbounds i16, ptr %37, i64 2
  %39 = load i16, ptr %38, align 2, !tbaa !11
  store i16 %39, ptr %8, align 2, !tbaa !11
  %40 = load i64, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %40
  %42 = getelementptr inbounds i16, ptr %41, i64 3
  %43 = load i16, ptr %42, align 2, !tbaa !11
  %44 = load i64, ptr %6, align 8, !tbaa !9
  %45 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %44
  %46 = getelementptr inbounds i16, ptr %45, i64 2
  store i16 %43, ptr %46, align 2, !tbaa !11
  %47 = load i16, ptr %8, align 2, !tbaa !11
  %48 = load i64, ptr %6, align 8, !tbaa !9
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %48
  %50 = getelementptr inbounds i16, ptr %49, i64 3
  store i16 %47, ptr %50, align 2, !tbaa !11
  br label %63

51:                                               ; preds = %28
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %53 = getelementptr inbounds i16, ptr %52, i64 1
  %54 = load i16, ptr %53, align 2, !tbaa !11
  store i16 %54, ptr %9, align 2, !tbaa !11
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %56 = getelementptr inbounds i16, ptr %55, i64 2
  %57 = load i16, ptr %56, align 2, !tbaa !11
  %58 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %59 = getelementptr inbounds i16, ptr %58, i64 1
  store i16 %57, ptr %59, align 2, !tbaa !11
  %60 = load i16, ptr %9, align 2, !tbaa !11
  %61 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %62 = getelementptr inbounds i16, ptr %61, i64 2
  store i16 %60, ptr %62, align 2, !tbaa !11
  br label %63

63:                                               ; preds = %51, %35
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = add i64 %64, 2
  store i64 %65, ptr %6, align 8, !tbaa !9
  br label %22, !llvm.loop !13

66:                                               ; preds = %22
  %67 = load i64, ptr %7, align 8, !tbaa !9
  %68 = add i64 %67, 2
  store i64 %68, ptr %7, align 8, !tbaa !9
  br label %15, !llvm.loop !15

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 = mul i64 %71, 45871808
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds i64, ptr %73, i64 0
  store i64 %72, ptr %74, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 2, 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 = !{!"short", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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, -10089659
  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.lr.ph

.preheader.lr.ph:                                 ; preds = %2
  %8 = getelementptr inbounds i8, ptr %3, i64 2
  %9 = getelementptr inbounds i8, ptr %3, i64 4
  %invariant.gep = getelementptr i8, ptr %3, i64 4
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %25
  %.01517 = phi i64 [ 0, %.preheader.lr.ph ], [ %26, %25 ]
  br label %10

10:                                               ; preds = %.preheader, %22
  %.016 = phi i64 [ 0, %.preheader ], [ %23, %22 ]
  %11 = load i64, ptr %3, align 8
  %12 = add i64 %.016, %.01517
  %13 = icmp ugt i64 %11, %12
  br i1 %13, label %14, label %17

14:                                               ; preds = %10
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.016
  %15 = load <2 x i16>, ptr %gep, align 4, !tbaa !9
  %16 = shufflevector <2 x i16> %15, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i16> %16, ptr %gep, align 4, !tbaa !9
  br label %22

17:                                               ; preds = %10
  %18 = lshr i64 %11, 32
  %19 = trunc i64 %18 to i16
  %20 = lshr i64 %11, 16
  %21 = trunc i64 %20 to i16
  store i16 %19, ptr %8, align 2, !tbaa !9
  store i16 %21, ptr %9, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %17, %14
  %23 = add nuw i64 %.016, 2
  %24 = icmp ult i64 %23, %7
  br i1 %24, label %10, label %25, !llvm.loop !11

25:                                               ; preds = %22
  %26 = add nuw i64 %.01517, 2
  %27 = icmp ult i64 %26, %7
  br i1 %27, label %.preheader, label %._crit_edge.loopexit, !llvm.loop !13

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass