; LLVM IR from ihucos/plash :: tests/C (pl_parse_subid)

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

@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @pl_fatal(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: noreturn nounwind
declare void @exit(i32 noundef) #2

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

; Function Attrs: nounwind
declare i32 @fork() #3

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

11:                                               ; preds = %1
  %12 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.38)
  br label %13

13:                                               ; preds = %11, %1
  %14 = call i32 @fork() #6
  store i32 %14, ptr %5, align 4, !tbaa !9
  switch i32 %14, label %45 [
    i32 -1, label %15
    i32 0, label %17
  ]

15:                                               ; preds = %13
  %16 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.26)
  br label %17

17:                                               ; preds = %15, %13
  %18 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = call i32 @dup2(i32 noundef %19, i32 noundef 1) #6
  %21 = icmp eq i32 %20, -1
  br i1 %21, label %22, label %24

22:                                               ; preds = %17
  %23 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.39)
  br label %24

24:                                               ; preds = %22, %17
  %25 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = call i32 @close(i32 noundef %26)
  %28 = icmp eq i32 %27, -1
  br i1 %28, label %29, label %31

29:                                               ; preds = %24
  %30 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.40)
  br label %31

31:                                               ; preds = %29, %24
  %32 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = call i32 @close(i32 noundef %33)
  %35 = icmp eq i32 %34, -1
  br i1 %35, label %36, label %38

36:                                               ; preds = %31
  %37 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.40)
  br label %38

38:                                               ; preds = %36, %31
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds ptr, ptr %39, i64 0
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = call i32 @execvp(ptr noundef %41, ptr noundef %42) #6
  %44 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.41)
  br label %45

45:                                               ; preds = %38, %13
  %46 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = call i32 @close(i32 noundef %47)
  %49 = icmp eq i32 %48, -1
  br i1 %49, label %50, label %52

50:                                               ; preds = %45
  %51 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.40)
  br label %52

52:                                               ; preds = %50, %45
  %53 = load i32, ptr %5, align 4, !tbaa !9
  %54 = call i32 @waitpid(i32 noundef %53, ptr noundef %4, i32 noundef 0)
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = and i32 %55, 127
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %60, label %58

58:                                               ; preds = %52
  %59 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.42)
  br label %60

60:                                               ; preds = %58, %52
  %61 = load i32, ptr %4, align 4, !tbaa !9
  %62 = and i32 %61, 65280
  %63 = ashr i32 %62, 8
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  call void @exit(i32 noundef 1) #8
  unreachable

66:                                               ; preds = %60
  %67 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = call i64 @read(i32 noundef %68, ptr noundef %69, i64 noundef 102400)
  %71 = icmp eq i64 %70, -1
  br i1 %71, label %72, label %74

72:                                               ; preds = %66
  %73 = call i32 (ptr, ...) @pl_fatal(ptr noundef @.str.43)
  br label %74

74:                                               ; preds = %72, %66
  %75 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = call i32 @close(i32 noundef %76)
  %78 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1
  %79 = load i32, ptr %78, align 4, !tbaa !9
  %80 = call i32 @close(i32 noundef %79)
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret ptr %81
}

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #4

; Function Attrs: nounwind
declare i32 @pipe(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @dup2(i32 noundef, i32 noundef) #3

declare i32 @close(i32 noundef) #5

; Function Attrs: nounwind
declare i32 @execvp(ptr noundef, ptr noundef) #3

declare i32 @waitpid(i32 noundef, ptr noundef, i32 noundef) #5

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

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 = { noreturn 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 "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 allocsize(0,1) "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 = { "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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }
attributes #8 = { noreturn 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}


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

@.str.26 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @pl_fatal(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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare i32 @fork() local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @pl_check_output(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca [2 x i32], align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %4 = tail call noalias dereferenceable_or_null(819200) ptr @calloc(i64 noundef 102400, i64 noundef 8) #9
  %5 = call i32 @pipe(ptr noundef nonnull %2) #8
  %6 = icmp eq i32 %5, -1
  br i1 %6, label %7, label %9

7:                                                ; preds = %1
  %8 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.38)
  br label %9

9:                                                ; preds = %7, %1
  %10 = call i32 @fork() #8
  switch i32 %10, label %36 [
    i32 -1, label %11
    i32 0, label %13
  ]

11:                                               ; preds = %9
  %12 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.26)
  br label %13

13:                                               ; preds = %11, %9
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = call i32 @dup2(i32 noundef %15, i32 noundef 1) #8
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %20

18:                                               ; preds = %13
  %19 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.39)
  br label %20

20:                                               ; preds = %18, %13
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = call i32 @close(i32 noundef %21) #8
  %23 = icmp eq i32 %22, -1
  br i1 %23, label %24, label %26

24:                                               ; preds = %20
  %25 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.40)
  br label %26

26:                                               ; preds = %24, %20
  %27 = load i32, ptr %14, align 4, !tbaa !5
  %28 = call i32 @close(i32 noundef %27) #8
  %29 = icmp eq i32 %28, -1
  br i1 %29, label %30, label %32

30:                                               ; preds = %26
  %31 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.40)
  br label %32

32:                                               ; preds = %30, %26
  %33 = load ptr, ptr %0, align 8, !tbaa !9
  %34 = call i32 @execvp(ptr noundef %33, ptr noundef nonnull %0) #8
  %35 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.41)
  br label %36

36:                                               ; preds = %32, %9
  %37 = getelementptr inbounds i8, ptr %2, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = call i32 @close(i32 noundef %38) #8
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.40)
  br label %43

43:                                               ; preds = %41, %36
  %44 = call i32 @waitpid(i32 noundef %10, ptr noundef nonnull %3, i32 noundef 0) #8
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = and i32 %45, 127
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %50, label %48

48:                                               ; preds = %43
  %49 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.42)
  %.pre = load i32, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %48, %43
  %51 = phi i32 [ %.pre, %48 ], [ %45, %43 ]
  %52 = and i32 %51, 65280
  %.not = icmp eq i32 %52, 0
  br i1 %.not, label %54, label %53

53:                                               ; preds = %50
  call void @exit(i32 noundef 1) #10
  unreachable

54:                                               ; preds = %50
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = call i64 @read(i32 noundef %55, ptr noundef %4, i64 noundef 102400) #8
  %57 = icmp eq i64 %56, -1
  br i1 %57, label %58, label %60

58:                                               ; preds = %54
  %59 = call i32 (ptr, ...) @pl_fatal(ptr noundef nonnull @.str.43)
  br label %60

60:                                               ; preds = %58, %54
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = call i32 @close(i32 noundef %61) #8
  %63 = load i32, ptr %37, align 4, !tbaa !5
  %64 = call i32 @close(i32 noundef %63) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  ret ptr %4
}

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

; Function Attrs: nounwind
declare i32 @pipe(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i32 @dup2(i32 noundef, i32 noundef) local_unnamed_addr #5

declare i32 @close(i32 noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare i32 @execvp(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @waitpid(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

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

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 = { noreturn 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 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #5 = { 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 #6 = { "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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
attributes #10 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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