; LLVM IR from pandax381/microps :: test (test)

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

@test_data = external dso_local constant [48 x i8], align 16
@IP_ADDR_ANY = external constant i32, align 4
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@optind = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@terminate = external hidden global i32, align 4
@.str.19 = external hidden unnamed_addr constant [22 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 ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i16, align 2
  %13 = alloca i16, align 2
  %14 = alloca i64, align 8
  %15 = 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) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %16 = load i32, ptr @IP_ADDR_ANY, align 4, !tbaa !5
  store i32 %16, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %13) #4
  store i16 0, ptr %13, align 2, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 28, ptr %14, align 8, !tbaa !13
  br label %17

17:                                               ; preds = %31, %2
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = call i32 @getopt(i32 noundef %18, ptr noundef %19, ptr noundef @.str) #4
  store i32 %20, ptr %6, align 4, !tbaa !5
  %21 = icmp ne i32 %20, -1
  br i1 %21, label %22, label %32

22:                                               ; preds = %17
  %23 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %23, label %25 [
    i32 110, label %24
  ]

24:                                               ; preds = %22
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %31

25:                                               ; preds = %22
  %26 = load ptr, ptr @stderr, align 8, !tbaa !9
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds ptr, ptr %27, i64 0
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.1, ptr noundef %29) #4
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

31:                                               ; preds = %24
  br label %17, !llvm.loop !15

32:                                               ; preds = %17
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr @optind, align 4, !tbaa !5
  %35 = sub nsw i32 %33, %34
  switch i32 %35, label %79 [
    i32 2, label %36
    i32 1, label %55
    i32 0, label %74
  ]

36:                                               ; preds = %32
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = load i32, ptr @optind, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds ptr, ptr %37, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = call i32 @ip_addr_pton(ptr noundef %41, ptr noundef %10)
  %43 = icmp eq i32 %42, -1
  br i1 %43, label %44, label %52

44:                                               ; preds = %36
  %45 = load ptr, ptr @stderr, align 8, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !9
  %47 = load i32, ptr @optind, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %46, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %45, i32 noundef 69, ptr noundef @.str.2, i32 noundef 53, ptr noundef @__func__.main, ptr noundef @.str.3, ptr noundef %50)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

52:                                               ; preds = %36
  %53 = load i32, ptr @optind, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr @optind, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %52, %32
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = load i32, ptr @optind, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds ptr, ptr %56, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !9
  %61 = call i32 @ip_addr_pton(ptr noundef %60, ptr noundef %11)
  %62 = icmp eq i32 %61, -1
  br i1 %62, label %63, label %71

63:                                               ; preds = %55
  %64 = load ptr, ptr @stderr, align 8, !tbaa !9
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = load i32, ptr @optind, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %64, i32 noundef 69, ptr noundef @.str.2, i32 noundef 60, ptr noundef @__func__.main, ptr noundef @.str.3, ptr noundef %69)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

71:                                               ; preds = %55
  %72 = load i32, ptr @optind, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr @optind, align 4, !tbaa !5
  br label %85

74:                                               ; preds = %32
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  br label %85

78:                                               ; preds = %74
  br label %79

79:                                               ; preds = %78, %32
  %80 = load ptr, ptr @stderr, align 8, !tbaa !9
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i64 0
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef @.str.1, ptr noundef %83) #4
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

85:                                               ; preds = %77, %71
  %86 = call ptr @signal(i32 noundef 2, ptr noundef @on_signal) #4
  %87 = call i32 @net_init()
  %88 = icmp eq i32 %87, -1
  br i1 %88, label %89, label %92

89:                                               ; preds = %85
  %90 = load ptr, ptr @stderr, align 8, !tbaa !9
  %91 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %90, i32 noundef 69, ptr noundef @.str.2, i32 noundef 79, ptr noundef @__func__.main, ptr noundef @.str.4)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

92:                                               ; preds = %85
  %93 = call ptr @null_init()
  store ptr %93, ptr %8, align 8, !tbaa !9
  %94 = load ptr, ptr %8, align 8, !tbaa !9
  %95 = icmp ne ptr %94, null
  br i1 %95, label %99, label %96

96:                                               ; preds = %92
  %97 = load ptr, ptr @stderr, align 8, !tbaa !9
  %98 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %97, i32 noundef 69, ptr noundef @.str.2, i32 noundef 84, ptr noundef @__func__.main, ptr noundef @.str.5)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

