; LLVM IR from sharkbench/sharkbench :: benchmark/computation/c/gcc-6 (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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 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: nounwind uwtable
declare dso_local void @handle_connection(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.sockaddr_in, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 16, ptr %5, align 4, !tbaa !5
  %6 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #6
  store i32 %6, ptr %2, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %0
  call void @perror(ptr noundef @.str.2)
  call void @exit(i32 noundef 1) #7
  unreachable

9:                                                ; preds = %0
  %10 = getelementptr inbounds %struct.sockaddr_in, ptr %4, i32 0, i32 0
  store i16 2, ptr %10, align 4, !tbaa !9
  %11 = getelementptr inbounds %struct.sockaddr_in, ptr %4, i32 0, i32 2
  %12 = getelementptr inbounds %struct.in_addr, ptr %11, i32 0, i32 0
  store i32 0, ptr %12, align 4, !tbaa !13
  %13 = call zeroext i16 @__bswap_16(i16 noundef zeroext 3000)
  %14 = getelementptr inbounds %struct.sockaddr_in, ptr %4, i32 0, i32 1
  store i16 %13, ptr %14, align 2, !tbaa !14
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = call i32 @bind(i32 noundef %15, ptr noundef %4, i32 noundef 16) #6
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %9
  call void @perror(ptr noundef @.str.3)
  call void @exit(i32 noundef 1) #7
  unreachable

19:                                               ; preds = %9
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = call i32 @listen(i32 noundef %20, i32 noundef 10) #6
  %22 = icmp slt i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %19
  call void @perror(ptr noundef @.str.4)
  call void @exit(i32 noundef 1) #7
  unreachable

24:                                               ; preds = %19
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef 3000)
  br label %26

26:                                               ; preds = %32, %24
  br label %27

27:                                               ; preds = %26
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = call i32 @accept(i32 noundef %28, ptr noundef %4, ptr noundef %5)
  store i32 %29, ptr %3, align 4, !tbaa !5
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  call void @perror(ptr noundef @.str.6)
  call void @exit(i32 noundef 1) #7
  unreachable

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  call void @handle_connection(i32 noundef %33)
  br label %26
}

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) #2

declare void @perror(ptr noundef) #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #5

; Function Attrs: nounwind
declare i32 @bind(i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @listen(i32 noundef, i32 noundef) #2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = { 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 = { 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 #6 = { nounwind }
attributes #7 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"sockaddr_in", !11, i64 0, !11, i64 2, !12, i64 4, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!"in_addr", !6, i64 0}
!13 = !{!10, !6, i64 4}
!14 = !{!10, !11, 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @handle_connection(i32 noundef) local_unnamed_addr #1

; Function Attrs: noreturn nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %struct.sockaddr_in, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 16, ptr %2, align 4, !tbaa !5
  %3 = tail call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #8
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %5, label %6

5:                                                ; preds = %0
  tail call void @perror(ptr noundef nonnull @.str.2) #9
  tail call void @exit(i32 noundef 1) #10
  unreachable

6:                                                ; preds = %0
  store i16 2, ptr %1, align 4, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %1, i64 4
  store i32 0, ptr %7, align 4, !tbaa !13
  %8 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext 3000)
  %9 = getelementptr inbounds i8, ptr %1, i64 2
  store i16 %8, ptr %9, align 2, !tbaa !14
  %10 = call i32 @bind(i32 noundef %3, ptr noundef nonnull %1, i32 noundef 16) #8
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %6
  call void @perror(ptr noundef nonnull @.str.3) #9
  call void @exit(i32 noundef 1) #10
  unreachable

13:                                               ; preds = %6
  %14 = call i32 @listen(i32 noundef %3, i32 noundef 10) #8
  %15 = icmp slt i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %13
  call void @perror(ptr noundef nonnull @.str.4) #9
  call void @exit(i32 noundef 1) #10
  unreachable

17:                                               ; preds = %13
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef 3000)
  %19 = call i32 @accept(i32 noundef %3, ptr noundef nonnull %1, ptr noundef nonnull %2) #8
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %17
  call void @perror(ptr noundef nonnull @.str.6) #9
  call void @exit(i32 noundef 1) #10
  unreachable

.lr.ph:                                           ; preds = %17, %.lr.ph
  %21 = phi i32 [ %22, %.lr.ph ], [ %19, %17 ]
  call void @handle_connection(i32 noundef %21)
  %22 = call i32 @accept(i32 noundef %3, ptr noundef nonnull %1, ptr noundef nonnull %2) #8
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %._crit_edge, label %.lr.ph
}

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @bind(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @listen(i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

declare i32 @accept(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 #7 = { "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 #8 = { nounwind }
attributes #9 = { cold }
attributes #10 = { 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"sockaddr_in", !11, i64 0, !11, i64 2, !12, i64 4, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!"in_addr", !6, i64 0}
!13 = !{!10, !6, i64 4}
!14 = !{!10, !11, i64 2}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass