; LLVM IR from gem5/gem5 :: util/term (term)

; 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.sockaddr_un = type { i16, [108 x i8] }

@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @remote_connect_unix(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %struct.sockaddr_un, align 2
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 110, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call noalias ptr @strdup(ptr noundef %16) #9
  store ptr %17, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #9
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %18, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  %19 = call i32 @socket(i32 noundef 1, i32 noundef 1, i32 noundef 0) #9
  store i32 %19, ptr %7, align 4, !tbaa !9
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = icmp eq i32 %20, -1
  br i1 %21, label %22, label %24

22:                                               ; preds = %1
  %23 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %23, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %118

24:                                               ; preds = %1
  call void @llvm.memset.p0.i64(ptr align 2 %4, i8 0, i64 110, i1 false)
  %25 = getelementptr inbounds %struct.sockaddr_un, ptr %4, i32 0, i32 0
  store i16 1, ptr %25, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 108, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %26 = getelementptr inbounds %struct.sockaddr_un, ptr %4, i32 0, i32 1
  %27 = getelementptr inbounds [108 x i8], ptr %26, i64 0, i64 0
  store ptr %27, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  store ptr null, ptr %11, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %28, i64 0
  %30 = load i8, ptr %29, align 1, !tbaa !14
  %31 = sext i8 %30 to i32
  %32 = icmp eq i32 %31, 64
  br i1 %32, label %33, label %53

33:                                               ; preds = %24
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i32 1
  store ptr %35, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %34, align 1, !tbaa !14
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %36, i32 1
  store ptr %37, ptr %5, align 8, !tbaa !5
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call i64 @strlen(ptr noundef %40) #10
  %42 = trunc i64 %41 to i32
  store i32 %42, ptr %12, align 4, !tbaa !9
  %43 = load i32, ptr %12, align 4, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %52

46:                                               ; preds = %33
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = load i32, ptr %12, align 4, !tbaa !9
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.4, i32 noundef %48, i32 noundef %49) #9
  %51 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %51, ptr %9, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %46, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %80

53:                                               ; preds = %24
  %54 = call noalias ptr @malloc(i64 noundef 4096) #11
  store ptr %54, ptr %11, align 8, !tbaa !5
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.5, i32 noundef 4096) #12
  unreachable

58:                                               ; preds = %53
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = call ptr @getcwd(ptr noundef %59, i64 noundef 4096) #9
  %61 = icmp ne ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @perror(ptr noundef @.str.6)
  call void @exit(i32 noundef 1) #13
  unreachable

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = call noalias ptr @strdup(ptr noundef %64) #9
  store ptr %65, ptr %13, align 8, !tbaa !5
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = icmp ne ptr %66, null
  br i1 %67, label %69, label %68

68:                                               ; preds = %63
  call void @perror(ptr noundef @.str.7)
  call void @exit(i32 noundef 1) #13
  unreachable

69:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = call ptr @dirname(ptr noundef %70) #9
  store ptr %71, ptr %14, align 8, !tbaa !5
  %72 = load ptr, ptr %14, align 8, !tbaa !5
  %73 = call i32 @chdir(ptr noundef %72) #9
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %69
  call void @perror(ptr noundef @.str.8)
  call void @exit(i32 noundef 1) #13
  unreachable

76:                                               ; preds = %69
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %77) #9
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = call ptr @__xpg_basename(ptr noundef %78) #9
  store ptr %79, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %80

80:                                               ; preds = %76, %52
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = call ptr @strncpy(ptr noundef %81, ptr noundef %82, i64 noundef %84) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i8, ptr %86, i64 %88
  %90 = ptrtoint ptr %89 to i64
  %91 = ptrtoint ptr %4 to i64
  %92 = sub i64 %90, %91
  %93 = trunc i64 %92 to i32
  store i32 %93, ptr %15, align 4, !tbaa !9
  %94 = load i32, ptr %7, align 4, !tbaa !9
  %95 = load i32, ptr %15, align 4, !tbaa !9
  %96 = call i32 @connect(i32 noundef %94, ptr noundef %4, i32 noundef %95)
  %97 = icmp eq i32 %96, -1
  br i1 %97, label %98, label %105

98:                                               ; preds = %80
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %104

101:                                              ; preds = %98
  %102 = load ptr, ptr %11, align 8, !tbaa !5
  %103 = call i32 @chdir(ptr noundef %102) #9
  br label %104

104:                                              ; preds = %101, %98
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef @.str.9) #12
  unreachable

105:                                              ; preds = %80
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %106) #9
  %107 = load ptr, ptr %11, align 8, !tbaa !5
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %116

109:                                              ; preds = %105
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = call i32 @chdir(ptr noundef %110) #9
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %114

113:                                              ; preds = %109
  call void @perror(ptr noundef @.str.10)
  call void @exit(i32 noundef 1) #13
  unreachable

114:                                              ; preds = %109
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %115) #9
  br label %116

116:                                              ; preds = %114, %105
  %117 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %117, ptr %2, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %118

118:                                              ; preds = %116, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 110, ptr %4) #9
  %119 = load i32, ptr %2, align 4
  ret i32 %119
}

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) #1

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) #6

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

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #7

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

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

; Function Attrs: nounwind
declare ptr @getcwd(ptr noundef, i64 noundef) #1

declare void @perror(ptr noundef) #6

; Function Attrs: nounwind
declare ptr @dirname(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @chdir(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

; Function Attrs: nounwind
declare ptr @__xpg_basename(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn "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 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nounwind willreturn memory(read) "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 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { noreturn }
attributes #13 = { 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}
!11 = !{!12, !13, i64 0}
!12 = !{!"sockaddr_un", !13, i64 0, !7, i64 2}
!13 = !{!"short", !7, i64 0}
!14 = !{!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.sockaddr_un = type { i16, [108 x i8] }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1

; 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 nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #1

; Function Attrs: noreturn
declare void @errx(i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i32 @remote_connect_unix(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = alloca %struct.sockaddr_un, align 2
  call void @llvm.lifetime.start.p0(i64 110, ptr nonnull %2) #13
  %3 = tail call noalias ptr @strdup(ptr noundef %0) #13
  %4 = tail call i32 @socket(i32 noundef 1, i32 noundef 1, i32 noundef 0) #13
  %5 = icmp eq i32 %4, -1
  br i1 %5, label %54, label %6

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %2, i64 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(110) %7, i8 0, i64 108, i1 false)
  store i16 1, ptr %2, align 2, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 2
  %9 = load i8, ptr %3, align 1, !tbaa !10
  %10 = icmp eq i8 %9, 64
  br i1 %10, label %11, label %21

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %2, i64 3
  %13 = getelementptr inbounds i8, ptr %3, i64 1
  %14 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %13) #14
  %15 = trunc i64 %14 to i32
  %16 = icmp slt i32 %15, 107
  br i1 %16, label %17, label %36

17:                                               ; preds = %11
  %18 = load ptr, ptr @stderr, align 8, !tbaa !11
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.4, i32 noundef %15, i32 noundef 107) #15
  %sext = shl i64 %14, 32
  %20 = ashr exact i64 %sext, 32
  br label %36

21:                                               ; preds = %6
  %22 = tail call noalias dereferenceable_or_null(4096) ptr @malloc(i64 noundef 4096) #16
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %23, label %24

23:                                               ; preds = %21
  tail call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.5, i32 noundef 4096) #17
  unreachable

24:                                               ; preds = %21
  %25 = tail call ptr @getcwd(ptr noundef nonnull %22, i64 noundef 4096) #13
  %.not43 = icmp eq ptr %25, null
  br i1 %.not43, label %26, label %27

26:                                               ; preds = %24
  tail call void @perror(ptr noundef nonnull @.str.6) #18
  tail call void @exit(i32 noundef 1) #17
  unreachable

27:                                               ; preds = %24
  %28 = tail call noalias ptr @strdup(ptr noundef nonnull %3) #13
  %.not44 = icmp eq ptr %28, null
  br i1 %.not44, label %29, label %30

29:                                               ; preds = %27
  tail call void @perror(ptr noundef nonnull @.str.7) #18
  tail call void @exit(i32 noundef 1) #17
  unreachable

30:                                               ; preds = %27
  %31 = tail call ptr @dirname(ptr noundef nonnull %28) #13
  %32 = tail call i32 @chdir(ptr noundef %31) #13
  %.not45 = icmp eq i32 %32, 0
  br i1 %.not45, label %34, label %33

33:                                               ; preds = %30
  tail call void @perror(ptr noundef nonnull @.str.8) #18
  tail call void @exit(i32 noundef 1) #17
  unreachable

34:                                               ; preds = %30
  tail call void @free(ptr noundef nonnull %28) #13
  %35 = tail call ptr @__xpg_basename(ptr noundef nonnull %3) #13
  br label %36

36:                                               ; preds = %11, %17, %34
  %.039 = phi ptr [ %8, %34 ], [ %12, %17 ], [ %12, %11 ]
  %.038 = phi ptr [ %22, %34 ], [ null, %17 ], [ null, %11 ]
  %.1 = phi i64 [ 108, %34 ], [ %20, %17 ], [ 107, %11 ]
  %.036 = phi ptr [ %35, %34 ], [ %13, %17 ], [ %13, %11 ]
  %37 = call ptr @strncpy(ptr noundef nonnull %.039, ptr noundef %.036, i64 noundef %.1) #13
  %38 = getelementptr inbounds i8, ptr %.039, i64 %.1
  %39 = ptrtoint ptr %38 to i64
  %40 = ptrtoint ptr %2 to i64
  %41 = sub i64 %39, %40
  %42 = trunc i64 %41 to i32
  %43 = call i32 @connect(i32 noundef %4, ptr noundef nonnull %2, i32 noundef %42) #13
  %44 = icmp eq i32 %43, -1
  br i1 %44, label %45, label %49

45:                                               ; preds = %36
  %.not48 = icmp eq ptr %.038, null
  br i1 %.not48, label %48, label %46

46:                                               ; preds = %45
  %47 = call i32 @chdir(ptr noundef nonnull %.038) #13
  br label %48

48:                                               ; preds = %46, %45
  call void (i32, ptr, ...) @errx(i32 noundef 1, ptr noundef nonnull @.str.9) #17
  unreachable

49:                                               ; preds = %36
  call void @free(ptr noundef nonnull %3) #13
  %.not46 = icmp eq ptr %.038, null
  br i1 %.not46, label %54, label %50

50:                                               ; preds = %49
  %51 = call i32 @chdir(ptr noundef nonnull %.038) #13
  %.not47 = icmp eq i32 %51, 0
  br i1 %.not47, label %53, label %52

52:                                               ; preds = %50
  call void @perror(ptr noundef nonnull @.str.10) #18
  call void @exit(i32 noundef 1) #17
  unreachable

53:                                               ; preds = %50
  call void @free(ptr noundef nonnull %.038) #13
  br label %54

54:                                               ; preds = %49, %53, %1
  call void @llvm.lifetime.end.p0(i64 110, ptr nonnull %2) #13
  ret i32 %4
}

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #7

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #8

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #9

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

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

; Function Attrs: nounwind
declare ptr @getcwd(ptr noundef, i64 noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #10

; Function Attrs: nounwind
declare ptr @dirname(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @chdir(ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #12

; Function Attrs: nounwind
declare ptr @__xpg_basename(ptr noundef) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { noreturn "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 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, 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 #9 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #10 = { 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 #11 = { 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 #12 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #13 = { nounwind }
attributes #14 = { nounwind willreturn memory(read) }
attributes #15 = { cold nounwind }
attributes #16 = { nounwind allocsize(0) }
attributes #17 = { noreturn nounwind }
attributes #18 = { cold }

!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 = !{!"sockaddr_un", !7, i64 0, !8, i64 2}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass