; LLVM IR from aap/pdp6 :: newemu (ut)

; 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.Ux555 = type { i32, ptr, i32, i32, i8, i8, i64, i8, i8, i32, i32, i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @uxunmount(ptr noundef) #1

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @uxmount(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  call void @uxunmount(ptr noundef %5)
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = call i32 (ptr, i32, ...) @open(ptr noundef %6, i32 noundef 2)
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.Ux555, ptr %8, i32 0, i32 0
  store i32 %7, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.Ux555, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp slt i32 %12, 0
  br i1 %13, label %14, label %30

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i32 (ptr, i32, ...) @open(ptr noundef %15, i32 noundef 0)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.Ux555, ptr %17, i32 0, i32 0
  store i32 %16, ptr %18, align 8, !tbaa !9
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.Ux555, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !9
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %27

23:                                               ; preds = %14
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str, ptr noundef %25) #4
  br label %93

27:                                               ; preds = %14
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Ux555, ptr %28, i32 0, i32 8
  store i8 1, ptr %29, align 1, !tbaa !14
  br label %30

30:                                               ; preds = %27, %2
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Ux555, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !9
  %34 = call i64 @lseek(i32 noundef %33, i64 noundef 0, i32 noundef 2) #4
  %35 = trunc i64 %34 to i32
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Ux555, ptr %36, i32 0, i32 2
  store i32 %35, ptr %37, align 8, !tbaa !15
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Ux555, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = sext i32 %40 to i64
  %42 = call noalias ptr @malloc(i64 noundef %41) #5
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Ux555, ptr %43, i32 0, i32 1
  store ptr %42, ptr %44, align 8, !tbaa !16
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.Ux555, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !9
  %48 = call i64 @lseek(i32 noundef %47, i64 noundef 0, i32 noundef 0) #4
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.Ux555, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 8, !tbaa !9
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.Ux555, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.Ux555, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 8, !tbaa !15
  %58 = sext i32 %57 to i64
  %59 = call i64 @read(i32 noundef %51, ptr noundef %54, i64 noundef %58)
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Ux555, ptr %60, i32 0, i32 4
  store i8 0, ptr %61, align 8, !tbaa !17
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.Ux555, ptr %62, i32 0, i32 3
  store i32 100, ptr %63, align 4, !tbaa !18
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.Ux555, ptr %64, i32 0, i32 3
  %66 = load i32, ptr %65, align 4, !tbaa !18
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.Ux555, ptr %67, i32 0, i32 2
  %69 = load i32, ptr %68, align 8, !tbaa !15
  %70 = icmp sge i32 %66, %69
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Ux555, ptr %71, i32 0, i32 5
  %73 = zext i1 %70 to i8
  store i8 %73, ptr %72, align 1, !tbaa !19
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.Ux555, ptr %74, i32 0, i32 7
  store i8 0, ptr %75, align 8, !tbaa !20
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.Ux555, ptr %76, i32 0, i32 10
  store i32 0, ptr %77, align 8, !tbaa !21
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.Ux555, ptr %78, i32 0, i32 11
  store i32 0, ptr %79, align 4, !tbaa !22
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.Ux555, ptr %80, i32 0, i32 9
  %82 = load i32, ptr %81, align 4, !tbaa !23
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.Ux555, ptr %84, i32 0, i32 2
  %86 = load i32, ptr %85, align 8, !tbaa !15
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Ux555, ptr %87, i32 0, i32 8
  %89 = load i8, ptr %88, align 1, !tbaa !14, !range !24, !noundef !25
  %90 = trunc i8 %89 to i1
  %91 = zext i1 %90 to i32
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %82, ptr noundef %83, i32 noundef %86, i32 noundef %91)
  br label %93

93:                                               ; preds = %30, %23
  ret void
}

declare i32 @open(ptr noundef, i32 noundef, ...) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare i64 @read(i32 noundef, ptr noundef, i64 noundef) #3

declare i32 @printf(ptr noundef, ...) #3

attributes #0 = { nounwind allocsize(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 = { 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 = { 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 = { "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 }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!"Ux555", !11, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 25, !13, i64 32, !12, i64 40, !12, i64 41, !11, i64 44, !11, i64 48, !11, i64 52}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!10, !12, i64 41}
!15 = !{!10, !11, i64 16}
!16 = !{!10, !6, i64 8}
!17 = !{!10, !12, i64 24}
!18 = !{!10, !11, i64 20}
!19 = !{!10, !12, i64 25}
!20 = !{!10, !12, i64 40}
!21 = !{!10, !11, i64 48}
!22 = !{!10, !11, i64 52}
!23 = !{!10, !11, i64 44}
!24 = !{i8 0, i8 2}
!25 = !{}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind
declare i64 @lseek(i32 noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @uxmount(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  tail call void @uxunmount(ptr noundef %0)
  %3 = tail call i32 (ptr, i32, ...) @open(ptr noundef %1, i32 noundef 2) #5
  store i32 %3, ptr %0, align 8, !tbaa !5
  %4 = icmp slt i32 %3, 0
  br i1 %4, label %5, label %13

5:                                                ; preds = %2
  %6 = tail call i32 (ptr, i32, ...) @open(ptr noundef %1, i32 noundef 0) #5
  store i32 %6, ptr %0, align 8, !tbaa !5
  %7 = icmp slt i32 %6, 0
  br i1 %7, label %8, label %11

8:                                                ; preds = %5
  %9 = load ptr, ptr @stderr, align 8, !tbaa !13
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef %1) #6
  br label %43

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %0, i64 41
  store i8 1, ptr %12, align 1, !tbaa !14
  br label %13

13:                                               ; preds = %11, %2
  %14 = phi i32 [ %6, %11 ], [ %3, %2 ]
  %15 = tail call i64 @lseek(i32 noundef %14, i64 noundef 0, i32 noundef 2) #5
  %16 = trunc i64 %15 to i32
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %16, ptr %17, align 8, !tbaa !15
  %sext = shl i64 %15, 32
  %18 = ashr exact i64 %sext, 32
  %19 = tail call noalias ptr @malloc(i64 noundef %18) #7
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %19, ptr %20, align 8, !tbaa !16
  %21 = load i32, ptr %0, align 8, !tbaa !5
  %22 = tail call i64 @lseek(i32 noundef %21, i64 noundef 0, i32 noundef 0) #5
  %23 = load i32, ptr %0, align 8, !tbaa !5
  %24 = load ptr, ptr %20, align 8, !tbaa !16
  %25 = load i32, ptr %17, align 8, !tbaa !15
  %26 = sext i32 %25 to i64
  %27 = tail call i64 @read(i32 noundef %23, ptr noundef %24, i64 noundef %26) #5
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 0, ptr %28, align 8, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 100, ptr %29, align 4, !tbaa !18
  %30 = load i32, ptr %17, align 8, !tbaa !15
  %31 = icmp slt i32 %30, 101
  %32 = getelementptr inbounds i8, ptr %0, i64 25
  %33 = zext i1 %31 to i8
  store i8 %33, ptr %32, align 1, !tbaa !19
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  store i8 0, ptr %34, align 8, !tbaa !20
  %35 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 0, ptr %35, align 8, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %0, i64 52
  store i32 0, ptr %36, align 4, !tbaa !22
  %37 = getelementptr inbounds i8, ptr %0, i64 44
  %38 = load i32, ptr %37, align 4, !tbaa !23
  %39 = getelementptr inbounds i8, ptr %0, i64 41
  %40 = load i8, ptr %39, align 1, !tbaa !14, !range !24, !noundef !25
  %41 = zext nneg i8 %40 to i32
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %38, ptr noundef %1, i32 noundef %30, i32 noundef %41)
  br label %43

43:                                               ; preds = %13, %8
  ret void
}

; Function Attrs: nofree
declare noundef i32 @open(ptr nocapture noundef readonly, i32 noundef, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { 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 = { nofree "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 = { 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 #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { nounwind allocsize(0) }

!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, !7, i64 0}
!6 = !{!"Ux555", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !11, i64 24, !11, i64 25, !12, i64 32, !11, i64 40, !11, i64 41, !7, i64 44, !7, i64 48, !7, i64 52}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !11, i64 41}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !10, i64 8}
!17 = !{!6, !11, i64 24}
!18 = !{!6, !7, i64 20}
!19 = !{!6, !11, i64 25}
!20 = !{!6, !11, i64 40}
!21 = !{!6, !7, i64 48}
!22 = !{!6, !7, i64 52}
!23 = !{!6, !7, i64 44}
!24 = !{i8 0, i8 2}
!25 = !{}


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