1 ; RUN: llvm-as < %s | llc -o - | %llvmgcc -xassembler -c -o /dev/null -
3 %struct..0._11 = type { i32 }
4 %struct..1__pthread_mutex_s = type { i32, i32, i32, i32, i32, %struct..0._11 }
5 %struct.pthread_attr_t = type { i32, [32 x i8] }
6 %struct.pthread_mutex_t = type { %struct..1__pthread_mutex_s }
7 %"struct.std::__ctype_abstract_base<wchar_t>" = type { %"struct.std::locale::facet" }
8 %"struct.std::basic_ios<char,std::char_traits<char> >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream<char,std::char_traits<char> >"*, i8, i8, %"struct.std::basic_streambuf<char,std::char_traits<char> >"*, %"struct.std::ctype<char>"*, %"struct.std::__ctype_abstract_base<wchar_t>"*, %"struct.std::__ctype_abstract_base<wchar_t>"* }
9 %"struct.std::basic_istream<char,std::char_traits<char> >" = type { i32 (...)**, i32, %"struct.std::basic_ios<char,std::char_traits<char> >" }
10 %"struct.std::basic_istream<char,std::char_traits<char> >::sentry" = type { i8 }
11 %"struct.std::basic_ostream<char,std::char_traits<char> >" = type { i32 (...)**, %"struct.std::basic_ios<char,std::char_traits<char> >" }
12 %"struct.std::basic_streambuf<char,std::char_traits<char> >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" }
13 %"struct.std::ctype<char>" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i16*, i8, [256 x i8], [256 x i8], i8 }
14 %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, %"struct.std::ios_base::_Words"*, %"struct.std::locale" }
15 %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 }
16 %"struct.std::ios_base::_Words" = type { i8*, i32 }
17 %"struct.std::locale" = type { %"struct.std::locale::_Impl"* }
18 %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** }
19 %"struct.std::locale::facet" = type { i32 (...)**, i32 }
21 @_ZL20__gthrw_pthread_oncePiPFvvE = alias weak i32 (i32*, void ()*)* @pthread_once ; <i32 (i32*, void ()*)*> [#uses=0]
22 @_ZL27__gthrw_pthread_getspecificj = alias weak i8* (i32)* @pthread_getspecific ; <i8* (i32)*> [#uses=0]
23 @_ZL27__gthrw_pthread_setspecificjPKv = alias weak i32 (i32, i8*)* @pthread_setspecific ; <i32 (i32, i8*)*> [#uses=0]
24 @_ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = alias weak i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; <i32 (i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)*> [#uses=0]
25 @_ZL22__gthrw_pthread_cancelm = alias weak i32 (i32)* @pthread_cancel ; <i32 (i32)*> [#uses=0]
26 @_ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
27 @_ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
28 @_ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
29 @_ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = alias weak i32 (%struct.pthread_mutex_t*, %struct..0._11*)* @pthread_mutex_init ; <i32 (%struct.pthread_mutex_t*, %struct..0._11*)*> [#uses=0]
30 @_ZL26__gthrw_pthread_key_createPjPFvPvE = alias weak i32 (i32*, void (i8*)*)* @pthread_key_create ; <i32 (i32*, void (i8*)*)*> [#uses=0]
31 @_ZL26__gthrw_pthread_key_deletej = alias weak i32 (i32)* @pthread_key_delete ; <i32 (i32)*> [#uses=0]
32 @_ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = alias weak i32 (%struct..0._11*)* @pthread_mutexattr_init ; <i32 (%struct..0._11*)*> [#uses=0]
33 @_ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%struct..0._11*, i32)* @pthread_mutexattr_settype ; <i32 (%struct..0._11*, i32)*> [#uses=0]
34 @_ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%struct..0._11*)* @pthread_mutexattr_destroy ; <i32 (%struct..0._11*)*> [#uses=0]
36 define %"struct.std::basic_istream<char,std::char_traits<char> >"* @_ZNSi7getlineEPcic(%"struct.std::basic_istream<char,std::char_traits<char> >"* %this, i8* %__s, i32 %__n, i8 signext %__delim) {
38 %__cerb = alloca %"struct.std::basic_istream<char,std::char_traits<char> >::sentry" ; <%"struct.std::basic_istream<char,std::char_traits<char> >::sentry"*> [#uses=2]
39 getelementptr %"struct.std::basic_istream<char,std::char_traits<char> >"* %this, i32 0, i32 1 ; <i32*>:0 [#uses=7]
40 store i32 0, i32* %0, align 4
41 call void @_ZNSi6sentryC1ERSib( %"struct.std::basic_istream<char,std::char_traits<char> >::sentry"* %__cerb, %"struct.std::basic_istream<char,std::char_traits<char> >"* %this, i8 zeroext 1 )
42 getelementptr %"struct.std::basic_istream<char,std::char_traits<char> >::sentry"* %__cerb, i32 0, i32 0 ; <i8*>:1 [#uses=1]
43 load i8* %1, align 8 ; <i8>:2 [#uses=1]
44 %toBool = icmp eq i8 %2, 0 ; <i1> [#uses=1]
45 br i1 %toBool, label %bb162, label %bb
48 zext i8 %__delim to i32 ; <i32>:3 [#uses=1]
49 getelementptr %"struct.std::basic_istream<char,std::char_traits<char> >"* %this, i32 0, i32 0 ; <i32 (...)***>:4 [#uses=1]
50 load i32 (...)*** %4, align 4 ; <i32 (...)**>:5 [#uses=1]
51 getelementptr i32 (...)** %5, i32 -3 ; <i32 (...)**>:6 [#uses=1]
52 bitcast i32 (...)** %6 to i32* ; <i32*>:7 [#uses=1]
53 load i32* %7, align 4 ; <i32>:8 [#uses=1]
54 bitcast %"struct.std::basic_istream<char,std::char_traits<char> >"* %this to i8* ; <i8*>:9 [#uses=1]
55 %ctg2186 = getelementptr i8* %9, i32 %8 ; <i8*> [#uses=1]
56 bitcast i8* %ctg2186 to %"struct.std::basic_ios<char,std::char_traits<char> >"* ; <%"struct.std::basic_ios<char,std::char_traits<char> >"*>:10 [#uses=1]
57 getelementptr %"struct.std::basic_ios<char,std::char_traits<char> >"* %10, i32 0, i32 4 ; <%"struct.std::basic_streambuf<char,std::char_traits<char> >"**>:11 [#uses=1]
58 load %"struct.std::basic_streambuf<char,std::char_traits<char> >"** %11, align 4 ; <%"struct.std::basic_streambuf<char,std::char_traits<char> >"*>:12 [#uses=9]
59 getelementptr %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12, i32 0, i32 2 ; <i8**>:13 [#uses=10]
60 load i8** %13, align 4 ; <i8*>:14 [#uses=2]
61 getelementptr %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12, i32 0, i32 3 ; <i8**>:15 [#uses=6]
62 load i8** %15, align 4 ; <i8*>:16 [#uses=1]
63 icmp ult i8* %14, %16 ; <i1>:17 [#uses=1]
64 br i1 %17, label %bb81, label %bb82
67 load i8* %14, align 1 ; <i8>:18 [#uses=1]
68 zext i8 %18 to i32 ; <i32>:19 [#uses=1]
69 %.pre = getelementptr %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
70 br label %bb119.preheader
73 getelementptr %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12, i32 0, i32 0 ; <i32 (...)***>:20 [#uses=2]
74 load i32 (...)*** %20, align 4 ; <i32 (...)**>:21 [#uses=1]
75 getelementptr i32 (...)** %21, i32 9 ; <i32 (...)**>:22 [#uses=1]
76 load i32 (...)** %22, align 4 ; <i32 (...)*>:23 [#uses=1]
77 bitcast i32 (...)* %23 to i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)* ; <i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)*>:24 [#uses=1]
78 invoke i32 %24( %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12 )
79 to label %bb119.preheader unwind label %lpad ; <i32>:25 [#uses=1]
81 bb119.preheader: ; preds = %bb82, %bb81
82 %.pre-phi = phi i32 (...)*** [ %.pre, %bb81 ], [ %20, %bb82 ] ; <i32 (...)***> [#uses=4]
83 %__c79.0.ph = phi i32 [ %19, %bb81 ], [ %25, %bb82 ] ; <i32> [#uses=1]
84 sext i8 %__delim to i32 ; <i32>:26 [#uses=1]
87 bb84: ; preds = %bb119
88 sub i32 %__n, %82 ; <i32>:27 [#uses=1]
89 add i32 %27, -1 ; <i32>:28 [#uses=2]
90 load i8** %15, align 4 ; <i8*>:29 [#uses=1]
91 ptrtoint i8* %29 to i32 ; <i32>:30 [#uses=1]
92 load i8** %13, align 4 ; <i8*>:31 [#uses=3]
93 ptrtoint i8* %31 to i32 ; <i32>:32 [#uses=2]
94 sub i32 %30, %32 ; <i32>:33 [#uses=2]
95 icmp slt i32 %28, %33 ; <i1>:34 [#uses=1]
96 select i1 %34, i32 %28, i32 %33 ; <i32>:35 [#uses=3]
97 icmp sgt i32 %35, 1 ; <i1>:36 [#uses=1]
98 br i1 %36, label %bb90, label %bb99
100 bb90: ; preds = %bb84
101 call i8* @memchr( i8* %31, i32 %26, i32 %35 ) nounwind readonly ; <i8*>:37 [#uses=2]
102 icmp eq i8* %37, null ; <i1>:38 [#uses=1]
103 br i1 %38, label %bb93, label %bb92
105 bb92: ; preds = %bb90
106 ptrtoint i8* %37 to i32 ; <i32>:39 [#uses=1]
107 sub i32 %39, %32 ; <i32>:40 [#uses=1]
110 bb93: ; preds = %bb92, %bb90
111 %__size.0 = phi i32 [ %40, %bb92 ], [ %35, %bb90 ] ; <i32> [#uses=4]
112 call void @llvm.memcpy.i32( i8* %__s_addr.0, i8* %31, i32 %__size.0, i32 1 )
113 getelementptr i8* %__s_addr.0, i32 %__size.0 ; <i8*>:41 [#uses=3]
114 load i8** %13, align 4 ; <i8*>:42 [#uses=1]
115 getelementptr i8* %42, i32 %__size.0 ; <i8*>:43 [#uses=1]
116 store i8* %43, i8** %13, align 4
117 load i32* %0, align 4 ; <i32>:44 [#uses=1]
118 add i32 %44, %__size.0 ; <i32>:45 [#uses=1]
119 store i32 %45, i32* %0, align 4
120 load i8** %13, align 4 ; <i8*>:46 [#uses=2]
121 load i8** %15, align 4 ; <i8*>:47 [#uses=1]
122 icmp ult i8* %46, %47 ; <i1>:48 [#uses=1]
123 br i1 %48, label %bb95, label %bb96
125 bb95: ; preds = %bb93
126 load i8* %46, align 1 ; <i8>:49 [#uses=1]
127 zext i8 %49 to i32 ; <i32>:50 [#uses=1]
130 bb96: ; preds = %bb93
131 load i32 (...)*** %.pre-phi, align 4 ; <i32 (...)**>:51 [#uses=1]
132 getelementptr i32 (...)** %51, i32 9 ; <i32 (...)**>:52 [#uses=1]
133 load i32 (...)** %52, align 4 ; <i32 (...)*>:53 [#uses=1]
134 bitcast i32 (...)* %53 to i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)* ; <i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)*>:54 [#uses=1]
135 invoke i32 %54( %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12 )
136 to label %bb119 unwind label %lpad ; <i32>:55 [#uses=1]
138 bb99: ; preds = %bb84
139 trunc i32 %__c79.0 to i8 ; <i8>:56 [#uses=1]
140 store i8 %56, i8* %__s_addr.0, align 1
141 getelementptr i8* %__s_addr.0, i32 1 ; <i8*>:57 [#uses=5]
142 load i32* %0, align 4 ; <i32>:58 [#uses=1]
143 add i32 %58, 1 ; <i32>:59 [#uses=1]
144 store i32 %59, i32* %0, align 4
145 load i8** %13, align 4 ; <i8*>:60 [#uses=3]
146 load i8** %15, align 4 ; <i8*>:61 [#uses=1]
147 icmp ult i8* %60, %61 ; <i1>:62 [#uses=1]
148 br i1 %62, label %bb101, label %bb102
150 bb101: ; preds = %bb99
151 load i8* %60, align 1 ; <i8>:63 [#uses=1]
152 zext i8 %63 to i32 ; <i32>:64 [#uses=1]
153 getelementptr i8* %60, i32 1 ; <i8*>:65 [#uses=1]
154 store i8* %65, i8** %13, align 4
157 bb102: ; preds = %bb99
158 load i32 (...)*** %.pre-phi, align 4 ; <i32 (...)**>:66 [#uses=1]
159 getelementptr i32 (...)** %66, i32 10 ; <i32 (...)**>:67 [#uses=1]
160 load i32 (...)** %67, align 4 ; <i32 (...)*>:68 [#uses=1]
161 bitcast i32 (...)* %68 to i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)* ; <i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)*>:69 [#uses=1]
162 invoke i32 %69( %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12 )
163 to label %bb104 unwind label %lpad ; <i32>:70 [#uses=1]
165 bb104: ; preds = %bb102, %bb101
166 %__ret44.0 = phi i32 [ %64, %bb101 ], [ %70, %bb102 ] ; <i32> [#uses=1]
167 icmp eq i32 %__ret44.0, -1 ; <i1>:71 [#uses=1]
168 br i1 %71, label %bb119, label %bb112
170 bb112: ; preds = %bb104
171 load i8** %13, align 4 ; <i8*>:72 [#uses=2]
172 load i8** %15, align 4 ; <i8*>:73 [#uses=1]
173 icmp ult i8* %72, %73 ; <i1>:74 [#uses=1]
174 br i1 %74, label %bb114, label %bb115
176 bb114: ; preds = %bb112
177 load i8* %72, align 1 ; <i8>:75 [#uses=1]
178 zext i8 %75 to i32 ; <i32>:76 [#uses=1]
181 bb115: ; preds = %bb112
182 load i32 (...)*** %.pre-phi, align 4 ; <i32 (...)**>:77 [#uses=1]
183 getelementptr i32 (...)** %77, i32 9 ; <i32 (...)**>:78 [#uses=1]
184 load i32 (...)** %78, align 4 ; <i32 (...)*>:79 [#uses=1]
185 bitcast i32 (...)* %79 to i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)* ; <i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)*>:80 [#uses=1]
186 invoke i32 %80( %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12 )
187 to label %bb119 unwind label %lpad ; <i32>:81 [#uses=1]
189 bb119: ; preds = %bb115, %bb114, %bb104, %bb96, %bb95, %bb119.preheader
190 %__c79.0 = phi i32 [ %__c79.0.ph, %bb119.preheader ], [ %50, %bb95 ], [ %76, %bb114 ], [ %55, %bb96 ], [ -1, %bb104 ], [ %81, %bb115 ] ; <i32> [#uses=3]
191 %__s_addr.0 = phi i8* [ %__s, %bb119.preheader ], [ %41, %bb95 ], [ %57, %bb114 ], [ %41, %bb96 ], [ %57, %bb104 ], [ %57, %bb115 ] ; <i8*> [#uses=5]
192 load i32* %0, align 4 ; <i32>:82 [#uses=2]
193 add i32 %82, 1 ; <i32>:83 [#uses=2]
194 %.not = icmp sge i32 %83, %__n ; <i1> [#uses=1]
195 icmp eq i32 %__c79.0, -1 ; <i1>:84 [#uses=3]
196 icmp eq i32 %__c79.0, %3 ; <i1>:85 [#uses=2]
197 %or.cond = or i1 %84, %85 ; <i1> [#uses=1]
198 %or.cond188 = or i1 %or.cond, %.not ; <i1> [#uses=1]
199 br i1 %or.cond188, label %bb141, label %bb84
201 bb141: ; preds = %bb119
202 %.not194 = xor i1 %85, true ; <i1> [#uses=1]
203 %brmerge = or i1 %84, %.not194 ; <i1> [#uses=1]
204 %.mux = select i1 %84, i32 2, i32 4 ; <i32> [#uses=0]
205 br i1 %brmerge, label %bb162, label %bb146
207 bb146: ; preds = %bb141
208 store i32 %83, i32* %0, align 4
209 load i8** %13, align 4 ; <i8*>:86 [#uses=2]
210 load i8** %15, align 4 ; <i8*>:87 [#uses=1]
211 icmp ult i8* %86, %87 ; <i1>:88 [#uses=1]
212 br i1 %88, label %bb148, label %bb149
214 bb148: ; preds = %bb146
215 getelementptr i8* %86, i32 1 ; <i8*>:89 [#uses=1]
216 store i8* %89, i8** %13, align 4
217 ret %"struct.std::basic_istream<char,std::char_traits<char> >"* %this
219 bb149: ; preds = %bb146
220 load i32 (...)*** %.pre-phi, align 4 ; <i32 (...)**>:90 [#uses=1]
221 getelementptr i32 (...)** %90, i32 10 ; <i32 (...)**>:91 [#uses=1]
222 load i32 (...)** %91, align 4 ; <i32 (...)*>:92 [#uses=1]
223 bitcast i32 (...)* %92 to i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)* ; <i32 (%"struct.std::basic_streambuf<char,std::char_traits<char> >"*)*>:93 [#uses=1]
224 invoke i32 %93( %"struct.std::basic_streambuf<char,std::char_traits<char> >"* %12 )
225 to label %bb162 unwind label %lpad ; <i32>:94 [#uses=0]
227 bb162: ; preds = %bb149, %bb141, %entry
228 ret %"struct.std::basic_istream<char,std::char_traits<char> >"* %this
230 lpad: ; preds = %bb149, %bb115, %bb102, %bb96, %bb82
231 %__s_addr.1 = phi i8* [ %__s, %bb82 ], [ %__s_addr.0, %bb149 ], [ %41, %bb96 ], [ %57, %bb102 ], [ %57, %bb115 ] ; <i8*> [#uses=0]
232 call void @__cxa_rethrow( ) noreturn
236 declare i8* @__cxa_begin_catch(i8*) nounwind
238 declare i8* @llvm.eh.exception() nounwind
240 declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind
242 declare void @__cxa_rethrow() noreturn
244 declare void @__cxa_end_catch()
246 declare i32 @__gxx_personality_v0(...)
248 declare void @_ZNSi6sentryC1ERSib(%"struct.std::basic_istream<char,std::char_traits<char> >::sentry"*, %"struct.std::basic_istream<char,std::char_traits<char> >"*, i8 zeroext )
250 declare i8* @memchr(i8*, i32, i32) nounwind readonly
252 declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind
254 declare void @_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate(%"struct.std::basic_ios<char,std::char_traits<char> >"*, i32)
256 declare extern_weak i32 @pthread_once(i32*, void ()*)
258 declare extern_weak i8* @pthread_getspecific(i32)
260 declare extern_weak i32 @pthread_setspecific(i32, i8*)
262 declare extern_weak i32 @pthread_create(i32*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
264 declare extern_weak i32 @pthread_cancel(i32)
266 declare extern_weak i32 @pthread_mutex_lock(%struct.pthread_mutex_t*)
268 declare extern_weak i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*)
270 declare extern_weak i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*)
272 declare extern_weak i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct..0._11*)
274 declare extern_weak i32 @pthread_key_create(i32*, void (i8*)*)
276 declare extern_weak i32 @pthread_key_delete(i32)
278 declare extern_weak i32 @pthread_mutexattr_init(%struct..0._11*)
280 declare extern_weak i32 @pthread_mutexattr_settype(%struct..0._11*, i32)
282 declare extern_weak i32 @pthread_mutexattr_destroy(%struct..0._11*)