; 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 i16, align 2
  %8 = alloca i32, align 4
  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 2, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 4, 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 = xor i64 %12, -832765941
  %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 = %68, %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 %71

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 ugt i64 %23, %24
  br i1 %25, label %26, label %53

26:                                               ; preds = %21
  %27 = load i64, ptr %6, align 8, !tbaa !9
  %28 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %27
  %29 = getelementptr inbounds i16, ptr %28, i64 0
  %30 = load i16, ptr %29, align 2, !tbaa !11
  store i16 %30, ptr %7, align 2, !tbaa !11
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %31
  %33 = getelementptr inbounds i16, ptr %32, i64 1
  %34 = load i16, ptr %33, align 2, !tbaa !11
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %35
  %37 = getelementptr inbounds i16, ptr %36, i64 0
  store i16 %34, ptr %37, align 2, !tbaa !11
  %38 = load i16, ptr %7, align 2, !tbaa !11
  %39 = load i64, ptr %6, align 8, !tbaa !9
  %40 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %39
  %41 = getelementptr inbounds i16, ptr %40, i64 1
  store i16 %38, ptr %41, align 2, !tbaa !11
  %42 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %43 = getelementptr inbounds i32, ptr %42, i64 1
  %44 = load i32, ptr %43, align 4, !tbaa !13
  store i32 %44, ptr %8, align 4, !tbaa !13
  %45 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %46 = getelementptr inbounds i32, ptr %45, i64 0
  %47 = load i32, ptr %46, align 4, !tbaa !13
  %48 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %49 = getelementptr inbounds i32, ptr %48, i64 1
  store i32 %47, ptr %49, align 4, !tbaa !13
  %50 = load i32, ptr %8, align 4, !tbaa !13
  %51 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds i32, ptr %51, i64 0
  store i32 %50, ptr %52, align 4, !tbaa !13
  br label %68

53:                                               ; preds = %21
  %54 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = and i64 %55, 31
  %57 = shl i64 %56, 4
  %58 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %59 = load i64, ptr %58, align 8, !tbaa !9
  %60 = or i64 %59, %57
  store i64 %60, ptr %58, align 8, !tbaa !9
  %61 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %64 = load i64, ptr %63, align 8, !tbaa !9
  %65 = mul i64 %62, %64
  %66 = load i64, ptr %6, align 8, !tbaa !9
  %67 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %66
  store i64 %65, ptr %67, align 8, !tbaa !9
  br label %68

68:                                               ; preds = %53, %26
  %69 = load i64, ptr %6, align 8, !tbaa !9
  %70 = add i64 %69, 1
  store i64 %70, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !15

71:                                               ; preds = %15
  %72 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %73 = load i64, ptr %72, align 8, !tbaa !9
  %74 = shl i64 %73, 13
  %75 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = lshr i64 %76, 51
  %78 = or i64 %74, %77
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds i64, ptr %79, i64 0
  store i64 %78, ptr %80, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 2, 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 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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) #3
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = add i64 %4, 914778474
  %6 = xor i64 %5, -832765941
  store i64 %6, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !5
  %invariant.gep = getelementptr inbounds i8, ptr %3, i64 2
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

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

10:                                               ; preds = %.lr.ph, %24
  %.013 = phi i64 [ 0, %.lr.ph ], [ %25, %24 ]
  %11 = load i64, ptr %3, align 8
  %12 = icmp ugt i64 %11, %.013
  br i1 %12, label %13, label %19

13:                                               ; preds = %10
  %14 = lshr i64 %11, 32
  %15 = trunc nuw i64 %14 to i32
  %16 = trunc i64 %11 to i16
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.013
  %17 = load i16, ptr %gep, align 2, !tbaa !9
  store i16 %17, ptr %3, align 8, !tbaa !9
  store i16 %16, ptr %gep, align 2, !tbaa !9
  %18 = load i32, ptr %3, align 8, !tbaa !11
  store i32 %18, ptr %9, align 4, !tbaa !11
  store i32 %15, ptr %3, align 8, !tbaa !11
  br label %24

19:                                               ; preds = %10
  %20 = shl i64 %11, 4
  %21 = and i64 %20, 496
  %22 = or i64 %21, %11
  %23 = mul i64 %22, %22
  store i64 %23, ptr %3, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %19, %13
  %25 = add nuw i64 %.013, 1
  %exitcond.not = icmp eq i64 %25, %8
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %10, !llvm.loop !13

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %26 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %6, %2 ]
  %27 = tail call i64 @llvm.fshl.i64(i64 %26, i64 %26, i64 13)
  store i64 %27, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.fshl.i64(i64, i64, i64) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass