; 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 i8, align 1
  %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 1, 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 = or i64 %11, 51238316
  %13 = lshr i64 %12, 3
  %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 = %88, %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 %91

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

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 i8, ptr %28, i64 4
  %30 = load i8, ptr %29, align 1, !tbaa !11
  store i8 %30, ptr %7, align 1, !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 i8, ptr %32, i64 7
  %34 = load i8, ptr %33, align 1, !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 i8, ptr %36, i64 4
  store i8 %34, ptr %37, align 1, !tbaa !11
  %38 = load i8, ptr %7, align 1, !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 i8, ptr %40, i64 7
  store i8 %38, ptr %41, align 1, !tbaa !11
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %42
  %44 = getelementptr inbounds i8, ptr %43, i64 7
  %45 = load i8, ptr %44, align 1, !tbaa !11
  store i8 %45, ptr %7, align 1, !tbaa !11
  %46 = load i64, ptr %6, align 8, !tbaa !9
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %46
  %48 = getelementptr inbounds i8, ptr %47, i64 0
  %49 = load i8, ptr %48, align 1, !tbaa !11
  %50 = load i64, ptr %6, align 8, !tbaa !9
  %51 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %50
  %52 = getelementptr inbounds i8, ptr %51, i64 7
  store i8 %49, ptr %52, align 1, !tbaa !11
  %53 = load i8, ptr %7, align 1, !tbaa !11
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %54
  %56 = getelementptr inbounds i8, ptr %55, i64 0
  store i8 %53, ptr %56, align 1, !tbaa !11
  br label %88

57:                                               ; preds = %21
  %58 = load i64, ptr %6, align 8, !tbaa !9
  %59 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %58
  %60 = getelementptr inbounds i8, ptr %59, i64 2
  %61 = load i8, ptr %60, align 1, !tbaa !11
  store i8 %61, ptr %8, align 1, !tbaa !11
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %62
  %64 = getelementptr inbounds i8, ptr %63, i64 5
  %65 = load i8, ptr %64, align 1, !tbaa !11
  %66 = load i64, ptr %6, align 8, !tbaa !9
  %67 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %66
  %68 = getelementptr inbounds i8, ptr %67, i64 2
  store i8 %65, ptr %68, align 1, !tbaa !11
  %69 = load i8, ptr %8, align 1, !tbaa !11
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %70
  %72 = getelementptr inbounds i8, ptr %71, i64 5
  store i8 %69, ptr %72, align 1, !tbaa !11
  %73 = load i64, ptr %6, align 8, !tbaa !9
  %74 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %73
  %75 = getelementptr inbounds i8, ptr %74, i64 3
  %76 = load i8, ptr %75, align 1, !tbaa !11
  store i8 %76, ptr %8, align 1, !tbaa !11
  %77 = load i64, ptr %6, align 8, !tbaa !9
  %78 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %77
  %79 = getelementptr inbounds i8, ptr %78, i64 7
  %80 = load i8, ptr %79, align 1, !tbaa !11
  %81 = load i64, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %81
  %83 = getelementptr inbounds i8, ptr %82, i64 3
  store i8 %80, ptr %83, align 1, !tbaa !11
  %84 = load i8, ptr %8, align 1, !tbaa !11
  %85 = load i64, ptr %6, align 8, !tbaa !9
  %86 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %85
  %87 = getelementptr inbounds i8, ptr %86, i64 7
  store i8 %84, ptr %87, align 1, !tbaa !11
  br label %88

88:                                               ; preds = %57, %26
  %89 = load i64, ptr %6, align 8, !tbaa !9
  %90 = add i64 %89, 2
  store i64 %90, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !12

91:                                               ; preds = %15
  %92 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %93 = load i64, ptr %92, align 8, !tbaa !9
  %94 = and i64 %93, 315155497
  %95 = or i64 %94, 1352176868
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds i64, ptr %96, i64 0
  store i64 %95, ptr %97, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 1, 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"}


; 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 = lshr i64 %4, 3
  %6 = or i64 %5, 6404789
  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
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %28
  %.025 = phi i64 [ %29, %28 ], [ 0, %2 ]
  %9 = load i64, ptr %3, align 8
  %10 = icmp ugt i64 %9, %.025
  br i1 %10, label %11, label %18

11:                                               ; preds = %.lr.ph
  %12 = trunc i64 %9 to i8
  %13 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.025
  %14 = getelementptr inbounds i8, ptr %13, i64 4
  %15 = load i8, ptr %14, align 4, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %13, i64 7
  %17 = load i8, ptr %16, align 1, !tbaa !9
  store i8 %17, ptr %14, align 4, !tbaa !9
  store i8 %12, ptr %16, align 1, !tbaa !9
  store i8 %15, ptr %3, align 8, !tbaa !9
  br label %28

18:                                               ; preds = %.lr.ph
  %19 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.025
  %20 = getelementptr inbounds i8, ptr %19, i64 2
  %21 = load i8, ptr %20, align 2, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %19, i64 5
  %23 = load i8, ptr %22, align 1, !tbaa !9
  store i8 %23, ptr %20, align 2, !tbaa !9
  store i8 %21, ptr %22, align 1, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %19, i64 3
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %19, i64 7
  %27 = load i8, ptr %26, align 1, !tbaa !9
  store i8 %27, ptr %24, align 1, !tbaa !9
  store i8 %25, ptr %26, align 1, !tbaa !9
  br label %28

28:                                               ; preds = %18, %11
  %29 = add nuw i64 %.025, 2
  %30 = icmp ult i64 %29, %8
  br i1 %30, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !10

._crit_edge.loopexit:                             ; preds = %28
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %31 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %6, %2 ]
  %32 = and i64 %31, 37773321
  %33 = or disjoint i64 %32, 1352176868
  store i64 %33, 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


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