; 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
  %8 = alloca i16, align 2
  %9 = 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
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #2
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds i32, ptr %10, i64 0
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = zext i32 %12 to i64
  %14 = add i64 %13, 914778474
  %15 = mul i64 %14, 2674260758
  %16 = trunc i64 %15 to i32
  %17 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %16, ptr %17, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %81, %2
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = icmp ult i64 %20, 1
  br i1 %21, label %22, label %84

22:                                               ; preds = %18
  %23 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = icmp ult i32 %24, %25
  br i1 %26, label %27, label %39

27:                                               ; preds = %22
  %28 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %29 = getelementptr inbounds i8, ptr %28, i64 0
  %30 = load i8, ptr %29, align 1, !tbaa !11
  store i8 %30, ptr %7, align 1, !tbaa !11
  %31 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %32 = getelementptr inbounds i8, ptr %31, i64 3
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %35 = getelementptr inbounds i8, ptr %34, i64 0
  store i8 %33, ptr %35, align 1, !tbaa !11
  %36 = load i8, ptr %7, align 1, !tbaa !11
  %37 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %38 = getelementptr inbounds i8, ptr %37, i64 3
  store i8 %36, ptr %38, align 1, !tbaa !11
  br label %39

39:                                               ; preds = %27, %22
  %40 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp ule i32 %41, %42
  br i1 %43, label %44, label %56

44:                                               ; preds = %39
  %45 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %46 = getelementptr inbounds i16, ptr %45, i64 0
  %47 = load i16, ptr %46, align 2, !tbaa !12
  store i16 %47, ptr %8, align 2, !tbaa !12
  %48 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %49 = getelementptr inbounds i16, ptr %48, i64 1
  %50 = load i16, ptr %49, align 2, !tbaa !12
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds i16, ptr %51, i64 0
  store i16 %50, ptr %52, align 2, !tbaa !12
  %53 = load i16, ptr %8, align 2, !tbaa !12
  %54 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %55 = getelementptr inbounds i16, ptr %54, i64 1
  store i16 %53, ptr %55, align 2, !tbaa !12
  br label %81

56:                                               ; preds = %39
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = zext i32 %57 to i64
  %59 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %58
  %60 = getelementptr inbounds i8, ptr %59, i64 3
  %61 = load i8, ptr %60, align 1, !tbaa !11
  store i8 %61, ptr %9, align 1, !tbaa !11
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %63
  %65 = getelementptr inbounds i8, ptr %64, i64 1
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %68
  %70 = getelementptr inbounds i8, ptr %69, i64 3
  store i8 %66, ptr %70, align 1, !tbaa !11
  %71 = load i8, ptr %9, align 1, !tbaa !11
  %72 = load i32, ptr %6, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %73
  %75 = getelementptr inbounds i8, ptr %74, i64 1
  store i8 %71, ptr %75, align 1, !tbaa !11
  %76 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = add i32 %79, %77
  store i32 %80, ptr %78, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %56, %44
  %82 = load i32, ptr %6, align 4, !tbaa !9
  %83 = add i32 %82, 1
  store i32 %83, ptr %6, align 4, !tbaa !9
  br label %18, !llvm.loop !14

84:                                               ; preds = %18
  %85 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = add i64 %87, 289949124
  %89 = add i64 %88, 1674481414
  %90 = trunc i64 %89 to i32
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds i32, ptr %91, i64 0
  store i32 %90, ptr %92, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #2
  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 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 = !{!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 nofree norecurse nosync nounwind willreturn 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 = mul i32 %3, -1620706538
  %5 = add i32 %4, -440795876
  %.sroa.0.sroa.9.0.extract.shift7591 = lshr i32 %5, 8
  %.sroa.11.0.extract.shift = lshr i32 %5, 16
  %sum.shift = lshr i32 %5, 24
  %6 = trunc i32 %.sroa.0.sroa.9.0.extract.shift7591 to i16
  %.sroa.0.sroa.9.0.insert.ext77 = shl i16 %6, 8
  %7 = trunc i32 %5 to i16
  %.sroa.0.sroa.0.0.insert.ext65 = and i16 %7, 254
  %.sroa.0.sroa.0.0.insert.insert67 = or disjoint i16 %.sroa.0.sroa.9.0.insert.ext77, %.sroa.0.sroa.0.0.insert.ext65
  %8 = trunc nuw nsw i32 %sum.shift to i16
  %.sroa.11.sroa.9.0.insert.shift = shl nuw i16 %8, 8
  %9 = trunc nuw i32 %.sroa.11.0.extract.shift to i16
  %.sroa.11.sroa.0.0.insert.ext = and i16 %9, 255
  %.sroa.11.sroa.0.0.insert.insert = or disjoint i16 %.sroa.11.sroa.9.0.insert.shift, %.sroa.11.sroa.0.0.insert.ext
  %.sroa.11.0.insert.ext = zext i16 %.sroa.11.sroa.0.0.insert.insert to i32
  %.sroa.11.0.insert.shift = shl nuw i32 %.sroa.11.0.insert.ext, 16
  %.sroa.0.0.insert.ext = zext i16 %.sroa.0.sroa.0.0.insert.insert67 to i32
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.11.0.insert.shift, %.sroa.0.0.insert.ext
  %.not.not = icmp eq i32 %.sroa.0.0.insert.insert, 0
  br i1 %.not.not, label %16, label %10

10:                                               ; preds = %2
  %.sroa.0.sroa.0.0.insert.insert70 = or disjoint i16 %.sroa.11.sroa.9.0.insert.shift, %.sroa.0.sroa.0.0.insert.ext65
  %.sroa.11.sroa.0.0.insert.insert39 = or disjoint i16 %.sroa.11.sroa.0.0.insert.ext, %.sroa.0.sroa.9.0.insert.ext77
  %.sroa.11.0.insert.ext25 = zext i16 %.sroa.11.sroa.0.0.insert.insert39 to i32
  %.sroa.0.0.insert.ext15 = zext i16 %.sroa.0.sroa.0.0.insert.insert70 to i32
  %11 = shl i32 %.sroa.11.0.insert.ext25, 17
  %12 = shl nuw nsw i32 %.sroa.0.0.insert.ext15, 1
  %13 = or disjoint i32 %11, %12
  %.sroa.0.sroa.9.0.extract.shift8593 = lshr i16 %.sroa.0.sroa.0.0.insert.insert70, 7
  %.sroa.11.0.extract.shift29 = lshr i32 %13, 16
  %sum.shift94 = lshr i32 %11, 24
  %14 = and i16 %.sroa.0.sroa.9.0.extract.shift8593, 255
  %15 = zext nneg i16 %14 to i32
  br label %16

16:                                               ; preds = %10, %2
  %.sroa.0.sroa.9.0.lcssa = phi i32 [ %15, %10 ], [ %sum.shift, %2 ]
  %.sroa.0.sroa.0.0.lcssa.in = phi i32 [ %12, %10 ], [ %.sroa.11.0.extract.shift, %2 ]
  %.sroa.11.sroa.9.0.lcssa.in = phi i32 [ %sum.shift94, %10 ], [ %.sroa.0.sroa.9.0.extract.shift7591, %2 ]
  %.sroa.11.sroa.0.0.lcssa.in = phi i32 [ %.sroa.11.0.extract.shift29, %10 ], [ %5, %2 ]
  %.sroa.0.sroa.9.0.insert.shift88 = shl nuw nsw i32 %.sroa.0.sroa.9.0.lcssa, 8
  %.sroa.0.sroa.0.0.insert.ext72 = and i32 %.sroa.0.sroa.0.0.lcssa.in, 255
  %.sroa.11.sroa.9.0.insert.ext54 = shl i32 %.sroa.11.sroa.9.0.lcssa.in, 24
  %.sroa.11.sroa.0.0.insert.ext41 = shl i32 %.sroa.11.sroa.0.0.lcssa.in, 16
  %17 = and i32 %.sroa.11.sroa.0.0.insert.ext41, 16711680
  %.sroa.11.0.insert.shift33 = add nuw nsw i32 %.sroa.0.sroa.0.0.insert.ext72, 1964430538
  %.sroa.0.sroa.0.0.insert.insert74 = add nuw nsw i32 %.sroa.11.0.insert.shift33, %.sroa.0.sroa.9.0.insert.shift88
  %.sroa.0.0.insert.insert22 = add i32 %.sroa.0.sroa.0.0.insert.insert74, %.sroa.11.sroa.9.0.insert.ext54
  %18 = add i32 %.sroa.0.0.insert.insert22, %17
  store i32 %18, ptr %1, align 4, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn 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"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass