; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @RandomFunc(ptr noundef %0, ptr noundef %1) #1 {
  %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 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 8, 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, 51238316
  %13 = add i64 %12, 274866410
  %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 = %69, %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 %72

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

22:                                               ; preds = %66, %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 %69

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 ne i64 %30, %33
  br i1 %34, label %66, label %35

35:                                               ; preds = %28
  %36 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = load i64, ptr %7, align 8, !tbaa !9
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = add i64 %37, %40
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %42
  store i64 %41, ptr %43, align 8, !tbaa !9
  %44 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i8, ptr %44, i64 0
  %46 = load i8, ptr %45, align 1, !tbaa !11
  store i8 %46, ptr %8, align 1, !tbaa !11
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %51 = getelementptr inbounds i8, ptr %50, i64 0
  store i8 %49, ptr %51, align 1, !tbaa !11
  %52 = load i8, ptr %8, align 1, !tbaa !11
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %54 = getelementptr inbounds i8, ptr %53, i64 4
  store i8 %52, ptr %54, align 1, !tbaa !11
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %56 = getelementptr inbounds i8, ptr %55, i64 5
  %57 = load i8, ptr %56, align 1, !tbaa !11
  store i8 %57, ptr %8, align 1, !tbaa !11
  %58 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %59 = getelementptr inbounds i8, ptr %58, i64 7
  %60 = load i8, ptr %59, align 1, !tbaa !11
  %61 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %62 = getelementptr inbounds i8, ptr %61, i64 5
  store i8 %60, ptr %62, align 1, !tbaa !11
  %63 = load i8, ptr %8, align 1, !tbaa !11
  %64 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %65 = getelementptr inbounds i8, ptr %64, i64 7
  store i8 %63, ptr %65, align 1, !tbaa !11
  br label %66

66:                                               ; preds = %35, %28
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = add i64 %67, 1
  store i64 %68, ptr %6, align 8, !tbaa !9
  br label %22, !llvm.loop !12

69:                                               ; preds = %22
  %70 = load i64, ptr %7, align 8, !tbaa !9
  %71 = add i64 %70, 2
  store i64 %71, ptr %7, align 8, !tbaa !9
  br label %15, !llvm.loop !14

72:                                               ; preds = %15
  %73 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %74 = load i64, ptr %73, align 8, !tbaa !9
  %75 = add i64 %74, 839257860
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds i64, ptr %76, i64 0
  store i64 %75, ptr %77, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, 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.end.p0(i64 immarg, ptr nocapture) #0

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


; 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 = add i64 %3, 326104726
  %.sroa.0.0.extract.trunc = trunc i64 %4 to i8
  %.sroa.9.0.extract.shift = lshr i64 %4, 8
  %.sroa.9.0.extract.trunc = trunc i64 %.sroa.9.0.extract.shift to i24
  %.sroa.937.0.extract.shift = lshr i64 %4, 32
  %.sroa.937.0.extract.trunc = trunc i64 %.sroa.937.0.extract.shift to i8
  %.sroa.11.0.extract.shift = lshr i64 %4, 40
  %.sroa.11.0.extract.trunc = trunc i64 %.sroa.11.0.extract.shift to i8
  %.sroa.13.0.extract.shift = lshr i64 %4, 48
  %.sroa.13.0.extract.trunc = trunc i64 %.sroa.13.0.extract.shift to i8
  %.sroa.1374.0.extract.shift = lshr i64 %4, 56
  %.sroa.1374.0.extract.trunc = trunc nuw i64 %.sroa.1374.0.extract.shift to i8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %.not108 = icmp eq i64 %6, 0
  br i1 %.not108, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %2, %13
  %.013102 = phi i64 [ %14, %13 ], [ 0, %2 ]
  %.sroa.0.0101 = phi i8 [ %.sroa.0.2, %13 ], [ %.sroa.0.0.extract.trunc, %2 ]
  %.sroa.937.0100 = phi i8 [ %.sroa.937.2, %13 ], [ %.sroa.937.0.extract.trunc, %2 ]
  %.sroa.11.099 = phi i8 [ %.sroa.11.2, %13 ], [ %.sroa.11.0.extract.trunc, %2 ]
  %.sroa.13.098 = phi i8 [ %.sroa.13.2, %13 ], [ %.sroa.13.0.extract.trunc, %2 ]
  %.sroa.1374.097 = phi i8 [ %.sroa.1374.2, %13 ], [ %.sroa.1374.0.extract.trunc, %2 ]
  %.sroa.9.sroa.0.096 = phi i24 [ %.sroa.9.sroa.0.2, %13 ], [ %.sroa.9.0.extract.trunc, %2 ]
  br label %7

