; LLVM IR from hit9/bitproto :: example/C-optimization-mode (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.Drone = type { i8, %struct.Position, %struct.Flight, [4 x %struct.Propeller], %struct.Power, %struct.Network, %struct.LandingGear, %struct.PressureSensor }
%struct.Position = type { i32, i32, i32 }
%struct.Flight = type { %struct.Pose, [3 x i32], [3 x i32] }
%struct.Pose = type { i32, i32, i32 }
%struct.Propeller = type { i8, i8, i8 }
%struct.Power = type { i8, i8, i8 }
%struct.Network = type { i8, i32 }
%struct.LandingGear = type { i8 }
%struct.PressureSensor = type { [2 x i32] }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.Drone, align 4
  %3 = alloca [67 x i8], align 16
  %4 = alloca %struct.Drone, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 88, ptr %2) #5
  call void @llvm.memset.p0.i64(ptr align 4 %2, i8 0, i64 88, i1 false)
  %5 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 0
  store i8 2, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 1
  %7 = getelementptr inbounds %struct.Position, ptr %6, i32 0, i32 1
  store i32 2000, ptr %7, align 4, !tbaa !18
  %8 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 1
  %9 = getelementptr inbounds %struct.Position, ptr %8, i32 0, i32 0
  store i32 2000, ptr %9, align 4, !tbaa !19
  %10 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 1
  %11 = getelementptr inbounds %struct.Position, ptr %10, i32 0, i32 2
  store i32 1080, ptr %11, align 4, !tbaa !20
  %12 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 2
  %13 = getelementptr inbounds %struct.Flight, ptr %12, i32 0, i32 2
  %14 = getelementptr inbounds [3 x i32], ptr %13, i64 0, i64 0
  store i32 -1001, ptr %14, align 4, !tbaa !21
  %15 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 4
  %16 = getelementptr inbounds %struct.Power, ptr %15, i32 0, i32 2
  store i8 0, ptr %16, align 2, !tbaa !22
  %17 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 3
  %18 = getelementptr inbounds [4 x %struct.Propeller], ptr %17, i64 0, i64 0
  %19 = getelementptr inbounds %struct.Propeller, ptr %18, i32 0, i32 2
  store i8 1, ptr %19, align 2, !tbaa !23
  %20 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 7
  %21 = getelementptr inbounds %struct.PressureSensor, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds [2 x i32], ptr %21, i64 0, i64 0
  store i32 -11, ptr %22, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 67, ptr %3) #5
  call void @llvm.memset.p0.i64(ptr align 16 %3, i8 0, i64 67, i1 false)
  %23 = getelementptr inbounds [67 x i8], ptr %3, i64 0, i64 0
  %24 = call i32 @EncodeDrone(ptr noundef %2, ptr noundef %23)
  call void @llvm.lifetime.start.p0(i64 88, ptr %4) #5
  call void @llvm.memset.p0.i64(ptr align 4 %4, i8 0, i64 88, i1 false)
  %25 = getelementptr inbounds [67 x i8], ptr %3, i64 0, i64 0
  %26 = call i32 @DecodeDrone(ptr noundef %4, ptr noundef %25)
  %27 = getelementptr inbounds %struct.Drone, ptr %4, i32 0, i32 0
  %28 = load i8, ptr %27, align 4, !tbaa !5
  %29 = zext i8 %28 to i32
  %30 = getelementptr inbounds %struct.Drone, ptr %2, i32 0, i32 0
  %31 = load i8, ptr %30, align 4, !tbaa !5
  %32 = zext i8 %31 to i32
  %33 = icmp eq i32 %29, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %0
  br label %36

35:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 27, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

36:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 88, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 67, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr %2) #5
  ret i32 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare i32 @EncodeDrone(ptr noundef, ptr noundef) #3

declare i32 @DecodeDrone(ptr noundef, ptr noundef) #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"Drone", !7, i64 0, !9, i64 4, !11, i64 16, !7, i64 52, !13, i64 64, !15, i64 68, !16, i64 76, !17, i64 80}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"Position", !10, i64 0, !10, i64 4, !10, i64 8}
!10 = !{!"int", !7, i64 0}
!11 = !{!"Flight", !12, i64 0, !7, i64 12, !7, i64 24}
!12 = !{!"Pose", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!"Power", !7, i64 0, !7, i64 1, !14, i64 2}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!"Network", !7, i64 0, !10, i64 4}
!16 = !{!"LandingGear", !7, i64 0}
!17 = !{!"PressureSensor", !7, i64 0}
!18 = !{!6, !10, i64 8}
!19 = !{!6, !10, i64 4}
!20 = !{!6, !10, i64 12}
!21 = !{!10, !10, i64 0}
!22 = !{!6, !14, i64 66}
!23 = !{!24, !7, i64 2}
!24 = !{!"Propeller", !7, i64 0, !7, i64 1, !7, i64 2}


; 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.Drone = type { i8, %struct.Position, %struct.Flight, [4 x %struct.Propeller], %struct.Power, %struct.Network, %struct.LandingGear, %struct.PressureSensor }
%struct.Position = type { i32, i32, i32 }
%struct.Flight = type { %struct.Pose, [3 x i32], [3 x i32] }
%struct.Pose = type { i32, i32, i32 }
%struct.Propeller = type { i8, i8, i8 }
%struct.Power = type { i8, i8, i8 }
%struct.Network = type { i8, i32 }
%struct.LandingGear = type { i8 }
%struct.PressureSensor = type { [2 x i32] }

@.str = external hidden unnamed_addr constant [33 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.Drone, align 4
  %2 = alloca [67 x i8], align 16
  %3 = alloca %struct.Drone, align 4
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %1) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(88) %1, i8 0, i64 88, i1 false)
  store i8 2, ptr %1, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 4
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 2000, ptr %5, align 4, !tbaa !18
  store i32 2000, ptr %4, align 4, !tbaa !19
  %6 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 1080, ptr %6, align 4, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %1, i64 40
  store i32 -1001, ptr %7, align 4, !tbaa !21
  %8 = getelementptr inbounds i8, ptr %1, i64 54
  store i8 1, ptr %8, align 2, !tbaa !22
  %9 = getelementptr inbounds i8, ptr %1, i64 80
  store i32 -11, ptr %9, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 67, ptr nonnull %2) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(67) %2, i8 0, i64 67, i1 false)
  %10 = call i32 @EncodeDrone(ptr noundef nonnull %1, ptr noundef nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %3) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(88) %3, i8 0, i64 88, i1 false)
  %11 = call i32 @DecodeDrone(ptr noundef nonnull %3, ptr noundef nonnull %2) #5
  %12 = load i8, ptr %3, align 4, !tbaa !5
  %13 = load i8, ptr %1, align 4, !tbaa !5
  %14 = icmp eq i8 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 27, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #6
  unreachable

16:                                               ; preds = %0
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 67, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %1) #5
  ret i32 0
}

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

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

declare i32 @EncodeDrone(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @DecodeDrone(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = !{!"Drone", !7, i64 0, !9, i64 4, !11, i64 16, !7, i64 52, !13, i64 64, !15, i64 68, !16, i64 76, !17, i64 80}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"Position", !10, i64 0, !10, i64 4, !10, i64 8}
!10 = !{!"int", !7, i64 0}
!11 = !{!"Flight", !12, i64 0, !7, i64 12, !7, i64 24}
!12 = !{!"Pose", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!"Power", !7, i64 0, !7, i64 1, !14, i64 2}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!"Network", !7, i64 0, !10, i64 4}
!16 = !{!"LandingGear", !7, i64 0}
!17 = !{!"PressureSensor", !7, i64 0}
!18 = !{!6, !10, i64 8}
!19 = !{!6, !10, i64 4}
!20 = !{!6, !10, i64 12}
!21 = !{!10, !10, i64 0}
!22 = !{!23, !7, i64 2}
!23 = !{!"Propeller", !7, i64 0, !7, i64 1, !7, i64 2}


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