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

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

20:                                               ; preds = %14
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %21

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

27:                                               ; preds = %21
  %28 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = or i64 %30, %31
  %33 = icmp ule i64 %29, %32
  br i1 %33, label %34, label %50

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

50:                                               ; preds = %27
  %51 = load i64, ptr %7, align 8, !tbaa !9
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = lshr i64 %56, 3
  %58 = and i64 %57, 15
  %59 = or i64 %58, 1
  %60 = shl i64 %53, %59
  %61 = load i64, ptr %7, align 8, !tbaa !9
  %62 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = load i64, ptr %6, align 8, !tbaa !9
  %65 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = lshr i64 %66, 3
  %68 = and i64 %67, 15
  %69 = or i64 %68, 1
  %70 = sub i64 64, %69
  %71 = lshr i64 %63, %70
  %72 = or i64 %60, %71
  %73 = and i64 %72, 15
  %74 = shl i64 %73, 2
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !9
  %78 = or i64 %77, %74
  store i64 %78, ptr %76, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %50, %34
  %80 = load i64, ptr %6, align 8, !tbaa !9
  %81 = add i64 %80, 1
  store i64 %81, ptr %6, align 8, !tbaa !9
  br label %21, !llvm.loop !13

82:                                               ; preds = %21
  %83 = load i64, ptr %7, align 8, !tbaa !9
  %84 = add i64 %83, 1
  store i64 %84, ptr %7, align 8, !tbaa !9
  br label %14, !llvm.loop !15

85:                                               ; preds = %14
  %86 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = xor i64 %87, 293908934
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds i64, ptr %89, i64 0
  store i64 %88, ptr %90, align 8, !tbaa !9
  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) #3
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = add i64 %4, 1373777115
  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
  %.not22 = icmp eq i64 %7, 0
  br i1 %.not22, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %invariant.gep = getelementptr i8, ptr %3, i64 2
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %24
  %.01921 = phi i64 [ %25, %24 ], [ 0, %.preheader.preheader ]
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.01921
  br label %8

8:                                                ; preds = %.preheader, %22
  %.020 = phi i64 [ 0, %.preheader ], [ %23, %22 ]
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = or i64 %.020, %.01921
  %.not = icmp ugt i64 %9, %10
  br i1 %.not, label %14, label %11

11:                                               ; preds = %8
  %12 = load <2 x i16>, ptr %gep, align 2, !tbaa !9
  %13 = shufflevector <2 x i16> %12, <2 x i16> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i16> %13, ptr %gep, align 2, !tbaa !9
  br label %22

14:                                               ; preds = %8
  %15 = lshr i64 %9, 3
  %16 = and i64 %15, 14
  %17 = or disjoint i64 %16, 1
  %18 = tail call i64 @llvm.fshl.i64(i64 %9, i64 %9, i64 %17)
  %19 = shl i64 %18, 2
  %20 = and i64 %19, 60
  %21 = or i64 %20, %9
  store i64 %21, ptr %3, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %14, %11
  %23 = add nuw i64 %.020, 1
  %exitcond.not = icmp eq i64 %23, %7
  br i1 %exitcond.not, label %24, label %8, !llvm.loop !11

24:                                               ; preds = %22
  %25 = add nuw i64 %.01921, 1
  %exitcond23.not = icmp eq i64 %25, %7
  br i1 %exitcond23.not, label %._crit_edge.loopexit, label %.preheader, !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 ], [ %5, %2 ]
  %27 = xor i64 %26, 293908934
  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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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