; 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 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 = %77, %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 %80

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

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
  br label %54

42:                                               ; preds = %21
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %44 = getelementptr inbounds i32, ptr %43, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !13
  store i32 %45, ptr %8, align 4, !tbaa !13
  %46 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %47 = getelementptr inbounds i32, ptr %46, i64 0
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %50 = getelementptr inbounds i32, ptr %49, i64 1
  store i32 %48, ptr %50, align 4, !tbaa !13
  %51 = load i32, ptr %8, align 4, !tbaa !13
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %53 = getelementptr inbounds i32, ptr %52, i64 0
  store i32 %51, ptr %53, align 4, !tbaa !13
  br label %54

54:                                               ; preds = %42, %26
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = icmp eq i64 %56, %57
  br i1 %58, label %59, label %68

59:                                               ; preds = %54
  %60 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = and i64 %61, 7
  %63 = shl i64 %62, 2
  %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 = or i64 %66, %63
  store i64 %67, ptr %65, align 8, !tbaa !9
  br label %77

68:                                               ; preds = %54
  %69 = load i64, ptr %6, align 8, !tbaa !9
  %70 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = and i64 %71, 7
  %73 = shl i64 %72, 2
  %74 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = or i64 %75, %73
  store i64 %76, ptr %74, align 8, !tbaa !9
  br label %77

77:                                               ; preds = %68, %59
  %78 = load i64, ptr %6, align 8, !tbaa !9
  %79 = add i64 %78, 1
  store i64 %79, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !15

80:                                               ; preds = %15
  %81 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %82 = load i64, ptr %81, align 8, !tbaa !9
  %83 = mul i64 %82, 549183897
  %84 = add i64 %83, 534246206
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds i64, ptr %85, i64 0
  store i64 %84, ptr %86, 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.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 = !{!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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; 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 #1 {
  %3 = alloca [1 x i64], align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #2
  %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, %19
  %11 = phi i64 [ %6, %.lr.ph ], [ %storemerge, %19 ]
  %.015 = phi i64 [ 0, %.lr.ph ], [ %21, %19 ]
  %12 = icmp ugt i64 %11, %.015
  br i1 %12, label %13, label %16

13:                                               ; preds = %10
  %14 = trunc i64 %11 to i16
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.015
  %15 = load i16, ptr %gep, align 2, !tbaa !9
  store i16 %15, ptr %3, align 8, !tbaa !9
  store i16 %14, ptr %gep, align 2, !tbaa !9
  br label %19

16:                                               ; preds = %10
  %.in = lshr i64 %11, 32
  %17 = trunc nuw i64 %.in to i32
  %18 = trunc i64 %11 to i32
  store i32 %18, ptr %9, align 4, !tbaa !11
  store i32 %17, ptr %3, align 8, !tbaa !11
  br label %19

19:                                               ; preds = %16, %13
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %.pn.in = shl i64 %20, 2
  %.pn = and i64 %.pn.in, 28
  %storemerge = or i64 %.pn, %20
  store i64 %storemerge, ptr %3, align 8, !tbaa !5
  %21 = add nuw i64 %.015, 1
  %exitcond.not = icmp eq i64 %21, %8
  br i1 %exitcond.not, label %._crit_edge, label %10, !llvm.loop !13

._crit_edge:                                      ; preds = %19, %2
  %22 = phi i64 [ %6, %2 ], [ %storemerge, %19 ]
  %23 = mul i64 %22, 549183897
  %24 = add i64 %23, 534246206
  store i64 %24, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #2
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = !{!"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,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass