; LLVM IR from ANL-CESAR/XSBench :: openmp-threading (io)

; 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.Inputs = type { i32, i64, i64, i32, ptr, i32, i32, i32, i32, i32, i32 }

@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @border_print() #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @print_results(ptr noundef byval(%struct.Inputs) align 8 %0, i32 noundef %1, double noundef %2, i32 noundef %3, i64 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store i32 %1, ptr %6, align 4, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !5
  store i64 %4, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  %15 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %18, label %24

18:                                               ; preds = %5
  %19 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 3
  %20 = load i32, ptr %19, align 8, !tbaa !17
  %21 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 7
  %22 = load i32, ptr %21, align 8, !tbaa !18
  %23 = mul nsw i32 %20, %22
  store i32 %23, ptr %10, align 4, !tbaa !5
  br label %32

24:                                               ; preds = %5
  %25 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %26 = load i32, ptr %25, align 4, !tbaa !13
  %27 = icmp eq i32 %26, 2
  br i1 %27, label %28, label %31

28:                                               ; preds = %24
  %29 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 3
  %30 = load i32, ptr %29, align 8, !tbaa !17
  store i32 %30, ptr %10, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %28, %24
  br label %32

32:                                               ; preds = %31, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = sitofp i32 %33 to double
  %35 = load double, ptr %7, align 8, !tbaa !9
  %36 = fdiv double %34, %35
  %37 = fptosi double %36 to i32
  store i32 %37, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !5
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %52

40:                                               ; preds = %32
  call void @border_print()
  call void @center_print(ptr noundef @.str.5, i32 noundef 79)
  call void @border_print()
  %41 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !19
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %42)
  %44 = load double, ptr %7, align 8, !tbaa !9
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, double noundef %44)
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %47 = load i32, ptr %10, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  call void @fancy_int(i64 noundef %48)
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %50 = load i32, ptr %11, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  call void @fancy_int(i64 noundef %51)
  br label %52

52:                                               ; preds = %40, %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = icmp eq i32 %54, 2
  br i1 %55, label %56, label %57

56:                                               ; preds = %52
  store i64 945990, ptr %14, align 8, !tbaa !11
  store i64 952131, ptr %13, align 8, !tbaa !11
  br label %63

57:                                               ; preds = %52
  %58 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 8
  %59 = load i32, ptr %58, align 4, !tbaa !13
  %60 = icmp eq i32 %59, 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %57
  store i64 941535, ptr %14, align 8, !tbaa !11
  store i64 954318, ptr %13, align 8, !tbaa !11
  br label %62

62:                                               ; preds = %61, %57
  br label %63

63:                                               ; preds = %62, %56
  %64 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !20
  %66 = call i32 @strcmp(ptr noundef %65, ptr noundef @.str.10) #5
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %74

68:                                               ; preds = %63
  %69 = load i64, ptr %9, align 8, !tbaa !11
  %70 = load i64, ptr %13, align 8, !tbaa !11
  %71 = icmp eq i64 %69, %70
  br i1 %71, label %72, label %73

72:                                               ; preds = %68
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %72, %68
  br label %86

74:                                               ; preds = %63
  %75 = getelementptr inbounds %struct.Inputs, ptr %0, i32 0, i32 4
  %76 = load ptr, ptr %75, align 8, !tbaa !20
  %77 = call i32 @strcmp(ptr noundef %76, ptr noundef @.str.11) #5
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %85

79:                                               ; preds = %74
  %80 = load i64, ptr %9, align 8, !tbaa !11
  %81 = load i64, ptr %14, align 8, !tbaa !11
  %82 = icmp eq i64 %80, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %79
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %83, %79
  br label %85

85:                                               ; preds = %84, %74
  br label %86

86:                                               ; preds = %85, %73
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %99

89:                                               ; preds = %86
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %95

92:                                               ; preds = %89
  %93 = load i64, ptr %9, align 8, !tbaa !11
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i64 noundef %93)
  br label %98

95:                                               ; preds = %89
  %96 = load i64, ptr %9, align 8, !tbaa !11
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i64 noundef %96)
  br label %98

98:                                               ; preds = %95, %92
  call void @border_print()
  br label %99

99:                                               ; preds = %98, %86
  %100 = load i32, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  ret i32 %100
}

; Function Attrs: nounwind uwtable
declare dso_local void @fancy_int(i64 noundef) #0

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(read) "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 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !6, i64 52}
!14 = !{!"", !6, i64 0, !15, i64 8, !15, i64 16, !6, i64 24, !16, i64 32, !6, i64 40, !6, i64 44, !6, i64 48, !6, i64 52, !6, i64 56, !6, i64 60}
!15 = !{!"long", !7, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!14, !6, i64 24}
!18 = !{!14, !6, i64 48}
!19 = !{!14, !6, i64 0}
!20 = !{!14, !16, i64 32}


; 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.Inputs = type { i32, i64, i64, i32, ptr, i32, i32, i32, i32, i32, i32 }

@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @border_print() local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @print_results(ptr nocapture noundef readonly byval(%struct.Inputs) align 8 %0, i32 noundef %1, double noundef %2, i32 noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %0, i64 52
  %7 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %7, label %17 [
    i32 1, label %8
    i32 2, label %14
  ]

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load i32, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load i32, ptr %11, align 8, !tbaa !13
  %13 = mul nsw i32 %12, %10
  br label %17

14:                                               ; preds = %5
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load i32, ptr %15, align 8, !tbaa !12
  br label %17

17:                                               ; preds = %5, %14, %8
  %.016 = phi i32 [ %13, %8 ], [ %16, %14 ], [ 0, %5 ]
  %18 = icmp eq i32 %1, 0
  br i1 %18, label %19, label %30

19:                                               ; preds = %17
  %20 = sitofp i32 %.016 to double
  %21 = fdiv double %20, %2
  %22 = fptosi double %21 to i32
  tail call void @border_print()
  tail call void @center_print(ptr noundef nonnull @.str.5, i32 noundef 79)
  tail call void @border_print()
  %23 = load i32, ptr %0, align 8, !tbaa !14
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %23)
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, double noundef %2)
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %27 = sext i32 %.016 to i64
  tail call void @fancy_int(i64 noundef %27)
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %29 = sext i32 %22 to i64
  tail call void @fancy_int(i64 noundef %29)
  br label %30

30:                                               ; preds = %19, %17
  switch i32 %7, label %.fold.split [
    i32 2, label %32
    i32 1, label %31
  ]

31:                                               ; preds = %30
  br label %32

.fold.split:                                      ; preds = %30
  br label %32

32:                                               ; preds = %30, %.fold.split, %31
  %.014 = phi i64 [ 954318, %31 ], [ 952131, %30 ], [ 0, %.fold.split ]
  %.0 = phi i64 [ 941535, %31 ], [ 945990, %30 ], [ 0, %.fold.split ]
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  %34 = load ptr, ptr %33, align 8, !tbaa !15
  %35 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.10) #3
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %39

37:                                               ; preds = %32
  %38 = icmp eq i64 %.014, %4
  br label %43

39:                                               ; preds = %32
  %40 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %34, ptr noundef nonnull dereferenceable(1) @.str.11) #3
  %41 = icmp eq i32 %40, 0
  %42 = icmp eq i64 %.0, %4
  %or.cond = and i1 %42, %41
  br label %43

43:                                               ; preds = %39, %37
  %.not = phi i1 [ %38, %37 ], [ %or.cond, %39 ]
  br i1 %18, label %44, label %46

44:                                               ; preds = %43
  %.str.13..str.12 = select i1 %.not, ptr @.str.13, ptr @.str.12
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.13..str.12, i64 noundef %4)
  tail call void @border_print()
  br label %46

46:                                               ; preds = %44, %43
  %.015.in = xor i1 %.not, true
  %.015 = zext i1 %.015.in to i32
  ret i32 %.015
}

; Function Attrs: nounwind uwtable
declare dso_local void @fancy_int(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #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 = { 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 #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }

!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 52}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 48}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !11, i64 32}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass