; LLVM IR from cpq/bare-metal-programming-guide :: steps/step-7-webserver/pico-w5500 (main)

; 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.spi = type { i32, i32, i32, i32, i32 }
%struct.mip_driver = type { ptr, ptr, ptr, ptr }
%struct.mip_spi = type { ptr, ptr, ptr, ptr }
%struct.mip_if = type { [6 x i8], i32, i32, i32, %struct.mg_str, %struct.mg_str, i8, i8, ptr, ptr, ptr, %struct.queue, i64, i64, i64, [62 x i8], i16, i16, i8 }
%struct.mg_str = type { ptr, i64 }
%struct.queue = type { ptr, i64, i64, i64 }
%struct.mg_mgr = type { ptr, %struct.mg_dns, %struct.mg_dns, i32, i8, i64, i64, ptr, i16, ptr, ptr, i32, ptr, i64 }
%struct.mg_dns = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [107 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@__const.main.spi0 = external hidden unnamed_addr constant %struct.spi, align 4
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@mip_driver_w5500 = external global %struct.mip_driver, align 8
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @my_spi_begin(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @my_spi_end(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @my_spi_txn(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @fn(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @mg_millis() #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.spi, align 4
  %3 = alloca i8, align 1
  %4 = alloca %struct.mip_spi, align 8
  %5 = alloca %struct.mip_if, align 8
  %6 = alloca %struct.mg_mgr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @clock_init()
  call void @uart_init(ptr noundef inttoptr (i64 1073954816 to ptr), i32 noundef 115200, i16 noundef zeroext 1, i16 noundef zeroext 0)
  call void @gpio_init(i16 noundef zeroext 25, i8 noundef zeroext 1, i8 noundef zeroext 0)
  br label %10

10:                                               ; preds = %0
  %11 = call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef @.str.2, i32 noundef 35, ptr noundef @__func__.main)
  br i1 %11, label %12, label %13

12:                                               ; preds = %10
  call void (ptr, ...) @mg_log(ptr noundef @.str.3)
  br label %13

13:                                               ; preds = %12, %10
  br label %14

14:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 20, ptr %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %2, ptr align 4 @__const.main.spi0, i64 20, i1 false)
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #6
  %15 = call zeroext i1 @spi_init(ptr noundef %2)
  %16 = zext i1 %15 to i8
  store i8 %16, ptr %3, align 1, !tbaa !5
  br label %17

17:                                               ; preds = %14
  %18 = call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef @.str.2, i32 noundef 41, ptr noundef @__func__.main)
  br i1 %18, label %19, label %23

19:                                               ; preds = %17
  %20 = load i8, ptr %3, align 1, !tbaa !5, !range !9, !noundef !10
  %21 = trunc i8 %20 to i1
  %22 = zext i1 %21 to i32
  call void (ptr, ...) @mg_log(ptr noundef @.str.4, i32 noundef %22)
  br label %23

23:                                               ; preds = %19, %17
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #6
  %26 = getelementptr inbounds %struct.mip_spi, ptr %4, i32 0, i32 0
  store ptr %2, ptr %26, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct.mip_spi, ptr %4, i32 0, i32 1
  store ptr @my_spi_begin, ptr %27, align 8, !tbaa !14
  %28 = getelementptr inbounds %struct.mip_spi, ptr %4, i32 0, i32 2
  store ptr @my_spi_end, ptr %28, align 8, !tbaa !15
  %29 = getelementptr inbounds %struct.mip_spi, ptr %4, i32 0, i32 3
  store ptr @my_spi_txn, ptr %29, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 216, ptr %5) #6
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 216, i1 false)
  %30 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 0
  store i8 2, ptr %30, align 1, !tbaa !17
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  %32 = getelementptr inbounds i8, ptr %30, i64 2
  store i8 1, ptr %32, align 1, !tbaa !17
  %33 = getelementptr inbounds i8, ptr %30, i64 3
  store i8 2, ptr %33, align 1, !tbaa !17
  %34 = getelementptr inbounds i8, ptr %30, i64 4
  store i8 3, ptr %34, align 1, !tbaa !17
  %35 = getelementptr inbounds i8, ptr %30, i64 5
  store i8 5, ptr %35, align 1, !tbaa !17
  %36 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 1
  %37 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 2
  %38 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 3
  %39 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 4
  %40 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 5
  %41 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 6
  %42 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 7
  %43 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 8
  store ptr @mip_driver_w5500, ptr %43, align 8, !tbaa !18
  %44 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 9
  store ptr %4, ptr %44, align 8, !tbaa !25
  %45 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 10
  %46 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 11
  %47 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 12
  %48 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 13
  %49 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 14
  %50 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 15
  %51 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 16
  %52 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 17
  %53 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 18
  call void @llvm.lifetime.start.p0(i64 120, ptr %6) #6
  call void @mg_mgr_init(ptr noundef %6)
  call void @mg_log_set(i32 noundef 3)
  call void @mip_init(ptr noundef %6, ptr noundef %5)
  %54 = call ptr @mg_http_listen(ptr noundef %6, ptr noundef @.str.5, ptr noundef @fn, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  store i8 0, ptr %7, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !26
  br label %55

55:                                               ; preds = %86, %25
  %56 = call i64 @mg_millis()
  %57 = call zeroext i1 @mg_timer_expired(ptr noundef %9, i64 noundef 500, i64 noundef %56)
  br i1 %57, label %58, label %69

58:                                               ; preds = %55
  %59 = load i8, ptr %7, align 1, !tbaa !5, !range !9, !noundef !10
  %60 = trunc i8 %59 to i1
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i8
  store i8 %62, ptr %7, align 1, !tbaa !5
  %63 = load ptr, ptr getelementptr inbounds (%struct.mip_driver, ptr @mip_driver_w5500, i32 0, i32 3), align 8, !tbaa !27
  %64 = call zeroext i1 %63(ptr noundef %5)
  br i1 %64, label %65, label %66

65:                                               ; preds = %58
  store i8 1, ptr %7, align 1, !tbaa !5
  br label %66

66:                                               ; preds = %65, %58
  %67 = load i8, ptr %7, align 1, !tbaa !5, !range !9, !noundef !10
  %68 = trunc i8 %67 to i1
  call void @gpio_write(i16 noundef zeroext 25, i1 noundef zeroext %68)
  br label %69

69:                                               ; preds = %66, %55
  %70 = call i64 @mg_millis()
  %71 = call zeroext i1 @mg_timer_expired(ptr noundef %8, i64 noundef 1000, i64 noundef %70)
  br i1 %71, label %72, label %86

72:                                               ; preds = %69
  br label %73

73:                                               ; preds = %72
  %74 = call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef @.str.2, i32 noundef 65, ptr noundef @__func__.main)
  br i1 %74, label %75, label %83

75:                                               ; preds = %73
  %76 = getelementptr inbounds %struct.mip_if, ptr %5, i32 0, i32 8
  %77 = load ptr, ptr %76, align 8, !tbaa !18
  %78 = getelementptr inbounds %struct.mip_driver, ptr %77, i32 0, i32 3
  %79 = load ptr, ptr %78, align 8, !tbaa !27
  %80 = call zeroext i1 %79(ptr noundef %5)
  %81 = zext i1 %80 to i64
  %82 = select i1 %80, ptr @.str.7, ptr @.str.8
  call void (ptr, ...) @mg_log(ptr noundef @.str.6, ptr noundef %82)
  br label %83

83:                                               ; preds = %75, %73
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85, %69
  call void @mg_mgr_poll(ptr noundef %6, i32 noundef 1)
  br label %55
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @clock_init() #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @uart_init(ptr noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gpio_init(i16 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #1

declare zeroext i1 @mg_log_prefix(i32 noundef, ptr noundef, i32 noundef, ptr noundef) #2

declare void @mg_log(ptr noundef, ...) #2

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

; 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) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @spi_init(ptr noundef) #1

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

declare void @mg_mgr_init(ptr noundef) #2

declare void @mg_log_set(i32 noundef) #2

declare void @mip_init(ptr noundef, ptr noundef) #2

declare ptr @mg_http_listen(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare zeroext i1 @mg_timer_expired(ptr noundef, i64 noundef, i64 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gpio_write(i16 noundef zeroext, i1 noundef zeroext) #1

declare void @mg_mgr_poll(ptr noundef, i32 noundef) #2

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 = { inlinehint 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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = !{!"_Bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{!12, !13, i64 0}
!12 = !{!"mip_spi", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 16}
!16 = !{!12, !13, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !13, i64 64}
!19 = !{!"mip_if", !7, i64 0, !20, i64 8, !20, i64 12, !20, i64 16, !21, i64 24, !21, i64 40, !6, i64 56, !6, i64 57, !13, i64 64, !13, i64 72, !13, i64 80, !23, i64 88, !22, i64 120, !22, i64 128, !22, i64 136, !7, i64 144, !24, i64 206, !24, i64 208, !7, i64 210}
!20 = !{!"int", !7, i64 0}
!21 = !{!"mg_str", !13, i64 0, !22, i64 8}
!22 = !{!"long", !7, i64 0}
!23 = !{!"queue", !13, i64 0, !22, i64 8, !22, i64 16, !22, i64 24}
!24 = !{!"short", !7, i64 0}
!25 = !{!19, !13, i64 72}
!26 = !{!22, !22, i64 0}
!27 = !{!28, !13, i64 24}
!28 = !{!"mip_driver", !13, i64 0, !13, i64 8, !13, i64 16, !13, 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.spi = type { i32, i32, i32, i32, i32 }
%struct.mip_driver = type { ptr, ptr, ptr, ptr }
%struct.mip_spi = type { ptr, ptr, ptr, ptr }
%struct.mip_if = type { [6 x i8], i32, i32, i32, %struct.mg_str, %struct.mg_str, i8, i8, ptr, ptr, ptr, %struct.queue, i64, i64, i64, [62 x i8], i16, i16, i8 }
%struct.mg_str = type { ptr, i64 }
%struct.queue = type { ptr, i64, i64, i64 }
%struct.mg_mgr = type { ptr, %struct.mg_dns, %struct.mg_dns, i32, i8, i64, i64, ptr, i16, ptr, ptr, i32, ptr, i64 }
%struct.mg_dns = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [107 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@__const.main.spi0 = external hidden unnamed_addr constant %struct.spi, align 4
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@mip_driver_w5500 = external global %struct.mip_driver, align 8
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @my_spi_begin(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @my_spi_end(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @my_spi_txn(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @fn(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @mg_millis() local_unnamed_addr #0

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %struct.spi, align 4
  %2 = alloca %struct.mip_spi, align 8
  %3 = alloca %struct.mip_if, align 8
  %4 = alloca %struct.mg_mgr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  tail call void @clock_init()
  tail call void @uart_init(ptr noundef nonnull inttoptr (i64 1073954816 to ptr), i32 noundef 115200, i16 noundef zeroext 1, i16 noundef zeroext 0)
  tail call void @gpio_init(i16 noundef zeroext 25, i8 noundef zeroext 1, i8 noundef zeroext 0)
  %7 = tail call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef nonnull @.str.2, i32 noundef 35, ptr noundef nonnull @__func__.main) #7
  br i1 %7, label %8, label %9

8:                                                ; preds = %0
  tail call void (ptr, ...) @mg_log(ptr noundef nonnull @.str.3) #7
  br label %9

9:                                                ; preds = %0, %8
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %1) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %1, ptr noundef nonnull align 4 dereferenceable(20) @__const.main.spi0, i64 20, i1 false)
  %10 = call zeroext i1 @spi_init(ptr noundef nonnull %1)
  %11 = call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef nonnull @.str.2, i32 noundef 41, ptr noundef nonnull @__func__.main) #7
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = zext i1 %10 to i32
  call void (ptr, ...) @mg_log(ptr noundef nonnull @.str.4, i32 noundef %13) #7
  br label %14

14:                                               ; preds = %12, %9
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  store ptr %1, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr @my_spi_begin, ptr %15, align 8, !tbaa !10
  %16 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr @my_spi_end, ptr %16, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr @my_spi_txn, ptr %17, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %3) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(216) %3, i8 0, i64 216, i1 false)
  store i8 2, ptr %3, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %3, i64 2
  store <4 x i8> <i8 1, i8 2, i8 3, i8 5>, ptr %18, align 2, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %3, i64 64
  store ptr @mip_driver_w5500, ptr %19, align 8, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %3, i64 72
  store ptr %2, ptr %20, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %4) #7
  call void @mg_mgr_init(ptr noundef nonnull %4) #7
  call void @mg_log_set(i32 noundef 3) #7
  call void @mip_init(ptr noundef nonnull %4, ptr noundef nonnull %3) #7
  %21 = call ptr @mg_http_listen(ptr noundef nonnull %4, ptr noundef nonnull @.str.5, ptr noundef nonnull @fn, ptr noundef null) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  store i64 0, ptr %5, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  store i64 0, ptr %6, align 8, !tbaa !23
  br label %22

22:                                               ; preds = %40, %14
  %.0 = phi i1 [ false, %14 ], [ %.2, %40 ]
  %23 = call i64 @mg_millis()
  %24 = call zeroext i1 @mg_timer_expired(ptr noundef nonnull %6, i64 noundef 500, i64 noundef %23) #7
  br i1 %24, label %25, label %29

25:                                               ; preds = %22
  %26 = xor i1 %.0, true
  %27 = load ptr, ptr getelementptr inbounds (i8, ptr @mip_driver_w5500, i64 24), align 8, !tbaa !24
  %28 = call zeroext i1 %27(ptr noundef nonnull %3) #7
  %spec.select = select i1 %28, i1 true, i1 %26
  call void @gpio_write(i16 noundef zeroext 25, i1 noundef zeroext %spec.select)
  br label %29

29:                                               ; preds = %25, %22
  %.2 = phi i1 [ %spec.select, %25 ], [ %.0, %22 ]
  %30 = call i64 @mg_millis()
  %31 = call zeroext i1 @mg_timer_expired(ptr noundef nonnull %5, i64 noundef 1000, i64 noundef %30) #7
  br i1 %31, label %32, label %40

32:                                               ; preds = %29
  %33 = call zeroext i1 @mg_log_prefix(i32 noundef 2, ptr noundef nonnull @.str.2, i32 noundef 65, ptr noundef nonnull @__func__.main) #7
  br i1 %33, label %34, label %40

34:                                               ; preds = %32
  %35 = load ptr, ptr %19, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %35, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = call zeroext i1 %37(ptr noundef nonnull %3) #7
  %39 = select i1 %38, ptr @.str.7, ptr @.str.8
  call void (ptr, ...) @mg_log(ptr noundef nonnull @.str.6, ptr noundef nonnull %39) #7
  br label %40

40:                                               ; preds = %32, %34, %29
  call void @mg_mgr_poll(ptr noundef nonnull %4, i32 noundef 1) #7
  br label %22
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @clock_init() local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @uart_init(ptr noundef, i32 noundef, i16 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gpio_init(i16 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2

declare zeroext i1 @mg_log_prefix(i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare void @mg_log(ptr noundef, ...) local_unnamed_addr #3

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

; 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) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @spi_init(ptr noundef) local_unnamed_addr #2

; 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 void @mg_mgr_init(ptr noundef) local_unnamed_addr #3

declare void @mg_log_set(i32 noundef) local_unnamed_addr #3

declare void @mip_init(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @mg_http_listen(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare zeroext i1 @mg_timer_expired(ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @gpio_write(i16 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #2

declare void @mg_mgr_poll(ptr noundef, i32 noundef) local_unnamed_addr #3

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 = { noreturn 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 = { inlinehint 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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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, !7, i64 0}
!6 = !{!"mip_spi", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!8, !8, i64 0}
!14 = !{!15, !7, i64 64}
!15 = !{!"mip_if", !8, i64 0, !16, i64 8, !16, i64 12, !16, i64 16, !17, i64 24, !17, i64 40, !19, i64 56, !19, i64 57, !7, i64 64, !7, i64 72, !7, i64 80, !20, i64 88, !18, i64 120, !18, i64 128, !18, i64 136, !8, i64 144, !21, i64 206, !21, i64 208, !8, i64 210}
!16 = !{!"int", !8, i64 0}
!17 = !{!"mg_str", !7, i64 0, !18, i64 8}
!18 = !{!"long", !8, i64 0}
!19 = !{!"_Bool", !8, i64 0}
!20 = !{!"queue", !7, i64 0, !18, i64 8, !18, i64 16, !18, i64 24}
!21 = !{!"short", !8, i64 0}
!22 = !{!15, !7, i64 72}
!23 = !{!18, !18, i64 0}
!24 = !{!25, !7, i64 24}
!25 = !{!"mip_driver", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}


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