	.file	"43801.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"argv[0]: %s, argv[1]: %s\n"
	.align 8
.LC1:
	.string	"Introduce los parametros necesarios"
.LC2:
	.string	"Uso: %s <comando>\n"
.LC3:
	.string	"Error fork() %d: %s\n"
.LC4:
	.string	"Hijo %d (padre: %d)\n"
.LC5:
	.string	"Error setpgid() %d: %s\n"
.LC6:
	.string	"/tmp"
.LC7:
	.string	"Error chdir() %d: %s\n"
.LC8:
	.string	"/tmp/daemon.out"
.LC9:
	.string	"/tmp/daemon.err"
.LC10:
	.string	"/dev/null"
.LC11:
	.string	"Viejo PGID: %d\n"
.LC12:
	.string	"Viejo SID: %d\n"
	.align 8
.LC13:
	.string	"\302\241Se ha creado un nuevo grupo!"
.LC14:
	.string	"Nuevo PGID: %d\n"
.LC15:
	.string	"Nuevo SID: %d\n"
.LC16:
	.string	"Error system() %d: %d\n"
.LC17:
	.string	"Padre %d (hijo: %d)\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 88
	.cfi_offset 3, -24
	mov	DWORD PTR -84[rbp], edi
	mov	QWORD PTR -96[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -24[rbp], rax
	xor	eax, eax
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 8
	mov	rdx, QWORD PTR [rax]
	mov	rax, QWORD PTR -96[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	cmp	DWORD PTR -84[rbp], 1
	jg	.L2
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -96[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L2:
	call	fork@PLT
	mov	DWORD PTR -68[rbp], eax
	cmp	DWORD PTR -68[rbp], -1
	jne	.L4
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rbx, rax
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	rdx, rbx
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L4:
	cmp	DWORD PTR -68[rbp], 0
	jne	.L5
	mov	edi, 10
	call	sleep@PLT
	call	getppid@PLT
	mov	ebx, eax
	call	getpid@PLT
	mov	edx, ebx
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	call	setsid@PLT
	cmp	eax, -1
	jne	.L6
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rbx, rax
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	rdx, rbx
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L6:
	lea	rdi, .LC6[rip]
	call	chdir@PLT
	cmp	eax, -1
	jne	.L7
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rbx, rax
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	rdx, rbx
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L7:
	mov	edx, 511
	mov	esi, 578
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -64[rbp], eax
	mov	edx, 511
	mov	esi, 578
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -60[rbp], eax
	mov	edx, 511
	mov	esi, 578
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -56[rbp], eax
	mov	eax, DWORD PTR -64[rbp]
	mov	esi, 1
	mov	edi, eax
	call	dup2@PLT
	mov	DWORD PTR -52[rbp], eax
	mov	eax, DWORD PTR -60[rbp]
	mov	esi, 2
	mov	edi, eax
	call	dup2@PLT
	mov	DWORD PTR -48[rbp], eax
	mov	eax, DWORD PTR -56[rbp]
	mov	esi, 0
	mov	edi, eax
	call	dup2@PLT
	mov	DWORD PTR -44[rbp], eax
	mov	eax, DWORD PTR -68[rbp]
	mov	edi, eax
	call	getpgid@PLT
	mov	DWORD PTR -40[rbp], eax
	mov	eax, DWORD PTR -68[rbp]
	mov	edi, eax
	call	getsid@PLT
	mov	DWORD PTR -36[rbp], eax
	mov	eax, DWORD PTR -40[rbp]
	mov	esi, eax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -36[rbp]
	mov	esi, eax
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC13[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -68[rbp]
	mov	edi, eax
	call	getpgid@PLT
	mov	DWORD PTR -32[rbp], eax
	mov	eax, DWORD PTR -68[rbp]
	mov	edi, eax
	call	getsid@PLT
	mov	DWORD PTR -28[rbp], eax
	mov	eax, DWORD PTR -32[rbp]
	mov	esi, eax
	lea	rdi, .LC14[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, eax
	lea	rdi, .LC15[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -96[rbp]
	lea	rdx, 8[rax]
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rdx
	mov	rdi, rax
	call	execvp@PLT
	cmp	eax, -1
	jne	.L8
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rbx, rax
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	rdx, rbx
	mov	esi, eax
	lea	rdi, .LC16[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L5:
	call	getpid@PLT
	mov	ecx, eax
	mov	eax, DWORD PTR -68[rbp]
	mov	edx, eax
	mov	esi, ecx
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rcx, -72[rbp]
	mov	eax, DWORD PTR -68[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	edi, eax
	call	waitpid@PLT
.L8:
	mov	eax, 0
.L3:
	mov	rcx, QWORD PTR -24[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L9
	call	__stack_chk_fail@PLT
.L9:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"43801.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"argv[0]: %s, argv[1]: %s\012\000"
	.align	2
.LC1:
	.ascii	"Introduce los parametros necesarios\000"
	.align	2
.LC2:
	.ascii	"Uso: %s <comando>\012\000"
	.align	2
.LC3:
	.ascii	"Error fork() %d: %s\012\000"
	.align	2
.LC4:
	.ascii	"Hijo %d (padre: %d)\012\000"
	.align	2
.LC5:
	.ascii	"Error setpgid() %d: %s\012\000"
	.align	2
.LC6:
	.ascii	"/tmp\000"
	.align	2
.LC7:
	.ascii	"Error chdir() %d: %s\012\000"
	.align	2
.LC8:
	.ascii	"/tmp/daemon.out\000"
	.align	2
.LC9:
	.ascii	"/tmp/daemon.err\000"
	.align	2
.LC10:
	.ascii	"/dev/null\000"
	.align	2
.LC11:
	.ascii	"Viejo PGID: %d\012\000"
	.align	2
.LC12:
	.ascii	"Viejo SID: %d\012\000"
	.align	2
.LC13:
	.ascii	"\302\241Se ha creado un nuevo grupo!\000"
	.align	2
.LC14:
	.ascii	"Nuevo PGID: %d\012\000"
	.align	2
.LC15:
	.ascii	"Nuevo SID: %d\012\000"
	.align	2
.LC16:
	.ascii	"Error system() %d: %d\012\000"
	.align	2
.LC17:
	.ascii	"Padre %d (hijo: %d)\012\000"
	.align	2
.LC18:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #68
	str	r0, [fp, #-72]
	str	r1, [fp, #-76]
	ldr	r3, .L10
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	ldr	r3, [fp, #-76]
	ldr	r1, [r3]
	ldr	r3, [fp, #-76]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r0, .L10+4
	bl	printf
	ldr	r3, [fp, #-72]
	cmp	r3, #1
	bgt	.L2
	ldr	r0, .L10+8
	bl	puts
	ldr	r3, [fp, #-76]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L10+12
	bl	printf
	mvn	r3, #0
	b	.L3
.L2:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-60]
	cmn	r3, #1
	bne	.L4
	bl	__errno_location
	mov	r3, r0
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L10+16
	bl	printf
	mvn	r3, #0
	b	.L3
.L4:
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	bne	.L5
	mov	r0, #10
	bl	sleep
	bl	getpid
	mov	r4, r0
	bl	getppid
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L10+20
	bl	printf
	bl	setsid
	mov	r3, r0
	cmn	r3, #1
	bne	.L6
	bl	__errno_location
	mov	r3, r0
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L10+24
	bl	printf
	mvn	r3, #0
	b	.L3
.L6:
	ldr	r0, .L10+28
	bl	chdir
	mov	r3, r0
	cmn	r3, #1
	bne	.L7
	bl	__errno_location
	mov	r3, r0
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L10+32
	bl	printf
	mvn	r3, #0
	b	.L3
.L7:
	ldr	r2, .L10+36
	ldr	r1, .L10+40
	ldr	r0, .L10+44
	bl	open
	str	r0, [fp, #-56]
	ldr	r2, .L10+36
	ldr	r1, .L10+40
	ldr	r0, .L10+48
	bl	open
	str	r0, [fp, #-52]
	ldr	r2, .L10+36
	ldr	r1, .L10+40
	ldr	r0, .L10+52
	bl	open
	str	r0, [fp, #-48]
	mov	r1, #1
	ldr	r0, [fp, #-56]
	bl	dup2
	str	r0, [fp, #-44]
	mov	r1, #2
	ldr	r0, [fp, #-52]
	bl	dup2
	str	r0, [fp, #-40]
	mov	r1, #0
	ldr	r0, [fp, #-48]
	bl	dup2
	str	r0, [fp, #-36]
	ldr	r0, [fp, #-60]
	bl	getpgid
	str	r0, [fp, #-32]
	ldr	r0, [fp, #-60]
	bl	getsid
	str	r0, [fp, #-28]
	ldr	r1, [fp, #-32]
	ldr	r0, .L10+56
	bl	printf
	ldr	r1, [fp, #-28]
	ldr	r0, .L10+60
	bl	printf
	ldr	r0, .L10+64
	bl	puts
	ldr	r0, [fp, #-60]
	bl	getpgid
	str	r0, [fp, #-24]
	ldr	r0, [fp, #-60]
	bl	getsid
	str	r0, [fp, #-20]
	ldr	r1, [fp, #-24]
	ldr	r0, .L10+68
	bl	printf
	ldr	r1, [fp, #-20]
	ldr	r0, .L10+72
	bl	printf
	ldr	r3, [fp, #-76]
	add	r3, r3, #4
	ldr	r2, [r3]
	ldr	r3, [fp, #-76]
	add	r3, r3, #4
	mov	r1, r3
	mov	r0, r2
	bl	execvp
	mov	r3, r0
	cmn	r3, #1
	bne	.L8
	bl	__errno_location
	mov	r3, r0
	ldr	r4, [r3]
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r2, r3
	mov	r1, r4
	ldr	r0, .L10+76
	bl	printf
	mvn	r3, #0
	b	.L3
.L5:
	bl	getpid
	mov	r3, r0
	ldr	r2, [fp, #-60]
	mov	r1, r3
	ldr	r0, .L10+80
	bl	printf
	sub	r3, fp, #64
	mov	r2, #0
	mov	r1, r3
	ldr	r0, [fp, #-60]
	bl	waitpid
.L8:
	mov	r3, #0
.L3:
	ldr	r2, .L10
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L9
	bl	__stack_chk_fail
.L9:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC18
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	511
	.word	578
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
