; 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 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 2, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 1, 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 = mul i64 %12, 67330564296145686
  %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 = %64, %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 %67

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

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %28 = getelementptr inbounds i16, ptr %27, i64 0
  %29 = load i16, ptr %28, align 2, !tbaa !11
  store i16 %29, ptr %7, align 2, !tbaa !11
  %30 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %31 = getelementptr inbounds i16, ptr %30, i64 3
  %32 = load i16, ptr %31, align 2, !tbaa !11
  %33 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %34 = getelementptr inbounds i16, ptr %33, i64 0
  store i16 %32, ptr %34, align 2, !tbaa !11
  %35 = load i16, ptr %7, align 2, !tbaa !11
  %36 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %37 = getelementptr inbounds i16, ptr %36, i64 3
  store i16 %35, ptr %37, align 2, !tbaa !11
  br label %47

38:                                               ; preds = %21
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = load i64, ptr %6, align 8, !tbaa !9
  %42 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = add i64 %40, %43
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %45
  store i64 %44, ptr %46, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %38, %26
  %48 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %49 = load i64, ptr %48, align 8, !tbaa !9
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = icmp eq i64 %49, %50
  br i1 %51, label %52, label %64

52:                                               ; preds = %47
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %54 = getelementptr inbounds i8, ptr %53, i64 1
  %55 = load i8, ptr %54, align 1, !tbaa !13
  store i8 %55, ptr %8, align 1, !tbaa !13
  %56 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %57 = getelementptr inbounds i8, ptr %56, i64 7
  %58 = load i8, ptr %57, align 1, !tbaa !13
  %59 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %60 = getelementptr inbounds i8, ptr %59, i64 1
  store i8 %58, ptr %60, align 1, !tbaa !13
  %61 = load i8, ptr %8, align 1, !tbaa !13
  %62 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %63 = getelementptr inbounds i8, ptr %62, i64 7
  store i8 %61, ptr %63, align 1, !tbaa !13
  br label %64

64:                                               ; preds = %52, %47
  %65 = load i64, ptr %6, align 8, !tbaa !9
  %66 = add i64 %65, 1
  store i64 %66, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !14

67:                                               ; preds = %15
  %68 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = sub i64 %69, 348226201
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds i64, ptr %71, i64 0
  store i64 %70, ptr %72, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, 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 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"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 = mul i64 %3, 67330564296145686
  %5 = add i64 %4, -2350340661842412260
  %.sroa.0.sroa.10.0.extract.shift110131 = lshr i64 %5, 8
  %.sroa.0.sroa.10.0.extract.trunc111 = trunc i64 %.sroa.0.sroa.10.0.extract.shift110131 to i8
  %sum.shift = lshr i64 %5, 56
  %.sroa.1243.sroa.10.0.extract.trunc = trunc nuw i64 %sum.shift to i8
  %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_crit_edge, label %.lr.ph.preheader

.._crit_edge_crit_edge:                           ; preds = %2
  %.pre151 = and i64 %5, 254
  %.pre153 = and i64 %5, 71776119061217280
  %.pre155 = and i64 %5, 281474976645120
  br label %._crit_edge

.lr.ph.preheader:                                 ; preds = %2
  %.sroa.12.0.extract.shift = lshr i64 %5, 16
  %.sroa.12.0.extract.trunc = trunc i64 %.sroa.12.0.extract.shift to i32
  %.sroa.1243.0.extract.shift = lshr i64 %5, 48
  %.sroa.1243.sroa.0.0.extract.trunc = trunc i64 %.sroa.1243.0.extract.shift to i8
  %.sroa.0.sroa.0.0.extract.trunc96 = trunc i64 %5 to i8
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %14
  %.0141 = phi i64 [ %21, %14 ], [ 0, %.lr.ph.preheader ]
  %.sroa.12.0140 = phi i32 [ %.sroa.12.1, %14 ], [ %.sroa.12.0.extract.trunc, %.lr.ph.preheader ]
  %.sroa.1243.sroa.0.0139 = phi i8 [ %.sroa.1243.sroa.0.1, %14 ], [ %.sroa.1243.sroa.0.0.extract.trunc, %.lr.ph.preheader ]
  %.sroa.1243.sroa.10.0138 = phi i8 [ %spec.select130, %14 ], [ %.sroa.1243.sroa.10.0.extract.trunc, %.lr.ph.preheader ]
  %.sroa.0.sroa.0.0137 = phi i8 [ %.sroa.0.sroa.0.1, %14 ], [ %.sroa.0.sroa.0.0.extract.trunc96, %.lr.ph.preheader ]
  %.sroa.0.sroa.10.0136 = phi i8 [ %spec.select, %14 ], [ %.sroa.0.sroa.10.0.extract.trunc111, %.lr.ph.preheader ]
  %.sroa.0.sroa.10.0.insert.ext112 = zext i8 %.sroa.0.sroa.10.0136 to i64
  %.sroa.0.sroa.10.0.insert.shift113 = shl nuw nsw i64 %.sroa.0.sroa.10.0.insert.ext112, 8
  %.sroa.0.sroa.0.0.insert.ext97 = zext i8 %.sroa.0.sroa.0.0137 to i64
  %.sroa.0.sroa.0.0.insert.insert99 = or disjoint i64 %.sroa.0.sroa.10.0.insert.shift113, %.sroa.0.sroa.0.0.insert.ext97
  %.sroa.1243.sroa.10.0.insert.ext = zext i8 %.sroa.1243.sroa.10.0138 to i64
  %.sroa.1243.sroa.0.0.insert.ext = zext i8 %.sroa.1243.sroa.0.0139 to i64
  %8 = shl nuw i64 %.sroa.1243.sroa.10.0.insert.ext, 56
  %9 = shl nuw nsw i64 %.sroa.1243.sroa.0.0.insert.ext, 48
  %.sroa.1243.0.insert.shift = or disjoint i64 %8, %9
  %.sroa.12.0.insert.ext = zext i32 %.sroa.12.0140 to i64
  %.sroa.12.0.insert.shift = shl nuw nsw i64 %.sroa.12.0.insert.ext, 16
  %10 = or disjoint i64 %.sroa.1243.0.insert.shift, %.sroa.0.sroa.0.0.insert.insert99
  %.sroa.0.0.insert.insert = or disjoint i64 %10, %.sroa.12.0.insert.shift
  %11 = icmp ult i64 %.sroa.0.0.insert.insert, %.0141
  br i1 %11, label %14, label %12

12:                                               ; preds = %.lr.ph
  %13 = shl i64 %.sroa.0.0.insert.insert, 1
  %.sroa.0.sroa.0.0.extract.trunc109 = trunc i64 %13 to i8
  %.sroa.0.sroa.10.0.extract.shift128133 = lshr i64 %13, 8
  %.sroa.0.sroa.10.0.extract.trunc129 = trunc i64 %.sroa.0.sroa.10.0.extract.shift128133 to i8
  %.sroa.12.0.extract.shift41 = lshr i64 %13, 16
  %.sroa.12.0.extract.trunc42 = trunc i64 %.sroa.12.0.extract.shift41 to i32
  %.sroa.1243.0.extract.shift59 = lshr i64 %13, 48
  %.sroa.1243.sroa.0.0.extract.trunc71 = trunc i64 %.sroa.1243.0.extract.shift59 to i8
  %sum.shift134 = lshr i64 %13, 56
  %.sroa.1243.sroa.10.0.extract.trunc89 = trunc nuw i64 %sum.shift134 to i8
  %.pre = and i64 %.sroa.0.sroa.10.0.extract.shift128133, 255
  %.pre146 = and i64 %13, 254
  %.pre148 = and i64 %.sroa.1243.0.extract.shift59, 255
  %.pre150 = and i64 %13, 281474976645120
  br label %14

14:                                               ; preds = %.lr.ph, %12
  %.sroa.12.0.insert.shift28.pre-phi = phi i64 [ %.sroa.12.0.insert.shift, %.lr.ph ], [ %.pre150, %12 ]
  %.sroa.1243.sroa.0.0.insert.ext62.pre-phi = phi i64 [ %.sroa.0.sroa.0.0.insert.ext97, %.lr.ph ], [ %.pre148, %12 ]
  %.sroa.1243.sroa.10.0.insert.ext76.pre-phi = phi i64 [ %.sroa.0.sroa.10.0.insert.ext112, %.lr.ph ], [ %sum.shift134, %12 ]
  %.sroa.0.sroa.0.0.insert.ext100.pre-phi = phi i64 [ %.sroa.1243.sroa.0.0.insert.ext, %.lr.ph ], [ %.pre146, %12 ]
  %.sroa.0.sroa.10.0.insert.ext116.pre-phi = phi i64 [ %.sroa.1243.sroa.10.0.insert.ext, %.lr.ph ], [ %.pre, %12 ]
  %.sroa.0.sroa.10.1 = phi i8 [ %.sroa.1243.sroa.10.0138, %.lr.ph ], [ %.sroa.0.sroa.10.0.extract.trunc129, %12 ]
  %.sroa.0.sroa.0.1 = phi i8 [ %.sroa.1243.sroa.0.0139, %.lr.ph ], [ %.sroa.0.sroa.0.0.extract.trunc109, %12 ]
  %.sroa.1243.sroa.10.1 = phi i8 [ %.sroa.0.sroa.10.0136, %.lr.ph ], [ %.sroa.1243.sroa.10.0.extract.trunc89, %12 ]
  %.sroa.1243.sroa.0.1 = phi i8 [ %.sroa.0.sroa.0.0137, %.lr.ph ], [ %.sroa.1243.sroa.0.0.extract.trunc71, %12 ]
  %.sroa.12.1 = phi i32 [ %.sroa.12.0140, %.lr.ph ], [ %.sroa.12.0.extract.trunc42, %12 ]
  %.sroa.0.sroa.10.0.insert.shift117 = shl nuw nsw i64 %.sroa.0.sroa.10.0.insert.ext116.pre-phi, 8
  %15 = shl nuw i64 %.sroa.1243.sroa.10.0.insert.ext76.pre-phi, 56
  %16 = shl nuw nsw i64 %.sroa.1243.sroa.0.0.insert.ext62.pre-phi, 48
  %17 = or disjoint i64 %.sroa.0.sroa.10.0.insert.shift117, %15
  %18 = or disjoint i64 %17, %.sroa.0.sroa.0.0.insert.ext100.pre-phi
  %19 = or disjoint i64 %18, %16
  %.sroa.0.0.insert.insert15 = or i64 %19, %.sroa.12.0.insert.shift28.pre-phi
  %20 = icmp eq i64 %.sroa.0.0.insert.insert15, %.0141
  %spec.select = select i1 %20, i8 %.sroa.1243.sroa.10.1, i8 %.sroa.0.sroa.10.1
  %spec.select130 = select i1 %20, i8 %.sroa.0.sroa.10.1, i8 %.sroa.1243.sroa.10.1
  %21 = add nuw i64 %.0141, 1
  %exitcond.not = icmp eq i64 %21, %7
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %14, %.._crit_edge_crit_edge
  %.sroa.12.0.insert.shift33.pre-phi = phi i64 [ %.pre155, %.._crit_edge_crit_edge ], [ %.sroa.12.0.insert.shift28.pre-phi, %14 ]
  %.pre-phi = phi i64 [ %.pre153, %.._crit_edge_crit_edge ], [ %16, %14 ]
  %.sroa.0.sroa.0.0.insert.ext103.pre-phi = phi i64 [ %.pre151, %.._crit_edge_crit_edge ], [ %.sroa.0.sroa.0.0.insert.ext100.pre-phi, %14 ]
  %.sroa.0.sroa.10.0.lcssa = phi i8 [ %.sroa.0.sroa.10.0.extract.trunc111, %.._crit_edge_crit_edge ], [ %spec.select, %14 ]
  %.sroa.1243.sroa.10.0.lcssa = phi i8 [ %.sroa.1243.sroa.10.0.extract.trunc, %.._crit_edge_crit_edge ], [ %spec.select130, %14 ]
  %.sroa.0.sroa.10.0.insert.ext120 = zext i8 %.sroa.0.sroa.10.0.lcssa to i64
  %.sroa.0.sroa.10.0.insert.shift121 = shl nuw nsw i64 %.sroa.0.sroa.10.0.insert.ext120, 8
  %.sroa.1243.sroa.10.0.insert.ext80 = zext i8 %.sroa.1243.sroa.10.0.lcssa to i64
  %22 = shl nuw i64 %.sroa.1243.sroa.10.0.insert.ext80, 56
  %.sroa.1243.0.insert.shift51 = add nuw nsw i64 %.sroa.0.sroa.0.0.insert.ext103.pre-phi, -348226201
  %.sroa.12.0.insert.insert35 = add nuw nsw i64 %.sroa.1243.0.insert.shift51, %.sroa.0.sroa.10.0.insert.shift121
  %.sroa.0.sroa.0.0.insert.insert105 = add i64 %.sroa.12.0.insert.insert35, %22
  %.sroa.0.0.insert.insert19 = add i64 %.sroa.0.sroa.0.0.insert.insert105, %.pre-phi
  %23 = add i64 %.sroa.0.0.insert.insert19, %.sroa.12.0.insert.shift33.pre-phi
  store i64 %23, 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: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass