; LLVM IR from aap/pdp6 :: tools (as6)

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

%struct.Token = type { i32, %union.anon.0 }
%union.anon.0 = type { i64 }
%struct.Value = type { i64, i32 }

@.str.46 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err(i32 noundef, ptr noundef, ...) #0

; 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare i64 @fw(i32 noundef, i32 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @putv(i64 noundef, i32 noundef) #0

declare i32 @right(i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @updateext(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local { i32, i64 } @token() #0

; Function Attrs: nounwind uwtable
declare dso_local { i64, i32 } @expr(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @xwd() #0 {
  %1 = alloca %struct.Token, align 8
  %2 = alloca %struct.Value, align 8
  %3 = alloca %struct.Value, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.Value, align 8
  %7 = alloca %struct.Value, align 8
  %8 = alloca %struct.Value, align 8
  %9 = alloca %struct.Token, align 8
  %10 = alloca %struct.Value, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store ptr null, ptr %4, align 8, !tbaa !5
  store ptr null, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.Value, ptr %6, i32 0, i32 0
  store i64 0, ptr %11, align 8, !tbaa !9
  %12 = getelementptr inbounds %struct.Value, ptr %6, i32 0, i32 1
  store i32 0, ptr %12, align 8, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %2, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !14
  %13 = getelementptr inbounds %struct.Value, ptr %7, i32 0, i32 0
  store i64 0, ptr %13, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.Value, ptr %7, i32 0, i32 1
  store i32 0, ptr %14, align 8, !tbaa !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #4
  %15 = call { i64, i32 } @expr(i32 noundef 0, ptr noundef %4)
  %16 = getelementptr inbounds { i64, i32 }, ptr %8, i32 0, i32 0
  %17 = extractvalue { i64, i32 } %15, 0
  store i64 %17, ptr %16, align 8
  %18 = getelementptr inbounds { i64, i32 }, ptr %8, i32 0, i32 1
  %19 = extractvalue { i64, i32 } %15, 1
  store i32 %19, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %2, ptr align 8 %8, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #4
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  call void @updateext(ptr noundef %20, ptr noundef %2, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %21 = call { i32, i64 } @token()
  %22 = getelementptr inbounds { i32, i64 }, ptr %9, i32 0, i32 0
  %23 = extractvalue { i32, i64 } %21, 0
  store i32 %23, ptr %22, align 8
  %24 = getelementptr inbounds { i32, i64 }, ptr %9, i32 0, i32 1
  %25 = extractvalue { i32, i64 } %21, 1
  store i64 %25, ptr %24, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %1, ptr align 8 %9, i64 16, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  %26 = getelementptr inbounds %struct.Token, ptr %1, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = icmp eq i32 %27, 44
  br i1 %28, label %29, label %36

29:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #4
  %30 = call { i64, i32 } @expr(i32 noundef 0, ptr noundef %5)
  %31 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 0
  %32 = extractvalue { i64, i32 } %30, 0
  store i64 %32, ptr %31, align 8
  %33 = getelementptr inbounds { i64, i32 }, ptr %10, i32 0, i32 1
  %34 = extractvalue { i64, i32 } %30, 1
  store i32 %34, ptr %33, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #4
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  call void @updateext(ptr noundef %35, ptr noundef %3, i32 noundef 0)
  br label %37

36:                                               ; preds = %0
  call void (i32, ptr, ...) @err(i32 noundef 0, ptr noundef @.str.46)
  br label %37

37:                                               ; preds = %36, %29
  %38 = getelementptr inbounds %struct.Value, ptr %2, i32 0, i32 0
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = call i32 @right(i64 noundef %39)
  %41 = getelementptr inbounds %struct.Value, ptr %3, i32 0, i32 0
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = call i32 @right(i64 noundef %42)
  %44 = call i64 @fw(i32 noundef %40, i32 noundef %43)
  %45 = getelementptr inbounds %struct.Value, ptr %2, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = shl i32 %46, 1
  %48 = getelementptr inbounds %struct.Value, ptr %3, i32 0, i32 1
  %49 = load i32, ptr %48, align 8, !tbaa !13
  %50 = or i32 %47, %49
  call void @putv(i64 noundef %44, i32 noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %1) #4
  ret void
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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, !11, i64 0}
!10 = !{!"Value", !11, i64 0, !12, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !12, i64 8}
!14 = !{i64 0, i64 8, !15, i64 8, i64 4, !16}
!15 = !{!11, !11, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{i64 0, i64 4, !16, i64 8, i64 8, !18}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !12, i64 0}
!20 = !{!"Token", !12, i64 0, !7, i64 8}


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

%struct.Value = type { i64, i32 }

@.str.46 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #0

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

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

declare i64 @fw(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @putv(i64 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @right(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @updateext(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local { i32, i64 } @token() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local { i64, i32 } @expr(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @xwd() local_unnamed_addr #0 {
  %1 = alloca %struct.Value, align 8
  %2 = alloca %struct.Value, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  store ptr null, ptr %4, align 8, !tbaa !5
  %.sroa.29.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  store i64 0, ptr %2, align 8, !tbaa !9
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  store i32 0, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !11
  %5 = call { i64, i32 } @expr(i32 noundef 0, ptr noundef nonnull %3)
  %6 = extractvalue { i64, i32 } %5, 0
  %7 = extractvalue { i64, i32 } %5, 1
  store i64 %6, ptr %1, align 8, !tbaa !9
  store i32 %7, ptr %.sroa.29.0..sroa_idx, align 8, !tbaa !11
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  call void @updateext(ptr noundef %8, ptr noundef nonnull %1, i32 noundef 1)
  %9 = call { i32, i64 } @token()
  %10 = extractvalue { i32, i64 } %9, 0
  %11 = icmp eq i32 %10, 44
  br i1 %11, label %12, label %17

12:                                               ; preds = %0
  %13 = call { i64, i32 } @expr(i32 noundef 0, ptr noundef nonnull %4)
  %14 = extractvalue { i64, i32 } %13, 0
  %15 = extractvalue { i64, i32 } %13, 1
  store i64 %14, ptr %2, align 8, !tbaa !9
  store i32 %15, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !11
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  call void @updateext(ptr noundef %16, ptr noundef nonnull %2, i32 noundef 0)
  br label %18

17:                                               ; preds = %0
  call void (i32, ptr, ...) @err(i32 noundef 0, ptr noundef nonnull @.str.46)
  br label %18

18:                                               ; preds = %17, %12
  %19 = load i64, ptr %1, align 8, !tbaa !13
  %20 = call i32 @right(i64 noundef %19) #3
  %21 = load i64, ptr %2, align 8, !tbaa !13
  %22 = call i32 @right(i64 noundef %21) #3
  %23 = call i64 @fw(i32 noundef %20, i32 noundef %22) #3
  %24 = load i32, ptr %.sroa.29.0..sroa_idx, align 8, !tbaa !15
  %25 = shl i32 %24, 1
  %26 = load i32, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !15
  %27 = or i32 %25, %26
  call void @putv(i64 noundef %23, i32 noundef %27)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #3
  ret void
}

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"Value", !10, i64 0, !12, i64 8}
!15 = !{!14, !12, i64 8}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass