; LLVM IR from moarseniy/CudaFEMproject :: FEMproject/thirdparty/segyio/src/SegyOut.ll (ZN8CSegyOut14writeSEGYTraceEv)

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

%"class.std::bad_alloc" = type { %"class.std::exception" }
%"class.std::exception" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%class.CSegyIO = type <{ ptr, i32, i32, i32, float, i32, [71 x i32], [27 x i32], [4 x i8], ptr, ptr, i64, %"class.std::basic_ifstream", %"class.std::basic_ofstream", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i8, i8, [6 x i8] }>
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }

@_ZZN8CSegyOut14writeSEGYTraceEvE5count = external hidden global i32, align 4
@_ZTISt9bad_alloc = external constant ptr
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546), ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547) %0) #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca [4 x i8], align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::bad_alloc", align 8
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator", align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #11
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #11
  store i64 0, ptr %6, align 8, !tbaa !9
  %20 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 2
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = mul nsw i32 %21, 4
  %23 = sext i32 %22 to i64
  %24 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %23) #12
          to label %25 unwind label %26

25:                                               ; preds = %1
  store ptr %24, ptr %5, align 8, !tbaa !5
  br label %50

26:                                               ; preds = %1
  %27 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %7, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %8, align 4
  br label %30

30:                                               ; preds = %26
  %31 = load i32, ptr %8, align 4
  %32 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9bad_alloc) #11
  %33 = icmp eq i32 %31, %32
  br i1 %33, label %34, label %109

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #11
  %35 = load ptr, ptr %7, align 8
  %36 = call ptr @__cxa_get_exception_ptr(ptr %35) #11
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %36) #11
  %37 = call ptr @__cxa_begin_catch(ptr %35) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #11
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #11
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.4, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %38 unwind label %40

38:                                               ; preds = %34
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %19, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %39 unwind label %44

39:                                               ; preds = %38
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #11
  store i1 false, ptr %2, align 1
  store i32 1, ptr %12, align 4
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #11
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #11
  br label %107

40:                                               ; preds = %34
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %7, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %8, align 4
  br label %48

44:                                               ; preds = %38
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %7, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #11
  br label %48

48:                                               ; preds = %44, %40
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #11
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #11
  invoke void @__cxa_end_catch()
          to label %49 unwind label %115

49:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #11
  br label %109

50:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #11
  store i32 0, ptr %13, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #11
  %51 = load i32, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !28
  %52 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = mul nsw i32 %51, %53
  store i32 %54, ptr %14, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #11
  br label %55

55:                                               ; preds = %90, %50
  %56 = load i32, ptr %13, align 4, !tbaa !28
  %57 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 2
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %60, label %93

60:                                               ; preds = %55
  %61 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 5
  %62 = load i32, ptr %61, align 8, !tbaa !29
  %63 = icmp eq i32 %62, 5
  br i1 %63, label %64, label %73

64:                                               ; preds = %60
  %65 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %66 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 9
  %67 = load ptr, ptr %66, align 8, !tbaa !30
  %68 = load i32, ptr %14, align 4, !tbaa !28
  %69 = load i32, ptr %13, align 4, !tbaa !28
  %70 = add nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds float, ptr %67, i64 %71
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %65, ptr align 4 %72, i64 4, i1 false)
  br label %84

73:                                               ; preds = %60
  %74 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 9
  %75 = load ptr, ptr %74, align 8, !tbaa !30
  %76 = load i32, ptr %14, align 4, !tbaa !28
  %77 = load i32, ptr %13, align 4, !tbaa !28
  %78 = add nsw i32 %76, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %75, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !31
  %82 = fptosi float %81 to i32
  store i32 %82, ptr %15, align 4, !tbaa !28
  %83 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %83, ptr align 4 %15, i64 4, i1 false)
  br label %84

84:                                               ; preds = %73, %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #11
  %85 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  store ptr %85, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #11
  %86 = load i64, ptr %6, align 8, !tbaa !9
  %87 = trunc i64 %86 to i32
  store i32 %87, ptr %17, align 4, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #11
  store i32 4, ptr %18, align 4, !tbaa !28
  call void @_ZN8CSegyOut9setBufferERKPcS2_RKiS4_(ptr noundef nonnull align 8 dereferenceable(1547) %19, ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #11
  %88 = load i64, ptr %6, align 8, !tbaa !9
  %89 = add nsw i64 %88, 4
  store i64 %89, ptr %6, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %84
  %91 = load i32, ptr %13, align 4, !tbaa !28
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %13, align 4, !tbaa !28
  br label %55, !llvm.loop !32

93:                                               ; preds = %55
  %94 = load i32, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !28
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !28
  %96 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 13
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %class.CSegyIO, ptr %19, i32 0, i32 2
  %99 = load i32, ptr %98, align 4, !tbaa !11
  %100 = mul nsw i32 %99, 4
  %101 = sext i32 %100 to i64
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %96, ptr noundef %97, i64 noundef %101)
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = icmp eq ptr %103, null
  br i1 %104, label %106, label %105

105:                                              ; preds = %93
  call void @_ZdaPv(ptr noundef %103) #13
  br label %106

106:                                              ; preds = %105, %93
  store ptr null, ptr %5, align 8, !tbaa !5
  store i1 true, ptr %2, align 1
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #11
  br label %107

107:                                              ; preds = %106, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #11
  %108 = load i1, ptr %2, align 1
  ret i1 %108

109:                                              ; preds = %49, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #11
  br label %110

110:                                              ; preds = %109
  %111 = load ptr, ptr %7, align 8
  %112 = load i32, ptr %8, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114

115:                                              ; preds = %48
  %116 = landingpad { ptr, i32 }
          catch ptr null
  %117 = extractvalue { ptr, i32 } %116, 0
  call void @__clang_call_terminate(ptr %117) #14
  unreachable
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8CSegyOut9setBufferERKPcS2_RKiS4_(ptr noundef nonnull align 8 dereferenceable(1547), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #6

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #7

declare ptr @__cxa_get_exception_ptr(ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

declare ptr @__cxa_begin_catch(ptr)

; Function Attrs: nounwind
declare void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #8

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #9

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #10

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nobuiltin allocsize(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 = { nounwind memory(none) }
attributes #8 = { 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 #9 = { noinline noreturn nounwind uwtable "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 #10 = { nobuiltin 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 #11 = { nounwind }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { builtin nounwind }
attributes #14 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 12}
!12 = !{!"_ZTS7CSegyIO", !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20, !13, i64 24, !7, i64 28, !7, i64 312, !6, i64 424, !6, i64 432, !10, i64 440, !15, i64 448, !24, i64 968, !26, i64 1480, !26, i64 1512, !21, i64 1544, !21, i64 1545}
!13 = !{!"int", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !16, i64 0, !17, i64 16}
!16 = !{!"_ZTSSi", !10, i64 8}
!17 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !18, i64 0, !7, i64 64, !20, i64 104, !22, i64 120, !23, i64 124, !23, i64 132, !23, i64 140, !6, i64 152, !10, i64 160, !21, i64 168, !21, i64 169, !21, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !21, i64 192, !6, i64 200, !6, i64 208, !10, i64 216, !6, i64 224, !6, i64 232}
!18 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !19, i64 56}
!19 = !{!"_ZTSSt6locale", !6, i64 0}
!20 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !21, i64 8}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!23 = !{!"_ZTS11__mbstate_t", !13, i64 0, !7, i64 4}
!24 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !25, i64 0, !17, i64 8}
!25 = !{!"_ZTSSo"}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !27, i64 0, !10, i64 8, !7, i64 16}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!28 = !{!13, !13, i64 0}
!29 = !{!12, !13, i64 24}
!30 = !{!12, !6, i64 424}
!31 = !{!14, !14, i64 0}
!32 = distinct !{!32, !33}
!33 = !{!"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"

%"class.std::bad_alloc" = type { %"class.std::exception" }
%"class.std::exception" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@_ZZN8CSegyOut14writeSEGYTraceEvE5count = external hidden local_unnamed_addr global i32, align 4
@_ZTISt9bad_alloc = external constant ptr
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca [4 x i8], align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.std::bad_alloc", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  store ptr null, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = shl nsw i32 %11, 2
  %13 = sext i32 %12 to i64
  %14 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %13) #11
          to label %15 unwind label %22

15:                                               ; preds = %1
  store ptr %14, ptr %3, align 8, !tbaa !5
  %16 = load i32, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !27
  %17 = icmp sgt i32 %11, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %15
  %18 = mul nsw i32 %16, %11
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = getelementptr inbounds i8, ptr %0, i64 424
  %21 = sext i32 %18 to i64
  br label %39

22:                                               ; preds = %1
  %23 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %24 = extractvalue { ptr, i32 } %23, 1
  %25 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9bad_alloc) #10
  %26 = icmp eq i32 %24, %25
  br i1 %26, label %27, label %64

27:                                               ; preds = %22
  %28 = extractvalue { ptr, i32 } %23, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #10
  %29 = tail call ptr @__cxa_get_exception_ptr(ptr %28) #10
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %29) #10
  %30 = call ptr @__cxa_begin_catch(ptr %28) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull @.str.4, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %31 unwind label %33

31:                                               ; preds = %27
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %0, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %32 unwind label %35

32:                                               ; preds = %31
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #10
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  br label %63

33:                                               ; preds = %27
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %37

35:                                               ; preds = %31
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #10
  br label %37

37:                                               ; preds = %35, %33
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %34, %33 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #10
  invoke void @__cxa_end_catch()
          to label %38 unwind label %65

38:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  br label %64

39:                                               ; preds = %.lr.ph, %50
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %50 ]
  %.01322 = phi i32 [ 0, %.lr.ph ], [ %51, %50 ]
  %40 = load i32, ptr %19, align 8, !tbaa !28
  %41 = icmp eq i32 %40, 5
  %42 = load ptr, ptr %20, align 8, !tbaa !29
  %43 = getelementptr float, ptr %42, i64 %indvars.iv
  %44 = getelementptr float, ptr %43, i64 %21
  br i1 %41, label %45, label %47

45:                                               ; preds = %39
  %46 = load i32, ptr %44, align 4
  br label %50

47:                                               ; preds = %39
  %48 = load float, ptr %44, align 4, !tbaa !30
  %49 = fptosi float %48 to i32
  br label %50

50:                                               ; preds = %47, %45
  %storemerge = phi i32 [ %46, %45 ], [ %49, %47 ]
  store i32 %storemerge, ptr %2, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #10
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #10
  store i32 %.01322, ptr %8, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #10
  store i32 4, ptr %9, align 4, !tbaa !27
  call void @_ZN8CSegyOut9setBufferERKPcS2_RKiS4_(ptr noundef nonnull align 8 dereferenceable(1547) %0, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #10
  %51 = add i32 %.01322, 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next, %53
  br i1 %54, label %39, label %._crit_edge.loopexit, !llvm.loop !31

._crit_edge.loopexit:                             ; preds = %50
  %.pre = load i32, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !27
  %.pre25 = load ptr, ptr %3, align 8, !tbaa !5
  %.pre26 = shl nsw i32 %52, 2
  %.pre27 = sext i32 %.pre26 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %15
  %.pre-phi28 = phi i64 [ %.pre27, %._crit_edge.loopexit ], [ %13, %15 ]
  %55 = phi ptr [ %.pre25, %._crit_edge.loopexit ], [ %14, %15 ]
  %56 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %16, %15 ]
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @_ZZN8CSegyOut14writeSEGYTraceEvE5count, align 4, !tbaa !27
  %58 = getelementptr inbounds i8, ptr %0, i64 968
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef %55, i64 noundef %.pre-phi28)
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %._crit_edge
  call void @_ZdaPv(ptr noundef nonnull %60) #12
  br label %63

63:                                               ; preds = %._crit_edge, %62, %32
  %.0 = phi i1 [ false, %32 ], [ true, %62 ], [ true, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #10
  ret i1 %.0

64:                                               ; preds = %38, %22
  %.merged = phi { ptr, i32 } [ %.pn, %38 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #10
  resume { ptr, i32 } %.merged

65:                                               ; preds = %37
  %66 = landingpad { ptr, i32 }
          catch ptr null
  %67 = extractvalue { ptr, i32 } %66, 0
  call void @__clang_call_terminate(ptr %67) #13
  unreachable
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSo5writeEPKcl(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8CSegyOut9setBufferERKPcS2_RKiS4_(ptr noundef nonnull align 8 dereferenceable(1547), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #5

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

declare ptr @__cxa_get_exception_ptr(ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #7

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #8

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #9

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { nobuiltin allocsize(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 = { nofree nosync nounwind memory(none) }
attributes #7 = { 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 #8 = { noinline noreturn nounwind uwtable "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 #9 = { nobuiltin 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 #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { builtin nounwind }
attributes #13 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 12}
!10 = !{!"_ZTS7CSegyIO", !11, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !11, i64 24, !7, i64 28, !7, i64 312, !6, i64 424, !6, i64 432, !13, i64 440, !14, i64 448, !23, i64 968, !25, i64 1480, !25, i64 1512, !20, i64 1544, !20, i64 1545}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !15, i64 0, !16, i64 16}
!15 = !{!"_ZTSSi", !13, i64 8}
!16 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !17, i64 0, !7, i64 64, !19, i64 104, !21, i64 120, !22, i64 124, !22, i64 132, !22, i64 140, !6, i64 152, !13, i64 160, !20, i64 168, !20, i64 169, !20, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !20, i64 192, !6, i64 200, !6, i64 208, !13, i64 216, !6, i64 224, !6, i64 232}
!17 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !18, i64 56}
!18 = !{!"_ZTSSt6locale", !6, i64 0}
!19 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !20, i64 8}
!20 = !{!"bool", !7, i64 0}
!21 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!22 = !{!"_ZTS11__mbstate_t", !11, i64 0, !7, i64 4}
!23 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !24, i64 0, !16, i64 8}
!24 = !{!"_ZTSSo"}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !13, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!11, !11, i64 0}
!28 = !{!10, !11, i64 24}
!29 = !{!10, !6, i64 424}
!30 = !{!12, !12, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass