; 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 = zext i32 %11 to i64
  %13 = add i64 %12, 51238316
  %14 = add i64 %13, 274866410
  %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 %7, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %71, %2
  %18 = load i32, ptr %7, 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 %76

23:                                               ; preds = %17
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %30, %23
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds i32, ptr %26, i64 1
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = icmp ult i32 %25, %28
  br i1 %29, label %30, label %71

30:                                               ; preds = %24
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %32
  %34 = getelementptr inbounds i8, ptr %33, i64 1
  %35 = load i8, ptr %34, align 1, !tbaa !11
  store i8 %35, ptr %8, align 1, !tbaa !11
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %37
  %39 = getelementptr inbounds i8, ptr %38, i64 0
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %42
  %44 = getelementptr inbounds i8, ptr %43, i64 1
  store i8 %40, ptr %44, align 1, !tbaa !11
  %45 = load i8, ptr %8, align 1, !tbaa !11
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = zext i32 %46 to i64
  %48 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %47
  %49 = getelementptr inbounds i8, ptr %48, i64 0
  store i8 %45, ptr %49, align 1, !tbaa !11
  %50 = load i32, ptr %7, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %51
  %53 = getelementptr inbounds i8, ptr %52, i64 3
  %54 = load i8, ptr %53, align 1, !tbaa !11
  store i8 %54, ptr %8, align 1, !tbaa !11
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %56
  %58 = getelementptr inbounds i8, ptr %57, i64 1
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %61
  %63 = getelementptr inbounds i8, ptr %62, i64 3
  store i8 %59, ptr %63, align 1, !tbaa !11
  %64 = load i8, ptr %8, align 1, !tbaa !11
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 %66
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  store i8 %64, ptr %68, align 1, !tbaa !11
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = add i32 %69, 1
  store i32 %70, ptr %6, align 4, !tbaa !9
  br label %24, !llvm.loop !12

71:                                               ; preds = %24
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = zext i32 %72 to i64
  %74 = add i64 %73, 2
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %7, align 4, !tbaa !9
  br label %17, !llvm.loop !14

76:                                               ; preds = %17
  %77 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %78 = load i32, ptr %77, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = add i64 %79, 334155543
  %81 = trunc i64 %80 to i32
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds i32, ptr %82, i64 0
  store i32 %81, ptr %83, 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 = alloca [1 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #2
  %4 = load i32, ptr %0, align 4, !tbaa !5
  %5 = add i32 %4, 326104726
  store i32 %5, ptr %3, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = trunc i32 %5 to i8
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge, label %.preheader.preheader

.preheader.preheader:                             ; preds = %2
  %9 = zext i32 %7 to i64
  %10 = add i32 %7, 1
  %xtraiter = and i32 %10, 7
  %11 = icmp ult i32 %7, 7
  %unroll_iter = and i32 %10, -8
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.epilog-lcssa
  %indvars.iv = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next, %.epilog-lcssa ]
  %.lcssa192324 = phi i8 [ %8, %.preheader.preheader ], [ %.lcssa32, %.epilog-lcssa ]
  %12 = getelementptr inbounds [1 x i32], ptr %3, i64 0, i64 %indvars.iv
  %13 = getelementptr inbounds i8, ptr %12, i64 1
  %14 = getelementptr inbounds i8, ptr %12, i64 3
  %.promoted = load i8, ptr %13, align 1, !tbaa !9
  %.promoted20 = load i8, ptr %14, align 1, !tbaa !9
  br i1 %11, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader, %.preheader.new
  %15 = phi i8 [ %17, %.preheader.new ], [ %.promoted20, %.preheader ]
  %16 = phi i8 [ %15, %.preheader.new ], [ %.lcssa192324, %.preheader ]
  %17 = phi i8 [ %16, %.preheader.new ], [ %.promoted, %.preheader ]
  %niter = phi i32 [ %niter.next.7, %.preheader.new ], [ 0, %.preheader ]
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.unr-lcssa, label %.preheader.new, !llvm.loop !10

.unr-lcssa:                                       ; preds = %.preheader.new, %.preheader
  %.lcssa33.ph = phi i8 [ poison, %.preheader ], [ %16, %.preheader.new ]
  %.lcssa32.ph = phi i8 [ poison, %.preheader ], [ %17, %.preheader.new ]
  %.lcssa.ph = phi i8 [ poison, %.preheader ], [ %15, %.preheader.new ]
  %.unr = phi i8 [ %.promoted20, %.preheader ], [ %17, %.preheader.new ]
  %.unr34 = phi i8 [ %.lcssa192324, %.preheader ], [ %15, %.preheader.new ]
  %.unr35 = phi i8 [ %.promoted, %.preheader ], [ %16, %.preheader.new ]
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.epil.preheader

.epil.preheader:                                  ; preds = %.unr-lcssa, %.epil.preheader
  %18 = phi i8 [ %19, %.epil.preheader ], [ %.unr, %.unr-lcssa ]
  %19 = phi i8 [ %20, %.epil.preheader ], [ %.unr34, %.unr-lcssa ]
  %20 = phi i8 [ %18, %.epil.preheader ], [ %.unr35, %.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %.unr-lcssa ]
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.epil.preheader, !llvm.loop !12

.epilog-lcssa:                                    ; preds = %.epil.preheader, %.unr-lcssa
  %.lcssa33 = phi i8 [ %.lcssa33.ph, %.unr-lcssa ], [ %18, %.epil.preheader ]
  %.lcssa32 = phi i8 [ %.lcssa32.ph, %.unr-lcssa ], [ %19, %.epil.preheader ]
  %.lcssa = phi i8 [ %.lcssa.ph, %.unr-lcssa ], [ %20, %.epil.preheader ]
  store i8 %.lcssa, ptr %13, align 1, !tbaa !9
  store i8 %.lcssa33, ptr %14, align 1, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %21 = icmp ult i64 %indvars.iv.next, %9
  br i1 %21, label %.preheader, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.epilog-lcssa, %2
  %.lcssa1923.lcssa = phi i8 [ %8, %2 ], [ %.lcssa32, %.epilog-lcssa ]
  store i8 %.lcssa1923.lcssa, ptr %3, align 4, !tbaa !9
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = add i32 %22, 334155543
  store i32 %23, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #2
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !11}


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