; LLVM IR from pandax381/microps :: app (tcpc)

; 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_in = type { i16, i16, i32 }

@__const.main.local = external hidden unnamed_addr constant %struct.sockaddr_in, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@optind = external global i32, align 4
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1
@terminate = external hidden global i32, align 4
@stdin = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca %struct.sockaddr_in, align 4
  %10 = alloca %struct.sockaddr_in, align 4
  %11 = alloca [1024 x i8], align 16
  %12 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 @__const.main.local, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #6
  br label %13

13:                                               ; preds = %53, %2
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = call i32 @getopt(i32 noundef %14, ptr noundef %15, ptr noundef @.str) #6
  store i32 %16, ptr %6, align 4, !tbaa !5
  %17 = icmp ne i32 %16, -1
  br i1 %17, label %18, label %54

18:                                               ; preds = %13
  %19 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %19, label %47 [
    i32 115, label %20
    i32 112, label %30
  ]

20:                                               ; preds = %18
  %21 = load ptr, ptr @optarg, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.sockaddr_in, ptr %9, i32 0, i32 2
  %23 = call i32 @ip_addr_pton(ptr noundef %21, ptr noundef %22)
  %24 = icmp eq i32 %23, -1
  br i1 %24, label %25, label %29

25:                                               ; preds = %20
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = load ptr, ptr @optarg, align 8, !tbaa !9
  %28 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %26, i32 noundef 69, ptr noundef @.str.1, i32 noundef 97, ptr noundef @__func__.main, ptr noundef @.str.2, ptr noundef %27)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

29:                                               ; preds = %20
  br label %53

30:                                               ; preds = %18
  %31 = load ptr, ptr @optarg, align 8, !tbaa !9
  %32 = call i64 @strtol(ptr noundef %31, ptr noundef null, i32 noundef 10) #6
  store i64 %32, ptr %8, align 8, !tbaa !11
  %33 = load i64, ptr %8, align 8, !tbaa !11
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %38, label %35

35:                                               ; preds = %30
  %36 = load i64, ptr %8, align 8, !tbaa !11
  %37 = icmp sgt i64 %36, 65535
  br i1 %37, label %38, label %42

38:                                               ; preds = %35, %30
  %39 = load ptr, ptr @stderr, align 8, !tbaa !9
  %40 = load ptr, ptr @optarg, align 8, !tbaa !9
  %41 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %39, i32 noundef 69, ptr noundef @.str.1, i32 noundef 104, ptr noundef @__func__.main, ptr noundef @.str.3, ptr noundef %40)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

42:                                               ; preds = %35
  %43 = load i64, ptr %8, align 8, !tbaa !11
  %44 = trunc i64 %43 to i16
  %45 = call zeroext i16 @hton16(i16 noundef zeroext %44)
  %46 = getelementptr inbounds %struct.sockaddr_in, ptr %9, i32 0, i32 1
  store i16 %45, ptr %46, align 2, !tbaa !13
  br label %53

47:                                               ; preds = %18
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !9
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.4, ptr noundef %51) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

53:                                               ; preds = %42, %29
  br label %13, !llvm.loop !16

54:                                               ; preds = %13
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr @optind, align 4, !tbaa !5
  %57 = sub nsw i32 %55, %56
  %58 = icmp ne i32 %57, 1
  br i1 %58, label %59, label %65

59:                                               ; preds = %54
  %60 = load ptr, ptr @stderr, align 8, !tbaa !9
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds ptr, ptr %61, i64 0
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.4, ptr noundef %63) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

65:                                               ; preds = %54
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = load i32, ptr @optind, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  %71 = call i32 @sockaddr_pton(ptr noundef %70, ptr noundef %10, i64 noundef 8)
  %72 = icmp eq i32 %71, -1
  br i1 %72, label %73, label %81

73:                                               ; preds = %65
  %74 = load ptr, ptr @stderr, align 8, !tbaa !9
  %75 = load ptr, ptr %5, align 8, !tbaa !9
  %76 = load i32, ptr @optind, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  %80 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %74, i32 noundef 69, ptr noundef @.str.1, i32 noundef 119, ptr noundef @__func__.main, ptr noundef @.str.5, ptr noundef %79)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

81:                                               ; preds = %65
  %82 = call i32 @setup()
  %83 = icmp eq i32 %82, -1
  br i1 %83, label %84, label %87

84:                                               ; preds = %81
  %85 = load ptr, ptr @stderr, align 8, !tbaa !9
  %86 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %85, i32 noundef 69, ptr noundef @.str.1, i32 noundef 126, ptr noundef @__func__.main, ptr noundef @.str.6)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

87:                                               ; preds = %81
  %88 = call i32 @sock_open(i32 noundef 2, i32 noundef 1, i32 noundef 0)
  store i32 %88, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = icmp eq i32 %89, -1
  br i1 %90, label %91, label %94

91:                                               ; preds = %87
  %92 = load ptr, ptr @stderr, align 8, !tbaa !9
  %93 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %92, i32 noundef 69, ptr noundef @.str.1, i32 noundef 134, ptr noundef @__func__.main, ptr noundef @.str.7)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

94:                                               ; preds = %87
  %95 = getelementptr inbounds %struct.sockaddr_in, ptr %9, i32 0, i32 1
  %96 = load i16, ptr %95, align 2, !tbaa !13
  %97 = icmp ne i16 %96, 0
  br i1 %97, label %98, label %106

98:                                               ; preds = %94
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = call i32 @sock_bind(i32 noundef %99, ptr noundef %9, i32 noundef 8)
  %101 = icmp eq i32 %100, -1
  br i1 %101, label %102, label %105

102:                                              ; preds = %98
  %103 = load ptr, ptr @stderr, align 8, !tbaa !9
  %104 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %103, i32 noundef 69, ptr noundef @.str.1, i32 noundef 139, ptr noundef @__func__.main, ptr noundef @.str.8)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

105:                                              ; preds = %98
  br label %106

106:                                              ; preds = %105, %94
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = call i32 @sock_connect(i32 noundef %107, ptr noundef %10, i32 noundef 8)
  %109 = icmp eq i32 %108, -1
  br i1 %109, label %110, label %113

110:                                              ; preds = %106
  %111 = load ptr, ptr @stderr, align 8, !tbaa !9
  %112 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %111, i32 noundef 69, ptr noundef @.str.1, i32 noundef 144, ptr noundef @__func__.main, ptr noundef @.str.9)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

113:                                              ; preds = %106
  %114 = load ptr, ptr @stderr, align 8, !tbaa !9
  %115 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %114, i32 noundef 73, ptr noundef @.str.1, i32 noundef 147, ptr noundef @__func__.main, ptr noundef @.str.10)
  br label %116

116:                                              ; preds = %136, %113
  %117 = load volatile i32, ptr @terminate, align 4, !tbaa !5
  %118 = icmp ne i32 %117, 0
  %119 = xor i1 %118, true
  br i1 %119, label %120, label %137

120:                                              ; preds = %116
  %121 = getelementptr inbounds [1024 x i8], ptr %11, i64 0, i64 0
  %122 = load ptr, ptr @stdin, align 8, !tbaa !9
  %123 = call ptr @fgets(ptr noundef %121, i32 noundef 1024, ptr noundef %122)
  %124 = icmp ne ptr %123, null
  br i1 %124, label %126, label %125

125:                                              ; preds = %120
  br label %137

126:                                              ; preds = %120
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = getelementptr inbounds [1024 x i8], ptr %11, i64 0, i64 0
  %129 = getelementptr inbounds [1024 x i8], ptr %11, i64 0, i64 0
  %130 = call i64 @strlen(ptr noundef %129) #7
  %131 = call i64 @sock_send(i32 noundef %127, ptr noundef %128, i64 noundef %130)
  %132 = icmp eq i64 %131, -1
  br i1 %132, label %133, label %136

133:                                              ; preds = %126
  %134 = load ptr, ptr @stderr, align 8, !tbaa !9
  %135 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %134, i32 noundef 69, ptr noundef @.str.1, i32 noundef 153, ptr noundef @__func__.main, ptr noundef @.str.11)
  br label %137

136:                                              ; preds = %126
  br label %116, !llvm.loop !18

137:                                              ; preds = %133, %125, %116
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = call i32 @sock_close(i32 noundef %138)
  call void @net_shutdown()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %140

140:                                              ; preds = %137, %110, %102, %91, %84, %73, %59, %47, %38, %25
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %141 = load i32, ptr %3, align 4
  ret i32 %141
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

declare i32 @ip_addr_pton(ptr noundef, ptr noundef) #4

declare i32 @lprintf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #4

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

declare zeroext i16 @hton16(i16 noundef zeroext) #4

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

declare i32 @sockaddr_pton(ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
declare hidden i32 @setup() #0

declare i32 @sock_open(i32 noundef, i32 noundef, i32 noundef) #4

declare i32 @sock_bind(i32 noundef, ptr noundef, i32 noundef) #4

declare i32 @sock_connect(i32 noundef, ptr noundef, i32 noundef) #4

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #4

declare i64 @sock_send(i32 noundef, ptr noundef, i64 noundef) #4

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

declare i32 @sock_close(i32 noundef) #4

declare void @net_shutdown() #4

; 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !15, i64 2}
!14 = !{!"sockaddr_in", !15, i64 0, !15, i64 2, !6, i64 4}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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_in = type { i16, i16, i32 }

@__const.main.local = external hidden unnamed_addr constant %struct.sockaddr_in, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [62 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [61 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1
@terminate = external hidden global i32, align 4
@stdin = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.sockaddr_in, align 8
  %4 = alloca %struct.sockaddr_in, align 4
  %5 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %6 = load i64, ptr @__const.main.local, align 4
  store i64 %6, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %5) #7
  %7 = getelementptr inbounds i8, ptr %3, i64 2
  %8 = getelementptr inbounds i8, ptr %3, i64 4
  br label %9

9:                                                ; preds = %.backedge, %2
  %10 = call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #7
  switch i32 %10, label %29 [
    i32 -1, label %33
    i32 115, label %11
    i32 112, label %19
  ]

11:                                               ; preds = %9
  %12 = load ptr, ptr @optarg, align 8, !tbaa !5
  %13 = call i32 @ip_addr_pton(ptr noundef %12, ptr noundef nonnull %8) #7
  %14 = icmp eq i32 %13, -1
  br i1 %14, label %15, label %.backedge

.backedge:                                        ; preds = %11, %26
  br label %9, !llvm.loop !9

15:                                               ; preds = %11
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = load ptr, ptr @optarg, align 8, !tbaa !5
  %18 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %16, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 97, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.2, ptr noundef %17) #7
  br label %94

19:                                               ; preds = %9
  %20 = load ptr, ptr @optarg, align 8, !tbaa !5
  %21 = call i64 @strtol(ptr nocapture noundef %20, ptr noundef null, i32 noundef 10) #7
  %or.cond = icmp ugt i64 %21, 65535
  br i1 %or.cond, label %22, label %26

22:                                               ; preds = %19
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = load ptr, ptr @optarg, align 8, !tbaa !5
  %25 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %23, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 104, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.3, ptr noundef %24) #7
  br label %94

26:                                               ; preds = %19
  %27 = trunc nuw i64 %21 to i16
  %28 = call zeroext i16 @hton16(i16 noundef zeroext %27) #7
  store i16 %28, ptr %7, align 2, !tbaa !11
  br label %.backedge

29:                                               ; preds = %9
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = load ptr, ptr %1, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.4, ptr noundef %31) #8
  br label %94

33:                                               ; preds = %9
  %34 = load i32, ptr @optind, align 4, !tbaa !15
  %35 = sub nsw i32 %0, %34
  %.not20 = icmp eq i32 %35, 1
  br i1 %.not20, label %40, label %36

36:                                               ; preds = %33
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = load ptr, ptr %1, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.4, ptr noundef %38) #8
  br label %94

40:                                               ; preds = %33
  %41 = sext i32 %34 to i64
  %42 = getelementptr inbounds ptr, ptr %1, i64 %41
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = call i32 @sockaddr_pton(ptr noundef %43, ptr noundef nonnull %4, i64 noundef 8) #7
  %45 = icmp eq i32 %44, -1
  br i1 %45, label %46, label %53

46:                                               ; preds = %40
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = load i32, ptr @optind, align 4, !tbaa !15
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds ptr, ptr %1, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %47, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 119, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.5, ptr noundef %51) #7
  br label %94

53:                                               ; preds = %40
  %54 = call i32 @setup()
  %55 = icmp eq i32 %54, -1
  br i1 %55, label %56, label %59

56:                                               ; preds = %53
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %57, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 126, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.6) #7
  br label %94

59:                                               ; preds = %53
  %60 = call i32 @sock_open(i32 noundef 2, i32 noundef 1, i32 noundef 0) #7
  %61 = icmp eq i32 %60, -1
  br i1 %61, label %62, label %65

62:                                               ; preds = %59
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %63, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 134, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.7) #7
  br label %94

65:                                               ; preds = %59
  %66 = load i16, ptr %7, align 2, !tbaa !11
  %.not21 = icmp eq i16 %66, 0
  br i1 %.not21, label %73, label %67

67:                                               ; preds = %65
  %68 = call i32 @sock_bind(i32 noundef %60, ptr noundef nonnull %3, i32 noundef 8) #7
  %69 = icmp eq i32 %68, -1
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  %71 = load ptr, ptr @stderr, align 8, !tbaa !5
  %72 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %71, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 139, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.8) #7
  br label %94

73:                                               ; preds = %67, %65
  %74 = call i32 @sock_connect(i32 noundef %60, ptr noundef nonnull %4, i32 noundef 8) #7
  %75 = icmp eq i32 %74, -1
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  br i1 %75, label %77, label %79

77:                                               ; preds = %73
  %78 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %76, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 144, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.9) #7
  br label %94

79:                                               ; preds = %73
  %80 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %76, i32 noundef 73, ptr noundef nonnull @.str.1, i32 noundef 147, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.10) #7
  br label %81

81:                                               ; preds = %86, %79
  %82 = load volatile i32, ptr @terminate, align 4, !tbaa !15
  %.not22 = icmp eq i32 %82, 0
  br i1 %.not22, label %83, label %.loopexit

83:                                               ; preds = %81
  %84 = load ptr, ptr @stdin, align 8, !tbaa !5
  %85 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 1024, ptr noundef %84)
  %.not23 = icmp eq ptr %85, null
  br i1 %.not23, label %.loopexit, label %86

86:                                               ; preds = %83
  %87 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #9
  %88 = call i64 @sock_send(i32 noundef %60, ptr noundef nonnull %5, i64 noundef %87) #7
  %89 = icmp eq i64 %88, -1
  br i1 %89, label %90, label %81, !llvm.loop !16

90:                                               ; preds = %86
  %91 = load ptr, ptr @stderr, align 8, !tbaa !5
  %92 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %91, i32 noundef 69, ptr noundef nonnull @.str.1, i32 noundef 153, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.11) #7
  br label %.loopexit

.loopexit:                                        ; preds = %83, %81, %90
  %93 = call i32 @sock_close(i32 noundef %60) #7
  call void @net_shutdown() #7
  br label %94

94:                                               ; preds = %.loopexit, %77, %70, %62, %56, %46, %36, %29, %22, %15
  %.0 = phi i32 [ -1, %29 ], [ -1, %22 ], [ -1, %15 ], [ -1, %36 ], [ -1, %46 ], [ -1, %56 ], [ -1, %62 ], [ -1, %70 ], [ -1, %77 ], [ 0, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  ret i32 %.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 i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ip_addr_pton(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @lprintf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

declare zeroext i16 @hton16(i16 noundef zeroext) local_unnamed_addr #3

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

declare i32 @sockaddr_pton(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden i32 @setup() local_unnamed_addr #0

declare i32 @sock_open(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare i32 @sock_bind(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @sock_connect(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #5

declare i64 @sock_send(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

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

declare i32 @sock_close(i32 noundef) local_unnamed_addr #3

declare void @net_shutdown() 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 = { mustprogress nofree nounwind willreturn "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { cold nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !13, i64 2}
!12 = !{!"sockaddr_in", !13, i64 0, !13, i64 2, !14, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = distinct !{!16, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass