; 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 i32], align 4
  %6 = alloca i16, align 2
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i16, align 2
  %10 = 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 2, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #2
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds i32, ptr %11, i64 0
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = zext i32 %13 to i64
  %15 = sub i64 %14, 51238316
  %16 = sub i64 %15, 339126204
  %17 = trunc i64 %16 to i32
  %18 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %17, ptr %18, align 4, !tbaa !9
  %19 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = lshr i32 %20, 3
  %22 = and i32 %21, 1
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %72

24:                                               ; preds = %2
  %25 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = and i32 %26, 1
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %37

29:                                               ; preds = %24
  %30 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = and i32 %31, 7
  %33 = shl i32 %32, 2
  %34 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = or i32 %35, %33
  store i32 %36, ptr %34, align 4, !tbaa !9
  br label %71

37:                                               ; preds = %24
  %38 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i16, ptr %38, i64 1
  %40 = load i16, ptr %39, align 2, !tbaa !11
  store i16 %40, ptr %6, align 2, !tbaa !11
  %41 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i16, ptr %41, i64 0
  %43 = load i16, ptr %42, align 2, !tbaa !11
  %44 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i16, ptr %44, i64 1
  store i16 %43, ptr %45, align 2, !tbaa !11
  %46 = load i16, ptr %6, align 2, !tbaa !11
  %47 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i16, ptr %47, i64 0
  store i16 %46, ptr %48, align 2, !tbaa !11
  %49 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %50 = getelementptr inbounds i8, ptr %49, i64 1
  %51 = load i8, ptr %50, align 1, !tbaa !13
  store i8 %51, ptr %7, align 1, !tbaa !13
  %52 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %53 = getelementptr inbounds i8, ptr %52, i64 0
  %54 = load i8, ptr %53, align 1, !tbaa !13
  %55 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %56 = getelementptr inbounds i8, ptr %55, i64 1
  store i8 %54, ptr %56, align 1, !tbaa !13
  %57 = load i8, ptr %7, align 1, !tbaa !13
  %58 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %59 = getelementptr inbounds i8, ptr %58, i64 0
  store i8 %57, ptr %59, align 1, !tbaa !13
  %60 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %61 = getelementptr inbounds i8, ptr %60, i64 0
  %62 = load i8, ptr %61, align 1, !tbaa !13
  store i8 %62, ptr %7, align 1, !tbaa !13
  %63 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %64 = getelementptr inbounds i8, ptr %63, i64 2
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %67 = getelementptr inbounds i8, ptr %66, i64 0
  store i8 %65, ptr %67, align 1, !tbaa !13
  %68 = load i8, ptr %7, align 1, !tbaa !13
  %69 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %70 = getelementptr inbounds i8, ptr %69, i64 2
  store i8 %68, ptr %70, align 1, !tbaa !13
  br label %71

71:                                               ; preds = %37, %29
  br label %120

72:                                               ; preds = %2
  %73 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = and i32 %74, 1
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %96

77:                                               ; preds = %72
  %78 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %79 = getelementptr inbounds i8, ptr %78, i64 1
  %80 = load i8, ptr %79, align 1, !tbaa !13
  store i8 %80, ptr %8, align 1, !tbaa !13
  %81 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %82 = getelementptr inbounds i8, ptr %81, i64 2
  %83 = load i8, ptr %82, align 1, !tbaa !13
  %84 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %85 = getelementptr inbounds i8, ptr %84, i64 1
  store i8 %83, ptr %85, align 1, !tbaa !13
  %86 = load i8, ptr %8, align 1, !tbaa !13
  %87 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %88 = getelementptr inbounds i8, ptr %87, i64 2
  store i8 %86, ptr %88, align 1, !tbaa !13
  %89 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = and i32 %90, 31
  %92 = shl i32 %91, 3
  %93 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %94 = load i32, ptr %93, align 4, !tbaa !9
  %95 = or i32 %94, %92
  store i32 %95, ptr %93, align 4, !tbaa !9
  br label %119

96:                                               ; preds = %72
  %97 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %98 = getelementptr inbounds i16, ptr %97, i64 0
  %99 = load i16, ptr %98, align 2, !tbaa !11
  store i16 %99, ptr %9, align 2, !tbaa !11
  %100 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %101 = getelementptr inbounds i16, ptr %100, i64 1
  %102 = load i16, ptr %101, align 2, !tbaa !11
  %103 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %104 = getelementptr inbounds i16, ptr %103, i64 0
  store i16 %102, ptr %104, align 2, !tbaa !11
  %105 = load i16, ptr %9, align 2, !tbaa !11
  %106 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %107 = getelementptr inbounds i16, ptr %106, i64 1
  store i16 %105, ptr %107, align 2, !tbaa !11
  %108 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %109 = getelementptr inbounds i8, ptr %108, i64 2
  %110 = load i8, ptr %109, align 1, !tbaa !13
  store i8 %110, ptr %10, align 1, !tbaa !13
  %111 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %112 = getelementptr inbounds i8, ptr %111, i64 3
  %113 = load i8, ptr %112, align 1, !tbaa !13
  %114 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %115 = getelementptr inbounds i8, ptr %114, i64 2
  store i8 %113, ptr %115, align 1, !tbaa !13
  %116 = load i8, ptr %10, align 1, !tbaa !13
  %117 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %118 = getelementptr inbounds i8, ptr %117, i64 3
  store i8 %116, ptr %118, align 1, !tbaa !13
  br label %119

119:                                              ; preds = %96, %77
  br label %120

120:                                              ; preds = %119, %71
  %121 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = shl i32 %122, 7
  %124 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = lshr i32 %125, 25
  %127 = or i32 %123, %126
  %128 = lshr i32 %127, 3
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds i32, ptr %129, i64 0
  store i32 %128, ptr %130, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 2, 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.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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}


; 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 {
  %3 = load i32, ptr %0, align 4, !tbaa !5
  %4 = add i32 %3, -390364520
  %.sroa.26.0.extract.shift = lshr i32 %4, 16
  %.sroa.0.sroa.0.0.insert.ext184 = and i32 %4, 247
  %.sroa.0.0.insert.ext = and i32 %4, 65535
  %5 = and i32 %4, 8
  %.not = icmp eq i32 %5, 0
  %6 = and i32 %3, 1
  %.not264 = icmp eq i32 %6, 0
  br i1 %.not, label %13, label %7

7:                                                ; preds = %2
  br i1 %.not264, label %12, label %8

8:                                                ; preds = %7
  %9 = shl nuw nsw i32 %.sroa.0.0.insert.ext, 2
  %10 = and i32 %9, 20
  %11 = or i32 %10, %.sroa.0.0.insert.ext
  %.sroa.0.sroa.22.0.extract.shift237271 = lshr i32 %4, 8
  %sum.shift = lshr i32 %4, 24
  br label %19

12:                                               ; preds = %7
  %.sroa.26.sroa.24.0.extract.shift171269 = lshr i32 %4, 8
  %.sroa.0.sroa.22.0.extract.shift270 = lshr i32 %4, 24
  br label %19

13:                                               ; preds = %2
  br i1 %.not264, label %18, label %14

14:                                               ; preds = %13
  %15 = shl nuw nsw i32 %.sroa.0.sroa.0.0.insert.ext184, 3
  %16 = or i32 %15, %.sroa.0.sroa.0.0.insert.ext184
  %17 = lshr i32 %4, 8
  %.sroa.26.sroa.24.0.extract.shift157267 = lshr i32 %4, 24
  br label %19

18:                                               ; preds = %13
  %.sroa.0.sroa.22.0.extract.shift217265 = lshr i32 %4, 24
  %.sroa.26.sroa.24.0.extract.shift177266 = lshr i32 %4, 8
  br label %19

19:                                               ; preds = %14, %18, %8, %12
  %.sroa.26.sroa.0.0.in = phi i32 [ %.sroa.26.0.extract.shift, %8 ], [ %.sroa.0.sroa.22.0.extract.shift270, %12 ], [ %17, %14 ], [ %.sroa.26.sroa.24.0.extract.shift177266, %18 ]
  %.sroa.26.sroa.24.0.in = phi i32 [ %sum.shift, %8 ], [ %.sroa.26.sroa.24.0.extract.shift171269, %12 ], [ %.sroa.26.sroa.24.0.extract.shift157267, %14 ], [ %4, %18 ]
  %.sroa.0.sroa.0.0.in = phi i32 [ %11, %8 ], [ %4, %12 ], [ %16, %14 ], [ %.sroa.26.0.extract.shift, %18 ]
  %.sroa.0.sroa.22.0.in = phi i32 [ %.sroa.0.sroa.22.0.extract.shift237271, %8 ], [ %.sroa.26.0.extract.shift, %12 ], [ %.sroa.26.0.extract.shift, %14 ], [ %.sroa.0.sroa.22.0.extract.shift217265, %18 ]
  %.sroa.0.sroa.22.0.insert.ext253 = shl nuw i32 %.sroa.0.sroa.22.0.in, 8
  %.sroa.0.sroa.0.0.insert.ext207 = and i32 %.sroa.0.sroa.0.0.in, 255
  %.sroa.26.sroa.24.0.insert.ext159 = shl i32 %.sroa.26.sroa.24.0.in, 8
  %.sroa.26.sroa.0.0.insert.ext117 = and i32 %.sroa.26.sroa.0.0.in, 255
  %.sroa.26.sroa.24.0.insert.ext159.masked = and i32 %.sroa.26.sroa.24.0.insert.ext159, 65280
  %.sroa.26.0.insert.ext83 = or disjoint i32 %.sroa.26.sroa.24.0.insert.ext159.masked, %.sroa.26.sroa.0.0.insert.ext117
  %.sroa.26.0.insert.shift84 = shl nuw i32 %.sroa.26.0.insert.ext83, 16
  %.sroa.0.sroa.22.0.insert.ext253.masked = and i32 %.sroa.0.sroa.22.0.insert.ext253, 65280
  %.sroa.0.0.insert.ext37 = or disjoint i32 %.sroa.0.sroa.0.0.insert.ext207, %.sroa.0.sroa.22.0.insert.ext253.masked
  %.sroa.0.0.insert.insert39 = or disjoint i32 %.sroa.0.0.insert.ext37, %.sroa.26.0.insert.shift84
  %20 = tail call i32 @llvm.fshl.i32(i32 %.sroa.0.0.insert.insert39, i32 %.sroa.0.0.insert.insert39, i32 7)
  %21 = lshr i32 %20, 3
  store i32 %21, 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 = { 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" }
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"}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass