; 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 i32], align 4
  %6 = alloca i16, align 2
  %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 2, 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 = zext i32 %10 to i64
  %12 = add i64 %11, 51238316
  %13 = add i64 %12, 274866410
  %14 = trunc i64 %13 to i32
  %15 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %14, ptr %15, align 4, !tbaa !9
  %16 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = lshr i32 %17, 4
  %19 = and i32 %18, 1
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %83

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

27:                                               ; preds = %21
  %28 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = lshr i32 %29, 2
  %31 = and i32 %30, 1
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %39

33:                                               ; preds = %27
  %34 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = add i32 %37, %35
  store i32 %38, ptr %36, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %33, %27
  br label %82

40:                                               ; preds = %21
  %41 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = lshr i32 %42, 2
  %44 = and i32 %43, 1
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %69

46:                                               ; preds = %40
  %47 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i16, ptr %47, i64 1
  %49 = load i16, ptr %48, align 2, !tbaa !11
  store i16 %49, ptr %6, align 2, !tbaa !11
  %50 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %51 = getelementptr inbounds i16, ptr %50, i64 0
  %52 = load i16, ptr %51, align 2, !tbaa !11
  %53 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %54 = getelementptr inbounds i16, ptr %53, i64 1
  store i16 %52, ptr %54, align 2, !tbaa !11
  %55 = load i16, ptr %6, align 2, !tbaa !11
  %56 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %57 = getelementptr inbounds i16, ptr %56, i64 0
  store i16 %55, ptr %57, align 2, !tbaa !11
  %58 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %59 = getelementptr inbounds i16, ptr %58, i64 0
  %60 = load i16, ptr %59, align 2, !tbaa !11
  store i16 %60, ptr %6, align 2, !tbaa !11
  %61 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %62 = getelementptr inbounds i16, ptr %61, i64 1
  %63 = load i16, ptr %62, align 2, !tbaa !11
  %64 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %65 = getelementptr inbounds i16, ptr %64, i64 0
  store i16 %63, ptr %65, align 2, !tbaa !11
  %66 = load i16, ptr %6, align 2, !tbaa !11
  %67 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %68 = getelementptr inbounds i16, ptr %67, i64 1
  store i16 %66, ptr %68, align 2, !tbaa !11
  br label %81

69:                                               ; preds = %40
  %70 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %71 = getelementptr inbounds i8, ptr %70, i64 2
  %72 = load i8, ptr %71, align 1, !tbaa !13
  store i8 %72, ptr %7, align 1, !tbaa !13
  %73 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %74 = getelementptr inbounds i8, ptr %73, i64 1
  %75 = load i8, ptr %74, align 1, !tbaa !13
  %76 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %77 = getelementptr inbounds i8, ptr %76, i64 2
  store i8 %75, ptr %77, align 1, !tbaa !13
  %78 = load i8, ptr %7, align 1, !tbaa !13
  %79 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %80 = getelementptr inbounds i8, ptr %79, i64 1
  store i8 %78, ptr %80, align 1, !tbaa !13
  br label %81

81:                                               ; preds = %69, %46
  br label %82

82:                                               ; preds = %81, %39
  br label %83

83:                                               ; preds = %82, %2
  %84 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %85 = load i32, ptr %84, align 4, !tbaa !9
  %86 = zext i32 %85 to i64
  %87 = add i64 %86, 629089775
  %88 = add i64 %87, 551229842
  %89 = trunc i64 %88 to i32
  %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 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 2, 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.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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !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 = add i32 %3, 326104726
  %.sroa.0.sroa.15.0.extract.shift163196 = lshr i32 %4, 8
  %.sroa.17.0.extract.shift = lshr i32 %4, 16
  %5 = and i32 %4, 16
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %13, label %6

6:                                                ; preds = %2
  %7 = and i32 %4, 8
  %.not198 = icmp eq i32 %7, 0
  %8 = and i32 %4, 4
  %.not199 = icmp eq i32 %8, 0
  br i1 %.not198, label %12, label %9

9:                                                ; preds = %6
  br i1 %.not199, label %13, label %10

10:                                               ; preds = %9
  %11 = shl i32 %4, 1
  %.sroa.0.sroa.15.0.extract.shift185201 = lshr i32 %11, 8
  %.sroa.17.0.extract.shift51 = lshr i32 %11, 16
  br label %13

12:                                               ; preds = %6
  %.sroa.0.sroa.15.0.extract.shift163196..sroa.17.0.extract.shift = select i1 %.not199, i32 %.sroa.0.sroa.15.0.extract.shift163196, i32 %.sroa.17.0.extract.shift
  %.sroa.17.0.extract.shift..sroa.0.sroa.15.0.extract.shift163196 = select i1 %.not199, i32 %.sroa.17.0.extract.shift, i32 %.sroa.0.sroa.15.0.extract.shift163196
  br label %13

13:                                               ; preds = %12, %10, %9, %2
  %.sroa.17.sroa.17.0.in.in = phi i32 [ %11, %10 ], [ %4, %9 ], [ %4, %2 ], [ %4, %12 ]
  %.sroa.17.sroa.0.0 = phi i32 [ %.sroa.17.0.extract.shift51, %10 ], [ %.sroa.17.0.extract.shift, %9 ], [ %.sroa.17.0.extract.shift, %2 ], [ %.sroa.0.sroa.15.0.extract.shift163196..sroa.17.0.extract.shift, %12 ]
  %.sroa.0.sroa.15.0.in = phi i32 [ %.sroa.0.sroa.15.0.extract.shift185201, %10 ], [ %.sroa.0.sroa.15.0.extract.shift163196, %9 ], [ %.sroa.0.sroa.15.0.extract.shift163196, %2 ], [ %.sroa.17.0.extract.shift..sroa.0.sroa.15.0.extract.shift163196, %12 ]
  %.sroa.0.sroa.15.0.insert.ext191 = shl nuw i32 %.sroa.0.sroa.15.0.in, 8
  %.sroa.0.sroa.0.0.insert.ext154 = and i32 %.sroa.17.sroa.17.0.in.in, 255
  %.sroa.17.sroa.0.0.insert.ext81 = shl i32 %.sroa.17.sroa.0.0, 16
  %.sroa.17.sroa.0.0.insert.insert83204 = and i32 %.sroa.17.sroa.0.0.insert.ext81, 16711680
  %.sroa.17.sroa.17.0.in.in.mask = and i32 %.sroa.17.sroa.17.0.in.in, -16777216
  %.sroa.17.0.insert.shift60 = or disjoint i32 %.sroa.17.sroa.17.0.in.in.mask, %.sroa.17.sroa.0.0.insert.insert83204
  %.sroa.0.sroa.15.0.insert.ext191.masked = and i32 %.sroa.0.sroa.15.0.insert.ext191, 65280
  %.sroa.0.0.insert.ext27 = or disjoint i32 %.sroa.0.sroa.0.0.insert.ext154, %.sroa.0.sroa.15.0.insert.ext191.masked
  %.sroa.0.0.insert.insert29 = add i32 %.sroa.17.0.insert.shift60, 1180319617
  %14 = add i32 %.sroa.0.0.insert.insert29, %.sroa.0.0.insert.ext27
  store i32 %14, 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