clarify the purpose of this project
[nyanglibc.git] / grp / initgroups.shared.s
blobf536f930d282d357a06e1a965d916bf683faae63
1 .text
2 #APP
3 memmove = __GI_memmove
4 memset = __GI_memset
5 memcpy = __GI_memcpy
6 .section .rodata.str1.1,"aMS",@progbits,1
7 .LC0:
8 .string "getgrent_r"
9 .LC1:
10 .string "setgrent"
11 .LC2:
12 .string "endgrent"
13 #NO_APP
14 .text
15 .p2align 4,,15
16 .type compat_call.constprop.1, @function
17 compat_call.constprop.1:
18 .LFB86:
19 pushq %r15
20 pushq %r14
21 movq %rdi, %r15
22 pushq %r13
23 pushq %r12
24 pushq %rbp
25 pushq %rbx
26 movq %rsi, %rbp
27 leaq .LC0(%rip), %rsi
28 subq $1144, %rsp
29 movq (%r9), %r13
30 movl %edx, 20(%rsp)
31 movq %rcx, 24(%rsp)
32 movq %r8, 32(%rsp)
33 movq %r9, 56(%rsp)
34 call __GI___nss_lookup_function
35 testq %rax, %rax
36 je .L22
37 leaq .LC1(%rip), %rsi
38 movq %r15, %rdi
39 movq %rax, %r12
40 call __GI___nss_lookup_function
41 testq %rax, %rax
42 movq %rax, %r14
43 je .L5
44 movq %rax, %rdi
45 call __GI__dl_mcount_wrapper_check
46 call *%r14
47 cmpl $1, %eax
48 movl %eax, %ebx
49 je .L5
50 .L1:
51 addq $1144, %rsp
52 movl %ebx, %eax
53 popq %rbx
54 popq %rbp
55 popq %r12
56 popq %r13
57 popq %r14
58 popq %r15
59 ret
60 .p2align 4,,10
61 .p2align 3
62 .L5:
63 leaq .LC2(%rip), %rsi
64 movq %r15, %rdi
65 call __GI___nss_lookup_function
66 movq %rax, 48(%rsp)
67 leaq 96(%rsp), %rax
68 movq __libc_errno@gottpoff(%rip), %r14
69 addq %fs:0, %r14
70 movq $1024, 104(%rsp)
71 movq %rax, 40(%rsp)
72 leaq 112(%rsp), %rax
73 movq %rax, 96(%rsp)
74 leaq 64(%rsp), %rax
75 movq %rax, 8(%rsp)
76 .p2align 4,,10
77 .p2align 3
78 .L4:
79 movq %r12, %rdi
80 call __GI__dl_mcount_wrapper_check
81 movq %r14, %rcx
82 movq 104(%rsp), %rdx
83 movq 96(%rsp), %rsi
84 movq 8(%rsp), %rdi
85 call *%r12
86 cmpl $-2, %eax
87 movl %eax, %ebx
88 je .L41
89 cmpl $1, %eax
90 jne .L9
91 movl 80(%rsp), %ebx
92 cmpl 20(%rsp), %ebx
93 je .L4
94 movq 88(%rsp), %r15
95 movq (%r15), %rdi
96 testq %rdi, %rdi
97 jne .L20
98 jmp .L4
99 .p2align 4,,10
100 .p2align 3
101 .L11:
102 addq $8, %r15
103 movq (%r15), %rdi
104 testq %rdi, %rdi
105 je .L4
106 .L20:
107 movq %rbp, %rsi
108 call __GI_strcmp
109 testl %eax, %eax
110 jne .L11
111 movq 24(%rsp), %rax
112 movq (%rax), %rdx
113 cmpq $0, %rdx
114 jle .L12
115 cmpl 0(%r13), %ebx
116 je .L4
117 xorl %eax, %eax
118 jmp .L13
119 .p2align 4,,10
120 .p2align 3
121 .L14:
122 cmpl 0(%r13,%rax,4), %ebx
123 je .L4
124 .L13:
125 addq $1, %rax
126 cmpq %rdx, %rax
127 jne .L14
128 .L15:
129 movq 32(%rsp), %rax
130 cmpq (%rax), %rdx
131 je .L42
132 .L16:
133 movq 24(%rsp), %rax
134 movl %ebx, 0(%r13,%rdx,4)
135 addq $1, %rdx
136 movq %rdx, (%rax)
137 jmp .L4
138 .p2align 4,,10
139 .p2align 3
140 .L41:
141 movq __libc_errno@gottpoff(%rip), %rax
142 cmpl $34, %fs:(%rax)
143 je .L8
144 .L9:
145 movl $1, %ebx
146 .L6:
147 movq 40(%rsp), %rax
148 movq 96(%rsp), %rdi
149 addq $16, %rax
150 cmpq %rax, %rdi
151 je .L21
152 call free@PLT
153 .L21:
154 movq 48(%rsp), %r14
155 testq %r14, %r14
156 je .L1
157 movq %r14, %rdi
158 call __GI__dl_mcount_wrapper_check
159 movq %r14, %rax
160 call *%rax
161 jmp .L1
162 .p2align 4,,10
163 .p2align 3
164 .L8:
165 movq 40(%rsp), %rdi
166 call __GI___libc_scratch_buffer_grow
167 testb %al, %al
168 jne .L4
169 jmp .L6
170 .L12:
171 jne .L4
172 jmp .L15
173 .p2align 4,,10
174 .p2align 3
175 .L42:
176 cmpq $0, 1200(%rsp)
177 jle .L17
178 cmpq 1200(%rsp), %rdx
179 je .L9
180 addq %rdx, %rdx
181 cmpq 1200(%rsp), %rdx
182 cmovg 1200(%rsp), %rdx
183 movq %rdx, %rbx
184 .L19:
185 leaq 0(,%rbx,4), %rsi
186 movq %r13, %rdi
187 call realloc@PLT
188 testq %rax, %rax
189 movq %rax, %r13
190 je .L9
191 movq 56(%rsp), %rax
192 movq %r13, (%rax)
193 movq 32(%rsp), %rax
194 movq %rbx, (%rax)
195 movq 24(%rsp), %rax
196 movl 80(%rsp), %ebx
197 movq (%rax), %rdx
198 jmp .L16
199 .L17:
200 leaq (%rdx,%rdx), %rbx
201 jmp .L19
202 .L22:
203 movl $-1, %ebx
204 jmp .L1
205 .LFE86:
206 .size compat_call.constprop.1, .-compat_call.constprop.1
207 .section .rodata.str1.1
208 .LC3:
209 .string "initgroups.c"
210 .LC4:
211 .string "*size > 0"
212 .LC5:
213 .string "files"
214 .LC6:
215 .string "initgroups_dyn"
216 .section .rodata.str1.8,"aMS",@progbits,1
217 .align 8
218 .LC7:
219 .string "Illegal status in internal_getgrouplist.\n"
220 .text
221 .p2align 4,,15
222 .type internal_getgrouplist, @function
223 internal_getgrouplist:
224 .LFB82:
225 pushq %r15
226 pushq %r14
227 pushq %r13
228 pushq %r12
229 pushq %rbp
230 pushq %rbx
231 subq $40, %rsp
232 cmpq $0, (%rdx)
233 movq %rdi, 8(%rsp)
234 jle .L94
235 movq (%rcx), %rax
236 leaq 24(%rsp), %r14
237 movl %esi, %ebx
238 movl $5, %edi
239 movq %rdx, %rbp
240 movq %rcx, %r12
241 movq %r8, %r13
242 movl %esi, (%rax)
243 movq %r14, %rsi
244 movq $1, 16(%rsp)
245 call __nss_database_get
246 testb %al, %al
247 je .L45
248 movq 24(%rsp), %rdi
249 testq %rdi, %rdi
250 je .L45
251 movb $1, use_initgroups_entry(%rip)
252 .L50:
253 cmpq $0, (%rdi)
254 leaq 16(%rsp), %r14
255 je .L48
256 .p2align 4,,10
257 .p2align 3
258 .L47:
259 leaq .LC6(%rip), %rsi
260 movq 16(%rsp), %r15
261 call __GI___nss_lookup_function
262 testq %rax, %rax
263 je .L95
264 movq %rax, %rdi
265 movq %rax, (%rsp)
266 call __GI__dl_mcount_wrapper_check
267 movq __libc_errno@gottpoff(%rip), %rdx
268 addq %fs:0, %rdx
269 subq $8, %rsp
270 movq %rbp, %rcx
271 movq %r13, %r9
272 movq %r12, %r8
273 movl %ebx, %esi
274 pushq %rdx
275 movq %r14, %rdx
276 movq 24(%rsp), %rdi
277 movq 16(%rsp), %rax
278 call *%rax
279 popq %rdx
280 popq %rcx
281 .L52:
282 movq 16(%rsp), %r8
283 movq %r15, %rdi
284 xorl %r11d, %r11d
285 .L53:
286 cmpq %r8, %rdi
287 jge .L57
288 .L96:
289 testq %r15, %r15
290 jle .L56
291 movq (%r12), %rcx
292 leaq (%rcx,%rdi,4), %r9
293 movl (%r9), %esi
294 cmpl (%rcx), %esi
295 je .L54
296 xorl %edx, %edx
297 jmp .L58
298 .p2align 4,,10
299 .p2align 3
300 .L55:
301 cmpl %esi, (%rcx,%rdx,4)
302 je .L54
303 .L58:
304 addq $1, %rdx
305 cmpq %rdx, %r15
306 jne .L55
307 .L56:
308 addq $1, %rdi
309 cmpq %r8, %rdi
310 jl .L96
311 .L57:
312 testb %r11b, %r11b
313 jne .L97
314 .L59:
315 leal 2(%rax), %ecx
316 cmpl $4, %ecx
317 ja .L98
318 cmpb $0, use_initgroups_entry(%rip)
319 movq 24(%rsp), %rdx
320 jne .L64
321 cmpl $1, %eax
322 je .L61
323 .L64:
324 movl 8(%rdx), %eax
325 addl %ecx, %ecx
326 shrl %cl, %eax
327 andl $3, %eax
328 cmpl $1, %eax
329 je .L48
330 .L61:
331 leaq 16(%rdx), %rdi
332 testq %rdi, %rdi
333 movq %rdi, 24(%rsp)
334 je .L48
335 cmpq $0, 16(%rdx)
336 jne .L47
337 .L48:
338 movq 16(%rsp), %rax
339 addq $40, %rsp
340 popq %rbx
341 popq %rbp
342 popq %r12
343 popq %r13
344 popq %r14
345 popq %r15
347 .L45:
348 movq %r14, %rsi
349 movl $2, %edi
350 call __nss_database_get
351 testb %al, %al
352 je .L49
353 movq 24(%rsp), %rdi
354 testq %rdi, %rdi
355 je .L49
356 movb $0, use_initgroups_entry(%rip)
357 jmp .L50
358 .L49:
359 leaq .LC5(%rip), %rdi
360 call __nss_action_parse@PLT
361 testq %rax, %rax
362 movq %rax, %rdi
363 movq %rax, 24(%rsp)
364 movb $0, use_initgroups_entry(%rip)
365 jne .L50
366 jmp .L48
367 .p2align 4,,10
368 .p2align 3
369 .L54:
370 subq $1, %r8
371 movl $1, %r11d
372 movl (%rcx,%r8,4), %edx
373 movl %edx, (%r9)
374 jmp .L53
375 .L95:
376 subq $8, %rsp
377 movq %r12, %r9
378 movq %rbp, %r8
379 pushq %r13
380 movq 24(%rsp), %rsi
381 movq %r14, %rcx
382 movq 40(%rsp), %rdi
383 movl %ebx, %edx
384 call compat_call.constprop.1
385 popq %rsi
386 popq %rdi
387 jmp .L52
388 .L97:
389 movq %r8, 16(%rsp)
390 jmp .L59
391 .L98:
392 leaq .LC7(%rip), %rdi
393 call __GI___libc_fatal
394 .L94:
395 leaq __PRETTY_FUNCTION__.13346(%rip), %rcx
396 leaq .LC3(%rip), %rsi
397 leaq .LC4(%rip), %rdi
398 movl $68, %edx
399 call __GI___assert_fail
400 .LFE82:
401 .size internal_getgrouplist, .-internal_getgrouplist
402 .p2align 4,,15
403 .globl getgrouplist
404 .type getgrouplist, @function
405 getgrouplist:
406 .LFB83:
407 pushq %r14
408 pushq %r13
409 movq %rcx, %r13
410 pushq %r12
411 pushq %rbp
412 movq %rdi, %rbp
413 pushq %rbx
414 movl $1, %edi
415 movl %esi, %r12d
416 movq %rdx, %rbx
417 movl $-1, %r14d
418 subq $16, %rsp
419 movl (%rcx), %eax
420 testl %eax, %eax
421 cmovg (%rcx), %edi
422 movslq %edi, %rdi
423 movq %rdi, (%rsp)
424 salq $2, %rdi
425 call malloc@PLT
426 testq %rax, %rax
427 movq %rax, 8(%rsp)
428 je .L99
429 leaq 8(%rsp), %rcx
430 movq $-1, %r8
431 movl %r12d, %esi
432 movq %rbp, %rdi
433 movq %rsp, %rdx
434 call internal_getgrouplist
435 cmpl %eax, 0(%r13)
436 movl %eax, %edx
437 movq 8(%rsp), %r12
438 cmovle 0(%r13), %edx
439 movq %rbx, %rdi
440 movl %eax, %ebp
441 movq %r12, %rsi
442 movslq %edx, %rdx
443 salq $2, %rdx
444 call __GI_memcpy@PLT
445 movq %r12, %rdi
446 call free@PLT
447 cmpl %ebp, 0(%r13)
448 movl %ebp, 0(%r13)
449 cmovge %ebp, %r14d
450 .L99:
451 addq $16, %rsp
452 movl %r14d, %eax
453 popq %rbx
454 popq %rbp
455 popq %r12
456 popq %r13
457 popq %r14
459 .LFE83:
460 .size getgrouplist, .-getgrouplist
461 .p2align 4,,15
462 .globl initgroups
463 .type initgroups, @function
464 initgroups:
465 .LFB84:
466 pushq %r12
467 pushq %rbp
468 movl %esi, %ebp
469 pushq %rbx
470 movq %rdi, %rbx
471 movl $3, %edi
472 subq $32, %rsp
473 call __GI___sysconf
474 testq %rax, %rax
475 movq %rax, %r12
476 jle .L107
477 cmpq $64, %rax
478 movl $64, %edi
479 cmovle %rax, %rdi
480 movq %rdi, 16(%rsp)
481 salq $2, %rdi
482 .L108:
483 call malloc@PLT
484 movq %rax, %rdx
485 movq %rax, 24(%rsp)
486 movl $-1, %eax
487 testq %rdx, %rdx
488 je .L106
489 leaq 24(%rsp), %rcx
490 leaq 16(%rsp), %rdx
491 movl %ebp, %esi
492 movq %rbx, %rdi
493 movq %r12, %r8
494 call internal_getgrouplist
495 movslq %eax, %rbp
496 movq %rbp, %rbx
497 jmp .L111
498 .p2align 4,,10
499 .p2align 3
500 .L116:
501 movq __libc_errno@gottpoff(%rip), %rdx
502 cmpl $22, %fs:(%rdx)
503 jne .L110
504 subl $1, %ebx
505 subq $1, %rbp
506 testl %ebx, %ebx
507 jle .L110
508 .L111:
509 movq 24(%rsp), %rsi
510 movq %rbp, %rdi
511 call __GI_setgroups
512 cmpl $-1, %eax
513 je .L116
514 .L110:
515 movq 24(%rsp), %rdi
516 movl %eax, 12(%rsp)
517 call free@PLT
518 movl 12(%rsp), %eax
519 .L106:
520 addq $32, %rsp
521 popq %rbx
522 popq %rbp
523 popq %r12
525 .p2align 4,,10
526 .p2align 3
527 .L107:
528 movq $16, 16(%rsp)
529 movl $64, %edi
530 jmp .L108
531 .LFE84:
532 .size initgroups, .-initgroups
533 .section .rodata.str1.16,"aMS",@progbits,1
534 .align 16
535 .type __PRETTY_FUNCTION__.13346, @object
536 .size __PRETTY_FUNCTION__.13346, 22
537 __PRETTY_FUNCTION__.13346:
538 .string "internal_getgrouplist"
539 .local use_initgroups_entry
540 .comm use_initgroups_entry,1,1
541 .hidden __nss_database_get