; 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
  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
  %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 = zext i32 %11 to i64
  %13 = sub i64 %12, 51238316
  %14 = sub i64 %13, 339126204
  %15 = trunc i64 %14 to i32
  %16 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %15, ptr %16, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %74, %2
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds i32, ptr %19, i64 1
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = icmp ult i32 %18, %21
  br i1 %22, label %23, label %77

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

28:                                               ; preds = %23
  %29 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp ule i32 %30, %31
  br i1 %32, label %33, label %53

33:                                               ; preds = %28
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %35
  %37 = getelementptr inbounds i8, ptr %36, i64 1
  %38 = load i8, ptr %37, align 1, !tbaa !11
  store i8 %38, ptr %7, align 1, !tbaa !11
  %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 = getelementptr inbounds i8, ptr %41, i64 3
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %45
  %47 = getelementptr inbounds i8, ptr %46, i64 1
  store i8 %43, ptr %47, align 1, !tbaa !11
  %48 = load i8, ptr %7, align 1, !tbaa !11
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = zext i32 %49 to i64
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %50
  %52 = getelementptr inbounds i8, ptr %51, i64 3
  store i8 %48, ptr %52, align 1, !tbaa !11
  br label %61

53:                                               ; preds = %28
  %54 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = load i32, ptr %6, align 4, !tbaa !9
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = sub i32 %59, %55
  store i32 %60, ptr %58, align 4, !tbaa !9
  br label %61

61:                                               ; preds = %53, %33
  br label %74

62:                                               ; preds = %23
  %63 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %64 = getelementptr inbounds i16, ptr %63, i64 1
  %65 = load i16, ptr %64, align 2, !tbaa !12
  store i16 %65, ptr %8, align 2, !tbaa !12
  %66 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %67 = getelementptr inbounds i16, ptr %66, i64 0
  %68 = load i16, ptr %67, align 2, !tbaa !12
  %69 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %70 = getelementptr inbounds i16, ptr %69, i64 1
  store i16 %68, ptr %70, align 2, !tbaa !12
  %71 = load i16, ptr %8, align 2, !tbaa !12
  %72 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %73 = getelementptr inbounds i16, ptr %72, i64 0
  store i16 %71, ptr %73, align 2, !tbaa !12
  br label %74

74:                                               ; preds = %62, %61
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = add i32 %75, 1
  store i32 %76, ptr %6, align 4, !tbaa !9
  br label %17, !llvm.loop !14

77:                                               ; preds = %17
  %78 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = xor i64 %80, 49080916
  %82 = trunc i64 %81 to i32
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds i32, ptr %83, i64 0
  store i32 %82, ptr %84, 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 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: 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, -390364520
  %.sroa.0.0.extract.trunc = trunc i32 %4 to i16
  %.sroa.9.0.extract.shift = lshr i32 %4, 16
  %.sroa.9.0.extract.trunc = trunc nuw i32 %.sroa.9.0.extract.shift to i16
  %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 %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %2
  %xtraiter = and i32 %6, 1
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %6, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %.039 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %11, %.lr.ph ]
  %.sroa.0.038 = phi i16 [ %.sroa.0.0.extract.trunc, %.lr.ph.preheader.new ], [ %spec.select36.1, %.lr.ph ]
  %.sroa.9.037 = phi i16 [ %.sroa.9.0.extract.trunc, %.lr.ph.preheader.new ], [ %spec.select.1, %.lr.ph ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %.sroa.9.0.insert.ext = zext i16 %.sroa.9.037 to i32
  %.sroa.9.0.insert.shift = shl nuw i32 %.sroa.9.0.insert.ext, 16
  %.sroa.0.0.insert.ext = zext i16 %.sroa.0.038 to i32
  %.sroa.0.0.insert.insert = or disjoint i32 %.sroa.9.0.insert.shift, %.sroa.0.0.insert.ext
  %8 = icmp ugt i32 %.sroa.0.0.insert.insert, %.039
  %spec.select = select i1 %8, i16 0, i16 %.sroa.0.038
  %spec.select36 = select i1 %8, i16 0, i16 %.sroa.9.037
  %9 = or disjoint i32 %.039, 1
  %.sroa.9.0.insert.ext.1 = zext i16 %spec.select to i32
  %.sroa.9.0.insert.shift.1 = shl nuw i32 %.sroa.9.0.insert.ext.1, 16
  %.sroa.0.0.insert.ext.1 = zext i16 %spec.select36 to i32
  %.sroa.0.0.insert.insert.1 = or disjoint i32 %.sroa.9.0.insert.shift.1, %.sroa.0.0.insert.ext.1
  %10 = icmp ugt i32 %.sroa.0.0.insert.insert.1, %9
  %spec.select.1 = select i1 %10, i16 0, i16 %spec.select36
  %spec.select36.1 = select i1 %10, i16 0, i16 %spec.select
  %11 = add nuw i32 %.039, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %spec.select.lcssa.ph = phi i16 [ poison, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %spec.select36.lcssa.ph = phi i16 [ poison, %.lr.ph.preheader ], [ %spec.select36.1, %.lr.ph ]
  %.039.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %11, %.lr.ph ]
  %.sroa.0.038.unr = phi i16 [ %.sroa.0.0.extract.trunc, %.lr.ph.preheader ], [ %spec.select36.1, %.lr.ph ]
  %.sroa.9.037.unr = phi i16 [ %.sroa.9.0.extract.trunc, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %.sroa.9.0.insert.ext.epil = zext i16 %.sroa.9.037.unr to i32
  %.sroa.9.0.insert.shift.epil = shl nuw i32 %.sroa.9.0.insert.ext.epil, 16
  %.sroa.0.0.insert.ext.epil = zext i16 %.sroa.0.038.unr to i32
  %.sroa.0.0.insert.insert.epil = or disjoint i32 %.sroa.9.0.insert.shift.epil, %.sroa.0.0.insert.ext.epil
  %12 = icmp ugt i32 %.sroa.0.0.insert.insert.epil, %.039.unr
  %spec.select.epil = select i1 %12, i16 0, i16 %.sroa.0.038.unr
  %spec.select36.epil = select i1 %12, i16 0, i16 %.sroa.9.037.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %2
  %.sroa.9.0.lcssa = phi i16 [ %.sroa.9.0.extract.trunc, %2 ], [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph.epil ]
  %.sroa.0.0.lcssa = phi i16 [ %.sroa.0.0.extract.trunc, %2 ], [ %spec.select36.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select36.epil, %.lr.ph.epil ]
  %.sroa.9.0.insert.ext25 = zext i16 %.sroa.9.0.lcssa to i32
  %.sroa.9.0.insert.shift26 = shl nuw i32 %.sroa.9.0.insert.ext25, 16
  %.sroa.0.0.insert.ext16 = zext i16 %.sroa.0.0.lcssa to i32
  %.sroa.0.0.insert.insert18 = or disjoint i32 %.sroa.9.0.insert.shift26, %.sroa.0.0.insert.ext16
  %13 = xor i32 %.sroa.0.0.insert.insert18, 49080916
  store i32 %13, 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"}


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