; 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 i8, align 1
  %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 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 1, 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 i32, ptr %9, i64 0
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = xor i32 %11, 700325083
  %13 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %12, ptr %13, align 4, !tbaa !9
  %14 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = lshr i32 %15, 4
  %17 = and i32 %16, 1
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %86

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

25:                                               ; preds = %19
  %26 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = and i32 %27, 1
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %41

30:                                               ; preds = %25
  %31 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = lshr i32 %32, 3
  %34 = and i32 %33, 7
  %35 = zext i32 %34 to i64
  %36 = or i64 %35, 1
  %37 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = trunc i64 %36 to i32
  %40 = shl i32 %38, %39
  store i32 %40, ptr %37, align 4, !tbaa !9
  br label %53

41:                                               ; preds = %25
  %42 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %43 = getelementptr inbounds i8, ptr %42, i64 0
  %44 = load i8, ptr %43, align 1, !tbaa !11
  store i8 %44, ptr %6, align 1, !tbaa !11
  %45 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %46 = getelementptr inbounds i8, ptr %45, i64 3
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %49 = getelementptr inbounds i8, ptr %48, i64 0
  store i8 %47, ptr %49, align 1, !tbaa !11
  %50 = load i8, ptr %6, align 1, !tbaa !11
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds i8, ptr %51, i64 3
  store i8 %50, ptr %52, align 1, !tbaa !11
  br label %53

53:                                               ; preds = %41, %30
  br label %85

54:                                               ; preds = %19
  %55 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = lshr i32 %56, 3
  %58 = and i32 %57, 1
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %72

60:                                               ; preds = %54
  %61 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %62 = getelementptr inbounds i8, ptr %61, i64 0
  %63 = load i8, ptr %62, align 1, !tbaa !11
  store i8 %63, ptr %7, align 1, !tbaa !11
  %64 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %65 = getelementptr inbounds i8, ptr %64, i64 2
  %66 = load i8, ptr %65, align 1, !tbaa !11
  %67 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %68 = getelementptr inbounds i8, ptr %67, i64 0
  store i8 %66, ptr %68, align 1, !tbaa !11
  %69 = load i8, ptr %7, align 1, !tbaa !11
  %70 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %71 = getelementptr inbounds i8, ptr %70, i64 2
  store i8 %69, ptr %71, align 1, !tbaa !11
  br label %84

72:                                               ; preds = %54
  %73 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %74 = getelementptr inbounds i16, ptr %73, i64 0
  %75 = load i16, ptr %74, align 2, !tbaa !12
  store i16 %75, ptr %8, align 2, !tbaa !12
  %76 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %77 = getelementptr inbounds i16, ptr %76, i64 1
  %78 = load i16, ptr %77, align 2, !tbaa !12
  %79 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %80 = getelementptr inbounds i16, ptr %79, i64 0
  store i16 %78, ptr %80, align 2, !tbaa !12
  %81 = load i16, ptr %8, align 2, !tbaa !12
  %82 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %83 = getelementptr inbounds i16, ptr %82, i64 1
  store i16 %81, ptr %83, align 2, !tbaa !12
  br label %84

84:                                               ; preds = %72, %60
  br label %85

85:                                               ; preds = %84, %53
  br label %86

86:                                               ; preds = %85, %2
  %87 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = shl i32 %88, 3
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds i32, ptr %90, i64 0
  store i32 %89, ptr %91, align 4, !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 1, 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}


; 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 = xor i32 %3, 700325083
  %.sroa.0.sroa.17.0.extract.shift143176 = lshr i32 %4, 8
  %.sroa.17.0.extract.shift = lshr i32 %4, 16
  %sum.shift = lshr i32 %4, 24
  %5 = and i32 %4, 16
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %17, label %6

6:                                                ; preds = %2
  %7 = and i32 %3, 4
  %.not178 = icmp eq i32 %7, 0
  br i1 %.not178, label %15, label %8

8:                                                ; preds = %6
  %9 = and i32 %4, 1
  %.not180 = icmp eq i32 %9, 0
  br i1 %.not180, label %17, label %10

10:                                               ; preds = %8
  %11 = lshr i32 %4, 3
  %12 = and i32 %11, 6
  %13 = or disjoint i32 %12, 1
  %14 = shl i32 %4, %13
  %.sroa.0.sroa.17.0.extract.shift165181 = lshr i32 %14, 8
  %.sroa.17.0.extract.shift51 = lshr i32 %14, 16
  %sum.shift182 = lshr i32 %14, 24
  br label %17

15:                                               ; preds = %6
  %16 = and i32 %4, 8
  %.not179 = icmp eq i32 %16, 0
  %.sroa.0.sroa.17.0.extract.shift143176.sum.shift = select i1 %.not179, i32 %.sroa.0.sroa.17.0.extract.shift143176, i32 %sum.shift
  %sum.shift..sroa.0.sroa.17.0.extract.shift143176 = select i1 %.not179, i32 %sum.shift, i32 %.sroa.0.sroa.17.0.extract.shift143176
  br label %17

17:                                               ; preds = %15, %8, %10, %2
  %.sroa.17.sroa.0.0 = phi i32 [ %.sroa.17.0.extract.shift51, %10 ], [ %.sroa.17.0.extract.shift, %2 ], [ %.sroa.17.0.extract.shift, %8 ], [ %4, %15 ]
  %.sroa.17.sroa.15.0 = phi i32 [ %sum.shift182, %10 ], [ %sum.shift, %2 ], [ %4, %8 ], [ %.sroa.0.sroa.17.0.extract.shift143176.sum.shift, %15 ]
  %.sroa.0.sroa.0.0.in = phi i32 [ %14, %10 ], [ %4, %2 ], [ %sum.shift, %8 ], [ %.sroa.17.0.extract.shift, %15 ]
  %.sroa.0.sroa.17.0.in = phi i32 [ %.sroa.0.sroa.17.0.extract.shift165181, %10 ], [ %.sroa.0.sroa.17.0.extract.shift143176, %2 ], [ %.sroa.0.sroa.17.0.extract.shift143176, %8 ], [ %sum.shift..sroa.0.sroa.17.0.extract.shift143176, %15 ]
  %.sroa.0.sroa.17.0.insert.ext171 = shl nuw i32 %.sroa.0.sroa.17.0.in, 8
  %.sroa.0.sroa.0.0.insert.ext140 = and i32 %.sroa.0.sroa.0.0.in, 255
  %.sroa.0.sroa.17.0.insert.ext171.masked = and i32 %.sroa.0.sroa.17.0.insert.ext171, 65280
  %.sroa.0.0.insert.ext28 = or disjoint i32 %.sroa.0.sroa.17.0.insert.ext171.masked, %.sroa.0.sroa.0.0.insert.ext140
  %18 = shl i32 %.sroa.17.sroa.15.0, 27
  %.sroa.17.sroa.0.0.insert.ext81 = shl i32 %.sroa.17.sroa.0.0, 19
  %19 = and i32 %.sroa.17.sroa.0.0.insert.ext81, 133693440
  %20 = or disjoint i32 %18, %19
  %21 = shl nuw nsw i32 %.sroa.0.0.insert.ext28, 3
  %22 = or disjoint i32 %21, %20
  store i32 %22, 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass