; LLVM IR from kojiba/purge :: evasion (substituteEvasion)

; 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"

%union.bytesTo64 = type { i64 }

; Function Attrs: nounwind uwtable
define dso_local i64 @substituteEvasion(i64 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %union.bytesTo64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %6 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %6, ptr %5, align 8, !tbaa !11
  %7 = load ptr, ptr %4, align 8, !tbaa !9
  %8 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 0
  %9 = load i8, ptr %8, align 8, !tbaa !11
  %10 = zext i8 %9 to i64
  %11 = getelementptr inbounds i8, ptr %7, i64 %10
  %12 = load i8, ptr %11, align 1, !tbaa !11
  %13 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 0
  store i8 %12, ptr %13, align 8, !tbaa !11
  %14 = load ptr, ptr %4, align 8, !tbaa !9
  %15 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 1
  %16 = load i8, ptr %15, align 1, !tbaa !11
  %17 = zext i8 %16 to i64
  %18 = getelementptr inbounds i8, ptr %14, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 1
  store i8 %19, ptr %20, align 1, !tbaa !11
  %21 = load ptr, ptr %4, align 8, !tbaa !9
  %22 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 2
  %23 = load i8, ptr %22, align 2, !tbaa !11
  %24 = zext i8 %23 to i64
  %25 = getelementptr inbounds i8, ptr %21, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !11
  %27 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 2
  store i8 %26, ptr %27, align 2, !tbaa !11
  %28 = load ptr, ptr %4, align 8, !tbaa !9
  %29 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 3
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %31 = zext i8 %30 to i64
  %32 = getelementptr inbounds i8, ptr %28, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 3
  store i8 %33, ptr %34, align 1, !tbaa !11
  %35 = load ptr, ptr %4, align 8, !tbaa !9
  %36 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 4
  %37 = load i8, ptr %36, align 4, !tbaa !11
  %38 = zext i8 %37 to i64
  %39 = getelementptr inbounds i8, ptr %35, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 4
  store i8 %40, ptr %41, align 4, !tbaa !11
  %42 = load ptr, ptr %4, align 8, !tbaa !9
  %43 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 5
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = zext i8 %44 to i64
  %46 = getelementptr inbounds i8, ptr %42, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 5
  store i8 %47, ptr %48, align 1, !tbaa !11
  %49 = load ptr, ptr %4, align 8, !tbaa !9
  %50 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 6
  %51 = load i8, ptr %50, align 2, !tbaa !11
  %52 = zext i8 %51 to i64
  %53 = getelementptr inbounds i8, ptr %49, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 6
  store i8 %54, ptr %55, align 2, !tbaa !11
  %56 = load ptr, ptr %4, align 8, !tbaa !9
  %57 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 7
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = zext i8 %58 to i64
  %60 = getelementptr inbounds i8, ptr %56, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = getelementptr inbounds [8 x i8], ptr %5, i64 0, i64 7
  store i8 %61, ptr %62, align 1, !tbaa !11
  %63 = load i64, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret i64 %63
}

; 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!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: read) uwtable
define dso_local i64 @substituteEvasion(i64 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %.sroa.6.0.extract.shift = lshr i64 %0, 8
  %.sroa.8.0.extract.shift = lshr i64 %0, 16
  %.sroa.10.0.extract.shift = lshr i64 %0, 24
  %.sroa.12.0.extract.shift = lshr i64 %0, 32
  %.sroa.14.0.extract.shift = lshr i64 %0, 40
  %.sroa.16.0.extract.shift = lshr i64 %0, 48
  %.sroa.18.0.extract.shift = lshr i64 %0, 56
  %3 = and i64 %0, 255
  %4 = getelementptr inbounds i8, ptr %1, i64 %3
  %5 = load i8, ptr %4, align 1, !tbaa !5
  %6 = and i64 %.sroa.6.0.extract.shift, 255
  %7 = getelementptr inbounds i8, ptr %1, i64 %6
  %8 = load i8, ptr %7, align 1, !tbaa !5
  %9 = and i64 %.sroa.8.0.extract.shift, 255
  %10 = getelementptr inbounds i8, ptr %1, i64 %9
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = and i64 %.sroa.10.0.extract.shift, 255
  %13 = getelementptr inbounds i8, ptr %1, i64 %12
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = and i64 %.sroa.12.0.extract.shift, 255
  %16 = getelementptr inbounds i8, ptr %1, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = and i64 %.sroa.14.0.extract.shift, 255
  %19 = getelementptr inbounds i8, ptr %1, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !5
  %21 = and i64 %.sroa.16.0.extract.shift, 255
  %22 = getelementptr inbounds i8, ptr %1, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 %.sroa.18.0.extract.shift
  %25 = load i8, ptr %24, align 1, !tbaa !5
  %.sroa.18.0.insert.ext = zext i8 %25 to i64
  %.sroa.18.0.insert.shift = shl nuw i64 %.sroa.18.0.insert.ext, 56
  %.sroa.16.0.insert.ext = zext i8 %23 to i64
  %.sroa.16.0.insert.shift = shl nuw nsw i64 %.sroa.16.0.insert.ext, 48
  %.sroa.14.0.insert.ext = zext i8 %20 to i64
  %.sroa.14.0.insert.shift = shl nuw nsw i64 %.sroa.14.0.insert.ext, 40
  %.sroa.12.0.insert.ext = zext i8 %17 to i64
  %.sroa.12.0.insert.shift = shl nuw nsw i64 %.sroa.12.0.insert.ext, 32
  %.sroa.10.0.insert.ext = zext i8 %14 to i64
  %.sroa.10.0.insert.shift = shl nuw nsw i64 %.sroa.10.0.insert.ext, 24
  %.sroa.8.0.insert.ext = zext i8 %11 to i64
  %.sroa.8.0.insert.shift = shl nuw nsw i64 %.sroa.8.0.insert.ext, 16
  %.sroa.6.0.insert.ext = zext i8 %8 to i64
  %.sroa.6.0.insert.shift = shl nuw nsw i64 %.sroa.6.0.insert.ext, 8
  %.sroa.0.0.insert.ext = zext i8 %5 to i64
  %.sroa.16.0.insert.insert = or disjoint i64 %.sroa.6.0.insert.shift, %.sroa.0.0.insert.ext
  %.sroa.14.0.insert.insert = or disjoint i64 %.sroa.16.0.insert.insert, %.sroa.8.0.insert.shift
  %.sroa.12.0.insert.insert = or disjoint i64 %.sroa.14.0.insert.insert, %.sroa.10.0.insert.shift
  %.sroa.10.0.insert.insert = or disjoint i64 %.sroa.12.0.insert.insert, %.sroa.12.0.insert.shift
  %.sroa.6.0.insert.mask = or i64 %.sroa.10.0.insert.insert, %.sroa.14.0.insert.shift
  %.sroa.0.0.insert.mask = or i64 %.sroa.6.0.insert.mask, %.sroa.16.0.insert.shift
  %.sroa.0.0.insert.insert = or i64 %.sroa.0.0.insert.mask, %.sroa.18.0.insert.shift
  ret i64 %.sroa.0.0.insert.insert
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


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