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

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

@arp_table = external hidden global [10 x %struct.etharp_entry], align 16
@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [186 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @etharp_get_entry(i64 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store i64 %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  br label %10

10:                                               ; preds = %4
  %11 = load ptr, ptr %7, align 8, !tbaa !9
  %12 = icmp ne ptr %11, null
  br i1 %12, label %17, label %13

13:                                               ; preds = %10
  br label %14

14:                                               ; preds = %13
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.3, i32 noundef 614, ptr noundef @.str.2)
  br label %16

16:                                               ; preds = %14
  br label %17

17:                                               ; preds = %16, %10
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %8, align 8, !tbaa !9
  %21 = icmp ne ptr %20, null
  br i1 %21, label %26, label %22

22:                                               ; preds = %19
  br label %23

23:                                               ; preds = %22
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.4, i32 noundef 615, ptr noundef @.str.2)
  br label %25

25:                                               ; preds = %23
  br label %26

26:                                               ; preds = %25, %19
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %9, align 8, !tbaa !9
  %30 = icmp ne ptr %29, null
  br i1 %30, label %35, label %31

31:                                               ; preds = %28
  br label %32

32:                                               ; preds = %31
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.5, i32 noundef 616, ptr noundef @.str.2)
  br label %34

34:                                               ; preds = %32
  br label %35

35:                                               ; preds = %34, %28
  br label %36

36:                                               ; preds = %35
  %37 = load i64, ptr %6, align 8, !tbaa !5
  %38 = icmp ult i64 %37, 10
  br i1 %38, label %39, label %60

39:                                               ; preds = %36
  %40 = load i64, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds [10 x %struct.etharp_entry], ptr @arp_table, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.etharp_entry, ptr %41, i32 0, i32 5
  %43 = load i8, ptr %42, align 8, !tbaa !11
  %44 = zext i8 %43 to i32
  %45 = icmp sge i32 %44, 2
  br i1 %45, label %46, label %60

46:                                               ; preds = %39
  %47 = load i64, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds [10 x %struct.etharp_entry], ptr @arp_table, i64 0, i64 %47
  %49 = getelementptr inbounds %struct.etharp_entry, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %49, ptr %50, align 8, !tbaa !9
  %51 = load i64, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds [10 x %struct.etharp_entry], ptr @arp_table, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.etharp_entry, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !17
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %54, ptr %55, align 8, !tbaa !9
  %56 = load i64, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds [10 x %struct.etharp_entry], ptr @arp_table, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.etharp_entry, ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %58, ptr %59, align 8, !tbaa !9
  store i32 1, ptr %5, align 4
  br label %61

60:                                               ; preds = %39, %36
  store i32 0, ptr %5, align 4
  br label %61

61:                                               ; preds = %60, %46
  %62 = load i32, ptr %5, align 4
  ret i32 %62
}

attributes #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 = { 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, !6, i64 0}
!6 = !{!"long", !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, !7, i64 32}
!12 = !{!"etharp_entry", !10, i64 0, !13, i64 8, !10, i64 16, !15, i64 24, !16, i64 30, !7, i64 32}
!13 = !{!"ip4_addr", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"eth_addr", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!12, !10, i64 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"

%struct.etharp_entry = type { ptr, %struct.ip4_addr, ptr, %struct.eth_addr, i16, i8 }
%struct.ip4_addr = type { i32 }
%struct.eth_addr = type { [6 x i8] }

@arp_table = external hidden global [10 x %struct.etharp_entry], align 16
@.str = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [186 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local range(i32 0, 2) i32 @etharp_get_entry(i64 noundef %0, ptr noundef writeonly %1, ptr noundef writeonly %2, ptr noundef writeonly %3) local_unnamed_addr #1 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %5, label %7

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

7:                                                ; preds = %5, %4
  %.not12 = icmp eq ptr %2, null
  br i1 %.not12, label %8, label %10

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

10:                                               ; preds = %8, %7
  %.not13 = icmp eq ptr %3, null
  br i1 %.not13, label %11, label %13

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

13:                                               ; preds = %10, %11
  %14 = icmp ult i64 %0, 10
  br i1 %14, label %15, label %25

15:                                               ; preds = %13
  %16 = getelementptr inbounds [10 x %struct.etharp_entry], ptr @arp_table, i64 0, i64 %0
  %17 = getelementptr inbounds i8, ptr %16, i64 32
  %18 = load i8, ptr %17, align 8, !tbaa !5
  %19 = icmp ugt i8 %18, 1
  br i1 %19, label %20, label %25

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %16, i64 8
  store ptr %21, ptr %1, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %16, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  store ptr %23, ptr %2, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %16, i64 24
  store ptr %24, ptr %3, align 8, !tbaa !14
  br label %25

25:                                               ; preds = %13, %15, %20
  %.0 = phi i32 [ 1, %20 ], [ 0, %15 ], [ 0, %13 ]
  ret i32 %.0
}

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 = { nofree 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 32}
!6 = !{!"etharp_entry", !7, i64 0, !10, i64 8, !7, i64 16, !12, i64 24, !13, i64 30, !8, i64 32}
!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 = !{!"eth_addr", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 16}


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