; LLVM IR from jedisct1/charm :: src (charm)

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare hidden void @permute(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @endian_swap_rate(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @xor128(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mem_cpy(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @squeeze_permute(ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
define dso_local void @uc_hash(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca [17 x i8], align 16
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 17, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %12 = load i64, ptr %8, align 8, !tbaa !9
  %13 = icmp ugt i64 %12, 16
  br i1 %13, label %14, label %32

14:                                               ; preds = %4
  br label %15

15:                                               ; preds = %28, %14
  %16 = load i64, ptr %10, align 8, !tbaa !9
  %17 = load i64, ptr %8, align 8, !tbaa !9
  %18 = sub i64 %17, 16
  %19 = icmp ult i64 %16, %18
  br i1 %19, label %20, label %31

20:                                               ; preds = %15
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  call void @endian_swap_rate(ptr noundef %21)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i64, ptr %10, align 8, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %23, i64 %24
  call void @xor128(ptr noundef %22, ptr noundef %25)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @endian_swap_rate(ptr noundef %26)
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  call void @permute(ptr noundef %27)
  br label %28

28:                                               ; preds = %20
  %29 = load i64, ptr %10, align 8, !tbaa !9
  %30 = add i64 %29, 16
  store i64 %30, ptr %10, align 8, !tbaa !9
  br label %15, !llvm.loop !11

31:                                               ; preds = %15
  br label %32

32:                                               ; preds = %31, %4
  %33 = load i64, ptr %8, align 8, !tbaa !9
  %34 = load i64, ptr %10, align 8, !tbaa !9
  %35 = sub i64 %33, %34
  store i64 %35, ptr %11, align 8, !tbaa !9
  %36 = getelementptr inbounds [17 x i8], ptr %9, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %36, i8 0, i64 16, i1 false)
  %37 = getelementptr inbounds [17 x i8], ptr %9, i64 0, i64 0
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = load i64, ptr %10, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %38, i64 %39
  %41 = load i64, ptr %11, align 8, !tbaa !9
  call void @mem_cpy(ptr noundef %37, ptr noundef %40, i64 noundef %41)
  %42 = load i64, ptr %11, align 8, !tbaa !9
  %43 = getelementptr inbounds [17 x i8], ptr %9, i64 0, i64 %42
  store i8 -128, ptr %43, align 1, !tbaa !13
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  call void @endian_swap_rate(ptr noundef %44)
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds [17 x i8], ptr %9, i64 0, i64 0
  call void @xor128(ptr noundef %45, ptr noundef %46)
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  call void @endian_swap_rate(ptr noundef %47)
  %48 = load i64, ptr %11, align 8, !tbaa !9
  %49 = trunc i64 %48 to i32
  %50 = lshr i32 %49, 4
  %51 = shl i32 %50, 25
  %52 = zext i32 %51 to i64
  %53 = or i64 16777216, %52
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds i32, ptr %54, i64 11
  %56 = load i32, ptr %55, align 4, !tbaa !14
  %57 = zext i32 %56 to i64
  %58 = xor i64 %57, %53
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %55, align 4, !tbaa !14
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  call void @permute(ptr noundef %60)
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 0
  call void @squeeze_permute(ptr noundef %61, ptr noundef %63)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i64 16
  call void @squeeze_permute(ptr noundef %64, ptr noundef %66)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 17, ptr %9) #4
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !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 nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
declare hidden void @permute(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @endian_swap_rate(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @xor128(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mem_cpy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @squeeze_permute(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
define dso_local void @uc_hash(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = alloca [17 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 17, ptr nonnull %5) #4
  %6 = icmp ugt i64 %3, 16
  br i1 %6, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %4
  %7 = add i64 %3, -16
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.025 = phi i64 [ %9, %.lr.ph ], [ 0, %.lr.ph.preheader ]
  tail call void @endian_swap_rate(ptr noundef %0)
  %8 = getelementptr inbounds i8, ptr %2, i64 %.025
  tail call void @xor128(ptr noundef %0, ptr noundef %8)
  tail call void @endian_swap_rate(ptr noundef %0)
  tail call void @permute(ptr noundef %0)
  %9 = add i64 %.025, 16
  %10 = icmp ult i64 %9, %7
  br i1 %10, label %.lr.ph, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %.lr.ph, %4
  %.1 = phi i64 [ 0, %4 ], [ %9, %.lr.ph ]
  %11 = sub i64 %3, %.1
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  %12 = getelementptr inbounds i8, ptr %2, i64 %.1
  call void @mem_cpy(ptr noundef nonnull %5, ptr noundef %12, i64 noundef %11)
  %13 = getelementptr inbounds [17 x i8], ptr %5, i64 0, i64 %11
  store i8 -128, ptr %13, align 1, !tbaa !7
  call void @endian_swap_rate(ptr noundef %0)
  call void @xor128(ptr noundef %0, ptr noundef nonnull %5)
  call void @endian_swap_rate(ptr noundef %0)
  %14 = getelementptr inbounds i8, ptr %0, i64 44
  %15 = load i32, ptr %14, align 4, !tbaa !10
  %.tr = trunc i64 %11 to i32
  %16 = shl i32 %.tr, 21
  %17 = and i32 %16, -33554432
  %18 = or disjoint i32 %17, 16777216
  %19 = xor i32 %15, %18
  store i32 %19, ptr %14, align 4, !tbaa !10
  call void @permute(ptr noundef %0)
  call void @squeeze_permute(ptr noundef %0, ptr noundef %1)
  %20 = getelementptr inbounds i8, ptr %1, i64 16
  call void @squeeze_permute(ptr noundef %0, ptr noundef nonnull %20)
  call void @llvm.lifetime.end.p0(i64 17, ptr nonnull %5) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass