; LLVM IR from freakout42/macrocalc :: arx/src (cur_init)

; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }
%struct.termtype = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i16, i16, i16, i16, i16, i16 }

@std_in = external dso_local global ptr, align 8
@std_out = external dso_local global ptr, align 8
@std_err = external dso_local global ptr, align 8
@std_nerr = external dso_local global ptr, align 8
@std_erread = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external global ptr, align 8
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@cur_redir = external dso_local global i32, align 4
@cur_term = external global ptr, align 8
@otermio = external dso_local global %struct.termios, align 4
@stdscr = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @cur_init(i32 noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca [2 x i32], align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %struct.termios, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr @.str, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 60, ptr %8) #5
  %10 = call ptr @signal(i32 noundef 8, ptr noundef inttoptr (i64 1 to ptr)) #5
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp sge i32 %11, 1
  br i1 %12, label %13, label %20

13:                                               ; preds = %1
  %14 = load ptr, ptr %7, align 8, !tbaa !9
  %15 = load ptr, ptr @stdin, align 8, !tbaa !9
  %16 = call ptr @lib_freo(ptr noundef %14, ptr noundef @.str.1, ptr noundef %15)
  store ptr %16, ptr @std_in, align 8, !tbaa !9
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %13
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

19:                                               ; preds = %13
  br label %20

20:                                               ; preds = %19, %1
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = icmp sge i32 %21, 2
  br i1 %22, label %23, label %30

23:                                               ; preds = %20
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  %25 = load ptr, ptr @stdout, align 8, !tbaa !9
  %26 = call ptr @lib_freo(ptr noundef %24, ptr noundef @.str.1, ptr noundef %25)
  store ptr %26, ptr @std_out, align 8, !tbaa !9
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %23
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

29:                                               ; preds = %23
  br label %30

30:                                               ; preds = %29, %20
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = icmp sge i32 %31, 3
  br i1 %32, label %33, label %81

33:                                               ; preds = %30
  %34 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 0
  %35 = call i32 @pipe(ptr noundef %34) #5
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %54, label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr @stderr, align 8, !tbaa !9
  %39 = call ptr @lib_freo(ptr noundef null, ptr noundef @.str.1, ptr noundef %38)
  store ptr %39, ptr @std_err, align 8, !tbaa !9
  %40 = icmp eq ptr %39, null
  br i1 %40, label %54, label %41

41:                                               ; preds = %37
  %42 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 1
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = call i32 @dup(i32 noundef %43) #5
  %45 = icmp ne i32 %44, 2
  br i1 %45, label %54, label %46

46:                                               ; preds = %41
  %47 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 1
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = call i32 @close(i32 noundef %48)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %54, label %51

51:                                               ; preds = %46
  %52 = call noalias ptr @fdopen(i32 noundef 2, ptr noundef @.str.2) #5
  store ptr %52, ptr @std_nerr, align 8, !tbaa !9
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %51, %46, %41, %37, %33
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

55:                                               ; preds = %51
  %56 = load ptr, ptr @stderr, align 8, !tbaa !9
  %57 = load ptr, ptr @std_nerr, align 8, !tbaa !9
  %58 = icmp ne ptr %56, %57
  br i1 %58, label %59, label %62

59:                                               ; preds = %55
  %60 = load ptr, ptr @stderr, align 8, !tbaa !9
  %61 = load ptr, ptr @std_nerr, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %60, ptr align 8 %61, i64 216, i1 false)
  br label %62

62:                                               ; preds = %59, %55
  %63 = load ptr, ptr @stderr, align 8, !tbaa !9
  call void @setbuf(ptr noundef %63, ptr noundef null) #5
  %64 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 0
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = call noalias ptr @fdopen(i32 noundef %65, ptr noundef @.str.3) #5
  store ptr %66, ptr @std_erread, align 8, !tbaa !9
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %69

68:                                               ; preds = %62
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

69:                                               ; preds = %62
  %70 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 0
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = call i32 (i32, i32, ...) @fcntl(i32 noundef %71, i32 noundef 2, i32 noundef 1)
  %73 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 0
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = call i32 (i32, i32, ...) @fcntl(i32 noundef %74, i32 noundef 3, i32 noundef 0)
  store i32 %75, ptr %6, align 4, !tbaa !5
  %76 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 0
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = or i32 %78, 2048
  %80 = call i32 (i32, i32, ...) @fcntl(i32 noundef %77, i32 noundef 4, i32 noundef %79)
  br label %81

81:                                               ; preds = %69, %30
  %82 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %82, ptr @cur_redir, align 4, !tbaa !5
  %83 = call ptr @initscr()
  store ptr %83, ptr %4, align 8, !tbaa !9
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

86:                                               ; preds = %81
  %87 = load ptr, ptr @cur_term, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.termtype, ptr %87, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !11
  %90 = getelementptr inbounds i16, ptr %89, i64 1
  store i16 0, ptr %90, align 2, !tbaa !14
  %91 = call ptr @signal(i32 noundef 20, ptr noundef inttoptr (i64 1 to ptr)) #5
  %92 = load ptr, ptr @stdin, align 8, !tbaa !9
  %93 = call i32 @fileno(ptr noundef %92) #5
  %94 = call i32 @tcgetattr(i32 noundef %93, ptr noundef %8) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 @otermio, ptr align 4 %8, i64 60, i1 false), !tbaa.struct !15
  %95 = getelementptr inbounds %struct.termios, ptr %8, i32 0, i32 5
  %96 = getelementptr inbounds [32 x i8], ptr %95, i64 0, i64 0
  store i8 0, ptr %96, align 1, !tbaa !16
  %97 = getelementptr inbounds %struct.termios, ptr %8, i32 0, i32 5
  %98 = getelementptr inbounds [32 x i8], ptr %97, i64 0, i64 10
  store i8 0, ptr %98, align 1, !tbaa !16
  %99 = getelementptr inbounds %struct.termios, ptr %8, i32 0, i32 5
  %100 = getelementptr inbounds [32 x i8], ptr %99, i64 0, i64 15
  store i8 0, ptr %100, align 1, !tbaa !16
  %101 = load ptr, ptr @stdin, align 8, !tbaa !9
  %102 = call i32 @fileno(ptr noundef %101) #5
  %103 = call i32 @tcsetattr(i32 noundef %102, i32 noundef 0, ptr noundef %8) #5
  %104 = call i32 @nonl()
  %105 = call i32 @noecho()
  %106 = load ptr, ptr @stdscr, align 8, !tbaa !9
  %107 = call i32 @keypad(ptr noundef %106, i1 noundef zeroext true)
  %108 = load ptr, ptr %4, align 8, !tbaa !9
  store ptr %108, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %109

109:                                              ; preds = %86, %85, %68, %54, %28, %18
  call void @llvm.lifetime.end.p0(i64 60, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  %110 = load ptr, ptr %2, align 8
  ret ptr %110
}

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

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

declare ptr @lib_freo(ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare i32 @dup(i32 noundef) #2

declare i32 @close(i32 noundef) #3

; Function Attrs: nounwind
declare noalias ptr @fdopen(i32 noundef, ptr noundef) #2

; 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) #4

; Function Attrs: nounwind
declare void @setbuf(ptr noundef, ptr noundef) #2

declare i32 @fcntl(i32 noundef, i32 noundef, ...) #3

declare ptr @initscr() #3

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

; Function Attrs: nounwind
declare i32 @fileno(ptr noundef) #2

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

declare i32 @nonl() #3

declare i32 @noecho() #3

declare i32 @keypad(ptr noundef, i1 noundef zeroext) #3

; 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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}
!11 = !{!12, !10, i64 24}
!12 = !{!"termtype", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56, !13, i64 58, !13, i64 60, !13, i64 62, !13, i64 64, !13, i64 66}
!13 = !{!"short", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 1, !16, i64 17, i64 32, !16, i64 52, i64 4, !5, i64 56, i64 4, !5}
!16 = !{!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"

%struct.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }

@std_in = external dso_local local_unnamed_addr global ptr, align 8
@std_out = external dso_local local_unnamed_addr global ptr, align 8
@std_err = external dso_local local_unnamed_addr global ptr, align 8
@std_nerr = external dso_local local_unnamed_addr global ptr, align 8
@std_erread = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@cur_redir = external dso_local local_unnamed_addr global i32, align 4
@cur_term = external local_unnamed_addr global ptr, align 8
@otermio = external dso_local local_unnamed_addr global %struct.termios, align 4
@stdscr = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @cur_init(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca [2 x i32], align 4
  %3 = alloca %struct.termios, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %3) #6
  %4 = tail call ptr @signal(i32 noundef 8, ptr noundef nonnull inttoptr (i64 1 to ptr)) #6
  %5 = icmp sgt i32 %0, 0
  br i1 %5, label %6, label %.thread14

6:                                                ; preds = %1
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  %8 = tail call ptr @lib_freo(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %7) #6
  store ptr %8, ptr @std_in, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %70, label %10

10:                                               ; preds = %6
  %.not15 = icmp eq i32 %0, 1
  br i1 %.not15, label %.thread14, label %11

11:                                               ; preds = %10
  %12 = load ptr, ptr @stdout, align 8, !tbaa !5
  %13 = tail call ptr @lib_freo(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %12) #6
  store ptr %13, ptr @std_out, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %70, label %15

15:                                               ; preds = %11
  %16 = icmp ugt i32 %0, 2
  br i1 %16, label %17, label %.thread14

17:                                               ; preds = %15
  %18 = call i32 @pipe(ptr noundef nonnull %2) #6
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %19, label %70

19:                                               ; preds = %17
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = call ptr @lib_freo(ptr noundef null, ptr noundef nonnull @.str.1, ptr noundef %20) #6
  store ptr %21, ptr @std_err, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %70, label %23

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %2, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = call i32 @dup(i32 noundef %25) #6
  %.not11 = icmp eq i32 %26, 2
  br i1 %.not11, label %27, label %70

27:                                               ; preds = %23
  %28 = load i32, ptr %24, align 4, !tbaa !9
  %29 = call i32 @close(i32 noundef %28) #6
  %.not12 = icmp eq i32 %29, 0
  br i1 %.not12, label %30, label %70

30:                                               ; preds = %27
  %31 = call noalias ptr @fdopen(i32 noundef 2, ptr noundef nonnull @.str.2) #6
  store ptr %31, ptr @std_nerr, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %70, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %.not13 = icmp eq ptr %34, %31
  br i1 %.not13, label %36, label %35

35:                                               ; preds = %33
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(216) %34, ptr noundef nonnull align 8 dereferenceable(216) %31, i64 216, i1 false)
  %.pre = load ptr, ptr @stderr, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %35, %33
  %37 = phi ptr [ %.pre, %35 ], [ %34, %33 ]
  call void @setbuf(ptr noundef %37, ptr noundef null) #6
  %38 = load i32, ptr %2, align 4, !tbaa !9
  %39 = call noalias ptr @fdopen(i32 noundef %38, ptr noundef nonnull @.str.3) #6
  store ptr %39, ptr @std_erread, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %70, label %41

41:                                               ; preds = %36
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = call i32 (i32, i32, ...) @fcntl(i32 noundef %42, i32 noundef 2, i32 noundef 1) #6
  %44 = load i32, ptr %2, align 4, !tbaa !9
  %45 = call i32 (i32, i32, ...) @fcntl(i32 noundef %44, i32 noundef 3, i32 noundef 0) #6
  %46 = load i32, ptr %2, align 4, !tbaa !9
  %47 = or i32 %45, 2048
  %48 = call i32 (i32, i32, ...) @fcntl(i32 noundef %46, i32 noundef 4, i32 noundef %47) #6
  br label %.thread14

.thread14:                                        ; preds = %1, %10, %41, %15
  store i32 %0, ptr @cur_redir, align 4, !tbaa !9
  %49 = call ptr @initscr() #6
  %50 = icmp eq ptr %49, null
  br i1 %50, label %70, label %51

51:                                               ; preds = %.thread14
  %52 = load ptr, ptr @cur_term, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 24
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds i8, ptr %54, i64 2
  store i16 0, ptr %55, align 2, !tbaa !14
  %56 = call ptr @signal(i32 noundef 20, ptr noundef nonnull inttoptr (i64 1 to ptr)) #6
  %57 = load ptr, ptr @stdin, align 8, !tbaa !5
  %58 = call i32 @fileno(ptr noundef %57) #6
  %59 = call i32 @tcgetattr(i32 noundef %58, ptr noundef nonnull %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(60) @otermio, ptr noundef nonnull align 4 dereferenceable(60) %3, i64 60, i1 false), !tbaa.struct !15
  %60 = getelementptr inbounds i8, ptr %3, i64 17
  store i8 0, ptr %60, align 1, !tbaa !16
  %61 = getelementptr inbounds i8, ptr %3, i64 27
  store i8 0, ptr %61, align 1, !tbaa !16
  %62 = getelementptr inbounds i8, ptr %3, i64 32
  store i8 0, ptr %62, align 4, !tbaa !16
  %63 = load ptr, ptr @stdin, align 8, !tbaa !5
  %64 = call i32 @fileno(ptr noundef %63) #6
  %65 = call i32 @tcsetattr(i32 noundef %64, i32 noundef 0, ptr noundef nonnull %3) #6
  %66 = call i32 @nonl() #6
  %67 = call i32 @noecho() #6
  %68 = load ptr, ptr @stdscr, align 8, !tbaa !5
  %69 = call i32 @keypad(ptr noundef %68, i1 noundef zeroext true) #6
  br label %70

70:                                               ; preds = %.thread14, %36, %17, %19, %23, %27, %30, %11, %6, %51
  %.0 = phi ptr [ %49, %51 ], [ null, %6 ], [ null, %11 ], [ null, %30 ], [ null, %27 ], [ null, %23 ], [ null, %19 ], [ null, %17 ], [ null, %36 ], [ null, %.thread14 ]
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret ptr %.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: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @lib_freo(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind
declare i32 @dup(i32 noundef) local_unnamed_addr #2

declare i32 @close(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress 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) #5

; Function Attrs: nofree nounwind
declare void @setbuf(ptr nocapture noundef, ptr noundef) local_unnamed_addr #4

declare i32 @fcntl(i32 noundef, i32 noundef, ...) local_unnamed_addr #3

declare ptr @initscr() local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @tcgetattr(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fileno(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @tcsetattr(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @nonl() local_unnamed_addr #3

declare i32 @noecho() local_unnamed_addr #3

declare i32 @keypad(ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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, !6, i64 24}
!12 = !{!"termtype", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 58, !13, i64 60, !13, i64 62, !13, i64 64, !13, i64 66}
!13 = !{!"short", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9, i64 16, i64 1, !16, i64 17, i64 32, !16, i64 52, i64 4, !9, i64 56, i64 4, !9}
!16 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass