; 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 i8, align 1
  %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 1, 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 = 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 %6, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %73, %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 %76

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 %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 5
  %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 3
  %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 5
  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 3
  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 3
  %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 2
  %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 3
  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 2
  store i8 %53, ptr %56, align 1, !tbaa !11
  br label %73

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 i16, ptr %59, i64 0
  %61 = load i16, ptr %60, align 2, !tbaa !12
  store i16 %61, ptr %8, align 2, !tbaa !12
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %62
  %64 = getelementptr inbounds i16, ptr %63, i64 3
  %65 = load i16, ptr %64, align 2, !tbaa !12
  %66 = load i64, ptr %6, align 8, !tbaa !9
  %67 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %66
  %68 = getelementptr inbounds i16, ptr %67, i64 0
  store i16 %65, ptr %68, align 2, !tbaa !12
  %69 = load i16, ptr %8, align 2, !tbaa !12
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %70
  %72 = getelementptr inbounds i16, ptr %71, i64 3
  store i16 %69, ptr %72, align 2, !tbaa !12
  br label %73

73:                                               ; preds = %57, %26
  %74 = load i64, ptr %6, align 8, !tbaa !9
  %75 = add i64 %74, 2
  store i64 %75, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !14

76:                                               ; preds = %15
  %77 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = add i64 %78, 736209367
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds i64, ptr %80, i64 0
  store i64 %79, ptr %81, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 2, 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.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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !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 = 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, 326104726
  store i64 %5, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %invariant.gep = getelementptr inbounds i8, ptr %3, i64 6
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %21
  %.020 = phi i64 [ %22, %21 ], [ 0, %2 ]
  %8 = load i64, ptr %3, align 8
  %9 = icmp ult i64 %8, %.020
  br i1 %9, label %10, label %18

10:                                               ; preds = %.lr.ph
  %11 = getelementptr inbounds [1 x i64], ptr %3, i64 0, i64 %.020
  %12 = getelementptr inbounds i8, ptr %11, i64 5
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %11, i64 3
  %15 = load i8, ptr %14, align 1, !tbaa !9
  store i8 %15, ptr %12, align 1, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %11, i64 2
  %17 = load i8, ptr %16, align 2, !tbaa !9
  store i8 %17, ptr %14, align 1, !tbaa !9
  store i8 %13, ptr %16, align 2, !tbaa !9
  br label %21

18:                                               ; preds = %.lr.ph
  %19 = trunc i64 %8 to i16
  %gep = getelementptr [1 x i64], ptr %invariant.gep, i64 0, i64 %.020
  %20 = load i16, ptr %gep, align 2, !tbaa !10
  store i16 %20, ptr %3, align 8, !tbaa !10
  store i16 %19, ptr %gep, align 2, !tbaa !10
  br label %21

21:                                               ; preds = %18, %10
  %22 = add nuw i64 %.020, 2
  %23 = icmp ult i64 %22, %7
  br i1 %23, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %24 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %5, %2 ]
  %25 = add i64 %24, 736209367
  store i64 %25, 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.start.p0(i64 immarg, ptr nocapture) #1

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

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" }
attributes #1 = { mustprogress 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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