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

; 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.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 }

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @ip4_addr_isbroadcast_u32(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.ip4_addr, align 4
  %7 = alloca i32, 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) #2
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = getelementptr inbounds %struct.ip4_addr, ptr %6, i32 0, i32 0
  store i32 %8, ptr %9, align 4, !tbaa !11
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = xor i32 %10, -1
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %16, label %13

13:                                               ; preds = %2
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13, %2
  store i8 1, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %68

17:                                               ; preds = %13
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.netif, ptr %18, i32 0, i32 13
  %20 = load i8, ptr %19, align 1, !tbaa !13
  %21 = zext i8 %20 to i32
  %22 = and i32 %21, 2
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %17
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %68

25:                                               ; preds = %17
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.netif, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds %struct.ip4_addr, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = icmp eq i32 %26, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %25
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %68

33:                                               ; preds = %25
  %34 = getelementptr inbounds %struct.ip4_addr, ptr %6, i32 0, i32 0
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.netif, ptr %36, i32 0, i32 2
  %38 = getelementptr inbounds %struct.ip4_addr, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = and i32 %35, %39
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.netif, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.ip4_addr, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 8, !tbaa !11
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.netif, ptr %45, i32 0, i32 2
  %47 = getelementptr inbounds %struct.ip4_addr, ptr %46, i32 0, i32 0
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = and i32 %44, %48
  %50 = icmp eq i32 %40, %49
  br i1 %50, label %51, label %67

51:                                               ; preds = %33
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.netif, ptr %53, i32 0, i32 2
  %55 = getelementptr inbounds %struct.ip4_addr, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !11
  %57 = xor i32 %56, -1
  %58 = and i32 %52, %57
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.netif, ptr %59, i32 0, i32 2
  %61 = getelementptr inbounds %struct.ip4_addr, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 4, !tbaa !11
  %63 = xor i32 %62, -1
  %64 = and i32 -1, %63
  %65 = icmp eq i32 %58, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %51
  store i8 1, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %68

67:                                               ; preds = %51, %33
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %68

68:                                               ; preds = %67, %66, %32, %24, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %69 = load i8, ptr %3, align 1
  ret i8 %69
}

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

!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, !6, i64 0}
!12 = !{!"ip4_addr", !6, i64 0}
!13 = !{!14, !7, i64 81}
!14 = !{!"netif", !10, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !15, i64 72, !7, i64 74, !7, i64 80, !7, i64 81, !7, i64 82, !7, i64 84, !7, i64 85}
!15 = !{!"short", !7, i64 0}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local zeroext range(i8 0, 2) i8 @ip4_addr_isbroadcast_u32(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = add i32 %0, 1
  %or.cond = icmp ult i32 %3, 2
  br i1 %or.cond, label %21, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 81
  %6 = load i8, ptr %5, align 1, !tbaa !5
  %7 = and i8 %6, 2
  %8 = icmp eq i8 %7, 0
  br i1 %8, label %21, label %9

9:                                                ; preds = %4
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = icmp eq i32 %11, %0
  br i1 %12, label %21, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %1, i64 12
  %15 = load i32, ptr %14, align 4, !tbaa !13
  %16 = xor i32 %11, %0
  %17 = and i32 %15, %16
  %18 = icmp eq i32 %17, 0
  %19 = or i32 %15, %0
  %20 = icmp eq i32 %19, -1
  %or.cond16 = and i1 %18, %20
  %spec.select = zext i1 %or.cond16 to i8
  br label %21

21:                                               ; preds = %13, %9, %4, %2
  %.0 = phi i8 [ 1, %2 ], [ 0, %4 ], [ 0, %9 ], [ %spec.select, %13 ]
  ret i8 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: 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" }

!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 81}
!6 = !{!"netif", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !8, i64 64, !12, i64 72, !8, i64 74, !8, i64 80, !8, i64 81, !8, i64 82, !8, i64 84, !8, i64 85}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"ip4_addr", !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!10, !11, i64 0}


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