99:                                               ; preds = %92
  %100 = call ptr @loopback_init()
  store ptr %100, ptr %8, align 8, !tbaa !9
  %101 = load ptr, ptr %8, align 8, !tbaa !9
  %102 = icmp ne ptr %101, null
  br i1 %102, label %106, label %103

103:                                              ; preds = %99
  %104 = load ptr, ptr @stderr, align 8, !tbaa !9
  %105 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %104, i32 noundef 69, ptr noundef @.str.2, i32 noundef 89, ptr noundef @__func__.main, ptr noundef @.str.6)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

106:                                              ; preds = %99
  %107 = call ptr @ip_iface_alloc(ptr noundef @.str.7, ptr noundef @.str.8)
  store ptr %107, ptr %9, align 8, !tbaa !9
  %108 = load ptr, ptr %9, align 8, !tbaa !9
  %109 = icmp ne ptr %108, null
  br i1 %109, label %113, label %110

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.2, i32 noundef 94, ptr noundef @__func__.main, ptr noundef @.str.9)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

113:                                              ; preds = %106
  %114 = load ptr, ptr %8, align 8, !tbaa !9
  %115 = load ptr, ptr %9, align 8, !tbaa !9
  %116 = call i32 @ip_iface_register(ptr noundef %114, ptr noundef %115)
  %117 = icmp eq i32 %116, -1
  br i1 %117, label %118, label %121

118:                                              ; preds = %113
  %119 = load ptr, ptr @stderr, align 8, !tbaa !9
  %120 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %119, i32 noundef 69, ptr noundef @.str.2, i32 noundef 98, ptr noundef @__func__.main, ptr noundef @.str.10)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

121:                                              ; preds = %113
  %122 = call ptr @ether_tap_init(ptr noundef @.str.11, ptr noundef @.str.12)
  store ptr %122, ptr %8, align 8, !tbaa !9
  %123 = load ptr, ptr %8, align 8, !tbaa !9
  %124 = icmp ne ptr %123, null
  br i1 %124, label %128, label %125

125:                                              ; preds = %121
  %126 = load ptr, ptr @stderr, align 8, !tbaa !9
  %127 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %126, i32 noundef 69, ptr noundef @.str.2, i32 noundef 103, ptr noundef @__func__.main, ptr noundef @.str.13)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

128:                                              ; preds = %121
  %129 = call ptr @ip_iface_alloc(ptr noundef @.str.14, ptr noundef @.str.15)
  store ptr %129, ptr %9, align 8, !tbaa !9
  %130 = load ptr, ptr %9, align 8, !tbaa !9
  %131 = icmp ne ptr %130, null
  br i1 %131, label %135, label %132

132:                                              ; preds = %128
  %133 = load ptr, ptr @stderr, align 8, !tbaa !9
  %134 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %133, i32 noundef 69, ptr noundef @.str.2, i32 noundef 108, ptr noundef @__func__.main, ptr noundef @.str.9)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

135:                                              ; preds = %128
  %136 = load ptr, ptr %8, align 8, !tbaa !9
  %137 = load ptr, ptr %9, align 8, !tbaa !9
  %138 = call i32 @ip_iface_register(ptr noundef %136, ptr noundef %137)
  %139 = icmp eq i32 %138, -1
  br i1 %139, label %140, label %143

140:                                              ; preds = %135
  %141 = load ptr, ptr @stderr, align 8, !tbaa !9
  %142 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %141, i32 noundef 69, ptr noundef @.str.2, i32 noundef 112, ptr noundef @__func__.main, ptr noundef @.str.10)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

143:                                              ; preds = %135
  %144 = load ptr, ptr %9, align 8, !tbaa !9
  %145 = call i32 @ip_route_set_default_gateway(ptr noundef %144, ptr noundef @.str.16)
  %146 = icmp eq i32 %145, -1
  br i1 %146, label %147, label %150

147:                                              ; preds = %143
  %148 = load ptr, ptr @stderr, align 8, !tbaa !9
  %149 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %148, i32 noundef 69, ptr noundef @.str.2, i32 noundef 116, ptr noundef @__func__.main, ptr noundef @.str.17)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

150:                                              ; preds = %143
  %151 = call i32 @net_run()
  %152 = icmp eq i32 %151, -1
  br i1 %152, label %153, label %156

153:                                              ; preds = %150
  %154 = load ptr, ptr @stderr, align 8, !tbaa !9
  %155 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %154, i32 noundef 69, ptr noundef @.str.2, i32 noundef 120, ptr noundef @__func__.main, ptr noundef @.str.18)
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

156:                                              ; preds = %150
  %157 = call i32 @getpid() #4
  %158 = srem i32 %157, 65535
  %159 = trunc i32 %158 to i16
  store i16 %159, ptr %12, align 2, !tbaa !11
  br label %160

160:                                              ; preds = %188, %156
  %161 = load volatile i32, ptr @terminate, align 4, !tbaa !5
  %162 = icmp ne i32 %161, 0
  %163 = xor i1 %162, true
  br i1 %163, label %164, label %190

164:                                              ; preds = %160
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %188, label %167

167:                                              ; preds = %164
  %168 = load i16, ptr %12, align 2, !tbaa !11
  %169 = zext i16 %168 to i32
  %170 = shl i32 %169, 16
  %171 = load i16, ptr %13, align 2, !tbaa !11
  %172 = add i16 %171, 1
  store i16 %172, ptr %13, align 2, !tbaa !11
  %173 = zext i16 %172 to i32
  %174 = or i32 %170, %173
  %175 = call i32 @hton32(i32 noundef %174)
  %176 = load i64, ptr %14, align 8, !tbaa !13
  %177 = getelementptr inbounds i8, ptr @test_data, i64 %176
  %178 = load i64, ptr %14, align 8, !tbaa !13
  %179 = sub i64 48, %178
  %180 = load i32, ptr %10, align 4, !tbaa !5
  %181 = load i32, ptr %11, align 4, !tbaa !5
  %182 = call i32 @icmp_output(i8 noundef zeroext 8, i8 noundef zeroext 0, i32 noundef %175, ptr noundef %177, i64 noundef %179, i32 noundef %180, i32 noundef %181)
  %183 = icmp eq i32 %182, -1
  br i1 %183, label %184, label %187

184:                                              ; preds = %167
  %185 = load ptr, ptr @stderr, align 8, !tbaa !9
  %186 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %185, i32 noundef 69, ptr noundef @.str.2, i32 noundef 130, ptr noundef @__func__.main, ptr noundef @.str.19)
  br label %190

187:                                              ; preds = %167
  br label %188

188:                                              ; preds = %187, %164
  %189 = call i32 @sleep(i32 noundef 1)
  br label %160, !llvm.loop !17

190:                                              ; preds = %184, %160
  call void @net_shutdown()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %191

191:                                              ; preds = %190, %153, %147, %140, %132, %125, %118, %110, %103, %96, %89, %79, %63, %44, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %192 = load i32, ptr %3, align 4
  ret i32 %192
}

; 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 i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @on_signal(i32 noundef) #0

declare i32 @net_init() #3

declare ptr @null_init() #3

declare ptr @loopback_init() #3

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

declare i32 @ip_iface_register(ptr noundef, ptr noundef) #3

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

declare i32 @ip_route_set_default_gateway(ptr noundef, ptr noundef) #3

declare i32 @net_run() #3

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

declare i32 @icmp_output(i8 noundef zeroext, i8 noundef zeroext, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) #3

declare i32 @hton32(i32 noundef) #3

declare i32 @sleep(i32 noundef) #3

declare void @net_shutdown() #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 = { 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, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@test_data = external dso_local constant [48 x i8], align 16
@IP_ADDR_ANY = external local_unnamed_addr constant i32, align 4
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [26 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [63 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@terminate = external hidden global i32, align 4
@.str.19 = external hidden unnamed_addr constant [22 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 {
.peel.begin:
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %4 = load i32, ptr @IP_ADDR_ANY, align 4, !tbaa !5
  store i32 %4, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %5 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #5
  switch i32 %5, label %.loopexit47 [
    i32 -1, label %.loopexit48
    i32 110, label %.peel.next
  ]

.peel.next:                                       ; preds = %.peel.begin, %.peel.next
  %6 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #5
  switch i32 %6, label %.loopexit47 [
    i32 -1, label %.loopexit48
    i32 110, label %.peel.next
  ], !llvm.loop !9

.loopexit47:                                      ; preds = %.peel.next, %.peel.begin
  %7 = load ptr, ptr @stderr, align 8, !tbaa !12
  %8 = load ptr, ptr %1, align 8, !tbaa !12
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.1, ptr noundef %8) #6
  br label %126

.loopexit48:                                      ; preds = %.peel.next, %.peel.begin
  %.not33.lcssa45 = phi i1 [ true, %.peel.begin ], [ false, %.peel.next ]
  %10 = load i32, ptr @optind, align 4, !tbaa !5
  %11 = sub nsw i32 %0, %10
  switch i32 %11, label %46 [
    i32 2, label %12
    i32 1, label %28
    i32 0, label %45
  ]

12:                                               ; preds = %.loopexit48
  %13 = sext i32 %10 to i64
  %14 = getelementptr inbounds ptr, ptr %1, i64 %13
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = call i32 @ip_addr_pton(ptr noundef %15, ptr noundef nonnull %2) #5
  %17 = icmp eq i32 %16, -1
  br i1 %17, label %18, label %25

18:                                               ; preds = %12
  %19 = load ptr, ptr @stderr, align 8, !tbaa !12
  %20 = load i32, ptr @optind, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds ptr, ptr %1, i64 %21
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  %24 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %19, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 53, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.3, ptr noundef %23) #5
  br label %126

25:                                               ; preds = %12
  %26 = load i32, ptr @optind, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @optind, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %25, %.loopexit48
  %29 = phi i32 [ %27, %25 ], [ %10, %.loopexit48 ]
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %1, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  %33 = call i32 @ip_addr_pton(ptr noundef %32, ptr noundef nonnull %3) #5
  %34 = icmp eq i32 %33, -1
  br i1 %34, label %35, label %42

35:                                               ; preds = %28
  %36 = load ptr, ptr @stderr, align 8, !tbaa !12
  %37 = load i32, ptr @optind, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %1, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !12
  %41 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %36, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 60, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.3, ptr noundef %40) #5
  br label %126

42:                                               ; preds = %28
  %43 = load i32, ptr @optind, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr @optind, align 4, !tbaa !5
  br label %50

45:                                               ; preds = %.loopexit48
  br i1 %.not33.lcssa45, label %46, label %50

46:                                               ; preds = %45, %.loopexit48
  %47 = load ptr, ptr @stderr, align 8, !tbaa !12
  %48 = load ptr, ptr %1, align 8, !tbaa !12
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.1, ptr noundef %48) #6
  br label %126

50:                                               ; preds = %45, %42
  %51 = call ptr @signal(i32 noundef 2, ptr noundef nonnull @on_signal) #5
  %52 = call i32 @net_init() #5
  %53 = icmp eq i32 %52, -1
  br i1 %53, label %54, label %57

54:                                               ; preds = %50
  %55 = load ptr, ptr @stderr, align 8, !tbaa !12
  %56 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %55, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 79, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.4) #5
  br label %126

57:                                               ; preds = %50
  %58 = call ptr @null_init() #5
  %.not34 = icmp eq ptr %58, null
  br i1 %.not34, label %59, label %62

59:                                               ; preds = %57
  %60 = load ptr, ptr @stderr, align 8, !tbaa !12
  %61 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %60, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 84, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.5) #5
  br label %126

62:                                               ; preds = %57
  %63 = call ptr @loopback_init() #5
  %.not35 = icmp eq ptr %63, null
  br i1 %.not35, label %64, label %67

64:                                               ; preds = %62
  %65 = load ptr, ptr @stderr, align 8, !tbaa !12
  %66 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %65, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 89, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.6) #5
  br label %126

67:                                               ; preds = %62
  %68 = call ptr @ip_iface_alloc(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.8) #5
  %.not36 = icmp eq ptr %68, null
  br i1 %.not36, label %69, label %72

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

72:                                               ; preds = %67
  %73 = call i32 @ip_iface_register(ptr noundef nonnull %63, ptr noundef nonnull %68) #5
  %74 = icmp eq i32 %73, -1
  br i1 %74, label %75, label %78

75:                                               ; preds = %72
  %76 = load ptr, ptr @stderr, align 8, !tbaa !12
  %77 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %76, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 98, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.10) #5
  br label %126

78:                                               ; preds = %72
  %79 = call ptr @ether_tap_init(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12) #5
  %.not37 = icmp eq ptr %79, null
  br i1 %.not37, label %80, label %83

80:                                               ; preds = %78
  %81 = load ptr, ptr @stderr, align 8, !tbaa !12
  %82 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %81, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 103, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.13) #5
  br label %126

83:                                               ; preds = %78
  %84 = call ptr @ip_iface_alloc(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15) #5
  %.not38 = icmp eq ptr %84, null
  br i1 %.not38, label %85, label %88

85:                                               ; preds = %83
  %86 = load ptr, ptr @stderr, align 8, !tbaa !12
  %87 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %86, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 108, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.9) #5
  br label %126

88:                                               ; preds = %83
  %89 = call i32 @ip_iface_register(ptr noundef nonnull %79, ptr noundef nonnull %84) #5
  %90 = icmp eq i32 %89, -1
  br i1 %90, label %91, label %94

91:                                               ; preds = %88
  %92 = load ptr, ptr @stderr, align 8, !tbaa !12
  %93 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %92, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 112, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.10) #5
  br label %126

94:                                               ; preds = %88
  %95 = call i32 @ip_route_set_default_gateway(ptr noundef nonnull %84, ptr noundef nonnull @.str.16) #5
  %96 = icmp eq i32 %95, -1
  br i1 %96, label %97, label %100

97:                                               ; preds = %94
  %98 = load ptr, ptr @stderr, align 8, !tbaa !12
  %99 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %98, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 116, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.17) #5
  br label %126

100:                                              ; preds = %94
  %101 = call i32 @net_run() #5
  %102 = icmp eq i32 %101, -1
  br i1 %102, label %103, label %106

103:                                              ; preds = %100
  %104 = load ptr, ptr @stderr, align 8, !tbaa !12
  %105 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %104, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 120, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.18) #5
  br label %126

106:                                              ; preds = %100
  %107 = call i32 @getpid() #5
  %108 = load volatile i32, ptr @terminate, align 4, !tbaa !5
  %.not3942 = icmp eq i32 %108, 0
  br i1 %.not3942, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %106
  %109 = srem i32 %107, 65535
  %110 = shl i32 %109, 16
  br i1 %.not33.lcssa45, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %119
  %.02643.us = phi i16 [ %111, %119 ], [ 0, %.lr.ph ]
  %111 = add i16 %.02643.us, 1
  %112 = zext i16 %111 to i32
  %113 = or disjoint i32 %110, %112
  %114 = call i32 @hton32(i32 noundef %113) #5
  %115 = load i32, ptr %2, align 4, !tbaa !5
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = call i32 @icmp_output(i8 noundef zeroext 8, i8 noundef zeroext 0, i32 noundef %114, ptr noundef nonnull getelementptr inbounds (i8, ptr @test_data, i64 28), i64 noundef 20, i32 noundef %115, i32 noundef %116) #5
  %118 = icmp eq i32 %117, -1
  br i1 %118, label %.split.us, label %119

119:                                              ; preds = %.lr.ph.split.us
  %120 = call i32 @sleep(i32 noundef 1) #5
  %121 = load volatile i32, ptr @terminate, align 4, !tbaa !5
  %.not39.us = icmp eq i32 %121, 0
  br i1 %.not39.us, label %.lr.ph.split.us, label %.loopexit, !llvm.loop !14

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  %122 = call i32 @sleep(i32 noundef 1) #5
  %123 = load volatile i32, ptr @terminate, align 4, !tbaa !5
  %.not39 = icmp eq i32 %123, 0
  br i1 %.not39, label %.lr.ph.split, label %.loopexit, !llvm.loop !14

.split.us:                                        ; preds = %.lr.ph.split.us
  %124 = load ptr, ptr @stderr, align 8, !tbaa !12
  %125 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %124, i32 noundef 69, ptr noundef nonnull @.str.2, i32 noundef 130, ptr noundef nonnull @__func__.main, ptr noundef nonnull @.str.19) #5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.split, %119, %106, %.split.us
  call void @net_shutdown() #5
  br label %126

126:                                              ; preds = %.loopexit, %103, %97, %91, %85, %80, %75, %69, %64, %59, %54, %46, %35, %18, %.loopexit47
  %.0 = phi i32 [ -1, %.loopexit47 ], [ -1, %46 ], [ -1, %54 ], [ -1, %75 ], [ -1, %91 ], [ -1, %97 ], [ -1, %103 ], [ 0, %.loopexit ], [ -1, %85 ], [ -1, %80 ], [ -1, %69 ], [ -1, %64 ], [ -1, %59 ], [ -1, %35 ], [ -1, %18 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  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

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @on_signal(i32 noundef) #0

declare i32 @net_init() local_unnamed_addr #4

declare ptr @null_init() local_unnamed_addr #4

declare ptr @loopback_init() local_unnamed_addr #4

declare ptr @ip_iface_alloc(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @ip_iface_register(ptr noundef, ptr noundef) local_unnamed_addr #4

declare ptr @ether_tap_init(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @ip_route_set_default_gateway(ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @net_run() local_unnamed_addr #4

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

declare i32 @icmp_output(i8 noundef zeroext, i8 noundef zeroext, i32 noundef, ptr noundef, i64 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @hton32(i32 noundef) local_unnamed_addr #4

declare i32 @sleep(i32 noundef) local_unnamed_addr #4

declare void @net_shutdown() local_unnamed_addr #4

; 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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { cold nounwind }

!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 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.peeled.count", i32 1}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass