; 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 i8, align 1
  %7 = alloca i16, align 2
  %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 1, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 2, 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 = add i32 %11, -10089659
  %13 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  store i32 %12, ptr %13, align 4, !tbaa !9
  %14 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = lshr i32 %15, 4
  %17 = and i32 %16, 1
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %74

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

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

31:                                               ; preds = %25
  %32 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = add i32 %35, %33
  store i32 %36, ptr %34, align 4, !tbaa !9
  br label %49

37:                                               ; preds = %25
  %38 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %39 = getelementptr inbounds i8, ptr %38, i64 3
  %40 = load i8, ptr %39, align 1, !tbaa !11
  store i8 %40, ptr %6, align 1, !tbaa !11
  %41 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %42 = getelementptr inbounds i8, ptr %41, i64 0
  %43 = load i8, ptr %42, align 1, !tbaa !11
  %44 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %45 = getelementptr inbounds i8, ptr %44, i64 3
  store i8 %43, ptr %45, align 1, !tbaa !11
  %46 = load i8, ptr %6, align 1, !tbaa !11
  %47 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %48 = getelementptr inbounds i8, ptr %47, i64 0
  store i8 %46, ptr %48, align 1, !tbaa !11
  br label %49

49:                                               ; preds = %37, %31
  br label %73

50:                                               ; preds = %19
  %51 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %52 = getelementptr inbounds i16, ptr %51, i64 0
  %53 = load i16, ptr %52, align 2, !tbaa !12
  store i16 %53, ptr %7, align 2, !tbaa !12
  %54 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %55 = getelementptr inbounds i16, ptr %54, i64 1
  %56 = load i16, ptr %55, align 2, !tbaa !12
  %57 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %58 = getelementptr inbounds i16, ptr %57, i64 0
  store i16 %56, ptr %58, align 2, !tbaa !12
  %59 = load i16, ptr %7, align 2, !tbaa !12
  %60 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %61 = getelementptr inbounds i16, ptr %60, i64 1
  store i16 %59, ptr %61, align 2, !tbaa !12
  %62 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %63 = getelementptr inbounds i16, ptr %62, i64 1
  %64 = load i16, ptr %63, align 2, !tbaa !12
  store i16 %64, ptr %7, align 2, !tbaa !12
  %65 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %66 = getelementptr inbounds i16, ptr %65, i64 0
  %67 = load i16, ptr %66, align 2, !tbaa !12
  %68 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %69 = getelementptr inbounds i16, ptr %68, i64 1
  store i16 %67, ptr %69, align 2, !tbaa !12
  %70 = load i16, ptr %7, align 2, !tbaa !12
  %71 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %72 = getelementptr inbounds i16, ptr %71, i64 0
  store i16 %70, ptr %72, align 2, !tbaa !12
  br label %73

73:                                               ; preds = %50, %49
  br label %97

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

97:                                               ; preds = %74, %73
  %98 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = zext i32 %99 to i64
  %101 = add i64 %100, 194279804
  %102 = add i64 %101, 924438113
  %103 = trunc i64 %102 to i32
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds i32, ptr %104, i64 0
  store i32 %103, ptr %105, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 1, 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 = !{!13, !13, i64 0}
!13 = !{!"short", !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, -10089659
  %.sroa.0.sroa.18.0.extract.shift152181 = lshr i32 %4, 8
  %.sroa.20.0.extract.shift = lshr i32 %4, 16
  %sum.shift = lshr i32 %4, 24
  %5 = and i32 %4, 16
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %10, label %6

6:                                                ; preds = %2
  %7 = and i32 %4, 4
  %.not183 = icmp eq i32 %7, 0
  br i1 %.not183, label %10, label %8

8:                                                ; preds = %6
  %9 = shl i32 %4, 1
  %.sroa.0.sroa.18.0.extract.shift174184 = lshr i32 %9, 8
  %.sroa.20.0.extract.shift51 = lshr i32 %9, 16
  %sum.shift185 = lshr i32 %9, 24
  br label %10

10:                                               ; preds = %2, %6, %8
  %.sroa.20.sroa.0.0 = phi i32 [ %.sroa.20.0.extract.shift51, %8 ], [ %.sroa.20.0.extract.shift, %6 ], [ %sum.shift, %2 ]
  %.sroa.20.sroa.16.0 = phi i32 [ %sum.shift185, %8 ], [ %4, %6 ], [ %.sroa.20.0.extract.shift, %2 ]
  %.sroa.0.sroa.0.0 = phi i32 [ %9, %8 ], [ %sum.shift, %6 ], [ %.sroa.0.sroa.18.0.extract.shift152181, %2 ]
  %.sroa.0.sroa.18.0 = phi i32 [ %.sroa.0.sroa.18.0.extract.shift174184, %8 ], [ %.sroa.0.sroa.18.0.extract.shift152181, %6 ], [ %4, %2 ]
  %.sroa.0.sroa.18.0.insert.ext176 = shl i32 %.sroa.0.sroa.18.0, 8
  %.sroa.0.sroa.18.0.insert.shift177 = and i32 %.sroa.0.sroa.18.0.insert.ext176, 65280
  %.sroa.0.sroa.0.0.insert.ext143 = and i32 %.sroa.0.sroa.0.0, 255
  %.sroa.0.sroa.0.0.insert.insert145 = or disjoint i32 %.sroa.0.sroa.0.0.insert.ext143, %.sroa.0.sroa.18.0.insert.shift177
  %.sroa.20.sroa.16.0.insert.ext106 = shl i32 %.sroa.20.sroa.16.0, 8
  %.sroa.20.sroa.16.0.insert.shift107 = and i32 %.sroa.20.sroa.16.0.insert.ext106, 65280
  %.sroa.20.sroa.0.0.insert.ext77 = and i32 %.sroa.20.sroa.0.0, 255
  %.sroa.20.sroa.0.0.insert.insert79 = or disjoint i32 %.sroa.20.sroa.16.0.insert.shift107, %.sroa.20.sroa.0.0.insert.ext77
  %.sroa.20.0.insert.shift55 = shl nuw i32 %.sroa.20.sroa.0.0.insert.insert79, 16
  %.sroa.0.0.insert.insert29 = add i32 %.sroa.20.0.insert.shift55, 1118717917
  %11 = add i32 %.sroa.0.0.insert.insert29, %.sroa.0.sroa.0.0.insert.insert145
  store i32 %11, ptr %1, align 4, !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 = !{!"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