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

; 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.tcp_pcb = type { %struct.ip4_addr, %struct.ip4_addr, i8, i8, i8, i8, ptr, ptr, i32, i8, i16, i16, i16, i8, i8, i8, i32, i32, i16, i16, i32, i16, i16, i32, i32, i16, i16, i16, i8, i8, i32, i16, i16, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, i8, i8, i8 }
%struct.ip4_addr = type { i32 }
%struct.pbuf = type { ptr, ptr, i16, i16, i8, 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.28 = external hidden unnamed_addr constant [38 x i8], align 1

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

; 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

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

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %15, label %11

11:                                               ; preds = %8
  br label %12

12:                                               ; preds = %11
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef @.str.28, i32 noundef 1545, ptr noundef @.str.2)
  br label %14

14:                                               ; preds = %12
  store i8 -16, ptr %2, align 1
  br label %106

15:                                               ; preds = %8
  br label %16

16:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.tcp_pcb, ptr %17, i32 0, i32 46
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.pbuf, ptr %19, i32 0, i32 5
  %21 = load i8, ptr %20, align 1, !tbaa !14
  store i8 %21, ptr %5, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.tcp_pcb, ptr %22, i32 0, i32 46
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  store ptr %24, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tcp_pcb, ptr %25, i32 0, i32 46
  store ptr null, ptr %26, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %16
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.tcp_pcb, ptr %28, i32 0, i32 49
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %42

32:                                               ; preds = %27
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.tcp_pcb, ptr %33, i32 0, i32 49
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.tcp_pcb, ptr %36, i32 0, i32 7
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = call signext i8 %35(ptr noundef %38, ptr noundef %39, ptr noundef %40, i8 noundef signext 0)
  store i8 %41, ptr %4, align 1, !tbaa !16
  br label %46

42:                                               ; preds = %27
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call signext i8 @tcp_recv_null(ptr noundef null, ptr noundef %43, ptr noundef %44, i8 noundef signext 0)
  store i8 %45, ptr %4, align 1, !tbaa !16
  br label %46

46:                                               ; preds = %42, %32
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load i8, ptr %4, align 1, !tbaa !16
  %50 = sext i8 %49 to i32
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %93

52:                                               ; preds = %48
  %53 = load i8, ptr %5, align 1, !tbaa !16
  %54 = zext i8 %53 to i32
  %55 = and i32 %54, 32
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %92

57:                                               ; preds = %52
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.tcp_pcb, ptr %58, i32 0, i32 18
  %60 = load i16, ptr %59, align 8, !tbaa !19
  %61 = zext i16 %60 to i32
  %62 = icmp ne i32 %61, 2920
  br i1 %62, label %63, label %68

63:                                               ; preds = %57
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.tcp_pcb, ptr %64, i32 0, i32 18
  %66 = load i16, ptr %65, align 8, !tbaa !19
  %67 = add i16 %66, 1
  store i16 %67, ptr %65, align 8, !tbaa !19
  br label %68

68:                                               ; preds = %63, %57
  br label %69

69:                                               ; preds = %68
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.tcp_pcb, ptr %70, i32 0, i32 49
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  %73 = icmp ne ptr %72, null
  br i1 %73, label %74, label %83

74:                                               ; preds = %69
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.tcp_pcb, ptr %75, i32 0, i32 49
  %77 = load ptr, ptr %76, align 8, !tbaa !17
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.tcp_pcb, ptr %78, i32 0, i32 7
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = call signext i8 %77(ptr noundef %80, ptr noundef %81, ptr noundef null, i8 noundef signext 0)
  store i8 %82, ptr %4, align 1, !tbaa !16
  br label %84

83:                                               ; preds = %69
  store i8 0, ptr %4, align 1, !tbaa !16
  br label %84

84:                                               ; preds = %83, %74
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = load i8, ptr %4, align 1, !tbaa !16
  %88 = sext i8 %87 to i32
  %89 = icmp eq i32 %88, -13
  br i1 %89, label %90, label %91

90:                                               ; preds = %86
  store i8 -13, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %103

91:                                               ; preds = %86
  br label %92

92:                                               ; preds = %91, %52
  br label %102

93:                                               ; preds = %48
  %94 = load i8, ptr %4, align 1, !tbaa !16
  %95 = sext i8 %94 to i32
  %96 = icmp eq i32 %95, -13
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  store i8 -13, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %103

98:                                               ; preds = %93
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.tcp_pcb, ptr %100, i32 0, i32 46
  store ptr %99, ptr %101, align 8, !tbaa !9
  store i8 -5, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %103

102:                                              ; preds = %92
  store i32 0, ptr %7, align 4
  br label %103

103:                                              ; preds = %102, %98, %97, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #3
  %104 = load i32, ptr %7, align 4
  switch i32 %104, label %108 [
    i32 0, label %105
    i32 1, label %106
  ]

105:                                              ; preds = %103
  store i8 0, ptr %2, align 1
  br label %106

106:                                              ; preds = %105, %103, %14
  %107 = load i8, ptr %2, align 1
  ret i8 %107

108:                                              ; preds = %103
  unreachable
}

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 144}
!10 = !{!"tcp_pcb", !11, i64 0, !11, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !6, i64 16, !6, i64 24, !12, i64 32, !7, i64 36, !13, i64 38, !13, i64 40, !13, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !12, i64 48, !12, i64 52, !13, i64 56, !13, i64 58, !12, i64 60, !13, i64 64, !13, i64 66, !12, i64 68, !12, i64 72, !13, i64 76, !13, i64 78, !13, i64 80, !7, i64 82, !7, i64 83, !12, i64 84, !13, i64 88, !13, i64 90, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !13, i64 112, !13, i64 114, !13, i64 116, !13, i64 118, !13, i64 120, !13, i64 122, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !12, i64 200, !7, i64 204, !7, i64 205, !7, i64 206, !7, i64 207}
!11 = !{!"ip4_addr", !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!15, !7, i64 21}
!15 = !{!"pbuf", !6, i64 0, !6, i64 8, !13, i64 16, !13, i64 18, !7, i64 20, !7, i64 21, !7, i64 22, !7, i64 23}
!16 = !{!7, !7, i64 0}
!17 = !{!10, !6, i64 168}
!18 = !{!10, !6, i64 24}
!19 = !{!10, !13, i64 56}


; 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.28 = external hidden unnamed_addr constant [38 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 @tcp_process_refused_data(ptr noundef %0) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %2, label %4

2:                                                ; preds = %1
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull @.str.28, i32 noundef 1545, ptr noundef nonnull @.str.2)
  br label %.thread

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 144
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 21
  %8 = load i8, ptr %7, align 1, !tbaa !13
  store ptr null, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 168
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  %.not31 = icmp eq ptr %10, null
  br i1 %.not31, label %15, label %11

11:                                               ; preds = %4
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %14 = tail call signext i8 %10(ptr noundef %13, ptr noundef nonnull %0, ptr noundef nonnull %6, i8 noundef signext 0) #2
  br label %17

15:                                               ; preds = %4
  %16 = tail call signext i8 @tcp_recv_null(ptr noundef null, ptr noundef nonnull %0, ptr noundef nonnull %6, i8 noundef signext 0)
  br label %17

17:                                               ; preds = %15, %11
  %.025 = phi i8 [ %14, %11 ], [ %16, %15 ]
  switch i8 %.025, label %32 [
    i8 0, label %18
    i8 -13, label %.thread
  ]

18:                                               ; preds = %17
  %19 = and i8 %8, 32
  %.not32 = icmp eq i8 %19, 0
  br i1 %.not32, label %.thread, label %20

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %0, i64 56
  %22 = load i16, ptr %21, align 8, !tbaa !17
  %.not33 = icmp eq i16 %22, 2920
  br i1 %.not33, label %25, label %23

23:                                               ; preds = %20
  %24 = add i16 %22, 1
  store i16 %24, ptr %21, align 8, !tbaa !17
  br label %25

25:                                               ; preds = %20, %23
  %26 = load ptr, ptr %9, align 8, !tbaa !15
  %.not34 = icmp eq ptr %26, null
  br i1 %.not34, label %.thread, label %27

27:                                               ; preds = %25
  %28 = getelementptr inbounds i8, ptr %0, i64 24
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  %30 = tail call signext i8 %26(ptr noundef %29, ptr noundef nonnull %0, ptr noundef null, i8 noundef signext 0) #2
  %31 = icmp eq i8 %30, -13
  %spec.select = select i1 %31, i8 -13, i8 0
  br label %.thread

32:                                               ; preds = %17
  store ptr %6, ptr %5, align 8, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %27, %17, %32, %25, %18, %2
  %.1 = phi i8 [ -16, %2 ], [ 0, %25 ], [ 0, %18 ], [ %.025, %17 ], [ -5, %32 ], [ %spec.select, %27 ]
  ret i8 %.1
}

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @tcp_recv_null(ptr noundef, ptr noundef, ptr noundef, i8 noundef signext) 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" }
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, !11, i64 144}
!6 = !{!"tcp_pcb", !7, i64 0, !7, i64 4, !9, i64 8, !9, i64 9, !9, i64 10, !9, i64 11, !11, i64 16, !11, i64 24, !8, i64 32, !9, i64 36, !12, i64 38, !12, i64 40, !12, i64 42, !9, i64 44, !9, i64 45, !9, i64 46, !8, i64 48, !8, i64 52, !12, i64 56, !12, i64 58, !8, i64 60, !12, i64 64, !12, i64 66, !8, i64 68, !8, i64 72, !12, i64 76, !12, i64 78, !12, i64 80, !9, i64 82, !9, i64 83, !8, i64 84, !12, i64 88, !12, i64 90, !8, i64 92, !8, i64 96, !8, i64 100, !8, i64 104, !8, i64 108, !12, i64 112, !12, i64 114, !12, i64 116, !12, i64 118, !12, i64 120, !12, i64 122, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !8, i64 200, !9, i64 204, !9, i64 205, !9, i64 206, !9, i64 207}
!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 = !{!14, !9, i64 21}
!14 = !{!"pbuf", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 18, !9, i64 20, !9, i64 21, !9, i64 22, !9, i64 23}
!15 = !{!6, !11, i64 168}
!16 = !{!6, !11, i64 24}
!17 = !{!6, !12, i64 56}


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