; 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
  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
  %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 = add i32 %10, 1373777115
  %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 %7, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %60, %2
  %14 = load i32, ptr %7, 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 %63

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

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

26:                                               ; preds = %20
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %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, 1
  %34 = and i32 %33, 15
  %35 = zext i32 %34 to i64
  %36 = or i64 %35, 1
  %37 = trunc i64 %36 to i32
  %38 = shl i32 %30, %37
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = lshr i32 %44, 1
  %46 = and i32 %45, 15
  %47 = zext i32 %46 to i64
  %48 = or i64 %47, 1
  %49 = sub i64 32, %48
  %50 = trunc i64 %49 to i32
  %51 = lshr i32 %42, %50
  %52 = or i32 %38, %51
  %53 = and i32 %52, 31
  %54 = shl i32 %53, 4
  %55 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = or i32 %56, %54
  store i32 %57, ptr %55, align 4, !tbaa !9
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = add i32 %58, 1
  store i32 %59, ptr %6, align 4, !tbaa !9
  br label %20, !llvm.loop !11

60:                                               ; preds = %20
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = add i32 %61, 1
  store i32 %62, ptr %7, align 4, !tbaa !9
  br label %13, !llvm.loop !13

63:                                               ; preds = %13
  %64 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %66 = lshr i32 %65, 11
  %67 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = shl i32 %68, 21
  %70 = or i32 %66, %69
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds i32, ptr %71, i64 0
  store i32 %70, ptr %72, align 4, !tbaa !9
  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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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 = add i32 %3, 1373777115
  %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

.preheader.preheader:                             ; preds = %2
  %xtraiter = and i32 %6, 1
  %7 = icmp eq i32 %6, 1
  %unroll_iter = and i32 %6, -2
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %29
  %.014 = phi i32 [ %30, %29 ], [ 0, %.preheader.preheader ]
  %.sroa.0.013 = phi i32 [ %.lcssa, %29 ], [ %4, %.preheader.preheader ]
  br i1 %7, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %.sroa.0.111 = phi i32 [ %21, %.preheader.new ], [ %.sroa.0.013, %.preheader ]
  %niter = phi i32 [ %niter.next.1, %.preheader.new ], [ 0, %.preheader ]
  %8 = lshr i32 %.sroa.0.111, 1
  %9 = and i32 %8, 14
  %10 = or disjoint i32 %9, 1
  %11 = tail call i32 @llvm.fshl.i32(i32 %.sroa.0.111, i32 %.sroa.0.111, i32 %10)
  %12 = shl i32 %11, 4
  %13 = and i32 %12, 496
  %14 = or i32 %13, %.sroa.0.111
  %15 = lshr i32 %14, 1
  %16 = and i32 %15, 14
  %17 = or disjoint i32 %16, 1
  %18 = tail call i32 @llvm.fshl.i32(i32 %14, i32 %14, i32 %17)
  %19 = shl i32 %18, 4
  %20 = and i32 %19, 496
  %21 = or i32 %20, %14
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.unr-lcssa, label %.preheader.new, !llvm.loop !9

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.lcssa.ph = phi i32 [ poison, %.preheader ], [ %21, %.preheader.new ]
  %.sroa.0.111.unr = phi i32 [ %.sroa.0.013, %.preheader ], [ %21, %.preheader.new ]
  br i1 %lcmp.mod.not, label %29, label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %22 = lshr i32 %.sroa.0.111.unr, 1
  %23 = and i32 %22, 14
  %24 = or disjoint i32 %23, 1
  %25 = tail call i32 @llvm.fshl.i32(i32 %.sroa.0.111.unr, i32 %.sroa.0.111.unr, i32 %24)
  %26 = shl i32 %25, 4
  %27 = and i32 %26, 496
  %28 = or i32 %27, %.sroa.0.111.unr
  br label %29

29:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %.unr-lcssa ], [ %28, %.epilog-lcssa ]
  %30 = add nuw i32 %.014, 1
  %exitcond15.not = icmp eq i32 %30, %6
  br i1 %exitcond15.not, label %._crit_edge, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %29, %2
  %.sroa.0.0.lcssa = phi i32 [ %4, %2 ], [ %.lcssa, %29 ]
  %31 = tail call i32 @llvm.fshl.i32(i32 %.sroa.0.0.lcssa, i32 %.sroa.0.0.lcssa, i32 21)
  store i32 %31, ptr %1, align 4, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #1

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" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass