; LLVM IR from steevo87/thermalvis :: src/streamer/serial_comms.ll (Z18displayTermiosData7termios)

; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }

@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18displayTermiosData7termios(ptr noundef byval(%struct.termios) align 8 %0) #1 {
  %2 = alloca i32, align 4
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.4)
  %3 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 0
  %4 = load i32, ptr %3, align 8, !tbaa !5
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.5, i32 noundef %4)
  %5 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 1
  %6 = load i32, ptr %5, align 4, !tbaa !10
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.6, i32 noundef %6)
  %7 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 2
  %8 = load i32, ptr %7, align 8, !tbaa !11
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.7, i32 noundef %8)
  %9 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 3
  %10 = load i32, ptr %9, align 4, !tbaa !12
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.8, i32 noundef %10)
  %11 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 6
  %12 = load i32, ptr %11, align 4, !tbaa !13
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.9, i32 noundef %12)
  %13 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 7
  %14 = load i32, ptr %13, align 8, !tbaa !14
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.10, i32 noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !15
  br label %15

15:                                               ; preds = %27, %1
  %16 = load i32, ptr %2, align 4, !tbaa !15
  %17 = icmp ult i32 %16, 32
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %30

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !15
  %21 = getelementptr inbounds %struct.termios, ptr %0, i32 0, i32 5
  %22 = load i32, ptr %2, align 4, !tbaa !15
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [32 x i8], ptr %21, i64 0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !16
  %26 = zext i8 %25 to i32
  call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef @.str.11, i32 noundef %20, i32 noundef %26)
  br label %27

27:                                               ; preds = %19
  %28 = load i32, ptr %2, align 4, !tbaa !15
  %29 = add i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !15
  br label %15, !llvm.loop !17

30:                                               ; preds = %18
  call void (ptr, ...) @_Z8ROS_WARNPcz(ptr noundef @.str.12)
  ret void
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { 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 = !{!"_ZTS7termios", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !8, i64 16, !8, i64 17, !7, i64 52, !7, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 12}
!13 = !{!6, !7, i64 52}
!14 = !{!6, !7, i64 56}
!15 = !{!7, !7, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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.termios = type { i32, i32, i32, i32, i8, [32 x i8], i32, i32 }

@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z18displayTermiosData7termios(ptr nocapture noundef readonly byval(%struct.termios) align 8 %0) local_unnamed_addr #0 {
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.4)
  %2 = load i32, ptr %0, align 8, !tbaa !5
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.5, i32 noundef %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 4
  %4 = load i32, ptr %3, align 4, !tbaa !10
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.6, i32 noundef %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i32, ptr %5, align 8, !tbaa !11
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.7, i32 noundef %6)
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  %8 = load i32, ptr %7, align 4, !tbaa !12
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.8, i32 noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 52
  %10 = load i32, ptr %9, align 4, !tbaa !13
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.9, i32 noundef %10)
  %11 = getelementptr inbounds i8, ptr %0, i64 56
  %12 = load i32, ptr %11, align 8, !tbaa !14
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.10, i32 noundef %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 17
  %14 = load i8, ptr %13, align 1, !tbaa !15
  %15 = zext i8 %14 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 0, i32 noundef %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 18
  %17 = load i8, ptr %16, align 2, !tbaa !15
  %18 = zext i8 %17 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 1, i32 noundef %18)
  %19 = getelementptr inbounds i8, ptr %0, i64 19
  %20 = load i8, ptr %19, align 1, !tbaa !15
  %21 = zext i8 %20 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 2, i32 noundef %21)
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  %23 = load i8, ptr %22, align 4, !tbaa !15
  %24 = zext i8 %23 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 3, i32 noundef %24)
  %25 = getelementptr inbounds i8, ptr %0, i64 21
  %26 = load i8, ptr %25, align 1, !tbaa !15
  %27 = zext i8 %26 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 4, i32 noundef %27)
  %28 = getelementptr inbounds i8, ptr %0, i64 22
  %29 = load i8, ptr %28, align 2, !tbaa !15
  %30 = zext i8 %29 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 5, i32 noundef %30)
  %31 = getelementptr inbounds i8, ptr %0, i64 23
  %32 = load i8, ptr %31, align 1, !tbaa !15
  %33 = zext i8 %32 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 6, i32 noundef %33)
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  %35 = load i8, ptr %34, align 8, !tbaa !15
  %36 = zext i8 %35 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 7, i32 noundef %36)
  %37 = getelementptr inbounds i8, ptr %0, i64 25
  %38 = load i8, ptr %37, align 1, !tbaa !15
  %39 = zext i8 %38 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 8, i32 noundef %39)
  %40 = getelementptr inbounds i8, ptr %0, i64 26
  %41 = load i8, ptr %40, align 2, !tbaa !15
  %42 = zext i8 %41 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 9, i32 noundef %42)
  %43 = getelementptr inbounds i8, ptr %0, i64 27
  %44 = load i8, ptr %43, align 1, !tbaa !15
  %45 = zext i8 %44 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 10, i32 noundef %45)
  %46 = getelementptr inbounds i8, ptr %0, i64 28
  %47 = load i8, ptr %46, align 4, !tbaa !15
  %48 = zext i8 %47 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 11, i32 noundef %48)
  %49 = getelementptr inbounds i8, ptr %0, i64 29
  %50 = load i8, ptr %49, align 1, !tbaa !15
  %51 = zext i8 %50 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 12, i32 noundef %51)
  %52 = getelementptr inbounds i8, ptr %0, i64 30
  %53 = load i8, ptr %52, align 2, !tbaa !15
  %54 = zext i8 %53 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 13, i32 noundef %54)
  %55 = getelementptr inbounds i8, ptr %0, i64 31
  %56 = load i8, ptr %55, align 1, !tbaa !15
  %57 = zext i8 %56 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 14, i32 noundef %57)
  %58 = getelementptr inbounds i8, ptr %0, i64 32
  %59 = load i8, ptr %58, align 8, !tbaa !15
  %60 = zext i8 %59 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 15, i32 noundef %60)
  %61 = getelementptr inbounds i8, ptr %0, i64 33
  %62 = load i8, ptr %61, align 1, !tbaa !15
  %63 = zext i8 %62 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 16, i32 noundef %63)
  %64 = getelementptr inbounds i8, ptr %0, i64 34
  %65 = load i8, ptr %64, align 2, !tbaa !15
  %66 = zext i8 %65 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 17, i32 noundef %66)
  %67 = getelementptr inbounds i8, ptr %0, i64 35
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = zext i8 %68 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 18, i32 noundef %69)
  %70 = getelementptr inbounds i8, ptr %0, i64 36
  %71 = load i8, ptr %70, align 4, !tbaa !15
  %72 = zext i8 %71 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 19, i32 noundef %72)
  %73 = getelementptr inbounds i8, ptr %0, i64 37
  %74 = load i8, ptr %73, align 1, !tbaa !15
  %75 = zext i8 %74 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 20, i32 noundef %75)
  %76 = getelementptr inbounds i8, ptr %0, i64 38
  %77 = load i8, ptr %76, align 2, !tbaa !15
  %78 = zext i8 %77 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 21, i32 noundef %78)
  %79 = getelementptr inbounds i8, ptr %0, i64 39
  %80 = load i8, ptr %79, align 1, !tbaa !15
  %81 = zext i8 %80 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 22, i32 noundef %81)
  %82 = getelementptr inbounds i8, ptr %0, i64 40
  %83 = load i8, ptr %82, align 8, !tbaa !15
  %84 = zext i8 %83 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 23, i32 noundef %84)
  %85 = getelementptr inbounds i8, ptr %0, i64 41
  %86 = load i8, ptr %85, align 1, !tbaa !15
  %87 = zext i8 %86 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 24, i32 noundef %87)
  %88 = getelementptr inbounds i8, ptr %0, i64 42
  %89 = load i8, ptr %88, align 2, !tbaa !15
  %90 = zext i8 %89 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 25, i32 noundef %90)
  %91 = getelementptr inbounds i8, ptr %0, i64 43
  %92 = load i8, ptr %91, align 1, !tbaa !15
  %93 = zext i8 %92 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 26, i32 noundef %93)
  %94 = getelementptr inbounds i8, ptr %0, i64 44
  %95 = load i8, ptr %94, align 4, !tbaa !15
  %96 = zext i8 %95 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 27, i32 noundef %96)
  %97 = getelementptr inbounds i8, ptr %0, i64 45
  %98 = load i8, ptr %97, align 1, !tbaa !15
  %99 = zext i8 %98 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 28, i32 noundef %99)
  %100 = getelementptr inbounds i8, ptr %0, i64 46
  %101 = load i8, ptr %100, align 2, !tbaa !15
  %102 = zext i8 %101 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 29, i32 noundef %102)
  %103 = getelementptr inbounds i8, ptr %0, i64 47
  %104 = load i8, ptr %103, align 1, !tbaa !15
  %105 = zext i8 %104 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 30, i32 noundef %105)
  %106 = getelementptr inbounds i8, ptr %0, i64 48
  %107 = load i8, ptr %106, align 8, !tbaa !15
  %108 = zext i8 %107 to i32
  tail call void (ptr, ...) @_Z8ROS_INFOPcz(ptr noundef nonnull @.str.11, i32 noundef 31, i32 noundef %108)
  tail call void (ptr, ...) @_Z8ROS_WARNPcz(ptr noundef nonnull @.str.12)
  ret void
}

declare void @_Z8ROS_INFOPcz(ptr noundef, ...) local_unnamed_addr #1

declare void @_Z8ROS_WARNPcz(ptr noundef, ...) local_unnamed_addr #1

attributes #0 = { mustprogress 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" }

!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 = !{!"_ZTS7termios", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !8, i64 16, !8, i64 17, !7, i64 52, !7, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 12}
!13 = !{!6, !7, i64 52}
!14 = !{!6, !7, i64 56}
!15 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass