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

13:                                               ; preds = %74, %2
  %14 = load i64, ptr %6, align 8, !tbaa !9
  %15 = icmp ult i64 %14, 1
  br i1 %15, label %16, label %77

16:                                               ; preds = %13
  %17 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = icmp ne i64 %18, %19
  br i1 %20, label %21, label %43

21:                                               ; preds = %16
  %22 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = lshr i64 %25, 2
  %27 = and i64 %26, 7
  %28 = or i64 %27, 1
  %29 = shl i64 %23, %28
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %30
  store i64 %29, ptr %31, align 8, !tbaa !9
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !9
  %35 = load i64, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %35
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = lshr i64 %37, 1
  %39 = and i64 %38, 7
  %40 = or i64 %39, 1
  %41 = lshr i64 %34, %40
  %42 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  store i64 %41, ptr %42, align 8, !tbaa !9
  br label %74

43:                                               ; preds = %16
  %44 = load i64, ptr %6, align 8, !tbaa !9
  %45 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %44
  %46 = getelementptr inbounds i32, ptr %45, i64 0
  %47 = load i32, ptr %46, align 4, !tbaa !11
  store i32 %47, ptr %7, align 4, !tbaa !11
  %48 = load i64, ptr %6, align 8, !tbaa !9
  %49 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %48
  %50 = getelementptr inbounds i32, ptr %49, i64 1
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = load i64, ptr %6, align 8, !tbaa !9
  %53 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %52
  %54 = getelementptr inbounds i32, ptr %53, i64 0
  store i32 %51, ptr %54, align 4, !tbaa !11
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = load i64, ptr %6, align 8, !tbaa !9
  %57 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %56
  %58 = getelementptr inbounds i32, ptr %57, i64 1
  store i32 %55, ptr %58, align 4, !tbaa !11
  %59 = load i64, ptr %6, align 8, !tbaa !9
  %60 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %59
  %61 = getelementptr inbounds i32, ptr %60, i64 1
  %62 = load i32, ptr %61, align 4, !tbaa !11
  store i32 %62, ptr %7, align 4, !tbaa !11
  %63 = load i64, ptr %6, align 8, !tbaa !9
  %64 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %63
  %65 = getelementptr inbounds i32, ptr %64, i64 0
  %66 = load i32, ptr %65, align 4, !tbaa !11
  %67 = load i64, ptr %6, align 8, !tbaa !9
  %68 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %67
  %69 = getelementptr inbounds i32, ptr %68, i64 1
  store i32 %66, ptr %69, align 4, !tbaa !11
  %70 = load i32, ptr %7, align 4, !tbaa !11
  %71 = load i64, ptr %6, align 8, !tbaa !9
  %72 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 %71
  %73 = getelementptr inbounds i32, ptr %72, i64 0
  store i32 %70, ptr %73, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %43, %21
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = add i64 %75, 2
  store i64 %76, ptr %6, align 8, !tbaa !9
  br label %13, !llvm.loop !13

77:                                               ; preds = %13
  %78 = getelementptr inbounds [1 x i64], ptr %5, i64 0, i64 0
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = and i64 %79, 387166272
  %81 = and i64 %80, 913307615
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds i64, ptr %82, i64 0
  store i64 %81, ptr %83, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, 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 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @RandomFunc(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
.critedge:
  %2 = load i64, ptr %0, align 8, !tbaa !5
  %3 = trunc i64 %2 to i32
  %.sroa.0.0.extract.trunc = xor i32 %3, 700325083
  %.sroa.9.0.insert.shift = and i64 %2, -4294967296
  %.sroa.0.0.insert.ext = zext i32 %.sroa.0.0.extract.trunc to i64
  %.sroa.0.0.insert.insert = or disjoint i64 %.sroa.9.0.insert.shift, %.sroa.0.0.insert.ext
  %.not = icmp eq i64 %.sroa.0.0.insert.insert, 0
  br i1 %.not, label %13, label %4

4:                                                ; preds = %.critedge
  %5 = lshr i64 %.sroa.0.0.insert.ext, 2
  %6 = and i64 %5, 6
  %7 = or disjoint i64 %6, 1
  %8 = shl i64 %.sroa.0.0.insert.insert, %7
  %9 = lshr exact i64 %8, 1
  %10 = and i64 %9, 6
  %11 = or disjoint i64 %10, 1
  %12 = lshr i64 %8, %11
  %.sroa.0.0.extract.trunc19 = trunc i64 %12 to i32
  br label %13

13:                                               ; preds = %.critedge, %4
  %.sroa.0.0 = phi i32 [ %.sroa.0.0.extract.trunc19, %4 ], [ %.sroa.0.0.extract.trunc, %.critedge ]
  %14 = and i32 %.sroa.0.0, 369340480
  %15 = zext nneg i32 %14 to i64
  store i64 %15, ptr %1, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn 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"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass