; LLVM IR from BoysTownOrg/chapro :: sha_process (cha_sha_process)

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

@SS = external hidden global ptr, align 8
@AA = external hidden global ptr, align 8
@II = external hidden global ptr, align 8
@JJ = external hidden global ptr, align 8
@g0 = external hidden global float, align 4
@a1 = external hidden global float, align 4
@a2 = external hidden global float, align 4
@a3 = external hidden global float, align 4
@gg = external hidden global float, align 4
@exr = external hidden global i32, align 4
@hbw = external hidden global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @cha_sha_process(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  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 i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds ptr, ptr %16, i64 1
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i32, ptr %18, i64 20
  %20 = load i32, ptr %19, align 4, !tbaa !9
  store i32 %20, ptr %15, align 4, !tbaa !9
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds ptr, ptr %21, i64 43
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %23, ptr %9, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds ptr, ptr %24, i64 44
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  store ptr %26, ptr %10, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds ptr, ptr %27, i64 46
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %29, ptr %11, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds ptr, ptr %30, i64 45
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %32, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds ptr, ptr %33, i64 47
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds ptr, ptr %36, i64 48
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  store ptr %38, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds ptr, ptr %39, i64 50
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  store ptr %41, ptr @SS, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds ptr, ptr %42, i64 51
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  store ptr %44, ptr @AA, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds ptr, ptr %45, i64 52
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %47, ptr @II, align 8, !tbaa !5
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds ptr, ptr %48, i64 53
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  store ptr %50, ptr @JJ, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds ptr, ptr %51, i64 2
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %53, i64 17
  %55 = load double, ptr %54, align 8, !tbaa !11
  %56 = fptrunc double %55 to float
  store float %56, ptr @g0, align 4, !tbaa !13
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds ptr, ptr %57, i64 2
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %59, i64 18
  %61 = load double, ptr %60, align 8, !tbaa !11
  %62 = fptrunc double %61 to float
  store float %62, ptr @a1, align 4, !tbaa !13
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds ptr, ptr %63, i64 2
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = getelementptr inbounds double, ptr %65, i64 19
  %67 = load double, ptr %66, align 8, !tbaa !11
  %68 = fptrunc double %67 to float
  store float %68, ptr @a2, align 4, !tbaa !13
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds ptr, ptr %69, i64 2
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds double, ptr %71, i64 20
  %73 = load double, ptr %72, align 8, !tbaa !11
  %74 = fptrunc double %73 to float
  store float %74, ptr @a3, align 4, !tbaa !13
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds ptr, ptr %75, i64 2
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = getelementptr inbounds double, ptr %77, i64 21
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = fptrunc double %79 to float
  store float %80, ptr @gg, align 4, !tbaa !13
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds ptr, ptr %81, i64 1
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = getelementptr inbounds i32, ptr %83, i64 25
  %85 = load i32, ptr %84, align 4, !tbaa !9
  store i32 %85, ptr @exr, align 4, !tbaa !9
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds ptr, ptr %86, i64 1
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds i32, ptr %88, i64 26
  %90 = load i32, ptr %89, align 4, !tbaa !9
  store i32 %90, ptr @hbw, align 4, !tbaa !9
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = load i32, ptr %15, align 4, !tbaa !9
  %93 = sdiv i32 %92, 2
  %94 = icmp sle i32 %91, %93
  br i1 %94, label %95, label %107

95:                                               ; preds = %4
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = load i32, ptr %15, align 4, !tbaa !9
  call void @sha_sc(ptr noundef %96, ptr noundef %97, ptr noundef %98, i32 noundef %99, ptr noundef %100, ptr noundef %101, ptr noundef %102, ptr noundef %103, ptr noundef %104, ptr noundef %105, i32 noundef %106)
  br label %118

107:                                              ; preds = %4
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !9
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = load i32, ptr %15, align 4, !tbaa !9
  call void @sha_lc(ptr noundef %108, ptr noundef %109, i32 noundef %110, ptr noundef %111, ptr noundef %112, ptr noundef %113, ptr noundef %114, ptr noundef %115, ptr noundef %116, i32 noundef %117)
  br label %118

118:                                              ; preds = %107, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  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: inlinehint nounwind uwtable
declare hidden void @sha_sc(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @sha_lc(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

; 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 = { 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 #3 = { 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 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !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"

@SS = external hidden local_unnamed_addr global ptr, align 8
@AA = external hidden local_unnamed_addr global ptr, align 8
@II = external hidden local_unnamed_addr global ptr, align 8
@JJ = external hidden local_unnamed_addr global ptr, align 8
@g0 = external hidden local_unnamed_addr global float, align 4
@a1 = external hidden local_unnamed_addr global float, align 4
@a2 = external hidden local_unnamed_addr global float, align 4
@a3 = external hidden local_unnamed_addr global float, align 4
@gg = external hidden local_unnamed_addr global float, align 4
@exr = external hidden local_unnamed_addr global i32, align 4
@hbw = external hidden local_unnamed_addr global i32, align 4

; Function Attrs: nounwind uwtable
define dso_local void @cha_sha_process(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 80
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 344
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 352
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 368
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 360
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 376
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %0, i64 384
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 400
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %22, ptr @SS, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %0, i64 408
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %24, ptr @AA, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 416
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  store ptr %26, ptr @II, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 424
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  store ptr %28, ptr @JJ, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %0, i64 16
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 136
  %32 = load double, ptr %31, align 8, !tbaa !11
  %33 = fptrunc double %32 to float
  store float %33, ptr @g0, align 4, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %30, i64 144
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = fptrunc double %35 to float
  store float %36, ptr @a1, align 4, !tbaa !13
  %37 = getelementptr inbounds i8, ptr %30, i64 152
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = fptrunc double %38 to float
  store float %39, ptr @a2, align 4, !tbaa !13
  %40 = getelementptr inbounds i8, ptr %30, i64 160
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = fptrunc double %41 to float
  store float %42, ptr @a3, align 4, !tbaa !13
  %43 = getelementptr inbounds i8, ptr %30, i64 168
  %44 = load double, ptr %43, align 8, !tbaa !11
  %45 = fptrunc double %44 to float
  store float %45, ptr @gg, align 4, !tbaa !13
  %46 = getelementptr inbounds i8, ptr %6, i64 100
  %47 = load i32, ptr %46, align 4, !tbaa !9
  store i32 %47, ptr @exr, align 4, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %6, i64 104
  %49 = load i32, ptr %48, align 4, !tbaa !9
  store i32 %49, ptr @hbw, align 4, !tbaa !9
  %50 = sdiv i32 %8, 2
  %.not = icmp slt i32 %50, %3
  br i1 %.not, label %52, label %51

51:                                               ; preds = %4
  tail call void @sha_sc(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %12, ptr noundef %14, ptr noundef %16, ptr noundef %18, ptr noundef %10, ptr noundef %20, i32 noundef %8)
  br label %53

52:                                               ; preds = %4
  tail call void @sha_lc(ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %12, ptr noundef %14, ptr noundef %16, ptr noundef %18, ptr noundef %10, ptr noundef %20, i32 noundef %8)
  br label %53

53:                                               ; preds = %52, %51
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @sha_sc(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @sha_lc(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #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 = { 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" }

!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 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass