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

; 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::__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.std::bad_alloc" = type { %"class.std::exception" }
%"class.std::exception" = type { ptr }
%class.CSegyOut = type { %class.CSegyIO.base, i8, [5 x i8] }
%class.CSegyIO.base = 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 }>
%"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 }
%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] }>

@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZTISt9bad_alloc = external constant ptr
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 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
declare dso_local noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547)) #3 align 2

; 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) #4

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

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

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 #7

declare void @__cxa_end_catch()

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8CSegyOut5writeERKPKiS3_RKPKfRS0_(ptr noundef nonnull align 8 dereferenceable(1547) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator", align 1
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %"class.std::__cxx11::basic_string", align 8
  %19 = alloca %"class.std::allocator", align 1
  %20 = alloca %"class.std::bad_alloc", align 8
  %21 = alloca %"class.std::__cxx11::basic_string", align 8
  %22 = alloca %"class.std::allocator", align 1
  %23 = alloca %"class.std::bad_alloc", align 8
  %24 = alloca %"class.std::__cxx11::basic_string", align 8
  %25 = alloca %"class.std::allocator", align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #11
  store i32 0, ptr %12, align 4, !tbaa !9
  %27 = getelementptr inbounds %class.CSegyOut, ptr %26, i32 0, i32 1
  %28 = load i8, ptr %27, align 2, !tbaa !11, !range !29, !noundef !30
  %29 = trunc i8 %28 to i1
  br i1 %29, label %30, label %31

30:                                               ; preds = %5
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %211

31:                                               ; preds = %5
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  store i32 %33, ptr %34, align 8, !tbaa !31
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = getelementptr inbounds i32, ptr %36, i64 38
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 2
  store i32 %38, ptr %39, align 4, !tbaa !32
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = getelementptr inbounds i32, ptr %41, i64 9
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 5
  store i32 %43, ptr %44, align 8, !tbaa !33
  %45 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %46 = load i32, ptr %45, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #11
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #11
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %47 unwind label %52

47:                                               ; preds = %31
  %48 = invoke noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %26, i32 noundef %46, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %49 unwind label %56

49:                                               ; preds = %47
  %50 = xor i1 %48, true
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #11
  br i1 %50, label %51, label %61

51:                                               ; preds = %49
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %211

52:                                               ; preds = %31
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %16, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %17, align 4
  br label %60

56:                                               ; preds = %47
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %16, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %17, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #11
  br label %60

60:                                               ; preds = %56, %52
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #11
  br label %213

61:                                               ; preds = %49
  %62 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 2
  %63 = load i32, ptr %62, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #11
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #11
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %18, ptr noundef @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %19)
          to label %64 unwind label %69

64:                                               ; preds = %61
  %65 = invoke noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %26, i32 noundef %63, ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %66 unwind label %73

66:                                               ; preds = %64
  %67 = xor i1 %65, true
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #11
  br i1 %67, label %68, label %78

68:                                               ; preds = %66
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %211

69:                                               ; preds = %61
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %16, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %17, align 4
  br label %77

73:                                               ; preds = %64
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %16, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %17, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %18) #11
  br label %77

77:                                               ; preds = %73, %69
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %19) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #11
  br label %213

78:                                               ; preds = %66
  %79 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 7
  %80 = getelementptr inbounds [27 x i32], ptr %79, i64 0, i64 0
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %80, ptr align 4 %82, i64 108, i1 false)
  %83 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 10
  %84 = load ptr, ptr %83, align 8, !tbaa !34
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %93

86:                                               ; preds = %78
  %87 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 10
  %88 = load ptr, ptr %87, align 8, !tbaa !34
  %89 = icmp eq ptr %88, null
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  call void @_ZdaPv(ptr noundef %88) #12
  br label %91

91:                                               ; preds = %90, %86
  %92 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 10
  store ptr null, ptr %92, align 8, !tbaa !34
  br label %93

93:                                               ; preds = %91, %78
  %94 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %95 = load i32, ptr %94, align 8, !tbaa !31
  %96 = mul nsw i32 %95, 71
  %97 = sext i32 %96 to i64
  %98 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %97, i64 4)
  %99 = extractvalue { i64, i1 } %98, 1
  %100 = extractvalue { i64, i1 } %98, 0
  %101 = select i1 %99, i64 -1, i64 %100
  %102 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %101) #13
          to label %103 unwind label %105

103:                                              ; preds = %93
  %104 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 10
  store ptr %102, ptr %104, align 8, !tbaa !34
  br label %129

105:                                              ; preds = %93
  %106 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %107 = extractvalue { ptr, i32 } %106, 0
  store ptr %107, ptr %16, align 8
  %108 = extractvalue { ptr, i32 } %106, 1
  store i32 %108, ptr %17, align 4
  br label %109

109:                                              ; preds = %105
  %110 = load i32, ptr %17, align 4
  %111 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9bad_alloc) #11
  %112 = icmp eq i32 %110, %111
  br i1 %112, label %113, label %213

113:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #11
  %114 = load ptr, ptr %16, align 8
  %115 = call ptr @__cxa_get_exception_ptr(ptr %114) #11
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %115) #11
  %116 = call ptr @__cxa_begin_catch(ptr %114) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr %21) #11
  call void @llvm.lifetime.start.p0(i64 1, ptr %22) #11
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %22)
          to label %117 unwind label %119

117:                                              ; preds = %113
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %26, ptr noundef nonnull align 8 dereferenceable(32) %21)
          to label %118 unwind label %123

118:                                              ; preds = %117
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #11
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #11
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #11
  br label %211

119:                                              ; preds = %113
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %16, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %17, align 4
  br label %127

123:                                              ; preds = %117
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %16, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %17, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #11
  br label %127

127:                                              ; preds = %123, %119
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %22) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %22) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %21) #11
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #11
  invoke void @__cxa_end_catch()
          to label %128 unwind label %219

128:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #11
  br label %213

129:                                              ; preds = %103
  %130 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 10
  %131 = load ptr, ptr %130, align 8, !tbaa !34
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = load ptr, ptr %132, align 8, !tbaa !5
  %134 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %135 = load i32, ptr %134, align 8, !tbaa !31
  %136 = mul nsw i32 %135, 71
  %137 = sext i32 %136 to i64
  %138 = mul i64 %137, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %131, ptr align 4 %133, i64 %138, i1 false)
  %139 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 9
  %140 = load ptr, ptr %139, align 8, !tbaa !35
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %149

142:                                              ; preds = %129
  %143 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 9
  %144 = load ptr, ptr %143, align 8, !tbaa !35
  %145 = icmp eq ptr %144, null
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  call void @_ZdaPv(ptr noundef %144) #12
  br label %147

147:                                              ; preds = %146, %142
  %148 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 9
  store ptr null, ptr %148, align 8, !tbaa !35
  br label %149

149:                                              ; preds = %147, %129
  %150 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %151 = load i32, ptr %150, align 8, !tbaa !31
  %152 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 2
  %153 = load i32, ptr %152, align 4, !tbaa !32
  %154 = mul nsw i32 %151, %153
  %155 = sext i32 %154 to i64
  %156 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %155, i64 4)
  %157 = extractvalue { i64, i1 } %156, 1
  %158 = extractvalue { i64, i1 } %156, 0
  %159 = select i1 %157, i64 -1, i64 %158
  %160 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %159) #13
          to label %161 unwind label %163

161:                                              ; preds = %149
  %162 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 9
  store ptr %160, ptr %162, align 8, !tbaa !35
  br label %187

163:                                              ; preds = %149
  %164 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %165 = extractvalue { ptr, i32 } %164, 0
  store ptr %165, ptr %16, align 8
  %166 = extractvalue { ptr, i32 } %164, 1
  store i32 %166, ptr %17, align 4
  br label %167

167:                                              ; preds = %163
  %168 = load i32, ptr %17, align 4
  %169 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9bad_alloc) #11
  %170 = icmp eq i32 %168, %169
  br i1 %170, label %171, label %213

171:                                              ; preds = %167
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #11
  %172 = load ptr, ptr %16, align 8
  %173 = call ptr @__cxa_get_exception_ptr(ptr %172) #11
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %173) #11
  %174 = call ptr @__cxa_begin_catch(ptr %172) #11
  call void @llvm.lifetime.start.p0(i64 32, ptr %24) #11
  call void @llvm.lifetime.start.p0(i64 1, ptr %25) #11
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %25) #11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %24, ptr noundef @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %25)
          to label %175 unwind label %177

175:                                              ; preds = %171
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %26, ptr noundef nonnull align 8 dereferenceable(32) %24)
          to label %176 unwind label %181

176:                                              ; preds = %175
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #11
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %25) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #11
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #11
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #11
  br label %211

177:                                              ; preds = %171
  %178 = landingpad { ptr, i32 }
          cleanup
  %179 = extractvalue { ptr, i32 } %178, 0
  store ptr %179, ptr %16, align 8
  %180 = extractvalue { ptr, i32 } %178, 1
  store i32 %180, ptr %17, align 4
  br label %185

181:                                              ; preds = %175
  %182 = landingpad { ptr, i32 }
          cleanup
  %183 = extractvalue { ptr, i32 } %182, 0
  store ptr %183, ptr %16, align 8
  %184 = extractvalue { ptr, i32 } %182, 1
  store i32 %184, ptr %17, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %24) #11
  br label %185

185:                                              ; preds = %181, %177
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %25) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr %25) #11
  call void @llvm.lifetime.end.p0(i64 32, ptr %24) #11
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #11
  invoke void @__cxa_end_catch()
          to label %186 unwind label %219

186:                                              ; preds = %185
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #11
  br label %213

187:                                              ; preds = %161
  %188 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 9
  %189 = load ptr, ptr %188, align 8, !tbaa !35
  %190 = load ptr, ptr %10, align 8, !tbaa !5
  %191 = load ptr, ptr %190, align 8, !tbaa !5
  %192 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %193 = load i32, ptr %192, align 8, !tbaa !31
  %194 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 2
  %195 = load i32, ptr %194, align 4, !tbaa !32
  %196 = mul nsw i32 %193, %195
  %197 = sext i32 %196 to i64
  %198 = mul i64 %197, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %189, ptr align 4 %191, i64 %198, i1 false)
  call void @_ZN8CSegyOut19writeSEGYFileHeaderEv(ptr noundef nonnull align 8 dereferenceable(1547) %26)
  br label %199

199:                                              ; preds = %206, %187
  %200 = load i32, ptr %12, align 4, !tbaa !9
  %201 = getelementptr inbounds %class.CSegyIO, ptr %26, i32 0, i32 3
  %202 = load i32, ptr %201, align 8, !tbaa !31
  %203 = icmp slt i32 %200, %202
  br i1 %203, label %204, label %209

204:                                              ; preds = %199
  call void @_ZN8CSegyOut20writeSEGYTraceHeaderEv(ptr noundef nonnull align 8 dereferenceable(1547) %26)
  %205 = call noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547) %26)
  br label %206

206:                                              ; preds = %204
  %207 = load i32, ptr %12, align 4, !tbaa !9
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %12, align 4, !tbaa !9
  br label %199, !llvm.loop !36

209:                                              ; preds = %199
  %210 = getelementptr inbounds %class.CSegyOut, ptr %26, i32 0, i32 1
  store i8 1, ptr %210, align 2, !tbaa !11
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %211

211:                                              ; preds = %209, %176, %118, %68, %51, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #11
  %212 = load i1, ptr %6, align 1
  ret i1 %212

213:                                              ; preds = %186, %167, %128, %109, %77, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #11
  br label %214

214:                                              ; preds = %213
  %215 = load ptr, ptr %16, align 8
  %216 = load i32, ptr %17, align 4
  %217 = insertvalue { ptr, i32 } poison, ptr %215, 0
  %218 = insertvalue { ptr, i32 } %217, i32 %216, 1
  resume { ptr, i32 } %218

219:                                              ; preds = %185, %127
  %220 = landingpad { ptr, i32 }
          catch ptr null
  %221 = extractvalue { ptr, i32 } %220, 0
  call void @__clang_call_terminate(ptr %221) #14
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #11 = { nounwind }
attributes #12 = { builtin nounwind }
attributes #13 = { builtin allocsize(0) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !22, i64 1546}
!12 = !{!"_ZTS8CSegyOut", !13, i64 0, !22, i64 1546}
!13 = !{!"_ZTS7CSegyIO", !10, i64 8, !10, i64 12, !10, i64 16, !14, i64 20, !10, i64 24, !7, i64 28, !7, i64 312, !6, i64 424, !6, i64 432, !15, i64 440, !16, i64 448, !25, i64 968, !27, i64 1480, !27, i64 1512, !22, i64 1544, !22, i64 1545}
!14 = !{!"float", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSSt14basic_ifstreamIcSt11char_traitsIcEE", !17, i64 0, !18, i64 16}
!17 = !{!"_ZTSSi", !15, i64 8}
!18 = !{!"_ZTSSt13basic_filebufIcSt11char_traitsIcEE", !19, i64 0, !7, i64 64, !21, i64 104, !23, i64 120, !24, i64 124, !24, i64 132, !24, i64 140, !6, i64 152, !15, i64 160, !22, i64 168, !22, i64 169, !22, i64 170, !7, i64 171, !6, i64 176, !6, i64 184, !22, i64 192, !6, i64 200, !6, i64 208, !15, i64 216, !6, i64 224, !6, i64 232}
!19 = !{!"_ZTSSt15basic_streambufIcSt11char_traitsIcEE", !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !20, i64 56}
!20 = !{!"_ZTSSt6locale", !6, i64 0}
!21 = !{!"_ZTSSt12__basic_fileIcE", !6, i64 0, !22, i64 8}
!22 = !{!"bool", !7, i64 0}
!23 = !{!"_ZTSSt13_Ios_Openmode", !7, i64 0}
!24 = !{!"_ZTS11__mbstate_t", !10, i64 0, !7, i64 4}
!25 = !{!"_ZTSSt14basic_ofstreamIcSt11char_traitsIcEE", !26, i64 0, !18, i64 8}
!26 = !{!"_ZTSSo"}
!27 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !28, i64 0, !15, i64 8, !7, i64 16}
!28 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!13, !10, i64 16}
!32 = !{!13, !10, i64 12}
!33 = !{!13, !10, i64 24}
!34 = !{!13, !6, i64 432}
!35 = !{!13, !6, i64 424}
!36 = distinct !{!36, !37}
!37 = !{!"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::__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.std::bad_alloc" = type { %"class.std::exception" }
%"class.std::exception" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@_ZTISt9bad_alloc = external constant ptr
@.str.5 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [36 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
declare dso_local noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546), i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress 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) #4

; 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 uwtable
define dso_local noundef zeroext i1 @_ZN8CSegyOut5writeERKPKiS3_RKPKfRS0_(ptr noundef nonnull align 8 dereferenceable(1547) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %2, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %3, ptr nocapture noundef nonnull readonly align 4 dereferenceable(4) %4) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca %"class.std::bad_alloc", align 8
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca %"class.std::allocator", align 1
  %13 = alloca %"class.std::bad_alloc", align 8
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %"class.std::allocator", align 1
  %16 = getelementptr inbounds i8, ptr %0, i64 1546
  %17 = load i8, ptr %16, align 2, !tbaa !5, !range !27, !noundef !28
  %18 = trunc nuw i8 %17 to i1
  br i1 %18, label %118, label %19

19:                                               ; preds = %5
  %20 = load i32, ptr %4, align 4, !tbaa !29
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %20, ptr %21, align 8, !tbaa !30
  %22 = load ptr, ptr %1, align 8, !tbaa !31
  %23 = getelementptr inbounds i8, ptr %22, i64 152
  %24 = load i32, ptr %23, align 4, !tbaa !29
  %25 = getelementptr inbounds i8, ptr %0, i64 12
  store i32 %24, ptr %25, align 4, !tbaa !32
  %26 = load ptr, ptr %2, align 8, !tbaa !31
  %27 = getelementptr inbounds i8, ptr %26, i64 36
  %28 = load i32, ptr %27, align 4, !tbaa !29
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %28, ptr %29, align 8, !tbaa !33
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull @.str.1, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %30 unwind label %33

30:                                               ; preds = %19
  %31 = invoke noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %0, i32 noundef %20, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %32 unwind label %35

32:                                               ; preds = %30
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #10
  br i1 %31, label %38, label %118

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

35:                                               ; preds = %30
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #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) %7) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #10
  br label %119

38:                                               ; preds = %32
  %39 = load i32, ptr %25, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef nonnull @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %40 unwind label %43

40:                                               ; preds = %38
  %41 = invoke noundef zeroext i1 @_ZN7CSegyIO16isEffectiveValueIiEEbT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %0, i32 noundef %39, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %42 unwind label %45

42:                                               ; preds = %40
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #10
  br i1 %41, label %48, label %118

43:                                               ; preds = %38
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %47

45:                                               ; preds = %40
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #10
  br label %47

47:                                               ; preds = %45, %43
  %.pn27 = phi { ptr, i32 } [ %46, %45 ], [ %44, %43 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #10
  br label %119

48:                                               ; preds = %42
  %49 = getelementptr inbounds i8, ptr %0, i64 312
  %50 = load ptr, ptr %2, align 8, !tbaa !31
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(108) %49, ptr noundef nonnull align 4 dereferenceable(108) %50, i64 108, i1 false)
  %51 = getelementptr inbounds i8, ptr %0, i64 432
  %52 = load ptr, ptr %51, align 8, !tbaa !34
  %.not = icmp eq ptr %52, null
  br i1 %.not, label %54, label %53

53:                                               ; preds = %48
  call void @_ZdaPv(ptr noundef nonnull %52) #11
  store ptr null, ptr %51, align 8, !tbaa !34
  br label %54

54:                                               ; preds = %53, %48
  %55 = load i32, ptr %21, align 8, !tbaa !30
  %56 = mul nsw i32 %55, 71
  %57 = sext i32 %56 to i64
  %58 = icmp slt i32 %55, 0
  %59 = shl nsw i64 %57, 2
  %60 = select i1 %58, i64 -1, i64 %59
  %61 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %60) #12
          to label %62 unwind label %66

62:                                               ; preds = %54
  store ptr %61, ptr %51, align 8, !tbaa !34
  %63 = load ptr, ptr %1, align 8, !tbaa !31
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %61, ptr align 4 %63, i64 %59, i1 false)
  %64 = getelementptr inbounds i8, ptr %0, i64 424
  %65 = load ptr, ptr %64, align 8, !tbaa !35
  %.not31 = icmp eq ptr %65, null
  br i1 %.not31, label %84, label %83

66:                                               ; preds = %54
  %67 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %68 = extractvalue { ptr, i32 } %67, 1
  %69 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9bad_alloc) #10
  %70 = icmp eq i32 %68, %69
  br i1 %70, label %71, label %119

71:                                               ; preds = %66
  %72 = extractvalue { ptr, i32 } %67, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #10
  %73 = call ptr @__cxa_get_exception_ptr(ptr %72) #10
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %73) #10
  %74 = call ptr @__cxa_begin_catch(ptr %72) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %12)
          to label %75 unwind label %77

75:                                               ; preds = %71
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %0, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %76 unwind label %79

76:                                               ; preds = %75
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #10
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #10
  br label %118

77:                                               ; preds = %71
  %78 = landingpad { ptr, i32 }
          cleanup
  br label %81

79:                                               ; preds = %75
  %80 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #10
  br label %81

81:                                               ; preds = %79, %77
  %.pn29 = phi { ptr, i32 } [ %80, %79 ], [ %78, %77 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %12) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #10
  invoke void @__cxa_end_catch()
          to label %82 unwind label %120

82:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #10
  br label %119

83:                                               ; preds = %62
  call void @_ZdaPv(ptr noundef nonnull %65) #11
  store ptr null, ptr %64, align 8, !tbaa !35
  %.pre = load i32, ptr %21, align 8, !tbaa !30
  br label %84

84:                                               ; preds = %83, %62
  %85 = phi i32 [ %.pre, %83 ], [ %55, %62 ]
  %86 = load i32, ptr %25, align 4, !tbaa !32
  %87 = mul nsw i32 %86, %85
  %88 = sext i32 %87 to i64
  %89 = icmp slt i32 %87, 0
  %90 = shl nsw i64 %88, 2
  %91 = select i1 %89, i64 -1, i64 %90
  %92 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %91) #12
          to label %93 unwind label %97

93:                                               ; preds = %84
  store ptr %92, ptr %64, align 8, !tbaa !35
  %94 = load ptr, ptr %3, align 8, !tbaa !31
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %92, ptr align 4 %94, i64 %90, i1 false)
  call void @_ZN8CSegyOut19writeSEGYFileHeaderEv(ptr noundef nonnull align 8 dereferenceable(1547) %0)
  %95 = load i32, ptr %21, align 8, !tbaa !30
  %96 = icmp sgt i32 %95, 0
  br i1 %96, label %.lr.ph, label %._crit_edge

97:                                               ; preds = %84
  %98 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9bad_alloc
  %99 = extractvalue { ptr, i32 } %98, 1
  %100 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9bad_alloc) #10
  %101 = icmp eq i32 %99, %100
  br i1 %101, label %102, label %119

102:                                              ; preds = %97
  %103 = extractvalue { ptr, i32 } %98, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #10
  %104 = call ptr @__cxa_get_exception_ptr(ptr %103) #10
  call void @_ZNSt9bad_allocC2ERKS_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %104) #10
  %105 = call ptr @__cxa_begin_catch(ptr %103) #10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %14) #10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %15) #10
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #10
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull @.str.6, ptr noundef nonnull align 1 dereferenceable(1) %15)
          to label %106 unwind label %108

106:                                              ; preds = %102
  invoke void @_ZN7CSegyIO15setErrorMessageERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(1546) %0, ptr noundef nonnull align 8 dereferenceable(32) %14)
          to label %107 unwind label %110

107:                                              ; preds = %106
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #10
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #10
  br label %118

108:                                              ; preds = %102
  %109 = landingpad { ptr, i32 }
          cleanup
  br label %112

110:                                              ; preds = %106
  %111 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #10
  br label %112

112:                                              ; preds = %110, %108
  %.pn32 = phi { ptr, i32 } [ %111, %110 ], [ %109, %108 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %15) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %15) #10
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %14) #10
  call void @_ZNSt9bad_allocD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #10
  invoke void @__cxa_end_catch()
          to label %113 unwind label %120

113:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #10
  br label %119

.lr.ph:                                           ; preds = %93, %.lr.ph
  %.02034 = phi i32 [ %115, %.lr.ph ], [ 0, %93 ]
  call void @_ZN8CSegyOut20writeSEGYTraceHeaderEv(ptr noundef nonnull align 8 dereferenceable(1547) %0)
  %114 = call noundef zeroext i1 @_ZN8CSegyOut14writeSEGYTraceEv(ptr noundef nonnull align 8 dereferenceable(1547) %0)
  %115 = add nuw nsw i32 %.02034, 1
  %116 = load i32, ptr %21, align 8, !tbaa !30
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %.lr.ph, label %._crit_edge, !llvm.loop !36

._crit_edge:                                      ; preds = %.lr.ph, %93
  store i8 1, ptr %16, align 2, !tbaa !5
  br label %118

118:                                              ; preds = %42, %32, %5, %._crit_edge, %107, %76
  %.021 = phi i1 [ true, %._crit_edge ], [ false, %107 ], [ false, %76 ], [ true, %5 ], [ false, %32 ], [ false, %42 ]
  ret i1 %.021

119:                                              ; preds = %113, %97, %82, %66, %47, %37
  %.merged = phi { ptr, i32 } [ %.pn32, %113 ], [ %98, %97 ], [ %.pn29, %82 ], [ %67, %66 ], [ %.pn27, %47 ], [ %.pn, %37 ]
  resume { ptr, i32 } %.merged

120:                                              ; preds = %112, %81
  %121 = landingpad { ptr, i32 }
          catch ptr null
  %122 = extractvalue { ptr, i32 } %121, 0
  call void @__clang_call_terminate(ptr %122) #13
  unreachable
}

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass