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

18:                                               ; preds = %101, %2
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = zext i32 %19 to i64
  %21 = icmp ult i64 %20, 1
  br i1 %21, label %22, label %106

22:                                               ; preds = %18
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %96, %22
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = icmp ult i64 %25, 1
  br i1 %26, label %27, label %101

27:                                               ; preds = %23
  %28 = getelementptr inbounds [1 x i32], ptr %5, i64 0, i64 0
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = and i32 %30, %31
  %33 = icmp ugt i32 %29, %32
  br i1 %33, label %34, label %73

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

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

96:                                               ; preds = %73, %34
  %97 = load i32, ptr %6, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = add i64 %98, 2
  %100 = trunc i64 %99 to i32
  store i32 %100, ptr %6, align 4, !tbaa !9
  br label %23, !llvm.loop !12

101:                                              ; preds = %23
  %102 = load i32, ptr %7, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = add i64 %103, 2
  %105 = trunc i64 %104 to i32
  store i32 %105, ptr %7, align 4, !tbaa !9
  br label %18, !llvm.loop !14

106:                                              ; preds = %18
  %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 = or i64 %109, 857470098
  %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 %9) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, 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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


; 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 {
.preheader:
  %2 = load i32, ptr %0, align 4, !tbaa !5
  %3 = lshr i32 %2, 3
  %4 = or i32 %3, 6404789
  %.sroa.9.0.extract.shift = lshr i32 %4, 8
  %.sroa.14.0.insert.shift40 = and i32 %3, 201326592
  %.sroa.11.0.insert.ext34 = shl i32 %4, 16
  %.sroa.11.0.insert.shift35 = and i32 %.sroa.11.0.insert.ext34, 14942208
  %.sroa.11.0.insert.insert37 = or disjoint i32 %.sroa.11.0.insert.shift35, %.sroa.14.0.insert.shift40
  %5 = and i32 %.sroa.9.0.extract.shift, 2925
  %.sroa.0.0.insert.insert27 = or disjoint i32 %.sroa.11.0.insert.insert37, %5
  %6 = or disjoint i32 %.sroa.0.0.insert.insert27, 857470098
  store i32 %6, 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass