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

; 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.udp_pcb = type { %struct.ip4_addr, %struct.ip4_addr, i8, i8, i8, i8, ptr, i8, i16, i16, ptr, ptr }
%struct.ip4_addr = type { i32 }
%struct.netif = type { ptr, %struct.ip4_addr, %struct.ip4_addr, %struct.ip4_addr, ptr, ptr, ptr, ptr, ptr, [1 x ptr], i16, [6 x i8], i8, i8, [2 x i8], i8, i8 }

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [178 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 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 i32 @printf(ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
define dso_local signext i8 @udp_sendto_if(ptr noundef %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3, ptr noundef %4) #2 {
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i16 %3, ptr %10, align 2, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  br label %14

14:                                               ; preds = %5
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %22, label %17

17:                                               ; preds = %14
  br label %18

18:                                               ; preds = %17
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.10, i32 noundef 640, ptr noundef @.str.2)
  br label %20

20:                                               ; preds = %18
  br label %21

21:                                               ; preds = %20
  store i8 -16, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

22:                                               ; preds = %14
  br label %23

23:                                               ; preds = %22
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %33, label %28

28:                                               ; preds = %25
  br label %29

29:                                               ; preds = %28
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.11, i32 noundef 641, ptr noundef @.str.2)
  br label %31

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  store i8 -16, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

33:                                               ; preds = %25
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %44, label %39

39:                                               ; preds = %36
  br label %40

40:                                               ; preds = %39
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.12, i32 noundef 642, ptr noundef @.str.2)
  br label %42

42:                                               ; preds = %40
  br label %43

43:                                               ; preds = %42
  store i8 -16, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

44:                                               ; preds = %36
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %55, label %50

50:                                               ; preds = %47
  br label %51

51:                                               ; preds = %50
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.13, i32 noundef 643, ptr noundef @.str.2)
  br label %53

53:                                               ; preds = %51
  br label %54

54:                                               ; preds = %53
  store i8 -16, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

55:                                               ; preds = %47
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.udp_pcb, ptr %58, i32 0, i32 0
  %60 = icmp eq ptr %59, null
  br i1 %60, label %75, label %61

61:                                               ; preds = %57
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.udp_pcb, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.ip4_addr, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !11
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %75, label %67

67:                                               ; preds = %61
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.udp_pcb, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.ip4_addr, ptr %69, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !11
  %72 = zext i32 %71 to i64
  %73 = and i64 %72, 240
  %74 = icmp eq i64 %73, 224
  br i1 %74, label %75, label %78

75:                                               ; preds = %67, %61, %57
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.netif, ptr %76, i32 0, i32 1
  store ptr %77, ptr %12, align 8, !tbaa !5
  br label %92

78:                                               ; preds = %67
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.udp_pcb, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.ip4_addr, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !11
  %83 = load ptr, ptr %11, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.netif, ptr %83, i32 0, i32 1
  %85 = getelementptr inbounds %struct.ip4_addr, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !15
  %87 = icmp eq i32 %82, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %78
  store i8 -4, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

89:                                               ; preds = %78
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.udp_pcb, ptr %90, i32 0, i32 0
  store ptr %91, ptr %12, align 8, !tbaa !5
  br label %92

92:                                               ; preds = %89, %75
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = load ptr, ptr %8, align 8, !tbaa !5
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = load i16, ptr %10, align 2, !tbaa !9
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = call signext i8 @udp_sendto_if_src(ptr noundef %93, ptr noundef %94, ptr noundef %95, i16 noundef zeroext %96, ptr noundef %97, ptr noundef %98)
  store i8 %99, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %100

100:                                              ; preds = %92, %88, %54, %43, %32, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %101 = load i8, ptr %6, align 1
  ret i8 %101
}

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @udp_sendto_if_src(ptr noundef, ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef, ptr noundef) #2

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 = { 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 #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !14, i64 0}
!12 = !{!"udp_pcb", !13, i64 0, !13, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 16, !7, i64 24, !10, i64 26, !10, i64 28, !6, i64 32, !6, i64 40}
!13 = !{!"ip4_addr", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!13, !14, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [178 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local signext i8 @udp_sendto_if(ptr noundef %0, ptr noundef %1, ptr noundef %2, i16 noundef zeroext %3, ptr noundef %4) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %8

6:                                                ; preds = %5
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.10, i32 noundef 640, ptr noundef nonnull @.str.2)
  br label %28

8:                                                ; preds = %5
  %.not23 = icmp eq ptr %1, null
  br i1 %.not23, label %9, label %11

9:                                                ; preds = %8
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.11, i32 noundef 641, ptr noundef nonnull @.str.2)
  br label %28

11:                                               ; preds = %8
  %.not24 = icmp eq ptr %2, null
  br i1 %.not24, label %12, label %14

12:                                               ; preds = %11
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.12, i32 noundef 642, ptr noundef nonnull @.str.2)
  br label %28

14:                                               ; preds = %11
  %.not25 = icmp eq ptr %4, null
  br i1 %.not25, label %15, label %17

15:                                               ; preds = %14
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.13, i32 noundef 643, ptr noundef nonnull @.str.2)
  br label %28

17:                                               ; preds = %14
  %18 = load i32, ptr %0, align 8, !tbaa !5
  %19 = icmp eq i32 %18, 0
  %20 = and i32 %18, 240
  %21 = icmp eq i32 %20, 224
  %or.cond = or i1 %19, %21
  %22 = getelementptr inbounds i8, ptr %4, i64 8
  br i1 %or.cond, label %26, label %23

23:                                               ; preds = %17
  %24 = load i32, ptr %22, align 8, !tbaa !13
  %25 = icmp eq i32 %18, %24
  br i1 %25, label %26, label %28

26:                                               ; preds = %17, %23
  %.0 = phi ptr [ %0, %23 ], [ %22, %17 ]
  %27 = tail call signext i8 @udp_sendto_if_src(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, i16 noundef zeroext %3, ptr noundef nonnull %4, ptr noundef nonnull %.0)
  br label %28

28:                                               ; preds = %23, %26, %15, %12, %9, %6
  %.017 = phi i8 [ %27, %26 ], [ -16, %15 ], [ -16, %12 ], [ -16, %9 ], [ -16, %6 ], [ -4, %23 ]
  ret i8 %.017
}

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @udp_sendto_if_src(ptr noundef, ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { 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" }

!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, !8, i64 0}
!6 = !{!"udp_pcb", !7, i64 0, !7, i64 4, !9, i64 8, !9, i64 9, !9, i64 10, !9, i64 11, !11, i64 16, !9, i64 24, !12, i64 26, !12, i64 28, !11, i64 32, !11, i64 40}
!7 = !{!"ip4_addr", !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"short", !9, i64 0}
!13 = !{!7, !8, i64 0}


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