; LLVM IR from devicehive/esp8266-firmware :: firmware-src/sources (dhesperrors)

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

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@dhesperrors_disconnect_reason.str = external hidden constant [6 x i8], align 4
@dhesperrors_disconnect_reason.str.25 = external hidden constant [6 x i8], align 4

; Function Attrs: nounwind uwtable
define dso_local void @dhesperrors_disconnect_reason(ptr noundef %0, i8 noundef zeroext %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = load i8, ptr %4, align 1, !tbaa !9
  %7 = zext i8 %6 to i32
  switch i32 %7, label %33 [
    i32 1, label %8
    i32 2, label %9
    i32 3, label %10
    i32 4, label %11
    i32 5, label %12
    i32 6, label %13
    i32 7, label %14
    i32 8, label %15
    i32 9, label %16
    i32 10, label %17
    i32 11, label %18
    i32 13, label %19
    i32 14, label %20
    i32 15, label %21
    i32 16, label %22
    i32 17, label %23
    i32 18, label %24
    i32 19, label %25
    i32 20, label %26
    i32 21, label %27
    i32 22, label %28
    i32 23, label %29
    i32 24, label %30
    i32 200, label %31
    i32 201, label %32
  ]

8:                                                ; preds = %2
  store ptr @.str, ptr %5, align 8, !tbaa !5
  br label %33

9:                                                ; preds = %2
  store ptr @.str.1, ptr %5, align 8, !tbaa !5
  br label %33

10:                                               ; preds = %2
  store ptr @.str.2, ptr %5, align 8, !tbaa !5
  br label %33

11:                                               ; preds = %2
  store ptr @.str.3, ptr %5, align 8, !tbaa !5
  br label %33

12:                                               ; preds = %2
  store ptr @.str.4, ptr %5, align 8, !tbaa !5
  br label %33

13:                                               ; preds = %2
  store ptr @.str.5, ptr %5, align 8, !tbaa !5
  br label %33

14:                                               ; preds = %2
  store ptr @.str.6, ptr %5, align 8, !tbaa !5
  br label %33

15:                                               ; preds = %2
  store ptr @.str.7, ptr %5, align 8, !tbaa !5
  br label %33

16:                                               ; preds = %2
  store ptr @.str.8, ptr %5, align 8, !tbaa !5
  br label %33

17:                                               ; preds = %2
  store ptr @.str.9, ptr %5, align 8, !tbaa !5
  br label %33

18:                                               ; preds = %2
  store ptr @.str.10, ptr %5, align 8, !tbaa !5
  br label %33

19:                                               ; preds = %2
  store ptr @.str.11, ptr %5, align 8, !tbaa !5
  br label %33

20:                                               ; preds = %2
  store ptr @.str.12, ptr %5, align 8, !tbaa !5
  br label %33

21:                                               ; preds = %2
  store ptr @.str.13, ptr %5, align 8, !tbaa !5
  br label %33

22:                                               ; preds = %2
  store ptr @.str.14, ptr %5, align 8, !tbaa !5
  br label %33

23:                                               ; preds = %2
  store ptr @.str.15, ptr %5, align 8, !tbaa !5
  br label %33

24:                                               ; preds = %2
  store ptr @.str.16, ptr %5, align 8, !tbaa !5
  br label %33

25:                                               ; preds = %2
  store ptr @.str.17, ptr %5, align 8, !tbaa !5
  br label %33

26:                                               ; preds = %2
  store ptr @.str.18, ptr %5, align 8, !tbaa !5
  br label %33

27:                                               ; preds = %2
  store ptr @.str.19, ptr %5, align 8, !tbaa !5
  br label %33

28:                                               ; preds = %2
  store ptr @.str.20, ptr %5, align 8, !tbaa !5
  br label %33

29:                                               ; preds = %2
  store ptr @.str.21, ptr %5, align 8, !tbaa !5
  br label %33

30:                                               ; preds = %2
  store ptr @.str.22, ptr %5, align 8, !tbaa !5
  br label %33

31:                                               ; preds = %2
  store ptr @.str.23, ptr %5, align 8, !tbaa !5
  br label %33

32:                                               ; preds = %2
  store ptr @.str.24, ptr %5, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %32, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %2
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %42

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ...) @dhdebug_ram(ptr noundef @dhesperrors_disconnect_reason.str, ptr noundef %38, ptr noundef %39)
  br label %40

40:                                               ; preds = %37
  br label %41

41:                                               ; preds = %40
  br label %49

42:                                               ; preds = %33
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load i8, ptr %4, align 1, !tbaa !9
  %46 = zext i8 %45 to i32
  call void (ptr, ...) @dhdebug_ram(ptr noundef @dhesperrors_disconnect_reason.str.25, ptr noundef %44, i32 noundef %46)
  br label %47

47:                                               ; preds = %43
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

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

; 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 = { "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 = !{!7, !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"

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@dhesperrors_disconnect_reason.str = external hidden constant [6 x i8], align 4
@dhesperrors_disconnect_reason.str.25 = external hidden constant [6 x i8], align 4

; Function Attrs: nounwind uwtable
define dso_local void @dhesperrors_disconnect_reason(ptr noundef %0, i8 noundef zeroext %1) local_unnamed_addr #0 {
  switch i8 %1, label %28 [
    i8 1, label %27
    i8 2, label %3
    i8 3, label %4
    i8 4, label %5
    i8 5, label %6
    i8 6, label %7
    i8 7, label %8
    i8 8, label %9
    i8 9, label %10
    i8 10, label %11
    i8 11, label %12
    i8 13, label %13
    i8 14, label %14
    i8 15, label %15
    i8 16, label %16
    i8 17, label %17
    i8 18, label %18
    i8 19, label %19
    i8 20, label %20
    i8 21, label %21
    i8 22, label %22
    i8 23, label %23
    i8 24, label %24
    i8 -56, label %25
    i8 -55, label %26
  ]

3:                                                ; preds = %2
  br label %27

4:                                                ; preds = %2
  br label %27

5:                                                ; preds = %2
  br label %27

6:                                                ; preds = %2
  br label %27

7:                                                ; preds = %2
  br label %27

8:                                                ; preds = %2
  br label %27

9:                                                ; preds = %2
  br label %27

10:                                               ; preds = %2
  br label %27

11:                                               ; preds = %2
  br label %27

12:                                               ; preds = %2
  br label %27

13:                                               ; preds = %2
  br label %27

14:                                               ; preds = %2
  br label %27

15:                                               ; preds = %2
  br label %27

16:                                               ; preds = %2
  br label %27

17:                                               ; preds = %2
  br label %27

18:                                               ; preds = %2
  br label %27

19:                                               ; preds = %2
  br label %27

20:                                               ; preds = %2
  br label %27

21:                                               ; preds = %2
  br label %27

22:                                               ; preds = %2
  br label %27

23:                                               ; preds = %2
  br label %27

24:                                               ; preds = %2
  br label %27

25:                                               ; preds = %2
  br label %27

26:                                               ; preds = %2
  br label %27

27:                                               ; preds = %2, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
  %.0.ph = phi ptr [ @.str.1, %3 ], [ @.str.2, %4 ], [ @.str.3, %5 ], [ @.str.4, %6 ], [ @.str.5, %7 ], [ @.str.6, %8 ], [ @.str.7, %9 ], [ @.str.8, %10 ], [ @.str.9, %11 ], [ @.str.10, %12 ], [ @.str.11, %13 ], [ @.str.12, %14 ], [ @.str.13, %15 ], [ @.str.14, %16 ], [ @.str.15, %17 ], [ @.str.16, %18 ], [ @.str.17, %19 ], [ @.str.18, %20 ], [ @.str.19, %21 ], [ @.str.20, %22 ], [ @.str.21, %23 ], [ @.str.22, %24 ], [ @.str.23, %25 ], [ @.str.24, %26 ], [ @.str, %2 ]
  tail call void (ptr, ...) @dhdebug_ram(ptr noundef nonnull @dhesperrors_disconnect_reason.str, ptr noundef %0, ptr noundef nonnull %.0.ph) #2
  br label %30

28:                                               ; preds = %2
  %29 = zext i8 %1 to i32
  tail call void (ptr, ...) @dhdebug_ram(ptr noundef nonnull @dhesperrors_disconnect_reason.str.25, ptr noundef %0, i32 noundef %29) #2
  br label %30

30:                                               ; preds = %28, %27
  ret void
}

declare void @dhdebug_ram(ptr noundef, ...) local_unnamed_addr #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 = { "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)"}


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