; 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 i16, align 2
  %7 = 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
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds i32, ptr %8, i64 0
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = zext i32 %10 to i64
  %12 = sub i64 %11, 51238316
  %13 = sub i64 %12, 339126204
  %14 = trunc i64 %13 to i32
  %15 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %14, ptr %15, align 4, !tbaa !9
  %16 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = lshr i32 %17, 3
  %19 = and i32 %18, 1
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %69

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

26:                                               ; preds = %21
  %27 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = and i32 %28, 7
  %30 = shl i32 %29, 2
  %31 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = or i32 %32, %30
  store i32 %33, ptr %31, align 4, !tbaa !9
  br label %68

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

68:                                               ; preds = %34, %26
  br label %106

69:                                               ; preds = %2
  %70 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = lshr i32 %73, 3
  %75 = and i32 %74, 15
  %76 = zext i32 %75 to i64
  %77 = or i64 %76, 1
  %78 = trunc i64 %77 to i32
  %79 = shl i32 %71, %78
  %80 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = lshr i32 %83, 3
  %85 = and i32 %84, 15
  %86 = zext i32 %85 to i64
  %87 = or i64 %86, 1
  %88 = sub i64 32, %87
  %89 = trunc i64 %88 to i32
  %90 = lshr i32 %81, %89
  %91 = or i32 %79, %90
  %92 = and i32 %91, 7
  %93 = shl i32 %92, 2
  %94 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %95 = load i32, ptr %94, align 4, !tbaa !9
  %96 = or i32 %95, %93
  store i32 %96, ptr %94, align 4, !tbaa !9
  %97 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = and i32 %98, 7
  %100 = zext i32 %99 to i64
  %101 = or i64 %100, 1
  %102 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = trunc i64 %101 to i32
  %105 = shl i32 %103, %104
  store i32 %105, ptr %102, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %69, %68
  %107 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %108 = load i32, ptr %107, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = sub i64 %109, 413274705
  %111 = trunc i64 %110 to i32
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds i32, ptr %112, i64 0
  store i32 %111, ptr %113, align 4, !tbaa !9
  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.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 = !{!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
  %5 = and i32 %4, 8
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %12, label %6

6:                                                ; preds = %2
  %7 = and i32 %3, 1
  %.not318 = icmp eq i32 %7, 0
  br i1 %.not318, label %11, label %8

8:                                                ; preds = %6
  %.sroa.0.sroa.0.0.insert.ext213 = shl i32 %3, 2
  %9 = and i32 %.sroa.0.sroa.0.0.insert.ext213, 20
  %10 = or i32 %9, %4
  %.sroa.0.sroa.24.0.extract.shift270321 = lshr i32 %4, 8
  %sum.shift322 = lshr i32 %4, 24
  br label %21

11:                                               ; preds = %6
  %.sroa.26.sroa.22.0.extract.shift210319 = lshr i32 %4, 8
  %.sroa.0.sroa.24.0.extract.shift320 = lshr i32 %4, 24
  br label %21

12:                                               ; preds = %2
  %.sroa.0.0.insert.ext = lshr i32 %4, 3
  %13 = and i32 %.sroa.0.0.insert.ext, 14
  %14 = or disjoint i32 %13, 1
  %15 = tail call i32 @llvm.fshl.i32(i32 %4, i32 %4, i32 %14)
  %16 = shl i32 %15, 2
  %17 = and i32 %16, 28
  %.sroa.26.0.insert.shift100 = and i32 %4, -65536
  %.masked = and i32 %4, 65527
  %.sroa.0.0.insert.ext41 = or i32 %17, %.masked
  %.sroa.0.0.insert.insert43 = or disjoint i32 %.sroa.0.0.insert.ext41, %.sroa.26.0.insert.shift100
  %18 = and i32 %.sroa.0.0.insert.ext41, 6
  %19 = or disjoint i32 %18, 1
  %20 = shl i32 %.sroa.0.0.insert.insert43, %19
  %.sroa.0.sroa.24.0.extract.shift302316 = lshr i32 %20, 8
  %.sroa.26.0.extract.shift108 = lshr i32 %20, 16
  %sum.shift = lshr i32 %20, 24
  br label %21

21:                                               ; preds = %8, %11, %12
  %.sroa.26.sroa.22.0.in = phi i32 [ %sum.shift322, %8 ], [ %.sroa.26.sroa.22.0.extract.shift210319, %11 ], [ %sum.shift, %12 ]
  %.sroa.26.sroa.0.0.in = phi i32 [ %.sroa.26.0.extract.shift, %8 ], [ %.sroa.0.sroa.24.0.extract.shift320, %11 ], [ %.sroa.26.0.extract.shift108, %12 ]
  %.sroa.0.sroa.0.0 = phi i32 [ %10, %8 ], [ %4, %11 ], [ %20, %12 ]
  %.sroa.0.sroa.24.0.in = phi i32 [ %.sroa.0.sroa.24.0.extract.shift270321, %8 ], [ %.sroa.26.0.extract.shift, %11 ], [ %.sroa.0.sroa.24.0.extract.shift302316, %12 ]
  %.sroa.0.sroa.24.0.insert.ext304 = shl nuw i32 %.sroa.0.sroa.24.0.in, 8
  %.sroa.0.sroa.0.0.insert.ext249 = and i32 %.sroa.0.sroa.0.0, 255
  %.sroa.26.sroa.22.0.insert.ext202 = shl nuw i32 %.sroa.26.sroa.22.0.in, 8
  %.sroa.26.sroa.0.0.insert.ext149 = and i32 %.sroa.26.sroa.0.0.in, 255
  %.sroa.26.sroa.22.0.insert.ext202.masked = and i32 %.sroa.26.sroa.22.0.insert.ext202, 65280
  %.sroa.26.0.insert.ext111 = or disjoint i32 %.sroa.26.sroa.22.0.insert.ext202.masked, %.sroa.26.sroa.0.0.insert.ext149
  %.sroa.26.0.insert.shift112 = shl nuw i32 %.sroa.26.0.insert.ext111, 16
  %.sroa.0.sroa.24.0.insert.ext304.masked = and i32 %.sroa.0.sroa.24.0.insert.ext304, 65280
  %.sroa.0.0.insert.ext50 = or disjoint i32 %.sroa.0.sroa.24.0.insert.ext304.masked, %.sroa.0.sroa.0.0.insert.ext249
  %.sroa.0.0.insert.insert52 = add i32 %.sroa.26.0.insert.shift112, -413274705
  %22 = add i32 %.sroa.0.0.insert.insert52, %.sroa.0.0.insert.ext50
  store i32 %22, 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass