	.file	"1004386.c"
	.intel_syntax noprefix
	.text
	.globl	nsimmax
	.bss
	.align 4
	.type	nsimmax, @object
	.size	nsimmax, 4
nsimmax:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 2072
A:
	.zero	2072
	.globl	B
	.align 4
	.type	B, @object
	.size	B, 4
B:
	.zero	4
	.text
	.globl	getCheckSum
	.type	getCheckSum, @function
getCheckSum:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -8[rbp], 0
	mov	eax, DWORD PTR 16[rbp]
	add	DWORD PTR -8[rbp], eax
	mov	eax, DWORD PTR 20[rbp]
	add	DWORD PTR -8[rbp], eax
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	movzx	eax, BYTE PTR 28[rbp+rax]
	movsx	eax, al
	add	DWORD PTR -8[rbp], eax
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 19
	jle	.L3
	mov	eax, DWORD PTR -8[rbp]
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	getCheckSum, .-getCheckSum
	.section	.rodata
	.align 8
.LC0:
	.string	"A_output: sent packet (seq=%d): %s\n"
	.align 8
.LC1:
	.string	"  A_output: start timer for seq=%d\n"
	.align 8
.LC2:
	.string	"  A_output: A.send_base: %d, A.next_seq: %d\n"
	.text
	.globl	send_buffer
	.type	send_buffer, @function
send_buffer:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	jmp	.L6
.L9:
	mov	eax, DWORD PTR A[rip+4]
	cdq
	shr	edx, 26
	add	eax, edx
	and	eax, 63
	sub	eax, edx
	cdqe
	sal	rax, 5
	mov	rsi, rax
	lea	rcx, A[rip+16]
	mov	rax, QWORD PTR [rsi+rcx]
	mov	rdx, QWORD PTR 8[rsi+rcx]
	mov	QWORD PTR -48[rbp], rax
	mov	QWORD PTR -40[rbp], rdx
	mov	rax, QWORD PTR 16[rsi+rcx]
	mov	rdx, QWORD PTR 24[rsi+rcx]
	mov	QWORD PTR -32[rbp], rax
	mov	QWORD PTR -24[rbp], rdx
	mov	eax, DWORD PTR -48[rbp]
	lea	rdx, -48[rbp]
	add	rdx, 12
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	mov	edi, 0
	call	tolayer3
	add	rsp, 32
	mov	edx, DWORD PTR A[rip+4]
	mov	eax, DWORD PTR A[rip]
	cmp	edx, eax
	jne	.L7
	mov	eax, DWORD PTR A[rip+2064]
	movd	xmm0, eax
	mov	edi, 0
	call	starttimer
	mov	eax, DWORD PTR A[rip]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
.L7:
	mov	eax, DWORD PTR A[rip+4]
	add	eax, 1
	mov	DWORD PTR A[rip+4], eax
	mov	edx, DWORD PTR A[rip+4]
	mov	eax, DWORD PTR A[rip]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
.L6:
	mov	edx, DWORD PTR A[rip+4]
	mov	eax, DWORD PTR A[rip+8]
	cmp	edx, eax
	jge	.L11
	mov	eax, DWORD PTR A[rip+4]
	mov	ecx, DWORD PTR A[rip]
	mov	edx, DWORD PTR A[rip+12]
	add	edx, ecx
	cmp	eax, edx
	jl	.L9
.L11:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	send_buffer, .-send_buffer
	.section	.rodata
	.align 8
.LC3:
	.string	"  A_output: Wrong seq number in GBN, aborted"
	.align 8
.LC4:
	.string	"  A_output: buffer full. drop the message: %s\n"
	.align 8
.LC5:
	.string	"  A_output: bufferred packet (seq=%d): %s\n"
.LC6:
	.string	"A buffer_next: %d\n"
	.text
	.globl	A_output
	.type	A_output, @function
