; 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 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, 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 = %79, %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 %82

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

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = load i64, ptr %6, align 8, !tbaa !9
  %30 = icmp ne i64 %28, %29
  br i1 %30, label %31, label %37

31:                                               ; preds = %26
  %32 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = add i64 %35, %33
  store i64 %36, ptr %34, align 8, !tbaa !9
  br label %49

37:                                               ; preds = %26
  %38 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i8, ptr %38, i64 1
  %40 = load i8, ptr %39, align 1, !tbaa !11
  store i8 %40, ptr %7, align 1, !tbaa !11
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i8, ptr %41, i64 7
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  store i8 %43, ptr %45, align 1, !tbaa !11
  %46 = load i8, ptr %7, align 1, !tbaa !11
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i8, ptr %47, i64 7
  store i8 %46, ptr %48, align 1, !tbaa !11
  br label %49

49:                                               ; preds = %37, %31
  br label %79

50:                                               ; preds = %21
  %51 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = load i64, ptr %6, align 8, !tbaa !9
  %54 = icmp eq i64 %52, %53
  br i1 %54, label %55, label %62

55:                                               ; preds = %50
  %56 = load i64, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = sub i64 %60, %58
  store i64 %61, ptr %59, align 8, !tbaa !9
  br label %78

62:                                               ; preds = %50
  %63 = load i64, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %63
  %65 = getelementptr inbounds i16, ptr %64, i64 3
  %66 = load i16, ptr %65, align 2, !tbaa !12
  store i16 %66, ptr %8, align 2, !tbaa !12
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %67
  %69 = getelementptr inbounds i16, ptr %68, i64 0
  %70 = load i16, ptr %69, align 2, !tbaa !12
  %71 = load i64, ptr %6, align 8, !tbaa !9
  %72 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %71
  %73 = getelementptr inbounds i16, ptr %72, i64 3
  store i16 %70, ptr %73, align 2, !tbaa !12
  %74 = load i16, ptr %8, align 2, !tbaa !12
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %75
  %77 = getelementptr inbounds i16, ptr %76, i64 0
  store i16 %74, ptr %77, align 2, !tbaa !12
  br label %78

78:                                               ; preds = %62, %55
  br label %79

79:                                               ; preds = %78, %49
  %80 = load i64, ptr %6, align 8, !tbaa !9
  %81 = add i64 %80, 1
  store i64 %81, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !14

82:                                               ; preds = %15
  %83 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %84 = load i64, ptr %83, align 8, !tbaa !9
  %85 = sub i64 %84, 1059477100
  %86 = add i64 %85, 204337520
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds i64, ptr %87, i64 0
  store i64 %86, ptr %88, 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.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 = !{!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: 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 = mul i64 %4, 67330564296145686
  %6 = add i64 %5, -2350340661842412260
  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 6
  %.not = icmp eq i64 %8, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %19
  %.015 = phi i64 [ %20, %19 ], [ 0, %2 ]
  %9 = load i64, ptr %3, align 8
  %10 = icmp ult i64 %9, %.015
  %11 = trunc i64 %9 to i16
  br i1 %10, label %12, label %14

12:                                               ; preds = %.lr.ph
  %13 = shl i64 %9, 1
  store i64 %13, ptr %3, align 8, !tbaa !5
  br label %19

14:                                               ; preds = %.lr.ph
  %15 = icmp eq i64 %9, %.015
  br i1 %15, label %16, label %17

16:                                               ; preds = %14
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %19

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

19:                                               ; preds = %16, %17, %12
  %20 = add nuw i64 %.015, 1
  %exitcond.not = icmp eq i64 %20, %8
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !11

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %21 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %6, %2 ]
  %22 = add i64 %21, -855139580
  store i64 %22, 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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