; 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 i32], align 4
  %6 = alloca i32, align 4
  %7 = 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 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds i32, ptr %8, i64 0
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = xor i32 %10, 700325083
  %12 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %11, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %52, %2
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds i32, ptr %15, i64 1
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = icmp ult i32 %14, %17
  br i1 %18, label %19, label %57

19:                                               ; preds = %13
  %20 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = icmp ne i32 %21, %22
  br i1 %23, label %24, label %36

24:                                               ; preds = %19
  %25 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %26 = getelementptr inbounds i8, ptr %25, i64 0
  %27 = load i8, ptr %26, align 1, !tbaa !11
  store i8 %27, ptr %7, align 1, !tbaa !11
  %28 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %29 = getelementptr inbounds i8, ptr %28, i64 1
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %31 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %32 = getelementptr inbounds i8, ptr %31, i64 0
  store i8 %30, ptr %32, align 1, !tbaa !11
  %33 = load i8, ptr %7, align 1, !tbaa !11
  %34 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %35 = getelementptr inbounds i8, ptr %34, i64 1
  store i8 %33, ptr %35, align 1, !tbaa !11
  br label %52

36:                                               ; preds = %19
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = lshr i32 %44, 1
  %46 = and i32 %45, 7
  %47 = zext i32 %46 to i64
  %48 = or i64 %47, 1
  %49 = trunc i64 %48 to i32
  %50 = lshr i32 %40, %49
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %50, ptr %51, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %36, %24
  %53 = load i32, ptr %6, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = add i64 %54, 2
  %56 = trunc i64 %55 to i32
  store i32 %56, ptr %6, align 4, !tbaa !9
  br label %13, !llvm.loop !12

57:                                               ; preds = %13
  %58 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = or i64 %60, 595841640
  %62 = trunc i64 %61 to i32
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds i32, ptr %63, i64 0
  store i32 %62, ptr %64, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !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: 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 i32, ptr %0, align 4, !tbaa !5
  %4 = xor i32 %3, 700325083
  %.sroa.0.0.extract.trunc = trunc i32 %4 to i8
  %.sroa.9.0.extract.shift = lshr i32 %4, 8
  %.sroa.9.0.extract.trunc = trunc i32 %.sroa.9.0.extract.shift to i8
  %.sroa.11.0.extract.shift = lshr i32 %4, 16
  %.sroa.11.0.extract.trunc = trunc nuw i32 %.sroa.11.0.extract.shift to i16
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not48 = icmp eq i32 %6, 0
  br i1 %.not48, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %12
  %.045 = phi i32 [ %13, %12 ], [ 0, %2 ]
  %.sroa.0.044 = phi i8 [ %.sroa.0.1, %12 ], [ %.sroa.0.0.extract.trunc, %2 ]
  %.sroa.9.043 = phi i8 [ %.sroa.9.1, %12 ], [ %.sroa.9.0.extract.trunc, %2 ]
  %.sroa.11.042 = phi i16 [ %.sroa.11.1, %12 ], [ %.sroa.11.0.extract.trunc, %2 ]
  %.sroa.11.0.insert.ext = zext i16 %.sroa.11.042 to i32
  %.sroa.11.0.insert.shift = shl nuw i32 %.sroa.11.0.insert.ext, 16
  %.sroa.9.0.insert.ext = zext i8 %.sroa.9.043 to i32
  %.sroa.9.0.insert.shift = shl nuw nsw i32 %.sroa.9.0.insert.ext, 8
  %.sroa.9.0.insert.insert = or disjoint i32 %.sroa.9.0.insert.shift, %.sroa.11.0.insert.shift
  %.sroa.0.0.insert.ext = zext i8 %.sroa.0.044 to i32
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.9.0.insert.insert, %.sroa.0.0.insert.ext
  %.not = icmp eq i32 %.sroa.0.0.insert.insert, %.045
  br i1 %.not, label %7, label %12

7:                                                ; preds = %.lr.ph
  %8 = lshr i32 %.sroa.0.0.insert.ext, 1
  %9 = and i32 %8, 6
  %10 = or disjoint i32 %9, 1
  %11 = lshr i32 %.045, %10
  %.sroa.0.0.extract.trunc9 = trunc i32 %11 to i8
  %.sroa.9.0.extract.shift18 = lshr i32 %11, 8
  %.sroa.9.0.extract.trunc19 = trunc i32 %.sroa.9.0.extract.shift18 to i8
  %.sroa.11.0.extract.shift30 = lshr i32 %11, 16
  %.sroa.11.0.extract.trunc31 = trunc nuw nsw i32 %.sroa.11.0.extract.shift30 to i16
  br label %12

12:                                               ; preds = %.lr.ph, %7
  %.sroa.11.1 = phi i16 [ %.sroa.11.0.extract.trunc31, %7 ], [ %.sroa.11.042, %.lr.ph ]
  %.sroa.9.1 = phi i8 [ %.sroa.9.0.extract.trunc19, %7 ], [ %.sroa.0.044, %.lr.ph ]
  %.sroa.0.1 = phi i8 [ %.sroa.0.0.extract.trunc9, %7 ], [ %.sroa.9.043, %.lr.ph ]
  %13 = add nuw i32 %.045, 2
  %14 = icmp ult i32 %13, %6
  br i1 %14, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %12, %2
  %.sroa.11.0.lcssa = phi i16 [ %.sroa.11.0.extract.trunc, %2 ], [ %.sroa.11.1, %12 ]
  %.sroa.9.0.lcssa = phi i8 [ %.sroa.9.0.extract.trunc, %2 ], [ %.sroa.9.1, %12 ]
  %.sroa.0.0.lcssa = phi i8 [ %.sroa.0.0.extract.trunc, %2 ], [ %.sroa.0.1, %12 ]
  %.sroa.11.0.insert.ext33 = zext i16 %.sroa.11.0.lcssa to i32
  %.sroa.11.0.insert.shift34 = shl nuw i32 %.sroa.11.0.insert.ext33, 16
  %.sroa.9.0.insert.ext21 = zext i8 %.sroa.9.0.lcssa to i32
  %.sroa.9.0.insert.shift22 = shl nuw nsw i32 %.sroa.9.0.insert.ext21, 8
  %.sroa.9.0.insert.insert24 = or disjoint i32 %.sroa.9.0.insert.shift22, %.sroa.11.0.insert.shift34
  %.sroa.0.0.insert.ext11 = zext i8 %.sroa.0.0.lcssa to i32
  %.sroa.0.0.insert.insert13 = or disjoint i32 %.sroa.9.0.insert.insert24, %.sroa.0.0.insert.ext11
  %15 = or i32 %.sroa.0.0.insert.insert13, 595841640
  store i32 %15, ptr %1, align 4, !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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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