A_output:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	edx, DWORD PTR A[rip+8]
	mov	eax, DWORD PTR A[rip]
	cmp	edx, eax
	jge	.L13
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L12
.L13:
	mov	eax, DWORD PTR A[rip]
	lea	edx, 63[rax]
	mov	eax, DWORD PTR A[rip+8]
	cmp	edx, eax
	jge	.L15
	lea	rsi, 16[rbp]
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L12
.L15:
	mov	eax, DWORD PTR A[rip+8]
	lea	rdx, 16[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR A[rip+8]
	cdq
	shr	edx, 26
	add	eax, edx
	and	eax, 63
	sub	eax, edx
	cdqe
	sal	rax, 5
	lea	rdx, 16[rax]
	lea	rax, A[rip]
	add	rax, rdx
	mov	QWORD PTR -8[rbp], rax
	mov	edx, DWORD PTR A[rip+8]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	mov	rax, QWORD PTR -8[rbp]
	add	rax, 12
	mov	edx, 20
	lea	rsi, 16[rbp]
	mov	rdi, rax
	call	memmove@PLT
	mov	rcx, QWORD PTR -8[rbp]
	sub	rsp, 32
	mov	rsi, rsp
	mov	rax, QWORD PTR [rcx]
	mov	rdx, QWORD PTR 8[rcx]
	mov	QWORD PTR [rsi], rax
	mov	QWORD PTR 8[rsi], rdx
	mov	rax, QWORD PTR 16[rcx]
	mov	rdx, QWORD PTR 24[rcx]
	mov	QWORD PTR 16[rsi], rax
	mov	QWORD PTR 24[rsi], rdx
	call	getCheckSum
	add	rsp, 32
	mov	rdx, QWORD PTR -8[rbp]
	mov	DWORD PTR 8[rdx], eax
	mov	eax, DWORD PTR A[rip+8]
	add	eax, 1
	mov	DWORD PTR A[rip+8], eax
	mov	eax, DWORD PTR A[rip+8]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	send_buffer
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	A_output, .-A_output
	.section	.rodata
	.align 8
.LC7:
	.string	"  B_output: USED only when bi-directional."
	.text
	.globl	B_output
	.type	B_output, @function
B_output:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, .LC7[rip]
	call	puts@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	B_output, .-B_output
	.section	.rodata
	.align 8
.LC8:
	.string	"  A_timerinterrupt: resend packet (seq=%d): %s\n"
	.text
	.globl	retransmit_pkt
	.type	retransmit_pkt, @function
retransmit_pkt:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR A[rip]
	mov	DWORD PTR -52[rbp], eax
	jmp	.L18
.L19:
	mov	eax, DWORD PTR -52[rbp]
	cdq
	shr	edx, 26
	add	eax, edx
	and	eax, 63
	sub	eax, edx
	cdqe
	sal	rax, 5
	mov	rsi, rax
	lea	rcx, A[rip+16]
	mov	rax, QWORD PTR [rsi+rcx]
	mov	rdx, QWORD PTR 8[rsi+rcx]
	mov	QWORD PTR -48[rbp], rax
	mov	QWORD PTR -40[rbp], rdx
	mov	rax, QWORD PTR 16[rsi+rcx]
	mov	rdx, QWORD PTR 24[rsi+rcx]
	mov	QWORD PTR -32[rbp], rax
	mov	QWORD PTR -24[rbp], rdx
	mov	eax, DWORD PTR -48[rbp]
	lea	rdx, -48[rbp]
	add	rdx, 12
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	mov	edi, 0
	call	tolayer3
	add	rsp, 32
	add	DWORD PTR -52[rbp], 1
.L18:
	mov	eax, DWORD PTR A[rip+4]
	cmp	DWORD PTR -52[rbp], eax
	jl	.L19
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	retransmit_pkt, .-retransmit_pkt
	.section	.rodata
	.align 8
.LC9:
	.string	"  A_input: corrupted NAK(ack=%d) drop packet.\n"
	.align 8
.LC10:
	.string	"  A_input: duplicated ACK(ack=%d), drop packet.\n"
	.align 8
.LC11:
	.string	"A_input: fast retransmit ACK(ack=%d) \n"
	.align 8
.LC12:
	.string	"A_input: ACKed(ack=%d) from B.\n"
	.align 8
.LC13:
	.string	"  A.send_base: %d, A.next_seq: %d\n"
.LC14:
	.string	"  A_input: stop timer"
	.align 8
.LC15:
	.string	"  A_input: restart timer + %f\n"
	.text
	.globl	A_input
	.type	A_input, @function
A_input:
.LFB11:
	.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, 8
	.cfi_offset 3, -24
	mov	ebx, DWORD PTR 24[rbp]
	push	QWORD PTR 40[rbp]
	push	QWORD PTR 32[rbp]
	push	QWORD PTR 24[rbp]
	push	QWORD PTR 16[rbp]
	call	getCheckSum
	add	rsp, 32
	cmp	ebx, eax
	je	.L22
	mov	eax, DWORD PTR 20[rbp]
	mov	esi, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L21
.L22:
	mov	edx, DWORD PTR 20[rbp]
	mov	eax, DWORD PTR A[rip]
	cmp	edx, eax
	jge	.L24
	mov	edx, DWORD PTR A[rip]
	mov	eax, DWORD PTR nsimmax[rip]
	cmp	edx, eax
	je	.L28
	mov	eax, DWORD PTR 20[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR A[rip+2068]
	cmp	eax, 3
	jne	.L26
	mov	eax, DWORD PTR 20[rbp]
	mov	esi, eax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	retransmit_pkt
	mov	DWORD PTR A[rip+2068], 0
.L26:
	mov	eax, DWORD PTR A[rip+2068]
	add	eax, 1
	mov	DWORD PTR A[rip+2068], eax
	jmp	.L21
.L24:
	mov	eax, DWORD PTR 20[rbp]
	mov	esi, eax
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR 20[rbp]
	add	eax, 1
	mov	DWORD PTR A[rip], eax
	mov	edx, DWORD PTR A[rip+4]
	mov	eax, DWORD PTR A[rip]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	call	stoptimer
	mov	edx, DWORD PTR A[rip]
	mov	eax, DWORD PTR A[rip+4]
	cmp	edx, eax
	jne	.L27
	lea	rdi, .LC14[rip]
	call	puts@PLT
	mov	eax, 0
	call	send_buffer
	jmp	.L21
.L27:
	mov	eax, DWORD PTR A[rip+2064]
	movd	xmm0, eax
	mov	edi, 0
	call	starttimer
	movss	xmm0, DWORD PTR A[rip+2064]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	movq	xmm0, rax
	lea	rdi, .LC15[rip]
	mov	eax, 1
	call	printf@PLT
	jmp	.L21
.L28:
	nop
.L21:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	A_input, .-A_input
	.section	.rodata
	.align 8
.LC16:
	.string	"  A_timerinterrupt: restart timer + %f\n"
	.text
	.globl	A_timerinterrupt
	.type	A_timerinterrupt, @function
A_timerinterrupt:
.LFB12:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, 0
	call	retransmit_pkt
	mov	eax, DWORD PTR A[rip+2064]
	movd	xmm0, eax
	mov	edi, 0
	call	starttimer
	movss	xmm0, DWORD PTR A[rip+2064]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	movq	xmm0, rax
	lea	rdi, .LC16[rip]
	mov	eax, 1
	call	printf@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	A_timerinterrupt, .-A_timerinterrupt
	.globl	A_init
	.type	A_init, @function
A_init:
.LFB13:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR A[rip], 0
	mov	DWORD PTR A[rip+4], 0
	mov	DWORD PTR A[rip+8], 0
	movss	xmm0, DWORD PTR .LC17[rip]
	movss	DWORD PTR A[rip+2064], xmm0
	mov	DWORD PTR A[rip+12], 8
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	A_init, .-A_init
	.globl	send_ack
	.type	send_ack, @function
send_ack:
.LFB14:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	DWORD PTR -52[rbp], edi
	mov	DWORD PTR -56[rbp], esi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, DWORD PTR -56[rbp]
	mov	DWORD PTR -44[rbp], eax
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	call	getCheckSum
	add	rsp, 32
	mov	DWORD PTR -40[rbp], eax
	mov	eax, DWORD PTR -52[rbp]
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	mov	edi, eax
	call	tolayer3
	add	rsp, 32
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L32
	call	__stack_chk_fail@PLT
.L32:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE14:
	.size	send_ack, .-send_ack
	.section	.rodata
	.align 8
.LC18:
	.string	"  B_input: packet from A is corrupted, send NAK(ack=%d)\n"
	.align 8
.LC19:
	.string	"  B_input: packet seq:%d, send duplicated ACK(ack=%d)\n"
	.align 8
.LC20:
	.string	"  B_input: recv packet (seq=%d): %s\n"
.LC21:
	.string	"  B_input: send ACK(ack=%d)\n"
	.text
	.globl	B_input
	.type	B_input, @function
B_input:
.LFB15:
	.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, 8
	.cfi_offset 3, -24
	mov	ebx, DWORD PTR 24[rbp]
	push	QWORD PTR 40[rbp]
	push	QWORD PTR 32[rbp]
	push	QWORD PTR 24[rbp]
	push	QWORD PTR 16[rbp]
	call	getCheckSum
	add	rsp, 32
	cmp	ebx, eax
	je	.L34
	mov	eax, DWORD PTR B[rip]
	sub	eax, 1
	mov	esi, eax
	lea	rdi, .LC18[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR B[rip]
	sub	eax, 1
	mov	esi, eax
	mov	edi, 1
	call	send_ack
	jmp	.L33
.L34:
	mov	edx, DWORD PTR 16[rbp]
	mov	eax, DWORD PTR B[rip]
	cmp	edx, eax
	je	.L36
	mov	eax, DWORD PTR B[rip]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR 16[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR B[rip]
	sub	eax, 1
	mov	esi, eax
	mov	edi, 1
	call	send_ack
	jmp	.L33
.L36:
	mov	eax, DWORD PTR 16[rbp]
	lea	rdx, 28[rbp]
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR B[rip]
	mov	esi, eax
	lea	rdi, .LC21[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR B[rip]
	mov	esi, eax
	mov	edi, 1
	call	send_ack
	lea	rax, 28[rbp]
	mov	rsi, rax
	mov	edi, 1
	call	tolayer5
	mov	eax, DWORD PTR B[rip]
	add	eax, 1
	mov	DWORD PTR B[rip], eax
.L33:
	mov	rbx, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE15:
	.size	B_input, .-B_input
	.section	.rodata
	.align 8
.LC22:
	.string	"B_timerinterrupt: USED only when bi-directional."
	.text
	.globl	B_timerinterrupt
	.type	B_timerinterrupt, @function
B_timerinterrupt:
.LFB16:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, .LC22[rip]
	call	puts@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE16:
	.size	B_timerinterrupt, .-B_timerinterrupt
	.globl	B_init
	.type	B_init, @function
B_init:
.LFB17:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR B[rip], 0
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE17:
	.size	B_init, .-B_init
	.globl	evlist
	.bss
	.align 8
	.type	evlist, @object
	.size	evlist, 8
evlist:
	.zero	8
	.globl	TRACE
	.data
	.align 4
	.type	TRACE, @object
	.size	TRACE, 4
TRACE:
	.long	1
	.globl	nsim
	.bss
	.align 4
	.type	nsim, @object
	.size	nsim, 4
nsim:
	.zero	4
	.globl	time
	.align 4
	.type	time, @object
	.size	time, 4
time:
	.zero	4
	.globl	lossprob
	.align 4
	.type	lossprob, @object
	.size	lossprob, 4
lossprob:
	.zero	4
	.globl	corruptprob
	.align 4
	.type	corruptprob, @object
	.size	corruptprob, 4
corruptprob:
	.zero	4
	.globl	lambda
	.align 4
	.type	lambda, @object
	.size	lambda, 4
lambda:
	.zero	4
	.globl	ntolayer3
	.align 4
	.type	ntolayer3, @object
	.size	ntolayer3, 4
ntolayer3:
	.zero	4
	.globl	nlost
	.align 4
	.type	nlost, @object
	.size	nlost, 4
nlost:
	.zero	4
	.globl	ncorrupt
	.align 4
	.type	ncorrupt, @object
	.size	ncorrupt, 4
ncorrupt:
	.zero	4
	.section	.rodata
.LC23:
	.string	"\nEVENT time: %f,"
.LC24:
	.string	"  type: %d"
.LC25:
	.string	", timerinterrupt  "
.LC26:
	.string	", fromlayer5 "
.LC27:
	.string	", fromlayer3 "
.LC28:
	.string	" entity: %d\n"
	.align 8
.LC29:
	.string	"          MAINLOOP: data given to student: "
	.align 8
.LC30:
	.string	"INTERNAL PANIC: unknown event type "
	.align 8
.LC31:
	.string	" Simulator terminated at time %f\n after sending %d msgs from layer5\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB18:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 112
	mov	DWORD PTR -100[rbp], edi
	mov	QWORD PTR -112[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rdx, QWORD PTR -112[rbp]
	mov	eax, DWORD PTR -100[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	init
	mov	eax, 0
	call	A_init
	mov	eax, 0
	call	B_init
.L63:
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -88[rbp], rax
	cmp	QWORD PTR -88[rbp], 0
	je	.L67
	mov	rax, QWORD PTR evlist[rip]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR evlist[rip], rax
	mov	rax, QWORD PTR evlist[rip]
	test	rax, rax
	je	.L42
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR 24[rax], 0
.L42:
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 1
	jle	.L43
	mov	rax, QWORD PTR -88[rbp]
	movss	xmm0, DWORD PTR [rax]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	movq	xmm0, rax
	lea	rdi, .LC23[rip]
	mov	eax, 1
	call	printf@PLT
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	mov	esi, eax
	lea	rdi, .LC24[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	test	eax, eax
	jne	.L44
	lea	rdi, .LC25[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L45
.L44:
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	cmp	eax, 1
	jne	.L46
	lea	rdi, .LC26[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L45
.L46:
	lea	rdi, .LC27[rip]
	mov	eax, 0
	call	printf@PLT
.L45:
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 8[rax]
	mov	esi, eax
	lea	rdi, .LC28[rip]
	mov	eax, 0
	call	printf@PLT
.L43:
	mov	rax, QWORD PTR -88[rbp]
	movss	xmm0, DWORD PTR [rax]
	movss	DWORD PTR time[rip], xmm0
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	cmp	eax, 1
	jne	.L47
	mov	edx, DWORD PTR nsim[rip]
	mov	eax, DWORD PTR nsimmax[rip]
	cmp	edx, eax
	jge	.L48
	mov	eax, DWORD PTR nsim[rip]
	lea	edx, 1[rax]
	mov	eax, DWORD PTR nsimmax[rip]
	cmp	edx, eax
	jge	.L49
	call	generate_next_arrival
.L49:
	mov	eax, DWORD PTR nsim[rip]
	movsx	rdx, eax
	imul	rdx, rdx, 1321528399
	shr	rdx, 32
	sar	edx, 3
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	mov	DWORD PTR -92[rbp], edx
	mov	edx, DWORD PTR -92[rbp]
	imul	edx, edx, 26
	sub	eax, edx
	mov	DWORD PTR -92[rbp], eax
	mov	DWORD PTR -96[rbp], 0
	jmp	.L50
.L51:
	mov	eax, DWORD PTR -92[rbp]
	add	eax, 97
	mov	edx, eax
	mov	eax, DWORD PTR -96[rbp]
	cdqe
	mov	BYTE PTR -80[rbp+rax], dl
	add	DWORD PTR -96[rbp], 1
.L50:
	cmp	DWORD PTR -96[rbp], 19
	jle	.L51
	mov	BYTE PTR -61[rbp], 0
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L52
	lea	rdi, .LC29[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -96[rbp], 0
	jmp	.L53
.L54:
	mov	eax, DWORD PTR -96[rbp]
	cdqe
	movzx	eax, BYTE PTR -80[rbp+rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	add	DWORD PTR -96[rbp], 1
.L53:
	cmp	DWORD PTR -96[rbp], 19
	jle	.L54
	mov	edi, 10
	call	putchar@PLT
.L52:
	mov	eax, DWORD PTR nsim[rip]
	add	eax, 1
	mov	DWORD PTR nsim[rip], eax
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 8[rax]
	test	eax, eax
	jne	.L55
	sub	rsp, 8
	sub	rsp, 24
	mov	rcx, rsp
	mov	rax, QWORD PTR -80[rbp]
	mov	rdx, QWORD PTR -72[rbp]
	mov	QWORD PTR [rcx], rax
	mov	QWORD PTR 8[rcx], rdx
	mov	eax, DWORD PTR -64[rbp]
	mov	DWORD PTR 16[rcx], eax
	call	A_output
	add	rsp, 32
	jmp	.L48
.L55:
	sub	rsp, 8
	sub	rsp, 24
	mov	rcx, rsp
	mov	rax, QWORD PTR -80[rbp]
	mov	rdx, QWORD PTR -72[rbp]
	mov	QWORD PTR [rcx], rax
	mov	QWORD PTR 8[rcx], rdx
	mov	eax, DWORD PTR -64[rbp]
	mov	DWORD PTR 16[rcx], eax
	call	B_output
	add	rsp, 32
	jmp	.L48
.L47:
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	cmp	eax, 2
	jne	.L56
	mov	rax, QWORD PTR -88[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -48[rbp], eax
	mov	rax, QWORD PTR -88[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	eax, DWORD PTR 4[rax]
	mov	DWORD PTR -44[rbp], eax
	mov	rax, QWORD PTR -88[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	eax, DWORD PTR 8[rax]
	mov	DWORD PTR -40[rbp], eax
	mov	DWORD PTR -96[rbp], 0
	jmp	.L57
.L58:
	mov	rax, QWORD PTR -88[rbp]
	mov	rdx, QWORD PTR 16[rax]
	mov	eax, DWORD PTR -96[rbp]
	cdqe
	movzx	edx, BYTE PTR 12[rdx+rax]
	mov	eax, DWORD PTR -96[rbp]
	cdqe
	mov	BYTE PTR -36[rbp+rax], dl
	add	DWORD PTR -96[rbp], 1
.L57:
	cmp	DWORD PTR -96[rbp], 19
	jle	.L58
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 8[rax]
	test	eax, eax
	jne	.L59
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	call	A_input
	add	rsp, 32
	jmp	.L60
.L59:
	push	QWORD PTR -24[rbp]
	push	QWORD PTR -32[rbp]
	push	QWORD PTR -40[rbp]
	push	QWORD PTR -48[rbp]
	call	B_input
	add	rsp, 32
.L60:
	mov	rax, QWORD PTR -88[rbp]
	mov	rax, QWORD PTR 16[rax]
	mov	rdi, rax
	call	free@PLT
	jmp	.L48
.L56:
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 4[rax]
	test	eax, eax
	jne	.L61
	mov	rax, QWORD PTR -88[rbp]
	mov	eax, DWORD PTR 8[rax]
	test	eax, eax
	jne	.L62
	mov	eax, 0
	call	A_timerinterrupt
	jmp	.L48
.L62:
	mov	eax, 0
	call	B_timerinterrupt
	jmp	.L48
.L61:
	lea	rdi, .LC30[rip]
	call	puts@PLT
.L48:
	mov	rax, QWORD PTR -88[rbp]
	mov	rdi, rax
	call	free@PLT
	jmp	.L63
.L67:
	nop
.L41:
	mov	edx, DWORD PTR nsim[rip]
	movss	xmm0, DWORD PTR time[rip]
	pxor	xmm2, xmm2
	cvtss2sd	xmm2, xmm0
	movq	rax, xmm2
	mov	esi, edx
	movq	xmm0, rax
	lea	rdi, .LC31[rip]
	mov	eax, 1
	call	printf@PLT
	mov	eax, 0
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L65
	call	__stack_chk_fail@PLT
.L65:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE18:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC32:
	.string	"usage: %s  num_sim  prob_loss  prob_corrupt  interval  debug_level\n"
	.align 8
.LC33:
	.string	"-----  Stop and Wait Network Simulator Version 1.1 -------- \n"
	.align 8
.LC34:
	.string	"the number of messages to simulate: %d\n"
.LC35:
	.string	"packet loss probability: %f\n"
	.align 8
.LC36:
	.string	"packet corruption probability: %f\n"
	.align 8
.LC37:
	.string	"average time between messages from sender's layer5: %f\n"
.LC38:
	.string	"TRACE: %d\n"
	.align 8
.LC43:
	.string	"It is likely that random number generation on your machine"
	.align 8
.LC44:
	.string	"is different from what this emulator expects.  Please take"
	.align 8
.LC45:
	.string	"a look at the routine jimsrand() in the emulator code. Sorry. "
	.text
	.globl	init
	.type	init, @function
init:
.LFB19:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	cmp	DWORD PTR -20[rbp], 6
	je	.L69
	mov	rax, QWORD PTR -32[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC32[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L69:
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR nsimmax[rip], eax
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atof@PLT
	cvtsd2ss	xmm0, xmm0
	movss	DWORD PTR lossprob[rip], xmm0
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 24
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atof@PLT
	cvtsd2ss	xmm0, xmm0
	movss	DWORD PTR corruptprob[rip], xmm0
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 32
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atof@PLT
	cvtsd2ss	xmm0, xmm0
	movss	DWORD PTR lambda[rip], xmm0
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 40
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR TRACE[rip], eax
	lea	rdi, .LC33[rip]
	call	puts@PLT
	mov	eax, DWORD PTR nsimmax[rip]
	mov	esi, eax
	lea	rdi, .LC34[rip]
	mov	eax, 0
	call	printf@PLT
	movss	xmm0, DWORD PTR lossprob[rip]
	pxor	xmm2, xmm2
	cvtss2sd	xmm2, xmm0
	movq	rax, xmm2
	movq	xmm0, rax
	lea	rdi, .LC35[rip]
	mov	eax, 1
	call	printf@PLT
	movss	xmm0, DWORD PTR corruptprob[rip]
	pxor	xmm3, xmm3
	cvtss2sd	xmm3, xmm0
	movq	rax, xmm3
	movq	xmm0, rax
	lea	rdi, .LC36[rip]
	mov	eax, 1
	call	printf@PLT
	movss	xmm0, DWORD PTR lambda[rip]
	pxor	xmm4, xmm4
	cvtss2sd	xmm4, xmm0
	movq	rax, xmm4
	movq	xmm0, rax
	lea	rdi, .LC37[rip]
	mov	eax, 1
	call	printf@PLT
	mov	eax, DWORD PTR TRACE[rip]
	mov	esi, eax
	lea	rdi, .LC38[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 9999
	call	srand@PLT
	pxor	xmm0, xmm0
	movss	DWORD PTR -8[rbp], xmm0
	mov	DWORD PTR -12[rbp], 0
	jmp	.L70
.L71:
	mov	eax, 0
	call	jimsrand
	movss	xmm1, DWORD PTR -8[rbp]
	addss	xmm0, xmm1
	movss	DWORD PTR -8[rbp], xmm0
	add	DWORD PTR -12[rbp], 1
.L70:
	cmp	DWORD PTR -12[rbp], 999
	jle	.L71
	movss	xmm0, DWORD PTR -8[rbp]
	movss	xmm1, DWORD PTR .LC40[rip]
	divss	xmm0, xmm1
	movss	DWORD PTR -4[rbp], xmm0
	movss	xmm0, DWORD PTR .LC41[rip]
	comiss	xmm0, DWORD PTR -4[rbp]
	ja	.L72
	movss	xmm0, DWORD PTR -4[rbp]
	comiss	xmm0, DWORD PTR .LC42[rip]
	jbe	.L75
.L72:
	lea	rdi, .LC43[rip]
	call	puts@PLT
	lea	rdi, .LC44[rip]
	call	puts@PLT
	lea	rdi, .LC45[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L75:
	mov	DWORD PTR ntolayer3[rip], 0
	mov	DWORD PTR nlost[rip], 0
	mov	DWORD PTR ncorrupt[rip], 0
	pxor	xmm0, xmm0
	movss	DWORD PTR time[rip], xmm0
	call	generate_next_arrival
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE19:
	.size	init, .-init
	.globl	jimsrand
	.type	jimsrand, @function
jimsrand:
.LFB20:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	movsd	xmm0, QWORD PTR .LC46[rip]
	movsd	QWORD PTR -8[rbp], xmm0
	call	rand@PLT
	pxor	xmm0, xmm0
	cvtsi2sd	xmm0, eax
	divsd	xmm0, QWORD PTR -8[rbp]
	cvtsd2ss	xmm0, xmm0
	movss	DWORD PTR -12[rbp], xmm0
	movss	xmm0, DWORD PTR -12[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE20:
	.size	jimsrand, .-jimsrand
	.section	.rodata
	.align 8
.LC47:
	.string	"          GENERATE NEXT ARRIVAL: creating new arrival"
	.text
	.globl	generate_next_arrival
	.type	generate_next_arrival, @function
generate_next_arrival:
.LFB21:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L79
	lea	rdi, .LC47[rip]
	call	puts@PLT
.L79:
	call	jimsrand
	movss	xmm1, DWORD PTR lambda[rip]
	mulss	xmm0, xmm1
	addss	xmm0, xmm0
	cvtss2sd	xmm0, xmm0
	movsd	QWORD PTR -16[rbp], xmm0
	mov	edi, 40
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	movss	xmm0, DWORD PTR time[rip]
	cvtss2sd	xmm0, xmm0
	addsd	xmm0, QWORD PTR -16[rbp]
	cvtsd2ss	xmm0, xmm0
	mov	rax, QWORD PTR -8[rbp]
	movss	DWORD PTR [rax], xmm0
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR 4[rax], 1
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR 8[rax], 0
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	insertevent
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE21:
	.size	generate_next_arrival, .-generate_next_arrival
	.section	.rodata
	.align 8
.LC48:
	.string	"            INSERTEVENT: time is %lf\n"
	.align 8
.LC49:
	.string	"            INSERTEVENT: future time will be %lf\n"
	.text
	.globl	insertevent
	.type	insertevent, @function
insertevent:
.LFB22:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L81
	movss	xmm0, DWORD PTR time[rip]
	pxor	xmm2, xmm2
	cvtss2sd	xmm2, xmm0
	movq	rax, xmm2
	movq	xmm0, rax
	lea	rdi, .LC48[rip]
	mov	eax, 1
	call	printf@PLT
	mov	rax, QWORD PTR -24[rbp]
	movss	xmm0, DWORD PTR [rax]
	pxor	xmm3, xmm3
	cvtss2sd	xmm3, xmm0
	movq	rax, xmm3
	movq	xmm0, rax
	lea	rdi, .LC49[rip]
	mov	eax, 1
	call	printf@PLT
.L81:
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -16[rbp], rax
	cmp	QWORD PTR -16[rbp], 0
	jne	.L82
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR evlist[rip], rax
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 32[rax], 0
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 24[rax], 0
	jmp	.L89
.L82:
	mov	rax, QWORD PTR -16[rbp]
	mov	QWORD PTR -8[rbp], rax
	jmp	.L84
.L86:
	mov	rax, QWORD PTR -16[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR -16[rbp], rax
.L84:
	cmp	QWORD PTR -16[rbp], 0
	je	.L85
	mov	rax, QWORD PTR -24[rbp]
	movss	xmm0, DWORD PTR [rax]
	mov	rax, QWORD PTR -16[rbp]
	movss	xmm1, DWORD PTR [rax]
	comiss	xmm0, xmm1
	ja	.L86
.L85:
	cmp	QWORD PTR -16[rbp], 0
	jne	.L87
	mov	rax, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR -24[rbp]
	mov	QWORD PTR 32[rax], rdx
	mov	rax, QWORD PTR -24[rbp]
	mov	rdx, QWORD PTR -8[rbp]
	mov	QWORD PTR 24[rax], rdx
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 32[rax], 0
	jmp	.L89
.L87:
	mov	rax, QWORD PTR evlist[rip]
	cmp	QWORD PTR -16[rbp], rax
	jne	.L88
	mov	rdx, QWORD PTR evlist[rip]
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 32[rax], rdx
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 24[rax], 0
	mov	rax, QWORD PTR -24[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	rdx, QWORD PTR -24[rbp]
	mov	QWORD PTR 24[rax], rdx
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR evlist[rip], rax
	jmp	.L89
.L88:
	mov	rax, QWORD PTR -24[rbp]
	mov	rdx, QWORD PTR -16[rbp]
	mov	QWORD PTR 32[rax], rdx
	mov	rax, QWORD PTR -16[rbp]
	mov	rdx, QWORD PTR 24[rax]
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR 24[rax], rdx
	mov	rax, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR 24[rax]
	mov	rdx, QWORD PTR -24[rbp]
	mov	QWORD PTR 32[rax], rdx
	mov	rax, QWORD PTR -16[rbp]
	mov	rdx, QWORD PTR -24[rbp]
	mov	QWORD PTR 24[rax], rdx
.L89:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE22:
	.size	insertevent, .-insertevent
	.section	.rodata
	.align 8
.LC50:
	.string	"--------------\nEvent List Follows:"
	.align 8
.LC51:
	.string	"Event time: %f, type: %d entity: %d\n"
.LC52:
	.string	"--------------"
	.text
	.globl	printevlist
	.type	printevlist, @function
printevlist:
.LFB23:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	lea	rdi, .LC50[rip]
	call	puts@PLT
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -8[rbp], rax
	jmp	.L91
.L92:
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, DWORD PTR 8[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	ecx, DWORD PTR 4[rax]
	mov	rax, QWORD PTR -8[rbp]
	movss	xmm0, DWORD PTR [rax]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	mov	esi, ecx
	movq	xmm0, rax
	lea	rdi, .LC51[rip]
	mov	eax, 1
	call	printf@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR -8[rbp], rax
.L91:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L92
	lea	rdi, .LC52[rip]
	call	puts@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE23:
	.size	printevlist, .-printevlist
	.section	.rodata
	.align 8
.LC53:
	.string	"          STOP TIMER: stopping timer at %f\n"
	.align 8
.LC54:
	.string	"Warning: unable to cancel your timer. It wasn't running."
	.text
	.globl	stoptimer
	.type	stoptimer, @function
stoptimer:
.LFB24:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L94
	movss	xmm0, DWORD PTR time[rip]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	movq	xmm0, rax
	lea	rdi, .LC53[rip]
	mov	eax, 1
	call	printf@PLT
.L94:
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -8[rbp], rax
	jmp	.L95
.L102:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR 4[rax]
	test	eax, eax
	jne	.L96
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR 8[rax]
	cmp	DWORD PTR -20[rbp], eax
	jne	.L96
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	test	rax, rax
	jne	.L97
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 24[rax]
	test	rax, rax
	jne	.L97
	mov	QWORD PTR evlist[rip], 0
	jmp	.L98
.L97:
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	test	rax, rax
	jne	.L99
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 24[rax]
	mov	QWORD PTR 32[rax], 0
	jmp	.L98
.L99:
	mov	rax, QWORD PTR evlist[rip]
	cmp	QWORD PTR -8[rbp], rax
	jne	.L100
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR 24[rax], 0
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR evlist[rip], rax
	jmp	.L98
.L100:
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	rdx, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR 24[rdx]
	mov	QWORD PTR 24[rax], rdx
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 24[rax]
	mov	rdx, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR 32[rdx]
	mov	QWORD PTR 32[rax], rdx
.L98:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	jmp	.L93
.L96:
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR -8[rbp], rax
.L95:
	cmp	QWORD PTR -8[rbp], 0
	jne	.L102
	lea	rdi, .LC54[rip]
	call	puts@PLT
.L93:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE24:
	.size	stoptimer, .-stoptimer
	.section	.rodata
	.align 8
.LC55:
	.string	"          START TIMER: starting timer at %f\n"
	.align 8
.LC56:
	.string	"Warning: attempt to start a timer that is already started"
	.text
	.globl	starttimer
	.type	starttimer, @function
starttimer:
.LFB25:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	movss	DWORD PTR -24[rbp], xmm0
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L104
	movss	xmm0, DWORD PTR time[rip]
	pxor	xmm1, xmm1
	cvtss2sd	xmm1, xmm0
	movq	rax, xmm1
	movq	xmm0, rax
	lea	rdi, .LC55[rip]
	mov	eax, 1
	call	printf@PLT
.L104:
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -16[rbp], rax
	jmp	.L105
.L108:
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 4[rax]
	test	eax, eax
	jne	.L106
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR 8[rax]
	cmp	DWORD PTR -20[rbp], eax
	jne	.L106
	lea	rdi, .LC56[rip]
	call	puts@PLT
	jmp	.L103
.L106:
	mov	rax, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR -16[rbp], rax
.L105:
	cmp	QWORD PTR -16[rbp], 0
	jne	.L108
	mov	edi, 40
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	movss	xmm0, DWORD PTR time[rip]
	addss	xmm0, DWORD PTR -24[rbp]
	mov	rax, QWORD PTR -8[rbp]
	movss	DWORD PTR [rax], xmm0
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR 4[rax], 0
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, DWORD PTR -20[rbp]
	mov	DWORD PTR 8[rax], edx
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	insertevent
.L103:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE25:
	.size	starttimer, .-starttimer
	.section	.rodata
	.align 8
.LC57:
	.string	"          TOLAYER3: packet being lost"
	.align 8
.LC58:
	.string	"          TOLAYER3: seq: %d, ack %d, check: %d "
	.align 8
.LC62:
	.string	"          TOLAYER3: packet being corrupted"
	.align 8
.LC63:
	.string	"          TOLAYER3: scheduling arrival on other side"
	.text
	.globl	tolayer3
	.type	tolayer3, @function
tolayer3:
.LFB26:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	DWORD PTR -52[rbp], edi
	mov	eax, DWORD PTR ntolayer3[rip]
	add	eax, 1
	mov	DWORD PTR ntolayer3[rip], eax
	call	jimsrand
	movss	xmm1, DWORD PTR lossprob[rip]
	comiss	xmm1, xmm0
	jbe	.L134
	mov	eax, DWORD PTR nlost[rip]
	add	eax, 1
	mov	DWORD PTR nlost[rip], eax
	mov	eax, DWORD PTR TRACE[rip]
	test	eax, eax
	jle	.L137
	lea	rdi, .LC57[rip]
	call	puts@PLT
	jmp	.L137
.L134:
	mov	edi, 32
	call	malloc@PLT
	mov	QWORD PTR -16[rbp], rax
	mov	edx, DWORD PTR 16[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR [rax], edx
	mov	edx, DWORD PTR 20[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 4[rax], edx
	mov	edx, DWORD PTR 24[rbp]
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 8[rax], edx
	mov	DWORD PTR -32[rbp], 0
	jmp	.L114
.L115:
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	movzx	ecx, BYTE PTR 28[rbp+rax]
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	mov	BYTE PTR 12[rdx+rax], cl
	add	DWORD PTR -32[rbp], 1
.L114:
	cmp	DWORD PTR -32[rbp], 19
	jle	.L115
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L116
	mov	rax, QWORD PTR -16[rbp]
	mov	ecx, DWORD PTR 8[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR 4[rax]
	mov	rax, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC58[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -32[rbp], 0
	jmp	.L117
.L118:
	mov	rdx, QWORD PTR -16[rbp]
	mov	eax, DWORD PTR -32[rbp]
	cdqe
	movzx	eax, BYTE PTR 12[rdx+rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	add	DWORD PTR -32[rbp], 1
.L117:
	cmp	DWORD PTR -32[rbp], 19
	jle	.L118
	mov	edi, 10
	call	putchar@PLT
.L116:
	mov	edi, 40
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR 4[rax], 2
	mov	eax, DWORD PTR -52[rbp]
	add	eax, 1
	cdq
	shr	edx, 31
	add	eax, edx
	and	eax, 1
	sub	eax, edx
	mov	edx, eax
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR 8[rax], edx
	mov	rax, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR -16[rbp]
	mov	QWORD PTR 16[rax], rdx
	movss	xmm0, DWORD PTR time[rip]
	movss	DWORD PTR -36[rbp], xmm0
	mov	rax, QWORD PTR evlist[rip]
	mov	QWORD PTR -24[rbp], rax
	jmp	.L119
.L121:
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR 4[rax]
	cmp	eax, 2
	jne	.L120
	mov	rax, QWORD PTR -24[rbp]
	mov	edx, DWORD PTR 8[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR 8[rax]
	cmp	edx, eax
	jne	.L120
	mov	rax, QWORD PTR -24[rbp]
	movss	xmm0, DWORD PTR [rax]
	movss	DWORD PTR -36[rbp], xmm0
.L120:
	mov	rax, QWORD PTR -24[rbp]
	mov	rax, QWORD PTR 32[rax]
	mov	QWORD PTR -24[rbp], rax
.L119:
	cmp	QWORD PTR -24[rbp], 0
	jne	.L121
	movss	xmm1, DWORD PTR -36[rbp]
	movss	xmm0, DWORD PTR .LC59[rip]
	addss	xmm1, xmm0
	movss	DWORD PTR -56[rbp], xmm1
	call	jimsrand
	movss	xmm1, DWORD PTR .LC60[rip]
	mulss	xmm0, xmm1
	addss	xmm0, DWORD PTR -56[rbp]
	mov	rax, QWORD PTR -8[rbp]
	movss	DWORD PTR [rax], xmm0
	call	jimsrand
	movss	xmm1, DWORD PTR corruptprob[rip]
	comiss	xmm1, xmm0
	jbe	.L122
	mov	eax, DWORD PTR ncorrupt[rip]
	add	eax, 1
	mov	DWORD PTR ncorrupt[rip], eax
	call	jimsrand
	movd	eax, xmm0
	mov	DWORD PTR -28[rbp], eax
	movss	xmm0, DWORD PTR .LC42[rip]
	comiss	xmm0, DWORD PTR -28[rbp]
	jbe	.L135
	mov	rax, QWORD PTR -16[rbp]
	mov	BYTE PTR 12[rax], 90
	jmp	.L126
.L135:
	movss	xmm0, DWORD PTR .LC61[rip]
	comiss	xmm0, DWORD PTR -28[rbp]
	jbe	.L136
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR [rax], 999999
	jmp	.L126
.L136:
	mov	rax, QWORD PTR -16[rbp]
	mov	DWORD PTR 4[rax], 999999
.L126:
	mov	eax, DWORD PTR TRACE[rip]
	test	eax, eax
	jle	.L122
	lea	rdi, .LC62[rip]
	call	puts@PLT
.L122:
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L129
	lea	rdi, .LC63[rip]
	call	puts@PLT
.L129:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	insertevent
	jmp	.L109
.L137:
	nop
.L109:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE26:
	.size	tolayer3, .-tolayer3
	.section	.rodata
	.align 8
.LC64:
	.string	"          TOLAYER5: data received: "
	.text
	.globl	tolayer5
	.type	tolayer5, @function
tolayer5:
.LFB27:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	eax, DWORD PTR TRACE[rip]
	cmp	eax, 2
	jle	.L142
	lea	rdi, .LC64[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -4[rbp], 0
	jmp	.L140
.L141:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	add	DWORD PTR -4[rbp], 1
.L140:
	cmp	DWORD PTR -4[rbp], 19
	jle	.L141
	mov	edi, 10
	call	putchar@PLT
.L142:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE27:
	.size	tolayer5, .-tolayer5
	.section	.rodata
	.align 4
.LC17:
	.long	1097859072
	.align 4
.LC40:
	.long	1148846080
	.align 4
.LC41:
	.long	1048576000
	.align 4
.LC42:
	.long	1061158912
	.align 8
.LC46:
	.long	-4194304
	.long	1105199103
	.align 4
.LC59:
	.long	1065353216
	.align 4
.LC60:
	.long	1091567616
	.align 4
.LC61:
	.long	1063256064
	.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	"1004386.c"
	.text
	.global	nsimmax
	.bss
	.align	2
	.type	nsimmax, %object
	.size	nsimmax, 4
nsimmax:
	.space	4
	.comm	A,2072,4
	.comm	B,4,4
	.text
	.align	2
	.global	getCheckSum
	.syntax unified
	.arm
	.fpu softvfp
	.type	getCheckSum, %function
getCheckSum:
	@ args = 32, pretend = 16, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	sub	sp, sp, #16
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	add	ip, fp, #4
	stm	ip, {r0, r1, r2, r3}
	mov	r3, #0
	str	r3, [fp, #-12]
	ldr	r3, [fp, #4]
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	ldr	r3, [fp, #8]
	ldr	r2, [fp, #-12]
	add	r3, r2, r3
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L3:
	add	r2, fp, #16
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r3
	ldr	r3, [fp, #-12]
	add	r3, r3, r2
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #19
	ble	.L3
	ldr	r3, [fp, #-12]
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	add	sp, sp, #16
	bx	lr
	.size	getCheckSum, .-getCheckSum
	.section	.rodata
	.align	2
.LC0:
	.ascii	"A_output: sent packet (seq=%d): %s\012\000"
	.align	2
.LC1:
	.ascii	"  A_output: start timer for seq=%d\012\000"
	.align	2
.LC2:
	.ascii	"  A_output: A.send_base: %d, A.next_seq: %d\012\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	send_buffer
	.syntax unified
	.arm
	.fpu softvfp
	.type	send_buffer, %function
send_buffer:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #64
	ldr	r3, .L12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	b	.L6
.L9:
	ldr	r3, .L12+4
	ldr	r3, [r3, #4]
	rsbs	r2, r3, #0
	and	r3, r3, #63
	and	r2, r2, #63
	rsbpl	r3, r2, #0
	ldr	r2, .L12+4
	lsl	r3, r3, #5
	add	r3, r2, r3
	sub	ip, fp, #40
	add	lr, r3, #16
	ldmia	lr!, {r0, r1, r2, r3}
	stmia	ip!, {r0, r1, r2, r3}
	ldm	lr, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	ldr	r1, [fp, #-40]
	sub	r3, fp, #40
	add	r3, r3, #12
	mov	r2, r3
	ldr	r0, .L12+8
	bl	printf
	mov	lr, sp
	sub	ip, fp, #28
	ldmia	ip!, {r0, r1, r2, r3}
	stmia	lr!, {r0, r1, r2, r3}
	ldr	r3, [ip]
	str	r3, [lr]
	sub	r3, fp, #40
	ldm	r3, {r1, r2, r3}
	mov	r0, #0
	bl	tolayer3
	ldr	r3, .L12+4
	ldr	r2, [r3, #4]
	ldr	r3, .L12+4
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L7
	ldr	r3, .L12+4
	ldr	r3, [r3, #2064]	@ float
	mov	r1, r3
	mov	r0, #0
	bl	starttimer
	ldr	r3, .L12+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L12+12
	bl	printf
.L7:
	ldr	r3, .L12+4
	ldr	r3, [r3, #4]
	add	r3, r3, #1
	ldr	r2, .L12+4
	str	r3, [r2, #4]
	ldr	r3, .L12+4
	ldr	r3, [r3]
	ldr	r2, .L12+4
	ldr	r2, [r2, #4]
	mov	r1, r3
	ldr	r0, .L12+16
	bl	printf
.L6:
	ldr	r3, .L12+4
	ldr	r2, [r3, #4]
	ldr	r3, .L12+4
	ldr	r3, [r3, #8]
	cmp	r2, r3
	bge	.L11
	ldr	r3, .L12+4
	ldr	r2, [r3, #4]
	ldr	r3, .L12+4
	ldr	r1, [r3]
	ldr	r3, .L12+4
	ldr	r3, [r3, #12]
	add	r3, r1, r3
	cmp	r2, r3
	blt	.L9
.L11:
	nop
	ldr	r3, .L12
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L10
	bl	__stack_chk_fail
.L10:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	.LC3
	.word	A
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	send_buffer, .-send_buffer
	.section	.rodata
	.align	2
.LC4:
	.ascii	"  A_output: Wrong seq number in GBN, aborted\000"
	.align	2
.LC5:
	.ascii	"  A_output: buffer full. drop the message: %s\012\000"
	.align	2
.LC6:
	.ascii	"  A_output: bufferred packet (seq=%d): %s\012\000"
	.align	2
.LC7:
	.ascii	"A buffer_next: %d\012\000"
	.text
	.align	2
	.global	A_output
	.syntax unified
	.arm
	.fpu softvfp
	.type	A_output, %function
A_output:
	@ args = 20, pretend = 16, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	sub	sp, sp, #16
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	add	ip, fp, #4
	stm	ip, {r0, r1, r2, r3}
	ldr	r3, .L18
	ldr	r2, [r3, #8]
	ldr	r3, .L18
	ldr	r3, [r3]
	cmp	r2, r3
	bge	.L15
	ldr	r0, .L18+4
	bl	printf
	b	.L14
.L15:
	ldr	r3, .L18
	ldr	r3, [r3]
	add	r2, r3, #63
	ldr	r3, .L18
	ldr	r3, [r3, #8]
	cmp	r2, r3
	bge	.L17
	add	r3, fp, #4
	mov	r1, r3
	ldr	r0, .L18+8
	bl	printf
	b	.L14
.L17:
	ldr	r3, .L18
	ldr	r3, [r3, #8]
	add	r2, fp, #4
	mov	r1, r3
	ldr	r0, .L18+12
	bl	printf
	ldr	r3, .L18
	ldr	r3, [r3, #8]
	rsbs	r2, r3, #0
	and	r3, r3, #63
	and	r2, r2, #63
	rsbpl	r3, r2, #0
	lsl	r3, r3, #5
	add	r3, r3, #16
	ldr	r2, .L18
	add	r3, r3, r2
	str	r3, [fp, #-8]
	ldr	r3, .L18
	ldr	r2, [r3, #8]
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #12
	mov	r2, #20
	add	r1, fp, #4
	mov	r0, r3
	bl	memmove
	ldr	ip, [fp, #-8]
	mov	lr, sp
	add	r3, ip, #16
	ldm	r3, {r0, r1, r2, r3}
	stm	lr, {r0, r1, r2, r3}
	ldm	ip, {r0, r1, r2, r3}
	bl	getCheckSum
	mov	r2, r0
	ldr	r3, [fp, #-8]
	str	r2, [r3, #8]
	ldr	r3, .L18
	ldr	r3, [r3, #8]
	add	r3, r3, #1
	ldr	r2, .L18
	str	r3, [r2, #8]
	ldr	r3, .L18
	ldr	r3, [r3, #8]
	mov	r1, r3
	ldr	r0, .L18+16
	bl	printf
	bl	send_buffer
.L14:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, lr}
	add	sp, sp, #16
	bx	lr
.L19:
	.align	2
.L18:
	.word	A
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	A_output, .-A_output
	.section	.rodata
	.align	2
.LC8:
	.ascii	"  B_output: USED only when bi-directional.\000"
	.text
	.align	2
	.global	B_output
	.syntax unified
	.arm
	.fpu softvfp
	.type	B_output, %function
B_output:
	@ args = 20, pretend = 16, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	sub	sp, sp, #16
	push	{fp, lr}
	add	fp, sp, #4
	add	ip, fp, #4
	stm	ip, {r0, r1, r2, r3}
	ldr	r0, .L21
	bl	puts
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, lr}
	add	sp, sp, #16
	bx	lr
.L22:
	.align	2
.L21:
	.word	.LC8
	.size	B_output, .-B_output
	.section	.rodata
	.align	2
.LC9:
	.ascii	"  A_timerinterrupt: resend packet (seq=%d): %s\012\000"
	.align	2
.LC10:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	retransmit_pkt
	.syntax unified
	.arm
	.fpu softvfp
	.type	retransmit_pkt, %function
retransmit_pkt:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #64
	ldr	r3, .L27
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L27+4
	ldr	r3, [r3]
	str	r3, [fp, #-44]
	b	.L24
.L25:
	ldr	r3, [fp, #-44]
	rsbs	r2, r3, #0
	and	r3, r3, #63
	and	r2, r2, #63
	rsbpl	r3, r2, #0
	ldr	r2, .L27+4
	lsl	r3, r3, #5
	add	r3, r2, r3
	sub	ip, fp, #40
	add	lr, r3, #16
	ldmia	lr!, {r0, r1, r2, r3}
	stmia	ip!, {r0, r1, r2, r3}
	ldm	lr, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	ldr	r1, [fp, #-40]
	sub	r3, fp, #40
	add	r3, r3, #12
	mov	r2, r3
	ldr	r0, .L27+8
	bl	printf
	mov	lr, sp
	sub	ip, fp, #28
	ldmia	ip!, {r0, r1, r2, r3}
	stmia	lr!, {r0, r1, r2, r3}
	ldr	r3, [ip]
	str	r3, [lr]
	sub	r3, fp, #40
	ldm	r3, {r1, r2, r3}
	mov	r0, #0
	bl	tolayer3
	ldr	r3, [fp, #-44]
	add	r3, r3, #1
	str	r3, [fp, #-44]
.L24:
	ldr	r3, .L27+4
	ldr	r3, [r3, #4]
	ldr	r2, [fp, #-44]
	cmp	r2, r3
	blt	.L25
	nop
	ldr	r3, .L27
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L26
	bl	__stack_chk_fail
.L26:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L28:
	.align	2
.L27:
	.word	.LC10
	.word	A
	.word	.LC9
	.size	retransmit_pkt, .-retransmit_pkt
	.section	.rodata
	.align	2
.LC11:
	.ascii	"  A_input: corrupted NAK(ack=%d) drop packet.\012\000"
	.align	2
.LC12:
	.ascii	"  A_input: duplicated ACK(ack=%d), drop packet.\012"
	.ascii	"\000"
	.align	2
.LC13:
	.ascii	"A_input: fast retransmit ACK(ack=%d) \012\000"
	.align	2
.LC14:
	.ascii	"A_input: ACKed(ack=%d) from B.\012\000"
	.align	2
.LC15:
	.ascii	"  A.send_base: %d, A.next_seq: %d\012\000"
	.align	2
.LC16:
	.ascii	"  A_input: stop timer\000"
	.global	__aeabi_f2d
	.align	2
.LC17:
	.ascii	"  A_input: restart timer + %f\012\000"
	.text
	.align	2
	.global	A_input
	.syntax unified
	.arm
	.fpu softvfp
	.type	A_input, %function
A_input:
	@ args = 32, pretend = 16, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	sub	sp, sp, #16
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #20
	add	ip, fp, #4
	stm	ip, {r0, r1, r2, r3}
	ldr	r4, [fp, #12]
	mov	ip, sp
	add	r3, fp, #20
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	add	r3, fp, #4
	ldm	r3, {r0, r1, r2, r3}
	bl	getCheckSum
	mov	r3, r0
	cmp	r4, r3
	beq	.L30
	ldr	r3, [fp, #8]
	mov	r1, r3
	ldr	r0, .L37
	bl	printf
	b	.L29
.L30:
	ldr	r2, [fp, #8]
	ldr	r3, .L37+4
	ldr	r3, [r3]
	cmp	r2, r3
	bge	.L32
	ldr	r3, .L37+4
	ldr	r2, [r3]
	ldr	r3, .L37+8
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L36
	ldr	r3, [fp, #8]
	mov	r1, r3
	ldr	r0, .L37+12
	bl	printf
	ldr	r3, .L37+4
	ldr	r3, [r3, #2068]
	cmp	r3, #3
	bne	.L34
	ldr	r3, [fp, #8]
	mov	r1, r3
	ldr	r0, .L37+16
	bl	printf
	bl	retransmit_pkt
	ldr	r3, .L37+4
	mov	r2, #0
	str	r2, [r3, #2068]
.L34:
	ldr	r3, .L37+4
	ldr	r3, [r3, #2068]
	add	r3, r3, #1
	ldr	r2, .L37+4
	str	r3, [r2, #2068]
	b	.L29
.L32:
	ldr	r3, [fp, #8]
	mov	r1, r3
	ldr	r0, .L37+20
	bl	printf
	ldr	r3, [fp, #8]
	add	r3, r3, #1
	ldr	r2, .L37+4
	str	r3, [r2]
	ldr	r3, .L37+4
	ldr	r3, [r3]
	ldr	r2, .L37+4
	ldr	r2, [r2, #4]
	mov	r1, r3
	ldr	r0, .L37+24
	bl	printf
	mov	r0, #0
	bl	stoptimer
	ldr	r3, .L37+4
	ldr	r2, [r3]
	ldr	r3, .L37+4
	ldr	r3, [r3, #4]
	cmp	r2, r3
	bne	.L35
	ldr	r0, .L37+28
	bl	puts
	bl	send_buffer
	b	.L29
.L35:
	ldr	r3, .L37+4
	ldr	r3, [r3, #2064]	@ float
	mov	r1, r3
	mov	r0, #0
	bl	starttimer
	ldr	r3, .L37+4
	ldr	r3, [r3, #2064]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L37+32
	bl	printf
	b	.L29
.L36:
	nop
.L29:
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, lr}
	add	sp, sp, #16
	bx	lr
.L38:
	.align	2
.L37:
	.word	.LC11
	.word	A
	.word	nsimmax
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.size	A_input, .-A_input
	.section	.rodata
	.align	2
.LC18:
	.ascii	"  A_timerinterrupt: restart timer + %f\012\000"
	.text
	.align	2
	.global	A_timerinterrupt
	.syntax unified
	.arm
	.fpu softvfp
	.type	A_timerinterrupt, %function
A_timerinterrupt:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	bl	retransmit_pkt
	ldr	r3, .L40
	ldr	r3, [r3, #2064]	@ float
	mov	r1, r3
	mov	r0, #0
	bl	starttimer
	ldr	r3, .L40
	ldr	r3, [r3, #2064]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L40+4
	bl	printf
	nop
	pop	{fp, pc}
.L41:
	.align	2
.L40:
	.word	A
	.word	.LC18
	.size	A_timerinterrupt, .-A_timerinterrupt
	.align	2
	.global	A_init
	.syntax unified
	.arm
	.fpu softvfp
	.type	A_init, %function
A_init:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L43
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L43
	mov	r2, #0
	str	r2, [r3, #4]
	ldr	r3, .L43
	mov	r2, #0
	str	r2, [r3, #8]
	ldr	r3, .L43
	ldr	r2, .L43+4
	str	r2, [r3, #2064]	@ float
	ldr	r3, .L43
	mov	r2, #8
	str	r2, [r3, #12]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L44:
	.align	2
.L43:
	.word	A
	.word	1097859072
	.size	A_init, .-A_init
	.section	.rodata
	.align	2
.LC19:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	send_ack
	.syntax unified
	.arm
	.fpu softvfp
	.type	send_ack, %function
send_ack:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #72
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	ldr	r3, .L47
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-52]
	str	r3, [fp, #-36]
	mov	ip, sp
	sub	r3, fp, #24
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	sub	r3, fp, #40
	ldm	r3, {r0, r1, r2, r3}
	bl	getCheckSum
	mov	r3, r0
	str	r3, [fp, #-32]
	mov	lr, sp
	sub	ip, fp, #28
	ldmia	ip!, {r0, r1, r2, r3}
	stmia	lr!, {r0, r1, r2, r3}
	ldr	r3, [ip]
	str	r3, [lr]
	sub	r3, fp, #40
	ldm	r3, {r1, r2, r3}
	ldr	r0, [fp, #-48]
	bl	tolayer3
	nop
	ldr	r3, .L47
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L46
	bl	__stack_chk_fail
.L46:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L48:
	.align	2
.L47:
	.word	.LC19
	.size	send_ack, .-send_ack
	.section	.rodata
	.align	2
.LC20:
	.ascii	"  B_input: packet from A is corrupted, send NAK(ack"
	.ascii	"=%d)\012\000"
	.align	2
.LC21:
	.ascii	"  B_input: packet seq:%d, send duplicated ACK(ack=%"
	.ascii	"d)\012\000"
	.align	2
.LC22:
	.ascii	"  B_input: recv packet (seq=%d): %s\012\000"
	.align	2
.LC23:
	.ascii	"  B_input: send ACK(ack=%d)\012\000"
	.text
	.align	2
	.global	B_input
	.syntax unified
	.arm
	.fpu softvfp
	.type	B_input, %function
B_input:
	@ args = 32, pretend = 16, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	sub	sp, sp, #16
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #20
	add	ip, fp, #4
	stm	ip, {r0, r1, r2, r3}
	ldr	r4, [fp, #12]
	mov	ip, sp
	add	r3, fp, #20
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	add	r3, fp, #4
	ldm	r3, {r0, r1, r2, r3}
	bl	getCheckSum
	mov	r3, r0
	cmp	r4, r3
	beq	.L50
	ldr	r3, .L53
	ldr	r3, [r3]
	sub	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L53+4
	bl	printf
	ldr	r3, .L53
	ldr	r3, [r3]
	sub	r3, r3, #1
	mov	r1, r3
	mov	r0, #1
	bl	send_ack
	b	.L49
.L50:
	ldr	r2, [fp, #4]
	ldr	r3, .L53
	ldr	r3, [r3]
	cmp	r2, r3
	beq	.L52
	ldr	r1, [fp, #4]
	ldr	r3, .L53
	ldr	r3, [r3]
	sub	r3, r3, #1
	mov	r2, r3
	ldr	r0, .L53+8
	bl	printf
	ldr	r3, .L53
	ldr	r3, [r3]
	sub	r3, r3, #1
	mov	r1, r3
	mov	r0, #1
	bl	send_ack
	b	.L49
.L52:
	ldr	r3, [fp, #4]
	add	r2, fp, #16
	mov	r1, r3
	ldr	r0, .L53+12
	bl	printf
	ldr	r3, .L53
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L53+16
	bl	printf
	ldr	r3, .L53
	ldr	r3, [r3]
	mov	r1, r3
	mov	r0, #1
	bl	send_ack
	add	r3, fp, #16
	mov	r1, r3
	mov	r0, #1
	bl	tolayer5
	ldr	r3, .L53
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L53
	str	r3, [r2]
.L49:
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, lr}
	add	sp, sp, #16
	bx	lr
.L54:
	.align	2
.L53:
	.word	B
	.word	.LC20
	.word	.LC21
	.word	.LC22
	.word	.LC23
	.size	B_input, .-B_input
	.section	.rodata
	.align	2
.LC24:
	.ascii	"B_timerinterrupt: USED only when bi-directional.\000"
	.text
	.align	2
	.global	B_timerinterrupt
	.syntax unified
	.arm
	.fpu softvfp
	.type	B_timerinterrupt, %function
B_timerinterrupt:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L56
	bl	puts
	nop
	pop	{fp, pc}
.L57:
	.align	2
.L56:
	.word	.LC24
	.size	B_timerinterrupt, .-B_timerinterrupt
	.align	2
	.global	B_init
	.syntax unified
	.arm
	.fpu softvfp
	.type	B_init, %function
B_init:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L59
	mov	r2, #0
	str	r2, [r3]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L60:
	.align	2
.L59:
	.word	B
	.size	B_init, .-B_init
	.global	evlist
	.bss
	.align	2
	.type	evlist, %object
	.size	evlist, 4
evlist:
	.space	4
	.global	TRACE
	.data
	.align	2
	.type	TRACE, %object
	.size	TRACE, 4
TRACE:
	.word	1
	.global	nsim
	.bss
	.align	2
	.type	nsim, %object
	.size	nsim, 4
nsim:
	.space	4
	.global	time
	.align	2
	.type	time, %object
	.size	time, 4
time:
	.space	4
	.comm	lossprob,4,4
	.comm	corruptprob,4,4
	.comm	lambda,4,4
	.comm	ntolayer3,4,4
	.comm	nlost,4,4
	.comm	ncorrupt,4,4
	.section	.rodata
	.align	2
.LC25:
	.ascii	"\012EVENT time: %f,\000"
	.align	2
.LC26:
	.ascii	"  type: %d\000"
	.align	2
.LC27:
	.ascii	", timerinterrupt  \000"
	.align	2
.LC28:
	.ascii	", fromlayer5 \000"
	.align	2
.LC29:
	.ascii	", fromlayer3 \000"
	.align	2
.LC30:
	.ascii	" entity: %d\012\000"
	.align	2
.LC31:
	.ascii	"          MAINLOOP: data given to student: \000"
	.align	2
.LC32:
	.ascii	"INTERNAL PANIC: unknown event type \000"
	.align	2
.LC33:
	.ascii	" Simulator terminated at time %f\012 after sending "
	.ascii	"%d msgs from layer5\012\000"
	.align	2
.LC34:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 80
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #96
	str	r0, [fp, #-80]
	str	r1, [fp, #-84]
	ldr	r3, .L90
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r1, [fp, #-84]
	ldr	r0, [fp, #-80]
	bl	init
	bl	A_init
	bl	B_init
.L85:
	ldr	r3, .L90+4
	ldr	r3, [r3]
	str	r3, [fp, #-68]
	ldr	r3, [fp, #-68]
	cmp	r3, #0
	beq	.L89
	ldr	r3, .L90+4
	ldr	r3, [r3]
	ldr	r3, [r3, #20]
	ldr	r2, .L90+4
	str	r3, [r2]
	ldr	r3, .L90+4
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L64
	ldr	r3, .L90+4
	ldr	r3, [r3]
	mov	r2, #0
	str	r2, [r3, #16]
.L64:
	ldr	r3, .L90+8
	ldr	r3, [r3]
	cmp	r3, #1
	ble	.L65
	ldr	r3, [fp, #-68]
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L90+12
	bl	printf
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	mov	r1, r3
	ldr	r0, .L90+16
	bl	printf
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	cmp	r3, #0
	bne	.L66
	ldr	r0, .L90+20
	bl	printf
	b	.L67
.L66:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	cmp	r3, #1
	bne	.L68
	ldr	r0, .L90+24
	bl	printf
	b	.L67
.L68:
	ldr	r0, .L90+28
	bl	printf
.L67:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #8]
	mov	r1, r3
	ldr	r0, .L90+32
	bl	printf
.L65:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3]	@ float
	ldr	r2, .L90+36
	str	r3, [r2]	@ float
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	cmp	r3, #1
	bne	.L69
	ldr	r3, .L90+40
	ldr	r2, [r3]
	ldr	r3, .L90+44
	ldr	r3, [r3]
	cmp	r2, r3
	bge	.L70
	ldr	r3, .L90+40
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r3, .L90+44
	ldr	r3, [r3]
	cmp	r2, r3
	bge	.L71
	bl	generate_next_arrival
.L71:
	ldr	r3, .L90+40
	ldr	r2, [r3]
	ldr	r3, .L90+48
	smull	r1, r3, r2, r3
	asr	r1, r3, #3
	asr	r3, r2, #31
	sub	r1, r1, r3
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	lsl	r3, r3, #2
	add	r3, r3, r1
	lsl	r3, r3, #1
	sub	r3, r2, r3
	str	r3, [fp, #-64]
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L72
.L73:
	ldr	r3, [fp, #-64]
	and	r3, r3, #255
	add	r3, r3, #97
	and	r1, r3, #255
	sub	r2, fp, #60
	ldr	r3, [fp, #-72]
	add	r3, r2, r3
	mov	r2, r1
	strb	r2, [r3]
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
.L72:
	ldr	r3, [fp, #-72]
	cmp	r3, #19
	ble	.L73
	mov	r3, #0
	strb	r3, [fp, #-41]
	ldr	r3, .L90+8
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L74
	ldr	r0, .L90+52
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L75
.L76:
	sub	r2, fp, #60
	ldr	r3, [fp, #-72]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
.L75:
	ldr	r3, [fp, #-72]
	cmp	r3, #19
	ble	.L76
	mov	r0, #10
	bl	putchar
.L74:
	ldr	r3, .L90+40
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L90+40
	str	r3, [r2]
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #8]
	cmp	r3, #0
	bne	.L77
	ldr	r3, [fp, #-44]
	str	r3, [sp]
	sub	r3, fp, #60
	ldm	r3, {r0, r1, r2, r3}
	bl	A_output
	b	.L70
.L77:
	ldr	r3, [fp, #-44]
	str	r3, [sp]
	sub	r3, fp, #60
	ldm	r3, {r0, r1, r2, r3}
	bl	B_output
	b	.L70
.L69:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	cmp	r3, #2
	bne	.L78
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #12]
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #12]
	ldr	r3, [r3, #4]
	str	r3, [fp, #-36]
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #12]
	ldr	r3, [r3, #8]
	str	r3, [fp, #-32]
	mov	r3, #0
	str	r3, [fp, #-72]
	b	.L79
.L80:
	ldr	r3, [fp, #-68]
	ldr	r2, [r3, #12]
	ldr	r3, [fp, #-72]
	add	r3, r2, r3
	add	r3, r3, #12
	ldrb	r1, [r3]	@ zero_extendqisi2
	sub	r2, fp, #28
	ldr	r3, [fp, #-72]
	add	r3, r2, r3
	mov	r2, r1
	strb	r2, [r3]
	ldr	r3, [fp, #-72]
	add	r3, r3, #1
	str	r3, [fp, #-72]
.L79:
	ldr	r3, [fp, #-72]
	cmp	r3, #19
	ble	.L80
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #8]
	cmp	r3, #0
	bne	.L81
	mov	ip, sp
	sub	r3, fp, #24
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	sub	r3, fp, #40
	ldm	r3, {r0, r1, r2, r3}
	bl	A_input
	b	.L82
.L81:
	mov	ip, sp
	sub	r3, fp, #24
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	sub	r3, fp, #40
	ldm	r3, {r0, r1, r2, r3}
	bl	B_input
.L82:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #12]
	mov	r0, r3
	bl	free
	b	.L70
.L78:
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #4]
	cmp	r3, #0
	bne	.L83
	ldr	r3, [fp, #-68]
	ldr	r3, [r3, #8]
	cmp	r3, #0
	bne	.L84
	bl	A_timerinterrupt
	b	.L70
.L84:
	bl	B_timerinterrupt
	b	.L70
.L83:
	ldr	r0, .L90+56
	bl	puts
.L70:
	ldr	r0, [fp, #-68]
	bl	free
	b	.L85
.L89:
	nop
.L63:
	ldr	r3, .L90+36
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r1, .L90+40
	ldr	r1, [r1]
	str	r1, [sp]
	ldr	r0, .L90+60
	bl	printf
	mov	r3, #0
	ldr	r2, .L90
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L87
	bl	__stack_chk_fail
.L87:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L91:
	.align	2
.L90:
	.word	.LC34
	.word	evlist
	.word	TRACE
	.word	.LC25
	.word	.LC26
	.word	.LC27
	.word	.LC28
	.word	.LC29
	.word	.LC30
	.word	time
	.word	nsim
	.word	nsimmax
	.word	1321528399
	.word	.LC31
	.word	.LC32
	.word	.LC33
	.size	main, .-main
	.section	.rodata
	.align	2
.LC35:
	.ascii	"usage: %s  num_sim  prob_loss  prob_corrupt  interv"
	.ascii	"al  debug_level\012\000"
	.global	__aeabi_d2f
	.align	2
.LC36:
	.ascii	"-----  Stop and Wait Network Simulator Version 1.1 "
	.ascii	"-------- \012\000"
	.align	2
.LC37:
	.ascii	"the number of messages to simulate: %d\012\000"
	.align	2
.LC38:
	.ascii	"packet loss probability: %f\012\000"
	.align	2
.LC39:
	.ascii	"packet corruption probability: %f\012\000"
	.align	2
.LC40:
	.ascii	"average time between messages from sender's layer5:"
	.ascii	" %f\012\000"
	.align	2
.LC41:
	.ascii	"TRACE: %d\012\000"
	.global	__aeabi_fadd
	.global	__aeabi_fdiv
	.global	__aeabi_fcmplt
	.global	__aeabi_fcmpgt
	.align	2
.LC42:
	.ascii	"It is likely that random number generation on your "
	.ascii	"machine\000"
	.align	2
.LC43:
	.ascii	"is different from what this emulator expects.  Plea"
	.ascii	"se take\000"
	.align	2
.LC44:
	.ascii	"a look at the routine jimsrand() in the emulator co"
	.ascii	"de. Sorry. \000"
	.text
	.align	2
	.global	init
	.syntax unified
	.arm
	.fpu softvfp
	.type	init, %function
init:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, [fp, #-24]
	cmp	r3, #6
	beq	.L93
	ldr	r3, [fp, #-28]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L100
	bl	printf
	mov	r0, #1
	bl	exit
.L93:
	ldr	r3, [fp, #-28]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L100+4
	str	r3, [r2]
	ldr	r3, [fp, #-28]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r0, r3
	bl	atof
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2f
	mov	r3, r0
	ldr	r2, .L100+8
	str	r3, [r2]	@ float
	ldr	r3, [fp, #-28]
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r0, r3
	bl	atof
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2f
	mov	r3, r0
	ldr	r2, .L100+12
	str	r3, [r2]	@ float
	ldr	r3, [fp, #-28]
	add	r3, r3, #16
	ldr	r3, [r3]
	mov	r0, r3
	bl	atof
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2f
	mov	r3, r0
	ldr	r2, .L100+16
	str	r3, [r2]	@ float
	ldr	r3, [fp, #-28]
	add	r3, r3, #20
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L100+20
	str	r3, [r2]
	ldr	r0, .L100+24
	bl	puts
	ldr	r3, .L100+4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L100+28
	bl	printf
	ldr	r3, .L100+8
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L100+32
	bl	printf
	ldr	r3, .L100+12
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L100+36
	bl	printf
	ldr	r3, .L100+16
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L100+40
	bl	printf
	ldr	r3, .L100+20
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L100+44
	bl	printf
	ldr	r0, .L100+48
	bl	srand
	mov	r3, #0
	str	r3, [fp, #-12]	@ float
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L94
.L95:
	bl	jimsrand
	mov	r3, r0
	mov	r1, r3
	ldr	r0, [fp, #-12]	@ float
	bl	__aeabi_fadd
	mov	r3, r0
	str	r3, [fp, #-12]	@ float
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L94:
	ldr	r3, [fp, #-16]
	cmp	r3, #1000
	blt	.L95
	ldr	r1, .L100+52
	ldr	r0, [fp, #-12]	@ float
	bl	__aeabi_fdiv
	mov	r3, r0
	str	r3, [fp, #-8]	@ float
	mov	r1, #1048576000
	ldr	r0, [fp, #-8]	@ float
	bl	__aeabi_fcmplt
	mov	r3, r0
	cmp	r3, #0
	bne	.L96
	mov	r1, #1061158912
	ldr	r0, [fp, #-8]	@ float
	bl	__aeabi_fcmpgt
	mov	r3, r0
	cmp	r3, #0
	beq	.L99
.L96:
	ldr	r0, .L100+56
	bl	puts
	ldr	r0, .L100+60
	bl	puts
	ldr	r0, .L100+64
	bl	puts
	mov	r0, #1
	bl	exit
.L99:
	ldr	r3, .L100+68
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L100+72
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L100+76
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L100+80
	mov	r2, #0
	str	r2, [r3]	@ float
	bl	generate_next_arrival
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L101:
	.align	2
.L100:
	.word	.LC35
	.word	nsimmax
	.word	lossprob
	.word	corruptprob
	.word	lambda
	.word	TRACE
	.word	.LC36
	.word	.LC37
	.word	.LC38
	.word	.LC39
	.word	.LC40
	.word	.LC41
	.word	9999
	.word	1148846080
	.word	.LC42
	.word	.LC43
	.word	.LC44
	.word	ntolayer3
	.word	nlost
	.word	ncorrupt
	.word	time
	.size	init, .-init
	.global	__aeabi_i2d
	.global	__aeabi_ddiv
	.align	2
	.global	jimsrand
	.syntax unified
	.arm
	.fpu softvfp
	.type	jimsrand, %function
jimsrand:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r2, .L104
	ldr	r3, .L104+4
	str	r2, [fp, #-12]
	str	r3, [fp, #-8]
	bl	rand
	mov	r3, r0
	mov	r0, r3
	bl	__aeabi_i2d
	sub	r3, fp, #12
	ldmia	r3, {r2-r3}
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2f
	mov	r3, r0
	str	r3, [fp, #-16]	@ float
	ldr	r3, [fp, #-16]	@ float
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L105:
	.align	2
.L104:
	.word	-4194304
	.word	1105199103
	.size	jimsrand, .-jimsrand
	.section	.rodata
	.align	2
.LC45:
	.ascii	"          GENERATE NEXT ARRIVAL: creating new arriv"
	.ascii	"al\000"
	.global	__aeabi_fmul
	.global	__aeabi_dadd
	.text
	.align	2
	.global	generate_next_arrival
	.syntax unified
	.arm
	.fpu softvfp
	.type	generate_next_arrival, %function
generate_next_arrival:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r3, .L108
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L107
	ldr	r0, .L108+4
	bl	puts
.L107:
	bl	jimsrand
	mov	r2, r0
	ldr	r3, .L108+8
	ldr	r3, [r3]	@ float
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_fmul
	mov	r3, r0
	mov	r1, r3
	mov	r0, r3
	bl	__aeabi_fadd
	mov	r3, r0
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-12]
	str	r3, [fp, #-8]
	mov	r0, #24
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-16]
	ldr	r3, .L108+12
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	sub	r3, fp, #12
	ldmia	r3, {r2-r3}
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2f
	mov	r2, r0
	ldr	r3, [fp, #-16]
	str	r2, [r3]	@ float
	ldr	r3, [fp, #-16]
	mov	r2, #1
	str	r2, [r3, #4]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #8]
	ldr	r0, [fp, #-16]
	bl	insertevent
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L109:
	.align	2
.L108:
	.word	TRACE
	.word	.LC45
	.word	lambda
	.word	time
	.size	generate_next_arrival, .-generate_next_arrival
	.section	.rodata
	.align	2
.LC46:
	.ascii	"            INSERTEVENT: time is %lf\012\000"
	.align	2
.LC47:
	.ascii	"            INSERTEVENT: future time will be %lf\012"
	.ascii	"\000"
	.text
	.align	2
	.global	insertevent
	.syntax unified
	.arm
	.fpu softvfp
	.type	insertevent, %function
insertevent:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	ldr	r3, .L120
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L111
	ldr	r3, .L120+4
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L120+8
	bl	printf
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L120+12
	bl	printf
.L111:
	ldr	r3, .L120+16
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L112
	ldr	r2, .L120+16
	ldr	r3, [fp, #-16]
	str	r3, [r2]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #20]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #16]
	b	.L119
.L112:
	ldr	r3, [fp, #-12]
	str	r3, [fp, #-8]
	b	.L114
.L116:
	ldr	r3, [fp, #-12]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3, #20]
	str	r3, [fp, #-12]
.L114:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L115
	ldr	r3, [fp, #-16]
	ldr	r2, [r3]	@ float
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]	@ float
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_fcmpgt
	mov	r3, r0
	cmp	r3, #0
	bne	.L116
.L115:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L117
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #20]
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-8]
	str	r2, [r3, #16]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #20]
	b	.L119
.L117:
	ldr	r3, .L120+16
	ldr	r3, [r3]
	ldr	r2, [fp, #-12]
	cmp	r2, r3
	bne	.L118
	ldr	r3, .L120+16
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	str	r2, [r3, #20]
	ldr	r3, [fp, #-16]
	mov	r2, #0
	str	r2, [r3, #16]
	ldr	r3, [fp, #-16]
	ldr	r3, [r3, #20]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #16]
	ldr	r2, .L120+16
	ldr	r3, [fp, #-16]
	str	r3, [r2]
	b	.L119
.L118:
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-12]
	str	r2, [r3, #20]
	ldr	r3, [fp, #-12]
	ldr	r2, [r3, #16]
	ldr	r3, [fp, #-16]
	str	r2, [r3, #16]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3, #16]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #20]
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #16]
.L119:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L121:
	.align	2
.L120:
	.word	TRACE
	.word	time
	.word	.LC46
	.word	.LC47
	.word	evlist
	.size	insertevent, .-insertevent
	.section	.rodata
	.align	2
.LC48:
	.ascii	"--------------\012Event List Follows:\000"
	.align	2
.LC49:
	.ascii	"Event time: %f, type: %d entity: %d\012\000"
	.align	2
.LC50:
	.ascii	"--------------\000"
	.text
	.align	2
	.global	printevlist
	.syntax unified
	.arm
	.fpu softvfp
	.type	printevlist, %function
printevlist:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r0, .L125
	bl	puts
	ldr	r3, .L125+4
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	b	.L123
.L124:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r1, [fp, #-8]
	ldr	r1, [r1, #4]
	ldr	r0, [fp, #-8]
	ldr	r0, [r0, #8]
	str	r0, [sp, #4]
	str	r1, [sp]
	ldr	r0, .L125+8
	bl	printf
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	str	r3, [fp, #-8]
.L123:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L124
	ldr	r0, .L125+12
	bl	puts
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L126:
	.align	2
.L125:
	.word	.LC48
	.word	evlist
	.word	.LC49
	.word	.LC50
	.size	printevlist, .-printevlist
	.section	.rodata
	.align	2
.LC51:
	.ascii	"          STOP TIMER: stopping timer at %f\012\000"
	.align	2
.LC52:
	.ascii	"Warning: unable to cancel your timer. It wasn't run"
	.ascii	"ning.\000"
	.text
	.align	2
	.global	stoptimer
	.syntax unified
	.arm
	.fpu softvfp
	.type	stoptimer, %function
stoptimer:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	ldr	r3, .L137
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L128
	ldr	r3, .L137+4
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L137+8
	bl	printf
.L128:
	ldr	r3, .L137+12
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	b	.L129
.L136:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #4]
	cmp	r3, #0
	bne	.L130
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #8]
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L130
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	cmp	r3, #0
	bne	.L131
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #16]
	cmp	r3, #0
	bne	.L131
	ldr	r3, .L137+12
	mov	r2, #0
	str	r2, [r3]
	b	.L132
.L131:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	cmp	r3, #0
	bne	.L133
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #16]
	mov	r2, #0
	str	r2, [r3, #20]
	b	.L132
.L133:
	ldr	r3, .L137+12
	ldr	r3, [r3]
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bne	.L134
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	mov	r2, #0
	str	r2, [r3, #16]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	ldr	r2, .L137+12
	str	r3, [r2]
	b	.L132
.L134:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	ldr	r2, [fp, #-8]
	ldr	r2, [r2, #16]
	str	r2, [r3, #16]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #16]
	ldr	r2, [fp, #-8]
	ldr	r2, [r2, #20]
	str	r2, [r3, #20]
.L132:
	ldr	r0, [fp, #-8]
	bl	free
	b	.L127
.L130:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3, #20]
	str	r3, [fp, #-8]
.L129:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L136
	ldr	r0, .L137+16
	bl	puts
.L127:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L138:
	.align	2
.L137:
	.word	TRACE
	.word	time
	.word	.LC51
	.word	evlist
	.word	.LC52
	.size	stoptimer, .-stoptimer
	.section	.rodata
	.align	2
.LC53:
	.ascii	"          START TIMER: starting timer at %f\012\000"
	.align	2
.LC54:
	.ascii	"Warning: attempt to start a timer that is already s"
	.ascii	"tarted\000"
	.text
	.align	2
	.global	starttimer
	.syntax unified
	.arm
	.fpu softvfp
	.type	starttimer, %function
starttimer:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]	@ float
	ldr	r3, .L145
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L140
	ldr	r3, .L145+4
	ldr	r3, [r3]	@ float
	mov	r0, r3
	bl	__aeabi_f2d
	mov	r2, r0
	mov	r3, r1
	ldr	r0, .L145+8
	bl	printf
.L140:
	ldr	r3, .L145+12
	ldr	r3, [r3]
	str	r3, [fp, #-12]
	b	.L141
.L144:
	ldr	r3, [fp, #-12]
	ldr	r3, [r3, #4]
	cmp	r3, #0
	bne	.L142
	ldr	r3, [fp, #-12]
	ldr	r3, [r3, #8]
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L142
	ldr	r0, .L145+16
	bl	puts
	b	.L139
.L142:
	ldr	r3, [fp, #-12]
	ldr	r3, [r3, #20]
	str	r3, [fp, #-12]
.L141:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L144
	mov	r0, #24
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, .L145+4
	ldr	r3, [r3]	@ float
	ldr	r1, [fp, #-20]	@ float
	mov	r0, r3
	bl	__aeabi_fadd
	mov	r3, r0
	mov	r2, r3
	ldr	r3, [fp, #-8]
	str	r2, [r3]	@ float
	ldr	r3, [fp, #-8]
	mov	r2, #0
	str	r2, [r3, #4]
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-16]
	str	r2, [r3, #8]
	ldr	r0, [fp, #-8]
	bl	insertevent
.L139:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L146:
	.align	2
.L145:
	.word	TRACE
	.word	time
	.word	.LC53
	.word	evlist
	.word	.LC54
	.size	starttimer, .-starttimer
	.section	.rodata
	.align	2
.LC55:
	.ascii	"          TOLAYER3: packet being lost\000"
	.align	2
.LC56:
	.ascii	"          TOLAYER3: seq: %d, ack %d, check: %d \000"
	.align	2
.LC57:
	.ascii	"          TOLAYER3: packet being corrupted\000"
	.align	2
.LC58:
	.ascii	"          TOLAYER3: scheduling arrival on other sid"
	.ascii	"e\000"
	.text
	.align	2
	.global	tolayer3
	.syntax unified
	.arm
	.fpu softvfp
	.type	tolayer3, %function
tolayer3:
	@ args = 36, pretend = 16, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	sub	sp, sp, #16
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #36
	str	r0, [fp, #-40]
	add	r0, fp, #8
	stm	r0, {r1, r2, r3}
	ldr	r3, .L176
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L176
	str	r3, [r2]
	bl	jimsrand
	mov	r2, r0
	ldr	r3, .L176+4
	ldr	r3, [r3]	@ float
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_fcmplt
	mov	r3, r0
	cmp	r3, #0
	beq	.L172
	ldr	r3, .L176+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L176+8
	str	r3, [r2]
	ldr	r3, .L176+12
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L175
	ldr	r0, .L176+16
	bl	puts
	b	.L175
.L172:
	mov	r0, #32
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-24]
	ldr	r2, [fp, #8]
	ldr	r3, [fp, #-24]
	str	r2, [r3]
	ldr	r2, [fp, #12]
	ldr	r3, [fp, #-24]
	str	r2, [r3, #4]
	ldr	r2, [fp, #16]
	ldr	r3, [fp, #-24]
	str	r2, [r3, #8]
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L152
.L153:
	add	r2, fp, #20
	ldr	r3, [fp, #-28]
	add	r3, r2, r3
	ldrb	r1, [r3]	@ zero_extendqisi2
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-28]
	add	r3, r2, r3
	add	r3, r3, #12
	mov	r2, r1
	strb	r2, [r3]
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L152:
	ldr	r3, [fp, #-28]
	cmp	r3, #19
	ble	.L153
	ldr	r3, .L176+12
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L154
	ldr	r3, [fp, #-24]
	ldr	r1, [r3]
	ldr	r3, [fp, #-24]
	ldr	r2, [r3, #4]
	ldr	r3, [fp, #-24]
	ldr	r3, [r3, #8]
	ldr	r0, .L176+20
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L155
.L156:
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-28]
	add	r3, r2, r3
	add	r3, r3, #12
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L155:
	ldr	r3, [fp, #-28]
	cmp	r3, #19
	ble	.L156
	mov	r0, #10
	bl	putchar
.L154:
	mov	r0, #24
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-20]
	mov	r2, #2
	str	r2, [r3, #4]
	ldr	r3, [fp, #-40]
	add	r3, r3, #1
	cmp	r3, #0
	and	r3, r3, #1
	rsblt	r3, r3, #0
	mov	r2, r3
	ldr	r3, [fp, #-20]
	str	r2, [r3, #8]
	ldr	r3, [fp, #-20]
	ldr	r2, [fp, #-24]
	str	r2, [r3, #12]
	ldr	r3, .L176+24
	ldr	r3, [r3]	@ float
	str	r3, [fp, #-32]	@ float
	ldr	r3, .L176+28
	ldr	r3, [r3]
	str	r3, [fp, #-36]
	b	.L157
.L159:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #4]
	cmp	r3, #2
	bne	.L158
	ldr	r3, [fp, #-36]
	ldr	r2, [r3, #8]
	ldr	r3, [fp, #-20]
	ldr	r3, [r3, #8]
	cmp	r2, r3
	bne	.L158
	ldr	r3, [fp, #-36]
	ldr	r3, [r3]	@ float
	str	r3, [fp, #-32]	@ float
.L158:
	ldr	r3, [fp, #-36]
	ldr	r3, [r3, #20]
	str	r3, [fp, #-36]
.L157:
	ldr	r3, [fp, #-36]
	cmp	r3, #0
	bne	.L159
	mov	r1, #1065353216
	ldr	r0, [fp, #-32]	@ float
	bl	__aeabi_fadd
	mov	r3, r0
	mov	r4, r3
	bl	jimsrand
	mov	r3, r0
	ldr	r1, .L176+32
	mov	r0, r3
	bl	__aeabi_fmul
	mov	r3, r0
	mov	r1, r3
	mov	r0, r4
	bl	__aeabi_fadd
	mov	r3, r0
	mov	r2, r3
	ldr	r3, [fp, #-20]
	str	r2, [r3]	@ float
	bl	jimsrand
	mov	r2, r0
	ldr	r3, .L176+36
	ldr	r3, [r3]	@ float
	mov	r1, r3
	mov	r0, r2
	bl	__aeabi_fcmplt
	mov	r3, r0
	cmp	r3, #0
	beq	.L160
	ldr	r3, .L176+40
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L176+40
	str	r3, [r2]
	bl	jimsrand
	str	r0, [fp, #-16]	@ float
	mov	r1, #1061158912
	ldr	r0, [fp, #-16]	@ float
	bl	__aeabi_fcmplt
	mov	r3, r0
	cmp	r3, #0
	beq	.L173
	ldr	r3, [fp, #-24]
	mov	r2, #90
	strb	r2, [r3, #12]
	b	.L164
.L173:
	ldr	r1, .L176+44
	ldr	r0, [fp, #-16]	@ float
	bl	__aeabi_fcmplt
	mov	r3, r0
	cmp	r3, #0
	beq	.L174
	ldr	r3, [fp, #-24]
	ldr	r2, .L176+48
	str	r2, [r3]
	b	.L164
.L174:
	ldr	r3, [fp, #-24]
	ldr	r2, .L176+48
	str	r2, [r3, #4]
.L164:
	ldr	r3, .L176+12
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L160
	ldr	r0, .L176+52
	bl	puts
.L160:
	ldr	r3, .L176+12
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L167
	ldr	r0, .L176+56
	bl	puts
.L167:
	ldr	r0, [fp, #-20]
	bl	insertevent
	b	.L147
.L175:
	nop
.L147:
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, lr}
	add	sp, sp, #16
	bx	lr
.L177:
	.align	2
.L176:
	.word	ntolayer3
	.word	lossprob
	.word	nlost
	.word	TRACE
	.word	.LC55
	.word	.LC56
	.word	time
	.word	evlist
	.word	1091567616
	.word	corruptprob
	.word	ncorrupt
	.word	1063256064
	.word	999999
	.word	.LC57
	.word	.LC58
	.size	tolayer3, .-tolayer3
	.section	.rodata
	.align	2
.LC59:
	.ascii	"          TOLAYER5: data received: \000"
	.text
	.align	2
	.global	tolayer5
	.syntax unified
	.arm
	.fpu softvfp
	.type	tolayer5, %function
tolayer5:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, .L183
	ldr	r3, [r3]
	cmp	r3, #2
	ble	.L182
	ldr	r0, .L183+4
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L180
.L181:
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L180:
	ldr	r3, [fp, #-8]
	cmp	r3, #19
	ble	.L181
	mov	r0, #10
	bl	putchar
.L182:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L184:
	.align	2
.L183:
	.word	TRACE
	.word	.LC59
	.size	tolayer5, .-tolayer5
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