7:                                                ; preds = %.preheader, %11
  %.095 = phi i64 [ 0, %.preheader ], [ %12, %11 ]
  %.sroa.0.194 = phi i8 [ %.sroa.0.0101, %.preheader ], [ %.sroa.0.2, %11 ]
  %.sroa.937.193 = phi i8 [ %.sroa.937.0100, %.preheader ], [ %.sroa.937.2, %11 ]
  %.sroa.11.192 = phi i8 [ %.sroa.11.099, %.preheader ], [ %.sroa.11.2, %11 ]
  %.sroa.13.191 = phi i8 [ %.sroa.13.098, %.preheader ], [ %.sroa.13.2, %11 ]
  %.sroa.1374.190 = phi i8 [ %.sroa.1374.097, %.preheader ], [ %.sroa.1374.2, %11 ]
  %.sroa.9.sroa.0.189 = phi i24 [ %.sroa.9.sroa.0.096, %.preheader ], [ %.sroa.9.sroa.0.2, %11 ]
  %.sroa.1374.0.insert.ext = zext i8 %.sroa.1374.190 to i64
  %.sroa.1374.0.insert.shift = shl nuw i64 %.sroa.1374.0.insert.ext, 56
  %.sroa.13.0.insert.ext = zext i8 %.sroa.13.191 to i64
  %.sroa.13.0.insert.shift = shl nuw nsw i64 %.sroa.13.0.insert.ext, 48
  %.sroa.13.0.insert.insert = or disjoint i64 %.sroa.13.0.insert.shift, %.sroa.1374.0.insert.shift
  %.sroa.11.0.insert.ext = zext i8 %.sroa.11.192 to i64
  %.sroa.11.0.insert.shift = shl nuw nsw i64 %.sroa.11.0.insert.ext, 40
  %.sroa.11.0.insert.insert = or disjoint i64 %.sroa.13.0.insert.insert, %.sroa.11.0.insert.shift
  %.sroa.937.0.insert.ext = zext i8 %.sroa.937.193 to i64
  %.sroa.937.0.insert.shift = shl nuw nsw i64 %.sroa.937.0.insert.ext, 32
  %.sroa.937.0.insert.insert = or disjoint i64 %.sroa.11.0.insert.insert, %.sroa.937.0.insert.shift
  %.sroa.9.0.insert.ext = zext i24 %.sroa.9.sroa.0.189 to i64
  %.sroa.9.0.insert.shift = shl nuw nsw i64 %.sroa.9.0.insert.ext, 8
  %.sroa.9.0.insert.insert = or disjoint i64 %.sroa.937.0.insert.insert, %.sroa.9.0.insert.shift
  %.sroa.0.0.insert.ext = zext i8 %.sroa.0.194 to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.insert, %.sroa.0.0.insert.ext
  %8 = add i64 %.095, %.013102
  %.not = icmp eq i64 %.sroa.0.0.insert.insert, %8
  br i1 %.not, label %9, label %11

9:                                                ; preds = %7
  %10 = shl i64 %.sroa.0.0.insert.insert, 1
  %.sroa.0.0.extract.trunc24 = trunc i64 %10 to i8
  %.sroa.9.0.extract.shift35 = lshr i64 %10, 8
  %.sroa.9.0.extract.trunc36 = trunc i64 %.sroa.9.0.extract.shift35 to i24
  %.sroa.937.0.extract.shift48 = lshr i64 %10, 32
  %.sroa.937.0.extract.trunc49 = trunc i64 %.sroa.937.0.extract.shift48 to i8
  %.sroa.11.0.extract.shift60 = lshr i64 %10, 40
  %.sroa.11.0.extract.trunc61 = trunc i64 %.sroa.11.0.extract.shift60 to i8
  %.sroa.13.0.extract.shift72 = lshr i64 %10, 48
  %.sroa.13.0.extract.trunc73 = trunc i64 %.sroa.13.0.extract.shift72 to i8
  %.sroa.1374.0.extract.shift85 = lshr i64 %10, 56
  %.sroa.1374.0.extract.trunc86 = trunc nuw i64 %.sroa.1374.0.extract.shift85 to i8
  br label %11

11:                                               ; preds = %9, %7
  %.sroa.9.sroa.0.2 = phi i24 [ %.sroa.9.0.extract.trunc36, %9 ], [ %.sroa.9.sroa.0.189, %7 ]
  %.sroa.1374.2 = phi i8 [ %.sroa.11.0.extract.trunc61, %9 ], [ %.sroa.1374.190, %7 ]
  %.sroa.13.2 = phi i8 [ %.sroa.13.0.extract.trunc73, %9 ], [ %.sroa.13.191, %7 ]
  %.sroa.11.2 = phi i8 [ %.sroa.1374.0.extract.trunc86, %9 ], [ %.sroa.11.192, %7 ]
  %.sroa.937.2 = phi i8 [ %.sroa.0.0.extract.trunc24, %9 ], [ %.sroa.937.193, %7 ]
  %.sroa.0.2 = phi i8 [ %.sroa.937.0.extract.trunc49, %9 ], [ %.sroa.0.194, %7 ]
  %12 = add nuw i64 %.095, 1
  %exitcond.not = icmp eq i64 %12, %6
  br i1 %exitcond.not, label %13, label %7, !llvm.loop !9

13:                                               ; preds = %11
  %14 = add nuw i64 %.013102, 2
  %15 = icmp ult i64 %14, %6
  br i1 %15, label %.preheader, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %13, %2
  %.sroa.9.sroa.0.0.lcssa = phi i24 [ %.sroa.9.0.extract.trunc, %2 ], [ %.sroa.9.sroa.0.2, %13 ]
  %.sroa.1374.0.lcssa = phi i8 [ %.sroa.1374.0.extract.trunc, %2 ], [ %.sroa.1374.2, %13 ]
  %.sroa.13.0.lcssa = phi i8 [ %.sroa.13.0.extract.trunc, %2 ], [ %.sroa.13.2, %13 ]
  %.sroa.11.0.lcssa = phi i8 [ %.sroa.11.0.extract.trunc, %2 ], [ %.sroa.11.2, %13 ]
  %.sroa.937.0.lcssa = phi i8 [ %.sroa.937.0.extract.trunc, %2 ], [ %.sroa.937.2, %13 ]
  %.sroa.0.0.lcssa = phi i8 [ %.sroa.0.0.extract.trunc, %2 ], [ %.sroa.0.2, %13 ]
  %.sroa.1374.0.insert.ext76 = zext i8 %.sroa.1374.0.lcssa to i64
  %.sroa.1374.0.insert.shift77 = shl nuw i64 %.sroa.1374.0.insert.ext76, 56
  %.sroa.13.0.insert.ext63 = zext i8 %.sroa.13.0.lcssa to i64
  %.sroa.13.0.insert.shift64 = shl nuw nsw i64 %.sroa.13.0.insert.ext63, 48
  %.sroa.11.0.insert.ext51 = zext i8 %.sroa.11.0.lcssa to i64
  %.sroa.11.0.insert.shift52 = shl nuw nsw i64 %.sroa.11.0.insert.ext51, 40
  %.sroa.937.0.insert.ext39 = zext i8 %.sroa.937.0.lcssa to i64
  %.sroa.937.0.insert.shift40 = shl nuw nsw i64 %.sroa.937.0.insert.ext39, 32
  %.sroa.9.0.insert.ext26 = zext i24 %.sroa.9.sroa.0.0.lcssa to i64
  %.sroa.9.0.insert.shift27 = shl nuw nsw i64 %.sroa.9.0.insert.ext26, 8
  %.sroa.0.0.insert.ext17 = zext i8 %.sroa.0.0.lcssa to i64
  %.sroa.13.0.insert.insert66 = add nuw nsw i64 %.sroa.9.0.insert.shift27, 839257860
  %.sroa.11.0.insert.insert54 = or disjoint i64 %.sroa.13.0.insert.insert66, %.sroa.1374.0.insert.shift77
  %.sroa.937.0.insert.insert42 = or disjoint i64 %.sroa.11.0.insert.insert54, %.sroa.13.0.insert.shift64
  %.sroa.9.0.insert.insert29 = or disjoint i64 %.sroa.937.0.insert.insert42, %.sroa.11.0.insert.shift52
  %.sroa.0.0.insert.insert19 = add nuw nsw i64 %.sroa.9.0.insert.insert29, %.sroa.0.0.insert.ext17
  %16 = add i64 %.sroa.0.0.insert.insert19, %.sroa.937.0.insert.shift40
  store i64 %16, 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"}
!11 = distinct !{!11, !10}


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