; ModuleID = 'bill.C'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"

%struct..0__pthread_mutex_s = type { i32, i32, i32, i32, i32, i32, %struct.__pthread_list_t }
%"struct.__gnu_cxx::new_allocator<char>" = type <{ i8 }>
%struct.__pthread_list_t = type { %struct.__pthread_list_t*, %struct.__pthread_list_t* }
%struct.__si_class_type_info_pseudo = type { %struct.__type_info_pseudo, %"struct.std::type_info"* }
%struct.__type_info_pseudo = type { i8*, i8* }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Alloc_hider" = type { i8* }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i64, i64, i32 }
%"struct.std::exception" = type { i32 (...)** }
%"struct.std::runtime_error" = type { %"struct.std::exception", %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" }
%"struct.std::type_info" = type opaque
%union.pthread_attr_t = type { i64, [12 x i32] }
%union.pthread_mutex_t = type { %struct..0__pthread_mutex_s }
%union.pthread_mutexattr_t = type { i32 }

@_ZNSs4_Rep20_S_empty_rep_storageE = external global [4 x i64] ; <[4 x i64]*> [#uses=2]
@_ZNSs4_Rep11_S_terminalE = external constant i8  ; <i8*> [#uses=1]
@.str = private constant [24 x i8] c"basic_string::_S_create\00", align 1 ; <[24 x i8]*> [#uses=1]
@.str1 = private constant [42 x i8] c"basic_string::_S_construct NULL not valid\00", align 8 ; <[42 x i8]*> [#uses=1]
@.str2 = private constant [7 x i8] c"string\00", align 1 ; <[7 x i8]*> [#uses=2]
@_ZTISt13runtime_error = external constant %struct.__si_class_type_info_pseudo ; <%struct.__si_class_type_info_pseudo*> [#uses=1]

@_ZL20__gthrw_pthread_oncePiPFvvE = alias weak i32 (i32*, void ()*)* @pthread_once ; <i32 (i32*, void ()*)*> [#uses=0]
@_ZL27__gthrw_pthread_getspecificj = alias weak i8* (i32)* @pthread_getspecific ; <i8* (i32)*> [#uses=0]
@_ZL27__gthrw_pthread_setspecificjPKv = alias weak i32 (i32, i8*)* @pthread_setspecific ; <i32 (i32, i8*)*> [#uses=0]
@_ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = alias weak i32 (i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; <i32 (i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*)*> [#uses=0]
@_ZL22__gthrw_pthread_cancelm = alias weak i32 (i64)* @pthread_cancel ; <i32 (i64)*> [#uses=1]
@_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = alias weak i32 (%union.pthread_mutex_t*)* @pthread_mutex_lock ; <i32 (%union.pthread_mutex_t*)*> [#uses=0]
@_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = alias weak i32 (%union.pthread_mutex_t*)* @pthread_mutex_trylock ; <i32 (%union.pthread_mutex_t*)*> [#uses=0]
@_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = alias weak i32 (%union.pthread_mutex_t*)* @pthread_mutex_unlock ; <i32 (%union.pthread_mutex_t*)*> [#uses=0]
@_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = alias weak i32 (%union.pthread_mutex_t*, %union.pthread_mutexattr_t*)* @pthread_mutex_init ; <i32 (%union.pthread_mutex_t*, %union.pthread_mutexattr_t*)*> [#uses=0]
@_ZL26__gthrw_pthread_key_createPjPFvPvE = alias weak i32 (i32*, void (i8*)*)* @pthread_key_create ; <i32 (i32*, void (i8*)*)*> [#uses=0]
@_ZL26__gthrw_pthread_key_deletej = alias weak i32 (i32)* @pthread_key_delete ; <i32 (i32)*> [#uses=0]
@_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = alias weak i32 (%union.pthread_mutexattr_t*)* @pthread_mutexattr_init ; <i32 (%union.pthread_mutexattr_t*)*> [#uses=0]
@_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%union.pthread_mutexattr_t*, i32)* @pthread_mutexattr_settype ; <i32 (%union.pthread_mutexattr_t*, i32)*> [#uses=0]
@_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%union.pthread_mutexattr_t*)* @pthread_mutexattr_destroy ; <i32 (%union.pthread_mutexattr_t*)*> [#uses=0]

define void @_Z11dummysymbolv() noreturn {
bb2.i:
  %0 = alloca %"struct.__gnu_cxx::new_allocator<char>", align 8 ; <%"struct.__gnu_cxx::new_allocator<char>"*> [#uses=2]
  %1 = alloca %"struct.__gnu_cxx::new_allocator<char>", align 8 ; <%"struct.__gnu_cxx::new_allocator<char>"*> [#uses=1]
  %2 = alloca %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >", align 8 ; <%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"*> [#uses=2]
  %3 = getelementptr inbounds %"struct.__gnu_cxx::new_allocator<char>"* %0, i64 0, i32 0 ; <i8*> [#uses=1]
  store i8 0, i8* %3, align 8
  %4 = invoke i8* @_ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag(i8* getelementptr inbounds ([7 x i8]* @.str2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8]* @.str2, i64 0, i64 6), %"struct.__gnu_cxx::new_allocator<char>"* %1, %"struct.__gnu_cxx::new_allocator<char>"* byval %0)
          to label %invcont unwind label %lpad    ; <i8*> [#uses=1]

invcont:                                          ; preds = %bb2.i
  %5 = getelementptr inbounds %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* %2, i64 0, i32 0, i32 0 ; <i8**> [#uses=3]
  store i8* %4, i8** %5, align 8
  %6 = call i8* @__cxa_allocate_exception(i64 16) nounwind ; <i8*> [#uses=3]
  %7 = bitcast i8* %6 to %"struct.std::runtime_error"* ; <%"struct.std::runtime_error"*> [#uses=1]
  invoke void @_ZNSt13runtime_errorC1ERKSs(%"struct.std::runtime_error"* %7, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* %2)
          to label %bb8 unwind label %lpad17

bb8:                                              ; preds = %invcont
  %8 = load i8** %5, align 8                      ; <i8*> [#uses=2]
  %9 = getelementptr inbounds i8* %8, i64 -24     ; <i8*> [#uses=2]
  %10 = icmp eq i8* %9, bitcast ([4 x i64]* @_ZNSs4_Rep20_S_empty_rep_storageE to i8*) ; <i1> [#uses=1]
  br i1 %10, label %bb14, label %bb.i.i34

bb.i.i34:                                         ; preds = %bb8
  %11 = getelementptr inbounds i8* %8, i64 -8     ; <i8*> [#uses=1]
  %12 = bitcast i8* %11 to i32*                   ; <i32*> [#uses=3]
  br i1 icmp eq (i32 (i64)* @_ZL22__gthrw_pthread_cancelm, i32 (i64)* null), label %bb1.i.i.i36, label %bb.i.i.i35

bb.i.i.i35:                                       ; preds = %bb.i.i34
  call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) nounwind
  %13 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %12, i32 -1) nounwind ; <i32> [#uses=1]
  br label %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i37

bb1.i.i.i36:                                      ; preds = %bb.i.i34
  %14 = load i32* %12, align 4                    ; <i32> [#uses=2]
  %15 = add nsw i32 %14, -1                       ; <i32> [#uses=1]
  store i32 %15, i32* %12, align 4
  br label %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i37

_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i37: ; preds = %bb1.i.i.i36, %bb.i.i.i35
  %16 = phi i32 [ %13, %bb.i.i.i35 ], [ %14, %bb1.i.i.i36 ] ; <i32> [#uses=1]
  %17 = icmp slt i32 %16, 1                       ; <i1> [#uses=1]
  br i1 %17, label %bb2.i.i38, label %bb14

bb2.i.i38:                                        ; preds = %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i37
  call void @_ZdlPv(i8* %9) nounwind
  br label %bb14

bb14:                                             ; preds = %bb2.i.i38, %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i37, %bb8
  call void @__cxa_throw(i8* %6, i8* bitcast (%struct.__si_class_type_info_pseudo* @_ZTISt13runtime_error to i8*), void (i8*)* bitcast (void (%"struct.std::runtime_error"*)* @_ZNSt13runtime_errorD1Ev to void (i8*)*)) noreturn
  unreachable

lpad:                                             ; preds = %bb2.i
  %eh_ptr = call i8* @llvm.eh.exception()         ; <i8*> [#uses=2]
  %eh_select16 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
  br label %ppad

lpad17:                                           ; preds = %invcont
  %eh_ptr18 = call i8* @llvm.eh.exception()       ; <i8*> [#uses=4]
  %eh_select20 = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr18, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
  call void @__cxa_free_exception(i8* %6) nounwind
  %18 = load i8** %5, align 8                     ; <i8*> [#uses=2]
  %19 = getelementptr inbounds i8* %18, i64 -24   ; <i8*> [#uses=2]
  %20 = icmp eq i8* %19, bitcast ([4 x i64]* @_ZNSs4_Rep20_S_empty_rep_storageE to i8*) ; <i1> [#uses=1]
  br i1 %20, label %ppad, label %bb.i.i

bb.i.i:                                           ; preds = %lpad17
  %21 = getelementptr inbounds i8* %18, i64 -8    ; <i8*> [#uses=1]
  %22 = bitcast i8* %21 to i32*                   ; <i32*> [#uses=3]
  br i1 icmp eq (i32 (i64)* @_ZL22__gthrw_pthread_cancelm, i32 (i64)* null), label %bb1.i.i.i, label %bb.i.i.i

bb.i.i.i:                                         ; preds = %bb.i.i
  call void @llvm.memory.barrier(i1 true, i1 true, i1 true, i1 true, i1 true) nounwind
  %23 = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %22, i32 -1) nounwind ; <i32> [#uses=1]
  br label %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i

bb1.i.i.i:                                        ; preds = %bb.i.i
  %24 = load i32* %22, align 4                    ; <i32> [#uses=2]
  %25 = add nsw i32 %24, -1                       ; <i32> [#uses=1]
  store i32 %25, i32* %22, align 4
  br label %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i

_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i: ; preds = %bb1.i.i.i, %bb.i.i.i
  %26 = phi i32 [ %23, %bb.i.i.i ], [ %24, %bb1.i.i.i ] ; <i32> [#uses=1]
  %27 = icmp slt i32 %26, 1                       ; <i1> [#uses=1]
  br i1 %27, label %bb2.i.i, label %ppad

bb2.i.i:                                          ; preds = %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i
  call void @_ZdlPv(i8* %19) nounwind
  br label %ppad

ppad:                                             ; preds = %bb2.i.i, %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i, %lpad17, %lpad
  %eh_exception.0 = phi i8* [ %eh_ptr, %lpad ], [ %eh_ptr18, %lpad17 ], [ %eh_ptr18, %_ZN9__gnu_cxxL27__exchange_and_add_dispatchEPii.exit.i.i ], [ %eh_ptr18, %bb2.i.i ] ; <i8*> [#uses=1]
  call void @_Unwind_Resume_or_Rethrow(i8* %eh_exception.0)
  unreachable
}

declare i8* @_Znwm(i64)

declare void @_ZSt20__throw_length_errorPKc(i8*) noreturn

declare i8* @llvm.eh.exception() nounwind readonly

declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind

declare i32 @__gxx_personality_v0(...)

declare void @_Unwind_Resume_or_Rethrow(i8*)

declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind

declare void @_ZdlPv(i8*) nounwind

define linkonce_odr i8* @_ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag(i8* %__beg, i8* %__end, %"struct.__gnu_cxx::new_allocator<char>"* nocapture %__a, %"struct.__gnu_cxx::new_allocator<char>"* nocapture byval %unnamed_arg) align 2 {
entry:
  %0 = icmp eq i8* %__beg, %__end                 ; <i1> [#uses=1]
  br i1 %0, label %bb11, label %bb12

bb11:                                             ; preds = %entry
  ret i8* bitcast (%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep"* getelementptr (%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep"* bitcast ([4 x i64]* @_ZNSs4_Rep20_S_empty_rep_storageE to %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep"*), i64 1) to i8*)

bb12:                                             ; preds = %entry
  %notlhs = icmp ne i8* %__beg, %__end            ; <i1> [#uses=1]
  %notrhs = icmp eq i8* %__beg, null              ; <i1> [#uses=1]
  %not.or.cond = and i1 %notlhs, %notrhs          ; <i1> [#uses=1]
  br i1 %not.or.cond, label %bb22, label %bb23

bb22:                                             ; preds = %bb12
  tail call void @_ZSt19__throw_logic_errorPKc(i8* getelementptr inbounds ([42 x i8]* @.str1, i64 0, i64 0)) noreturn
  unreachable

bb23:                                             ; preds = %bb12
  %1 = ptrtoint i8* %__end to i64                 ; <i64> [#uses=1]
  %2 = ptrtoint i8* %__beg to i64                 ; <i64> [#uses=1]
  %3 = sub i64 %1, %2                             ; <i64> [#uses=8]
  %4 = icmp ugt i64 %3, 4611686018427387897       ; <i1> [#uses=1]
  br i1 %4, label %bb.i, label %bb1.i

bb.i:                                             ; preds = %bb23
  tail call void @_ZSt20__throw_length_errorPKc(i8* getelementptr inbounds ([24 x i8]* @.str, i64 0, i64 0)) noreturn
  unreachable

bb1.i:                                            ; preds = %bb23
  %5 = add i64 %3, 57                             ; <i64> [#uses=2]
  %6 = icmp ugt i64 %5, 4096                      ; <i1> [#uses=1]
  %7 = icmp ne i8* %__end, %__beg                 ; <i1> [#uses=1]
  %8 = and i1 %6, %7                              ; <i1> [#uses=1]
  br i1 %8, label %bb7.i, label %bb10.i

bb7.i:                                            ; preds = %bb1.i
  %9 = and i64 %5, 4095                           ; <i64> [#uses=1]
  %10 = sub i64 4096, %9                          ; <i64> [#uses=1]
  %11 = add i64 %10, %3                           ; <i64> [#uses=2]
  %12 = icmp ugt i64 %11, 4611686018427387897     ; <i1> [#uses=1]
  %__capacity_addr.2.i = select i1 %12, i64 4611686018427387897, i64 %11 ; <i64> [#uses=1]
  br label %bb10.i

bb10.i:                                           ; preds = %bb7.i, %bb1.i
  %__size.0.in.i = phi i64 [ %__capacity_addr.2.i, %bb7.i ], [ %3, %bb1.i ] ; <i64> [#uses=2]
  %__size.0.i = add i64 %__size.0.in.i, 25        ; <i64> [#uses=1]
  %13 = invoke i8* @_Znwm(i64 %__size.0.i)
          to label %_ZNSs4_Rep9_S_createEmmRKSaIcE.exit unwind label %lpad.i ; <i8*> [#uses=5]

lpad.i:                                           ; preds = %bb10.i
  %eh_ptr.i = tail call i8* @llvm.eh.exception()  ; <i8*> [#uses=2]
  %eh_select14.i = tail call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr.i, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) ; <i32> [#uses=0]
  tail call void @_Unwind_Resume_or_Rethrow(i8* %eh_ptr.i)
  unreachable

_ZNSs4_Rep9_S_createEmmRKSaIcE.exit:              ; preds = %bb10.i
  %14 = getelementptr inbounds i8* %13, i64 8     ; <i8*> [#uses=1]
  %15 = bitcast i8* %14 to i64*                   ; <i64*> [#uses=1]
  store i64 %__size.0.in.i, i64* %15, align 8
  %16 = getelementptr inbounds i8* %13, i64 16    ; <i8*> [#uses=1]
  %17 = bitcast i8* %16 to i32*                   ; <i32*> [#uses=2]
  store i32 0, i32* %17, align 8
  %18 = getelementptr inbounds i8* %13, i64 24    ; <i8*> [#uses=3]
  %19 = icmp eq i64 %3, 1                         ; <i1> [#uses=1]
  br i1 %19, label %bb.i.i, label %bb1.i.i

bb.i.i:                                           ; preds = %_ZNSs4_Rep9_S_createEmmRKSaIcE.exit
  %20 = load i8* %__beg, align 1                  ; <i8> [#uses=1]
  store i8 %20, i8* %18, align 1
  br label %bb30

bb1.i.i:                                          ; preds = %_ZNSs4_Rep9_S_createEmmRKSaIcE.exit
  tail call void @llvm.memcpy.i64(i8* %18, i8* %__beg, i64 %3, i32 1) nounwind
  br label %bb30

bb30:                                             ; preds = %bb1.i.i, %bb.i.i
  store i32 0, i32* %17, align 8
  %21 = bitcast i8* %13 to i64*                   ; <i64*> [#uses=1]
  store i64 %3, i64* %21, align 8
  %.sum = add i64 %3, 24                          ; <i64> [#uses=1]
  %22 = getelementptr inbounds i8* %13, i64 %.sum ; <i8*> [#uses=1]
  %23 = load i8* @_ZNSs4_Rep11_S_terminalE, align 1 ; <i8> [#uses=1]
  store i8 %23, i8* %22, align 1
  ret i8* %18
}

declare void @_ZSt19__throw_logic_errorPKc(i8*) noreturn

declare void @llvm.memory.barrier(i1, i1, i1, i1, i1) nounwind

declare i32 @llvm.atomic.load.add.i32.p0i32(i32* nocapture, i32) nounwind

declare i8* @__cxa_allocate_exception(i64) nounwind

declare void @_ZNSt13runtime_errorC1ERKSs(%"struct.std::runtime_error"*, %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"*)

declare void @__cxa_free_exception(i8*) nounwind

declare void @__cxa_throw(i8*, i8*, void (i8*)*) noreturn

declare void @_ZNSt13runtime_errorD1Ev(%"struct.std::runtime_error"*) nounwind

declare extern_weak i32 @pthread_once(i32*, void ()*)

declare extern_weak i8* @pthread_getspecific(i32)

declare extern_weak i32 @pthread_setspecific(i32, i8*)

declare extern_weak i32 @pthread_create(i64*, %union.pthread_attr_t*, i8* (i8*)*, i8*)

declare extern_weak i32 @pthread_cancel(i64)

declare extern_weak i32 @pthread_mutex_lock(%union.pthread_mutex_t*)

declare extern_weak i32 @pthread_mutex_trylock(%union.pthread_mutex_t*)

declare extern_weak i32 @pthread_mutex_unlock(%union.pthread_mutex_t*)

declare extern_weak i32 @pthread_mutex_init(%union.pthread_mutex_t*, %union.pthread_mutexattr_t*)

declare extern_weak i32 @pthread_key_create(i32*, void (i8*)*)

declare extern_weak i32 @pthread_key_delete(i32)

declare extern_weak i32 @pthread_mutexattr_init(%union.pthread_mutexattr_t*)

declare extern_weak i32 @pthread_mutexattr_settype(%union.pthread_mutexattr_t*, i32)

declare extern_weak i32 @pthread_mutexattr_destroy(%union.pthread_mutexattr_t*)
