; 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 i64], align 8
  %6 = alloca i64, align 8
  %7 = alloca i16, align 2
  %8 = alloca i16, align 2
  %9 = 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 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #2
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds i64, ptr %10, i64 0
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = add i64 %12, -10089659
  %14 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %13, ptr %14, align 8, !tbaa !9
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %94, %2
  %16 = load i64, ptr %6, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds i64, ptr %17, i64 1
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = icmp ult i64 %16, %19
  br i1 %20, label %21, label %97

21:                                               ; preds = %15
  %22 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp ugt i64 %23, %24
  br i1 %25, label %26, label %32

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = add i64 %30, %28
  store i64 %31, ptr %29, align 8, !tbaa !9
  br label %46

32:                                               ; preds = %21
  %33 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %36 = load i64, ptr %35, align 8, !tbaa !9
  %37 = add i64 %34, %36
  %38 = load i64, ptr %6, align 8, !tbaa !9
  %39 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %38
  store i64 %37, ptr %39, align 8, !tbaa !9
  %40 = load i64, ptr %6, align 8, !tbaa !9
  %41 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = add i64 %44, %42
  store i64 %45, ptr %43, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %32, %26
  %47 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %48 = load i64, ptr %47, align 8, !tbaa !9
  %49 = load i64, ptr %6, align 8, !tbaa !9
  %50 = icmp ne i64 %48, %49
  br i1 %50, label %51, label %71

51:                                               ; preds = %46
  %52 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = add i64 %53, %56
  %58 = load i64, ptr %6, align 8, !tbaa !9
  %59 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %58
  store i64 %57, ptr %59, align 8, !tbaa !9
  %60 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %61 = getelementptr inbounds i16, ptr %60, i64 1
  %62 = load i16, ptr %61, align 2, !tbaa !11
  store i16 %62, ptr %7, align 2, !tbaa !11
  %63 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %64 = getelementptr inbounds i16, ptr %63, i64 3
  %65 = load i16, ptr %64, align 2, !tbaa !11
  %66 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %67 = getelementptr inbounds i16, ptr %66, i64 1
  store i16 %65, ptr %67, align 2, !tbaa !11
  %68 = load i16, ptr %7, align 2, !tbaa !11
  %69 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %70 = getelementptr inbounds i16, ptr %69, i64 3
  store i16 %68, ptr %70, align 2, !tbaa !11
  br label %94

71:                                               ; preds = %46
  %72 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %73 = getelementptr inbounds i16, ptr %72, i64 2
  %74 = load i16, ptr %73, align 2, !tbaa !11
  store i16 %74, ptr %8, align 2, !tbaa !11
  %75 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %76 = getelementptr inbounds i16, ptr %75, i64 3
  %77 = load i16, ptr %76, align 2, !tbaa !11
  %78 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %79 = getelementptr inbounds i16, ptr %78, i64 2
  store i16 %77, ptr %79, align 2, !tbaa !11
  %80 = load i16, ptr %8, align 2, !tbaa !11
  %81 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %82 = getelementptr inbounds i16, ptr %81, i64 3
  store i16 %80, ptr %82, align 2, !tbaa !11
  %83 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %84 = getelementptr inbounds i8, ptr %83, i64 2
  %85 = load i8, ptr %84, align 1, !tbaa !13
  store i8 %85, ptr %9, align 1, !tbaa !13
  %86 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %87 = getelementptr inbounds i8, ptr %86, i64 0
  %88 = load i8, ptr %87, align 1, !tbaa !13
  %89 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %90 = getelementptr inbounds i8, ptr %89, i64 2
  store i8 %88, ptr %90, align 1, !tbaa !13
  %91 = load i8, ptr %9, align 1, !tbaa !13
  %92 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %93 = getelementptr inbounds i8, ptr %92, i64 0
  store i8 %91, ptr %93, align 1, !tbaa !13
  br label %94

94:                                               ; preds = %71, %51
  %95 = load i64, ptr %6, align 8, !tbaa !9
  %96 = add i64 %95, 2
  store i64 %96, ptr %6, align 8, !tbaa !9
  br label %15, !llvm.loop !14

97:                                               ; preds = %15
  %98 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = sub i64 %99, 360314520
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds i64, ptr %101, i64 0
  store i64 %100, ptr %102, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !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 i64, ptr %0, align 8, !tbaa !5
  %4 = add i64 %3, -10089659
  %.sroa.1040.0.extract.shift = lshr i64 %4, 16
  %.sroa.1040.sroa.12.0.extract.shift115 = lshr i64 %4, 24
  %.sroa.14.0.extract.shift = lshr i64 %4, 32
  %.sroa.16.0.extract.shift = lshr i64 %4, 48
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %.not131 = icmp eq i64 %6, 0
  br i1 %.not131, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %13
  %.0125 = phi i64 [ %14, %13 ], [ 0, %2 ]
  %.sroa.0.0.in124 = phi i64 [ %.sroa.0.1.in, %13 ], [ %4, %2 ]
  %.sroa.10.0.in.in123 = phi i64 [ %.sroa.10.1.in.in, %13 ], [ %4, %2 ]
  %.sroa.14.0.in122 = phi i64 [ %.sroa.14.1.in, %13 ], [ %.sroa.14.0.extract.shift, %2 ]
  %.sroa.16.0121.in = phi i64 [ %.sroa.16.1.in, %13 ], [ %.sroa.16.0.extract.shift, %2 ]
  %.sroa.1040.sroa.0.0.in120 = phi i64 [ %.sroa.1040.sroa.0.1.in, %13 ], [ %.sroa.1040.0.extract.shift, %2 ]
  %.sroa.1040.sroa.12.0.in119 = phi i64 [ %.sroa.1040.sroa.12.1.in, %13 ], [ %.sroa.1040.sroa.12.0.extract.shift115, %2 ]
  %.sroa.16.0.insert.ext = shl i64 %.sroa.16.0121.in, 48
  %.sroa.14.0.insert.ext = shl nuw i64 %.sroa.14.0.in122, 32
  %.sroa.14.0.insert.shift = and i64 %.sroa.14.0.insert.ext, 281470681743360
  %.sroa.14.0.insert.insert = or disjoint i64 %.sroa.14.0.insert.shift, %.sroa.16.0.insert.ext
  %.sroa.1040.sroa.12.0.insert.ext = shl nuw i64 %.sroa.1040.sroa.12.0.in119, 24
  %7 = and i64 %.sroa.1040.sroa.12.0.insert.ext, 4278190080
  %.sroa.1040.sroa.0.0.insert.ext = shl i64 %.sroa.1040.sroa.0.0.in120, 16
  %8 = and i64 %.sroa.1040.sroa.0.0.insert.ext, 16711680
  %.sroa.1040.0.insert.shift = or disjoint i64 %7, %8
  %.sroa.1040.0.insert.insert = or disjoint i64 %.sroa.14.0.insert.insert, %.sroa.1040.0.insert.shift
  %.sroa.10.0.insert.ext = and i64 %.sroa.10.0.in.in123, 65280
  %.sroa.10.0.insert.insert = or disjoint i64 %.sroa.1040.0.insert.insert, %.sroa.10.0.insert.ext
  %.sroa.0.0.insert.ext = and i64 %.sroa.0.0.in124, 255
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.10.0.insert.insert, %.sroa.0.0.insert.ext
  %9 = icmp ugt i64 %.sroa.0.0.insert.insert, %.0125
  %storemerge.v = select i1 %9, i64 1, i64 2
  %storemerge = shl i64 %.sroa.0.0.insert.insert, %storemerge.v
  %.sroa.1040.0.extract.shift46 = lshr i64 %storemerge, 16
  %.sroa.1040.sroa.12.0.extract.shift101116 = lshr i64 %storemerge, 24
  %.sroa.14.0.extract.shift61 = lshr i64 %storemerge, 32
  %.sroa.16.0.extract.shift75 = lshr i64 %storemerge, 48
  %.not = icmp eq i64 %storemerge, %.0125
  br i1 %.not, label %13, label %10

10:                                               ; preds = %.lr.ph
  %.sroa.1040.sroa.12.0.insert.ext103 = shl nuw nsw i64 %.sroa.1040.sroa.12.0.extract.shift101116, 8
  %.sroa.1040.sroa.0.0.insert.ext89 = and i64 %.sroa.1040.0.extract.shift46, 255
  %.sroa.1040.sroa.12.0.insert.ext103.masked = and i64 %.sroa.1040.sroa.12.0.insert.ext103, 65280
  %.sroa.1040.0.insert.ext49 = or disjoint i64 %.sroa.1040.sroa.12.0.insert.ext103.masked, %.sroa.1040.sroa.0.0.insert.ext89
  %.sroa.1040.0.insert.shift50 = shl nuw nsw i64 %.sroa.1040.0.insert.ext49, 16
  %11 = and i64 %storemerge, -4294901762
  %.sroa.0.0.insert.insert24 = add i64 %11, %storemerge
  %12 = add i64 %.sroa.0.0.insert.insert24, %.sroa.1040.0.insert.shift50
  %.sroa.1040.0.extract.shift53 = lshr i64 %12, 16
  %.sroa.14.0.extract.shift68 = lshr i64 %12, 32
  %.sroa.16.0.extract.shift82 = lshr i64 %12, 48
  %sum.shift = lshr i64 %12, 56
  br label %13

13:                                               ; preds = %.lr.ph, %10
  %.sroa.1040.sroa.12.1.in = phi i64 [ %sum.shift, %10 ], [ %.sroa.1040.sroa.12.0.extract.shift101116, %.lr.ph ]
  %.sroa.1040.sroa.0.1.in = phi i64 [ %.sroa.16.0.extract.shift82, %10 ], [ %.0125, %.lr.ph ]
  %.sroa.16.1.in = phi i64 [ %.sroa.1040.0.extract.shift53, %10 ], [ %.sroa.14.0.extract.shift61, %.lr.ph ]
  %.sroa.14.1.in = phi i64 [ %.sroa.14.0.extract.shift68, %10 ], [ %.sroa.16.0.extract.shift75, %.lr.ph ]
  %.sroa.10.1.in.in = phi i64 [ %12, %10 ], [ %.0125, %.lr.ph ]
  %.sroa.0.1.in = phi i64 [ %12, %10 ], [ %.sroa.1040.0.extract.shift46, %.lr.ph ]
  %14 = add nuw i64 %.0125, 2
  %15 = icmp ult i64 %14, %6
  br i1 %15, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %13
  %16 = and i64 %.sroa.16.1.in, 65535
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %.sroa.1040.sroa.12.0.in.lcssa = phi i64 [ %.sroa.1040.sroa.12.0.extract.shift115, %2 ], [ %.sroa.1040.sroa.12.1.in, %._crit_edge.loopexit ]
  %.sroa.1040.sroa.0.0.in.lcssa = phi i64 [ %.sroa.1040.0.extract.shift, %2 ], [ %.sroa.1040.sroa.0.1.in, %._crit_edge.loopexit ]
  %.sroa.16.0.lcssa = phi i64 [ %.sroa.16.0.extract.shift, %2 ], [ %16, %._crit_edge.loopexit ]
  %.sroa.14.0.in.lcssa = phi i64 [ %.sroa.14.0.extract.shift, %2 ], [ %.sroa.14.1.in, %._crit_edge.loopexit ]
  %.sroa.10.0.in.in.lcssa = phi i64 [ %4, %2 ], [ %.sroa.10.1.in.in, %._crit_edge.loopexit ]
  %.sroa.0.0.in.lcssa = phi i64 [ %4, %2 ], [ %.sroa.0.1.in, %._crit_edge.loopexit ]
  %.sroa.16.0.insert.shift72 = shl nuw i64 %.sroa.16.0.lcssa, 48
  %.sroa.14.0.insert.ext57 = shl nuw i64 %.sroa.14.0.in.lcssa, 32
  %.sroa.14.0.insert.shift58 = and i64 %.sroa.14.0.insert.ext57, 281470681743360
  %.sroa.1040.sroa.12.0.insert.ext97 = shl nuw i64 %.sroa.1040.sroa.12.0.in.lcssa, 24
  %17 = and i64 %.sroa.1040.sroa.12.0.insert.ext97, 4278190080
  %.sroa.1040.sroa.0.0.insert.ext85 = shl i64 %.sroa.1040.sroa.0.0.in.lcssa, 16
  %18 = and i64 %.sroa.1040.sroa.0.0.insert.ext85, 16711680
  %.sroa.1040.0.insert.shift43 = or disjoint i64 %17, %18
  %.sroa.10.0.insert.shift28 = and i64 %.sroa.10.0.in.in.lcssa, 65280
  %.sroa.0.0.insert.ext17 = and i64 %.sroa.0.0.in.lcssa, 255
  %.sroa.14.0.insert.insert60 = add i64 %.sroa.16.0.insert.shift72, -360314520
  %.sroa.1040.0.insert.insert45 = add i64 %.sroa.14.0.insert.insert60, %.sroa.1040.0.insert.shift43
  %.sroa.10.0.insert.insert30 = add i64 %.sroa.1040.0.insert.insert45, %.sroa.14.0.insert.shift58
  %.sroa.0.0.insert.insert19 = add i64 %.sroa.10.0.insert.insert30, %.sroa.10.0.insert.shift28
  %19 = add i64 %.sroa.0.0.insert.insert19, %.sroa.0.0.insert.ext17
  store i64 %19, ptr %1, align 8, !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 = !{!"long", !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,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass