; LLVM IR from aap/pdp6 :: fe6 (pdp6common)

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @readwbak(ptr noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca [5 x i8], align 1
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5, ptr %4) #3
  %6 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call i64 @fread(ptr noundef %6, i64 noundef 1, i64 noundef 5, ptr noundef %7)
  %9 = icmp ne i64 %8, 5
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  store i64 -1, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %43

11:                                               ; preds = %1
  %12 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 0
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %14 = sext i8 %13 to i64
  %15 = shl i64 %14, 29
  %16 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 1
  %17 = load i8, ptr %16, align 1, !tbaa !9
  %18 = sext i8 %17 to i64
  %19 = shl i64 %18, 22
  %20 = or i64 %15, %19
  %21 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 2
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = sext i8 %22 to i64
  %24 = shl i64 %23, 15
  %25 = or i64 %20, %24
  %26 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 3
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = sext i8 %27 to i64
  %29 = shl i64 %28, 8
  %30 = or i64 %25, %29
  %31 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = sext i8 %32 to i64
  %34 = and i64 %33, 127
  %35 = shl i64 %34, 1
  %36 = or i64 %30, %35
  %37 = getelementptr inbounds [5 x i8], ptr %4, i64 0, i64 4
  %38 = load i8, ptr %37, align 1, !tbaa !9
  %39 = sext i8 %38 to i64
  %40 = and i64 %39, 128
  %41 = lshr i64 %40, 7
  %42 = or i64 %36, %41
  store i64 %42, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %43

43:                                               ; preds = %11, %10
  call void @llvm.lifetime.end.p0(i64 5, ptr %4) #3
  %44 = load i64, ptr %2, align 8
  ret i64 %44
}

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nofree nounwind uwtable
define dso_local i64 @readwbak(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %2) #3
  %3 = call i64 @fread(ptr noundef nonnull %2, i64 noundef 1, i64 noundef 5, ptr noundef %0)
  %.not = icmp eq i64 %3, 5
  br i1 %.not, label %4, label %32

4:                                                ; preds = %1
  %5 = load i8, ptr %2, align 1, !tbaa !5
  %6 = sext i8 %5 to i64
  %7 = shl nsw i64 %6, 29
  %8 = getelementptr inbounds i8, ptr %2, i64 1
  %9 = load i8, ptr %8, align 1, !tbaa !5
  %10 = sext i8 %9 to i64
  %11 = shl nsw i64 %10, 22
  %12 = or i64 %11, %7
  %13 = getelementptr inbounds i8, ptr %2, i64 2
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = sext i8 %14 to i64
  %16 = shl nsw i64 %15, 15
  %17 = or i64 %12, %16
  %18 = getelementptr inbounds i8, ptr %2, i64 3
  %19 = load i8, ptr %18, align 1, !tbaa !5
  %20 = sext i8 %19 to i64
  %21 = shl nsw i64 %20, 8
  %22 = or i64 %17, %21
  %23 = getelementptr inbounds i8, ptr %2, i64 4
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = sext i8 %24 to i64
  %26 = shl nsw i64 %25, 1
  %27 = and i64 %26, 254
  %28 = or disjoint i64 %22, %27
  %29 = lshr i64 %25, 7
  %30 = and i64 %29, 1
  %31 = or disjoint i64 %28, %30
  br label %32

32:                                               ; preds = %1, %4
  %.0 = phi i64 [ %31, %4 ], [ -1, %1 ]
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %2) #3
  ret i64 %.0
}

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

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


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