; 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 i32, align 4
  %8 = 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 4, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 1, 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
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %14

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

20:                                               ; preds = %14
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %62, %20
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds i32, ptr %23, i64 1
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = icmp ult i32 %22, %25
  br i1 %26, label %27, label %67

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 = load i32, ptr %6, align 4, !tbaa !9
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = lshr i32 %31, 4
  %33 = and i32 %32, 7
  %34 = zext i32 %33 to i64
  %35 = or i64 %34, 1
  %36 = trunc i64 %35 to i32
  %37 = shl i32 %30, %36
  %38 = icmp eq i32 %29, %37
  br i1 %38, label %62, label %39

39:                                               ; preds = %27
  %40 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %41 = getelementptr inbounds i8, ptr %40, i64 1
  %42 = load i8, ptr %41, align 1, !tbaa !11
  store i8 %42, ptr %8, align 1, !tbaa !11
  %43 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %44 = getelementptr inbounds i8, ptr %43, i64 2
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %47 = getelementptr inbounds i8, ptr %46, i64 1
  store i8 %45, ptr %47, align 1, !tbaa !11
  %48 = load i8, ptr %8, align 1, !tbaa !11
  %49 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %50 = getelementptr inbounds i8, ptr %49, i64 2
  store i8 %48, ptr %50, align 1, !tbaa !11
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds i8, ptr %51, i64 3
  %53 = load i8, ptr %52, align 1, !tbaa !11
  store i8 %53, ptr %8, align 1, !tbaa !11
  %54 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %55 = getelementptr inbounds i8, ptr %54, i64 0
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %58 = getelementptr inbounds i8, ptr %57, i64 3
  store i8 %56, ptr %58, align 1, !tbaa !11
  %59 = load i8, ptr %8, align 1, !tbaa !11
  %60 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %61 = getelementptr inbounds i8, ptr %60, i64 0
  store i8 %59, ptr %61, align 1, !tbaa !11
  br label %62

62:                                               ; preds = %39, %27
  %63 = load i32, ptr %6, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = add i64 %64, 2
  %66 = trunc i64 %65 to i32
  store i32 %66, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !12

67:                                               ; preds = %21
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = add i64 %69, 2
  %71 = trunc i64 %70 to i32
  store i32 %71, ptr %7, align 4, !tbaa !9
  br label %14, !llvm.loop !14

72:                                               ; preds = %14
  %73 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = or i32 %74, 955612895
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds i32, ptr %76, i64 0
  store i32 %75, ptr %77, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, 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"}
!14 = distinct !{!14, !13}


; 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.7.0.extract.shift = lshr i32 %4, 8
  %.sroa.7.0.extract.trunc = trunc i32 %.sroa.7.0.extract.shift to i8
  %.sroa.9.0.extract.shift = lshr i32 %4, 16
  %.sroa.9.0.extract.trunc = trunc i32 %.sroa.9.0.extract.shift to i8
  %.sroa.11.0.extract.shift = lshr i32 %4, 24
  %.sroa.11.0.extract.trunc = trunc nuw i32 %.sroa.11.0.extract.shift to i8
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %2, %17
  %.sroa.11.041 = phi i8 [ %.sroa.11.2, %17 ], [ %.sroa.11.0.extract.trunc, %2 ]
  %.040 = phi i32 [ %18, %17 ], [ 0, %2 ]
  %.sroa.0.039 = phi i8 [ %.sroa.0.2, %17 ], [ %.sroa.0.0.extract.trunc, %2 ]
  %.sroa.7.038 = phi i8 [ %.sroa.7.2, %17 ], [ %.sroa.7.0.extract.trunc, %2 ]
  %.sroa.9.037 = phi i8 [ %.sroa.9.2, %17 ], [ %.sroa.9.0.extract.trunc, %2 ]
  %7 = lshr i32 %.040, 4
  %8 = and i32 %7, 6
  %9 = or disjoint i32 %8, 1
  br label %10

10:                                               ; preds = %.preheader, %14
  %.sroa.11.136 = phi i8 [ %.sroa.11.041, %.preheader ], [ %.sroa.11.2, %14 ]
  %.03135 = phi i32 [ 0, %.preheader ], [ %15, %14 ]
  %.sroa.0.134 = phi i8 [ %.sroa.0.039, %.preheader ], [ %.sroa.0.2, %14 ]
  %.sroa.7.133 = phi i8 [ %.sroa.7.038, %.preheader ], [ %.sroa.7.2, %14 ]
  %.sroa.9.132 = phi i8 [ %.sroa.9.037, %.preheader ], [ %.sroa.9.2, %14 ]
  %.sroa.11.0.insert.ext = zext i8 %.sroa.11.136 to i32
  %.sroa.11.0.insert.shift = shl nuw i32 %.sroa.11.0.insert.ext, 24
  %.sroa.9.0.insert.ext = zext i8 %.sroa.9.132 to i32
  %.sroa.9.0.insert.shift = shl nuw nsw i32 %.sroa.9.0.insert.ext, 16
  %.sroa.9.0.insert.insert = or disjoint i32 %.sroa.11.0.insert.shift, %.sroa.9.0.insert.shift
  %.sroa.7.0.insert.ext = zext i8 %.sroa.7.133 to i32
  %.sroa.7.0.insert.shift = shl nuw nsw i32 %.sroa.7.0.insert.ext, 8
  %.sroa.7.0.insert.insert = or disjoint i32 %.sroa.9.0.insert.insert, %.sroa.7.0.insert.shift
  %.sroa.0.0.insert.ext = zext i8 %.sroa.0.134 to i32
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.7.0.insert.insert, %.sroa.0.0.insert.ext
  %11 = shl i32 %.03135, %9
  %12 = icmp eq i32 %.sroa.0.0.insert.insert, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  br label %14

14:                                               ; preds = %13, %10
  %.sroa.9.2 = phi i8 [ %.sroa.9.132, %10 ], [ %.sroa.7.133, %13 ]
  %.sroa.7.2 = phi i8 [ %.sroa.7.133, %10 ], [ %.sroa.9.132, %13 ]
  %.sroa.0.2 = phi i8 [ %.sroa.0.134, %10 ], [ %.sroa.11.136, %13 ]
  %.sroa.11.2 = phi i8 [ %.sroa.11.136, %10 ], [ %.sroa.0.134, %13 ]
  %15 = add nuw i32 %.03135, 2
  %16 = icmp ult i32 %15, %6
  br i1 %16, label %10, label %17, !llvm.loop !9

17:                                               ; preds = %14
  %18 = add nuw i32 %.040, 2
  %19 = icmp ult i32 %18, %6
  br i1 %19, label %.preheader, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %17, %2
  %.sroa.9.0.lcssa = phi i8 [ %.sroa.9.0.extract.trunc, %2 ], [ %.sroa.9.2, %17 ]
  %.sroa.7.0.lcssa = phi i8 [ %.sroa.7.0.extract.trunc, %2 ], [ %.sroa.7.2, %17 ]
  %.sroa.0.0.lcssa = phi i8 [ %.sroa.0.0.extract.trunc, %2 ], [ %.sroa.0.2, %17 ]
  %.sroa.11.0.lcssa = phi i8 [ %.sroa.11.0.extract.trunc, %2 ], [ %.sroa.11.2, %17 ]
  %.sroa.11.0.insert.ext24 = zext i8 %.sroa.11.0.lcssa to i32
  %.sroa.11.0.insert.shift25 = shl nuw i32 %.sroa.11.0.insert.ext24, 24
  %.sroa.9.0.insert.ext19 = zext i8 %.sroa.9.0.lcssa to i32
  %.sroa.9.0.insert.shift20 = shl nuw nsw i32 %.sroa.9.0.insert.ext19, 16
  %.sroa.9.0.insert.insert22 = or disjoint i32 %.sroa.11.0.insert.shift25, %.sroa.9.0.insert.shift20
  %.sroa.7.0.insert.ext14 = zext i8 %.sroa.7.0.lcssa to i32
  %.sroa.7.0.insert.shift15 = shl nuw nsw i32 %.sroa.7.0.insert.ext14, 8
  %.sroa.7.0.insert.insert17 = or disjoint i32 %.sroa.9.0.insert.insert22, %.sroa.7.0.insert.shift15
  %.sroa.0.0.insert.ext10 = zext i8 %.sroa.0.0.lcssa to i32
  %.sroa.0.0.insert.insert12 = or disjoint i32 %.sroa.7.0.insert.insert17, %.sroa.0.0.insert.ext10
  %20 = or i32 %.sroa.0.0.insert.insert12, 955612895
  store i32 %20, 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"}
!11 = distinct !{!11, !10}


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