; LLVM IR from whoiswelliton/Computer_Engineering_UTFPR-PB :: Embedded_Systems/TIVA Connected TM4C1294XL Projects/01 - lwIP_HTTPServer_on_TIVA (getaddrinfo)

; 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.ip4_addr = type { i32 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.sockaddr_in = type { i8, i8, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [179 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [51 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

declare signext i8 @netconn_gethostbyname(ptr noundef, ptr noundef) #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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

22:                                               ; preds = %4
  store i32 202, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

23:                                               ; preds = %4
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %24, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %31

27:                                               ; preds = %23
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i32 200, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

31:                                               ; preds = %27, %23
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %45

34:                                               ; preds = %31
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.addrinfo, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !13
  store i32 %37, ptr %17, align 4, !tbaa !9
  %38 = load i32, ptr %17, align 4, !tbaa !9
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %34
  %41 = load i32, ptr %17, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 2
  br i1 %42, label %43, label %44

43:                                               ; preds = %40
  store i32 204, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

44:                                               ; preds = %40, %34
  br label %46

45:                                               ; preds = %31
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %45, %44
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %59

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call i32 @atoi(ptr noundef %50) #8
  store i32 %51, ptr %14, align 4, !tbaa !9
  %52 = load i32, ptr %14, align 4, !tbaa !9
  %53 = icmp sle i32 %52, 0
  br i1 %53, label %57, label %54

54:                                               ; preds = %49
  %55 = load i32, ptr %14, align 4, !tbaa !9
  %56 = icmp sgt i32 %55, 65535
  br i1 %56, label %57, label %58

57:                                               ; preds = %54, %49
  store i32 201, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

58:                                               ; preds = %54
  br label %59

59:                                               ; preds = %58, %46
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %86

62:                                               ; preds = %59
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %77

65:                                               ; preds = %62
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.addrinfo, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 8, !tbaa !15
  %69 = and i32 %68, 4
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %77

71:                                               ; preds = %65
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = call i32 @ip4addr_aton(ptr noundef %72, ptr noundef %11)
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 200, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

76:                                               ; preds = %71
  br label %85

77:                                               ; preds = %65, %62
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = call signext i8 @netconn_gethostbyname(ptr noundef %78, ptr noundef %11)
  store i8 %79, ptr %10, align 1, !tbaa !16
  %80 = load i8, ptr %10, align 1, !tbaa !16
  %81 = sext i8 %80 to i32
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %77
  store i32 202, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

84:                                               ; preds = %77
  br label %85

85:                                               ; preds = %84, %76
  br label %100

86:                                               ; preds = %59
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %97

89:                                               ; preds = %86
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.addrinfo, ptr %90, i32 0, i32 0
  %92 = load i32, ptr %91, align 8, !tbaa !15
  %93 = and i32 %92, 1
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %97

95:                                               ; preds = %89
  %96 = getelementptr inbounds %struct.ip4_addr, ptr %11, i32 0, i32 0
  store i32 0, ptr %96, align 4, !tbaa !17
  br label %99

97:                                               ; preds = %89, %86
  %98 = getelementptr inbounds %struct.ip4_addr, ptr %11, i32 0, i32 0
  store i32 16777343, ptr %98, align 4, !tbaa !17
  br label %99

99:                                               ; preds = %97, %95
  br label %100

100:                                              ; preds = %99, %85
  store i64 64, ptr %15, align 8, !tbaa !11
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = icmp ne ptr %101, null
  br i1 %102, label %103, label %129

103:                                              ; preds = %100
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = call i64 @strlen(ptr noundef %104) #8
  store i64 %105, ptr %16, align 8, !tbaa !11
  %106 = load i64, ptr %16, align 8, !tbaa !11
  %107 = icmp ugt i64 %106, 256
  br i1 %107, label %108, label %109

108:                                              ; preds = %103
  store i32 202, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

109:                                              ; preds = %103
  br label %110

110:                                              ; preds = %109
  %111 = load i64, ptr %15, align 8, !tbaa !11
  %112 = load i64, ptr %16, align 8, !tbaa !11
  %113 = add i64 %111, %112
  %114 = add i64 %113, 1
  %115 = load i64, ptr %15, align 8, !tbaa !11
  %116 = icmp ugt i64 %114, %115
  br i1 %116, label %122, label %117

117:                                              ; preds = %110
  br label %118

118:                                              ; preds = %117
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 358, ptr noundef @.str.2)
  br label %120

120:                                              ; preds = %118
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121, %110
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %16, align 8, !tbaa !11
  %126 = add i64 %125, 1
  %127 = load i64, ptr %15, align 8, !tbaa !11
  %128 = add i64 %127, %126
  store i64 %128, ptr %15, align 8, !tbaa !11
  br label %129

129:                                              ; preds = %124, %100
  br label %130

130:                                              ; preds = %129
  %131 = load i64, ptr %15, align 8, !tbaa !11
  %132 = icmp ule i64 %131, 321
  br i1 %132, label %138, label %133

133:                                              ; preds = %130
  br label %134

134:                                              ; preds = %133
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.3, i32 noundef 363, ptr noundef @.str.2)
  br label %136

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136
  br label %138

138:                                              ; preds = %137, %130
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  %141 = call ptr @memp_malloc(i32 noundef 11)
  store ptr %141, ptr %12, align 8, !tbaa !5
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = icmp eq ptr %142, null
  br i1 %143, label %144, label %145

144:                                              ; preds = %140
  store i32 203, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

145:                                              ; preds = %140
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = load i64, ptr %15, align 8, !tbaa !11
  call void @llvm.memset.p0.i64(ptr align 8 %146, i8 0, i64 %147, i1 false)
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = getelementptr inbounds i8, ptr %148, i64 48
  store ptr %149, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %150, ptr %19, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.ip4_addr, ptr %11, i32 0, i32 0
  %152 = load i32, ptr %151, align 4, !tbaa !17
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.sockaddr_in, ptr %153, i32 0, i32 3
  %155 = getelementptr inbounds %struct.in_addr, ptr %154, i32 0, i32 0
  store i32 %152, ptr %155, align 4, !tbaa !19
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.sockaddr_in, ptr %156, i32 0, i32 1
  store i8 2, ptr %157, align 1, !tbaa !23
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.sockaddr_in, ptr %158, i32 0, i32 0
  store i8 16, ptr %159, align 4, !tbaa !24
  %160 = load i32, ptr %14, align 4, !tbaa !9
  %161 = trunc i32 %160 to i16
  %162 = call zeroext i16 @lwip_htons(i16 noundef zeroext %161)
  %163 = load ptr, ptr %19, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.sockaddr_in, ptr %163, i32 0, i32 2
  store i16 %162, ptr %164, align 2, !tbaa !25
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.addrinfo, ptr %165, i32 0, i32 1
  store i32 2, ptr %166, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  %167 = load ptr, ptr %8, align 8, !tbaa !5
  %168 = icmp ne ptr %167, null
  br i1 %168, label %169, label %180

169:                                              ; preds = %145
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.addrinfo, ptr %170, i32 0, i32 2
  %172 = load i32, ptr %171, align 8, !tbaa !26
  %173 = load ptr, ptr %12, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.addrinfo, ptr %173, i32 0, i32 2
  store i32 %172, ptr %174, align 8, !tbaa !26
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.addrinfo, ptr %175, i32 0, i32 3
  %177 = load i32, ptr %176, align 4, !tbaa !27
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.addrinfo, ptr %178, i32 0, i32 3
  store i32 %177, ptr %179, align 4, !tbaa !27
  br label %180

180:                                              ; preds = %169, %145
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = icmp ne ptr %181, null
  br i1 %182, label %183, label %199

183:                                              ; preds = %180
  %184 = load ptr, ptr %12, align 8, !tbaa !5
  %185 = getelementptr inbounds i8, ptr %184, i64 48
  %186 = getelementptr inbounds i8, ptr %185, i64 16
  %187 = load ptr, ptr %12, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.addrinfo, ptr %187, i32 0, i32 6
  store ptr %186, ptr %188, align 8, !tbaa !28
  %189 = load ptr, ptr %12, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.addrinfo, ptr %189, i32 0, i32 6
  %191 = load ptr, ptr %190, align 8, !tbaa !28
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = load i64, ptr %16, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %191, ptr align 1 %192, i64 %193, i1 false)
  %194 = load ptr, ptr %12, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.addrinfo, ptr %194, i32 0, i32 6
  %196 = load ptr, ptr %195, align 8, !tbaa !28
  %197 = load i64, ptr %16, align 8, !tbaa !11
  %198 = getelementptr inbounds i8, ptr %196, i64 %197
  store i8 0, ptr %198, align 1, !tbaa !16
  br label %199

199:                                              ; preds = %183, %180
  %200 = load ptr, ptr %12, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.addrinfo, ptr %200, i32 0, i32 4
  store i32 16, ptr %201, align 8, !tbaa !29
  %202 = load ptr, ptr %13, align 8, !tbaa !5
  %203 = load ptr, ptr %12, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.addrinfo, ptr %203, i32 0, i32 5
  store ptr %202, ptr %204, align 8, !tbaa !30
  %205 = load ptr, ptr %12, align 8, !tbaa !5
  %206 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %205, ptr %206, align 8, !tbaa !5
  store i32 0, ptr %5, align 4
  store i32 1, ptr %18, align 4
  br label %207

207:                                              ; preds = %199, %144, %108, %83, %75, %57, %43, %30, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  %208 = load i32, ptr %5, align 4
  ret i32 %208
}

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #5

declare i32 @ip4addr_aton(ptr noundef, ptr noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare ptr @memp_malloc(i32 noundef) #1

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

declare zeroext i16 @lwip_htons(i16 noundef zeroext) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { inlinehint nounwind willreturn memory(read) 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"addrinfo", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!14, !10, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !10, i64 0}
!18 = !{!"ip4_addr", !10, i64 0}
!19 = !{!20, !10, i64 4}
!20 = !{!"sockaddr_in", !7, i64 0, !7, i64 1, !21, i64 2, !22, i64 4, !7, i64 8}
!21 = !{!"short", !7, i64 0}
!22 = !{!"in_addr", !10, i64 0}
!23 = !{!20, !7, i64 1}
!24 = !{!20, !7, i64 0}
!25 = !{!20, !21, i64 2}
!26 = !{!14, !10, i64 8}
!27 = !{!14, !10, i64 12}
!28 = !{!14, !6, i64 32}
!29 = !{!14, !10, i64 16}
!30 = !{!14, !6, i64 24}


; 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.ip4_addr = type { i32 }

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

declare signext i8 @netconn_gethostbyname(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; 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: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 205) i32 @lwip_getaddrinfo(ptr noundef %0, ptr noundef readonly %1, ptr noundef readonly %2, ptr noundef writeonly %3) local_unnamed_addr #4 {
  %5 = alloca %struct.ip4_addr, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %6 = icmp eq ptr %3, null
  br i1 %6, label %62, label %7

7:                                                ; preds = %4
  store ptr null, ptr %3, align 8, !tbaa !5
  %8 = icmp eq ptr %0, null
  %9 = icmp eq ptr %1, null
  %or.cond = and i1 %8, %9
  br i1 %or.cond, label %62, label %10

10:                                               ; preds = %7
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %15, label %11

11:                                               ; preds = %10
  %12 = getelementptr inbounds i8, ptr %2, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = and i32 %13, -3
  %or.cond3.not = icmp eq i32 %14, 0
  br i1 %or.cond3.not, label %15, label %62

15:                                               ; preds = %10, %11
  br i1 %9, label %19, label %16

16:                                               ; preds = %15
  %17 = tail call i32 @atoi(ptr nocapture noundef %1) #8
  %18 = add i32 %17, -65536
  %or.cond5 = icmp ult i32 %18, -65535
  br i1 %or.cond5, label %62, label %19

19:                                               ; preds = %16, %15
  %.065 = phi i32 [ %17, %16 ], [ 0, %15 ]
  br i1 %8, label %28, label %20

20:                                               ; preds = %19
  br i1 %.not, label %26, label %21

21:                                               ; preds = %20
  %22 = load i32, ptr %2, align 8, !tbaa !12
  %23 = and i32 %22, 4
  %.not78 = icmp eq i32 %23, 0
  br i1 %.not78, label %26, label %24

24:                                               ; preds = %21
  %25 = call i32 @ip4addr_aton(ptr noundef nonnull %0, ptr noundef nonnull %5) #7
  %.not80 = icmp eq i32 %25, 0
  br i1 %.not80, label %62, label %34

26:                                               ; preds = %21, %20
  %27 = call signext i8 @netconn_gethostbyname(ptr noundef nonnull %0, ptr noundef nonnull %5) #7
  %.not79 = icmp eq i8 %27, 0
  br i1 %.not79, label %34, label %62

28:                                               ; preds = %19
  br i1 %.not, label %33, label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %2, align 8, !tbaa !12
  %31 = and i32 %30, 1
  %.not77 = icmp eq i32 %31, 0
  br i1 %.not77, label %33, label %32

32:                                               ; preds = %29
  store i32 0, ptr %5, align 4, !tbaa !13
  br label %.thread

33:                                               ; preds = %29, %28
  store i32 16777343, ptr %5, align 4, !tbaa !13
  br label %.thread

34:                                               ; preds = %26, %24
  %35 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #8
  %36 = icmp ugt i64 %35, 256
  br i1 %36, label %62, label %37

37:                                               ; preds = %34
  %38 = add nuw nsw i64 %35, 65
  br label %.thread

.thread:                                          ; preds = %33, %32, %37
  %.064 = phi i64 [ %38, %37 ], [ 64, %32 ], [ 64, %33 ]
  %.063 = phi i64 [ %35, %37 ], [ 0, %32 ], [ 0, %33 ]
  %39 = call ptr @memp_malloc(i32 noundef 11) #7
  %40 = icmp eq ptr %39, null
  br i1 %40, label %62, label %41

41:                                               ; preds = %.thread
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %39, i8 0, i64 %.064, i1 false)
  %42 = getelementptr inbounds i8, ptr %39, i64 48
  %43 = load i32, ptr %5, align 4, !tbaa !13
  %44 = getelementptr inbounds i8, ptr %39, i64 52
  store i32 %43, ptr %44, align 4, !tbaa !15
  %45 = getelementptr inbounds i8, ptr %39, i64 49
  store i8 2, ptr %45, align 1, !tbaa !19
  store i8 16, ptr %42, align 4, !tbaa !20
  %46 = trunc i32 %.065 to i16
  %47 = call zeroext i16 @lwip_htons(i16 noundef zeroext %46) #7
  %48 = getelementptr inbounds i8, ptr %39, i64 50
  store i16 %47, ptr %48, align 2, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %39, i64 4
  store i32 2, ptr %49, align 4, !tbaa !9
  br i1 %.not, label %54, label %50

50:                                               ; preds = %41
  %51 = getelementptr inbounds i8, ptr %2, i64 8
  %52 = getelementptr inbounds i8, ptr %39, i64 8
  %53 = load <2 x i32>, ptr %51, align 8, !tbaa !22
  store <2 x i32> %53, ptr %52, align 8, !tbaa !22
  br label %54

54:                                               ; preds = %50, %41
  br i1 %8, label %59, label %55

55:                                               ; preds = %54
  %56 = getelementptr inbounds i8, ptr %39, i64 64
  %57 = getelementptr inbounds i8, ptr %39, i64 32
  store ptr %56, ptr %57, align 8, !tbaa !23
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %56, ptr nonnull align 1 %0, i64 %.063, i1 false)
  %58 = getelementptr inbounds i8, ptr %56, i64 %.063
  store i8 0, ptr %58, align 1, !tbaa !24
  br label %59

59:                                               ; preds = %55, %54
  %60 = getelementptr inbounds i8, ptr %39, i64 16
  store i32 16, ptr %60, align 8, !tbaa !25
  %61 = getelementptr inbounds i8, ptr %39, i64 24
  store ptr %42, ptr %61, align 8, !tbaa !26
  store ptr %39, ptr %3, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %.thread, %34, %26, %24, %16, %11, %7, %4, %59
  %.0 = phi i32 [ 0, %59 ], [ 202, %4 ], [ 200, %7 ], [ 204, %11 ], [ 201, %16 ], [ 200, %24 ], [ 202, %26 ], [ 202, %34 ], [ 203, %.thread ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  ret i32 %.0
}

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #5

declare i32 @ip4addr_aton(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @memp_malloc(i32 noundef) local_unnamed_addr #1

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

declare zeroext i16 @lwip_htons(i16 noundef zeroext) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!10, !11, i64 4}
!10 = !{!"addrinfo", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!14, !11, i64 0}
!14 = !{!"ip4_addr", !11, i64 0}
!15 = !{!16, !11, i64 4}
!16 = !{!"sockaddr_in", !7, i64 0, !7, i64 1, !17, i64 2, !18, i64 4, !7, i64 8}
!17 = !{!"short", !7, i64 0}
!18 = !{!"in_addr", !11, i64 0}
!19 = !{!16, !7, i64 1}
!20 = !{!16, !7, i64 0}
!21 = !{!16, !17, i64 2}
!22 = !{!11, !11, i64 0}
!23 = !{!10, !6, i64 32}
!24 = !{!7, !7, i64 0}
!25 = !{!10, !11, i64 16}
!26 = !{!10, !6, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass