; 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 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 2, 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 = and i64 %11, 914778474
  %13 = shl i64 %12, 7
  %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 = %71, %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 %74

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 %60

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 ugt i64 %28, %29
  br i1 %30, label %31, label %43

31:                                               ; preds = %26
  %32 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %33 = getelementptr inbounds i16, ptr %32, i64 3
  %34 = load i16, ptr %33, align 2, !tbaa !11
  store i16 %34, ptr %7, align 2, !tbaa !11
  %35 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %36 = getelementptr inbounds i16, ptr %35, i64 1
  %37 = load i16, ptr %36, align 2, !tbaa !11
  %38 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i16, ptr %38, i64 3
  store i16 %37, ptr %39, align 2, !tbaa !11
  %40 = load i16, ptr %7, align 2, !tbaa !11
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i16, ptr %41, i64 1
  store i16 %40, ptr %42, align 2, !tbaa !11
  br label %59

43:                                               ; preds = %26
  %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 0
  %47 = load i16, ptr %46, align 2, !tbaa !11
  store i16 %47, 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 2
  %51 = load i16, ptr %50, align 2, !tbaa !11
  %52 = load i64, ptr %6, align 8, !tbaa !9
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %52
  %54 = getelementptr inbounds i16, ptr %53, i64 0
  store i16 %51, ptr %54, align 2, !tbaa !11
  %55 = load i16, ptr %8, align 2, !tbaa !11
  %56 = load i64, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %56
  %58 = getelementptr inbounds i16, ptr %57, i64 2
  store i16 %55, ptr %58, align 2, !tbaa !11
  br label %59

59:                                               ; preds = %43, %31
  br label %71

60:                                               ; preds = %21
  %61 = load i64, ptr %6, 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 = lshr i64 %63, 3
  %65 = and i64 %64, 7
  %66 = or i64 %65, 1
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = lshr i64 %69, %66
  store i64 %70, ptr %68, align 8, !tbaa !9
  br label %71

71:                                               ; preds = %60, %59
  %72 = load i64, ptr %6, align 8, !tbaa !9
  %73 = add i64 %72, 1
  store i64 %73, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !13

74:                                               ; preds = %15
  %75 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = shl i64 %76, 1
  %78 = xor i64 %77, 1048569772
  %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 2, 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 = distinct !{!13, !14}
!14 = !{!"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 = load i64, ptr %0, align 8, !tbaa !5
  %4 = shl i64 %3, 7
  %5 = and i64 %4, 117091644672
  %.sroa.0.0.extract.trunc = trunc i64 %5 to i16
  %.sroa.7.0.extract.shift = lshr i64 %5, 16
  %.sroa.7.0.extract.trunc = trunc i64 %.sroa.7.0.extract.shift to i16
  %.sroa.9.0.extract.shift = lshr i64 %5, 32
  %.sroa.9.0.extract.trunc = trunc nuw nsw i64 %.sroa.9.0.extract.shift to i16
  %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

.lr.ph:                                           ; preds = %2, %14
  %.064 = phi i64 [ %15, %14 ], [ 0, %2 ]
  %.sroa.0.063 = phi i16 [ %.sroa.0.1, %14 ], [ %.sroa.0.0.extract.trunc, %2 ]
  %.sroa.7.062 = phi i16 [ %.sroa.7.1, %14 ], [ %.sroa.7.0.extract.trunc, %2 ]
  %.sroa.9.061 = phi i16 [ %.sroa.9.1, %14 ], [ %.sroa.9.0.extract.trunc, %2 ]
  %.sroa.947.060 = phi i16 [ %.sroa.947.1, %14 ], [ 0, %2 ]
  %.sroa.947.0.insert.ext = zext i16 %.sroa.947.060 to i64
  %.sroa.947.0.insert.shift = shl nuw i64 %.sroa.947.0.insert.ext, 48
  %.sroa.9.0.insert.ext = zext i16 %.sroa.9.061 to i64
  %.sroa.9.0.insert.shift = shl nuw nsw i64 %.sroa.9.0.insert.ext, 32
  %.sroa.9.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.shift, %.sroa.947.0.insert.shift
  %.sroa.7.0.insert.ext = zext i16 %.sroa.7.062 to i64
  %.sroa.7.0.insert.shift = shl nuw nsw i64 %.sroa.7.0.insert.ext, 16
  %.sroa.7.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.insert, %.sroa.7.0.insert.shift
  %.sroa.0.0.insert.ext = zext i16 %.sroa.0.063 to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.7.0.insert.insert, %.sroa.0.0.insert.ext
  %8 = icmp ugt i64 %.sroa.0.0.insert.insert, %.064
  br i1 %8, label %14, label %9

9:                                                ; preds = %.lr.ph
  %10 = lshr i64 %.sroa.0.0.insert.ext, 3
  %11 = and i64 %10, 6
  %12 = or disjoint i64 %11, 1
  %13 = lshr i64 %.sroa.0.0.insert.insert, %12
  %.sroa.0.0.extract.trunc22 = trunc i64 %13 to i16
  %.sroa.7.0.extract.shift33 = lshr i64 %13, 16
  %.sroa.7.0.extract.trunc34 = trunc i64 %.sroa.7.0.extract.shift33 to i16
  %.sroa.9.0.extract.shift45 = lshr i64 %13, 32
  %.sroa.9.0.extract.trunc46 = trunc i64 %.sroa.9.0.extract.shift45 to i16
  %.sroa.947.0.extract.shift58 = lshr i64 %13, 48
  %.sroa.947.0.extract.trunc59 = trunc nuw nsw i64 %.sroa.947.0.extract.shift58 to i16
  br label %14

14:                                               ; preds = %.lr.ph, %9
  %.sroa.947.1 = phi i16 [ %.sroa.947.0.extract.trunc59, %9 ], [ %.sroa.7.062, %.lr.ph ]
  %.sroa.9.1 = phi i16 [ %.sroa.9.0.extract.trunc46, %9 ], [ %.sroa.9.061, %.lr.ph ]
  %.sroa.7.1 = phi i16 [ %.sroa.7.0.extract.trunc34, %9 ], [ %.sroa.947.060, %.lr.ph ]
  %.sroa.0.1 = phi i16 [ %.sroa.0.0.extract.trunc22, %9 ], [ %.sroa.0.063, %.lr.ph ]
  %15 = add nuw i64 %.064, 1
  %exitcond.not = icmp eq i64 %15, %7
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %14
  %16 = zext i16 %.sroa.947.1 to i64
  %17 = shl nuw i64 %16, 48
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %.sroa.947.0.lcssa = phi i64 [ 0, %2 ], [ %17, %._crit_edge.loopexit ]
  %.sroa.9.0.lcssa = phi i16 [ %.sroa.9.0.extract.trunc, %2 ], [ %.sroa.9.1, %._crit_edge.loopexit ]
  %.sroa.7.0.lcssa = phi i16 [ %.sroa.7.0.extract.trunc, %2 ], [ %.sroa.7.1, %._crit_edge.loopexit ]
  %.sroa.0.0.lcssa = phi i16 [ %.sroa.0.0.extract.trunc, %2 ], [ %.sroa.0.1, %._crit_edge.loopexit ]
  %.sroa.9.0.insert.ext36 = zext i16 %.sroa.9.0.lcssa to i64
  %.sroa.9.0.insert.shift37 = shl nuw nsw i64 %.sroa.9.0.insert.ext36, 32
  %.sroa.9.0.insert.insert39 = or disjoint i64 %.sroa.9.0.insert.shift37, %.sroa.947.0.lcssa
  %.sroa.7.0.insert.ext24 = zext i16 %.sroa.7.0.lcssa to i64
  %.sroa.7.0.insert.shift25 = shl nuw nsw i64 %.sroa.7.0.insert.ext24, 16
  %.sroa.7.0.insert.insert27 = or disjoint i64 %.sroa.9.0.insert.insert39, %.sroa.7.0.insert.shift25
  %.sroa.0.0.insert.ext15 = zext i16 %.sroa.0.0.lcssa to i64
  %.sroa.0.0.insert.insert17 = or disjoint i64 %.sroa.7.0.insert.insert27, %.sroa.0.0.insert.ext15
  %18 = shl i64 %.sroa.0.0.insert.insert17, 1
  %19 = xor i64 %18, 1048569772
  store i64 %19, ptr %1, align 8, !tbaa !5
  ret void
}

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" }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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