// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/schedule.c
// Function: send_outstanding_packets
void send_outstanding_packets(uint32_t curr_time)
{
	struct forw_node *forw_node;
	struct list_head *forw_pos, *if_pos, *temp;
	struct batman_if *batman_if;
	struct bat_packet *bat_packet;
	char orig_str[ADDR_STR_LEN];
	uint8_t directlink, curr_packet_num;
	int16_t curr_packet_len;

	prof_start(PROF_send_outstanding_packets);


	list_for_each_safe(forw_pos, temp, &forw_list) {

		forw_node = list_entry(forw_pos, struct forw_node, list);

		if ((int)(curr_time - forw_node->send_time) < 0)
			break;

		bat_packet = (struct bat_packet *)forw_node->pack_buff;

		addr_to_string(bat_packet->orig, orig_str, ADDR_STR_LEN);

		directlink = (bat_packet->flags & DIRECTLINK ? 1 : 0);

		if (forw_node->if_incoming == NULL) {
			debug_output(0, "Error - can't forward packet: incoming iface not specified \n");
			goto packet_free;
		}

		/* multihomed peer assumed */
		/* non-primary interfaces are only broadcasted on their interface */
		if (((directlink) && (bat_packet->ttl == 1)) ||
			((forw_node->own) && (forw_node->if_incoming->if_num > 0))) {

			debug_output(4, "%s packet (originator %s, seqno %d, TTL %d) on interface %s\n", (forw_node->own ? "Sending own" : "Forwarding"), orig_str, ntohs(bat_packet->seqno), bat_packet->ttl, forw_node->if_incoming->dev);

			if (send_udp_packet(forw_node->pack_buff, forw_node->pack_buff_len, &forw_node->if_incoming->broad, forw_node->if_incoming->udp_send_sock, forw_node->if_incoming) < 0)
					deactivate_interface(forw_node->if_incoming);

			goto packet_free;

		}

		list_for_each(if_pos, &if_list) {

			batman_if = list_entry(if_pos, struct batman_if, list);

			curr_packet_num = curr_packet_len = 0;
			bat_packet = (struct bat_packet *)forw_node->pack_buff;

			while ((curr_packet_len + sizeof(struct bat_packet) <= forw_node->pack_buff_len) &&
				(curr_packet_len + sizeof(struct bat_packet) + bat_packet->hna_len * 5 <= forw_node->pack_buff_len) &&
				(curr_packet_len + sizeof(struct bat_packet) + bat_packet->hna_len * 5 <= MAX_AGGREGATION_BYTES)) {

				if ((forw_node->direct_link_flags & (1 << curr_packet_num)) && (forw_node->if_incoming == batman_if))
					bat_packet->flags |= DIRECTLINK;
				else
					bat_packet->flags &= ~DIRECTLINK;

				if (curr_packet_num > 0)
					addr_to_string(bat_packet->orig, orig_str, ADDR_STR_LEN);

				debug_output(4, "%s %spacket (originator %s, seqno %d, TQ %d, TTL %d, IDF %s) on interface %s\n", (curr_packet_num > 0 ? "Forwarding" : (forw_node->own ? "Sending own" : "Forwarding")), (curr_packet_num > 0 ? "aggregated " : ""), orig_str, ntohs(bat_packet->seqno), bat_packet->tq, bat_packet->ttl, (bat_packet->flags & DIRECTLINK ? "on" : "off"), batman_if->dev);

				curr_packet_len += sizeof(struct bat_packet) + bat_packet->hna_len * 5;
				curr_packet_num++;
				bat_packet = (struct bat_packet *)(forw_node->pack_buff + curr_packet_len);

			}

			if (send_udp_packet(forw_node->pack_buff, forw_node->pack_buff_len, &batman_if->broad, batman_if->udp_send_sock, batman_if) < 0)
				deactivate_interface(batman_if);

		}

packet_free:	list_del((struct list_head *)&forw_list, forw_pos, &forw_list);

		if (forw_node->own && forw_node->if_incoming)
			schedule_own_packet(forw_node->if_incoming);

		debugFree(forw_node->pack_buff, 1501);
		debugFree(forw_node, 1502);

	}

	prof_stop(PROF_send_outstanding_packets);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xa8, %rsp
movl %edi, -0xc(%rbp)
movl $0x8, %edi
callq 0x8760
leaq 0x14aa8(%rip), %rax     # 0x1b3d8
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
leaq 0x14a8f(%rip), %rax     # 0x1b3d8
cmpq %rax, -0x20(%rbp)
je 0x6dca
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movl -0xc(%rbp), %eax
movq -0x18(%rbp), %rcx
subl 0x8(%rcx), %eax
cmpl $0x0, %eax
jge 0x696f
jmp 0x6dca
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl 0x8(%rax), %edi
leaq -0x50(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movq -0x40(%rbp), %rax
movzbl 0x1(%rax), %edx
andl $0x40, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, -0x51(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x69cb
xorl %edi, %edi
leaq 0xebb6(%rip), %rsi      # 0x15575
movb $0x0, %al
callq 0x123f0
jmp 0x6d5a
movzbl -0x51(%rbp), %eax
cmpl $0x0, %eax
je 0x69e1
movq -0x40(%rbp), %rax
movzbl 0x2(%rax), %eax
cmpl $0x1, %eax
je 0x6a07
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x6ac3
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movzbl 0x1c(%rax), %eax
cmpl $0x0, %eax
jle 0x6ac3
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %edx
leaq 0xebe5(%rip), %rax      # 0x155fb
leaq 0xebd2(%rip), %rcx      # 0x155ef
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x2390
movq -0x68(%rbp), %rdx
movq -0x60(%rbp), %rcx
movzwl %ax, %r8d
movq -0x40(%rbp), %rax
movzbl 0x2(%rax), %r9d
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movl $0x4, %edi
leaq 0xeb48(%rip), %rsi      # 0x155b2
movq %rax, (%rsp)
movb $0x0, %al
callq 0x123f0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x18(%rax), %esi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdx
addq $0x40, %rdx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movl 0x10(%rax), %ecx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %r8
callq 0xfe70
movsbl %al, %eax
cmpl $0x0, %eax
jge 0x6abe
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xe930
jmp 0x6d5a
leaq 0x148e6(%rip), %rax     # 0x1b3b0
movq (%rax), %rax
movq %rax, -0x28(%rbp)
leaq 0x148d8(%rip), %rax     # 0x1b3b0
cmpq %rax, -0x28(%rbp)
je 0x6d58
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movw $0x0, -0x54(%rbp)
movb $0x0, -0x52(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movswq -0x54(%rbp), %rcx
addq $0x12, %rcx
movq -0x18(%rbp), %rax
movzwl 0x18(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x69(%rbp)
ja 0x6b70
movswq -0x54(%rbp), %rcx
addq $0x12, %rcx
movq -0x40(%rbp), %rax
movzbl 0x11(%rax), %eax
imull $0x5, %eax, %eax
cltq
addq %rax, %rcx
movq -0x18(%rbp), %rax
movzwl 0x18(%rax), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x69(%rbp)
ja 0x6b70
movswq -0x54(%rbp), %rax
addq $0x12, %rax
movq -0x40(%rbp), %rcx
movzbl 0x11(%rcx), %ecx
imull $0x5, %ecx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
cmpq $0x200, %rax            # imm = 0x200
setbe %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x6b7c
jmp 0x6d0d
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
movzbl -0x52(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x6bb5
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0x6bb5
movq -0x40(%rbp), %rax
movzbl 0x1(%rax), %ecx
orl $0x40, %ecx
movb %cl, 0x1(%rax)
jmp 0x6bc3
movq -0x40(%rbp), %rax
movzbl 0x1(%rax), %ecx
andl $-0x41, %ecx
movb %cl, 0x1(%rax)
movzbl -0x52(%rbp), %eax
cmpl $0x0, %eax
jle 0x6be1
movq -0x40(%rbp), %rax
movl 0x8(%rax), %edi
leaq -0x50(%rbp), %rsi
movl $0x10, %edx
callq 0xfa90
movzbl -0x52(%rbp), %eax
cmpl $0x0, %eax
jle 0x6bf7
leaq 0xea0a(%rip), %rax      # 0x155fb
movq %rax, -0x78(%rbp)
jmp 0x6c18
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %edx
leaq 0xe9f5(%rip), %rax      # 0x155fb
leaq 0xe9e2(%rip), %rcx      # 0x155ef
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x90(%rbp)
movzbl -0x52(%rbp), %edx
leaq 0xffd2(%rip), %rax      # 0x16c00
leaq 0xea1f(%rip), %rcx      # 0x15654
cmpl $0x0, %edx
cmovgq %rcx, %rax
movq %rax, -0x88(%rbp)
leaq -0x50(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x2390
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq -0x80(%rbp), %r8
movzwl %ax, %r9d
movq -0x40(%rbp), %rax
movzbl 0x10(%rax), %ebx
movq -0x40(%rbp), %rax
movzbl 0x2(%rax), %r11d
movq -0x40(%rbp), %rax
movzbl 0x1(%rax), %esi
andl $0x40, %esi
leaq 0xe9cf(%rip), %r10      # 0x15660
leaq 0x114ed(%rip), %rax     # 0x18185
cmpl $0x0, %esi
cmovneq %rax, %r10
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl $0x4, %edi
leaq 0xe953(%rip), %rsi      # 0x15606
movl %ebx, (%rsp)
movl %r11d, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movb $0x0, %al
callq 0x123f0
movq -0x40(%rbp), %rax
movzbl 0x11(%rax), %eax
imull $0x5, %eax, %eax
movslq %eax, %rcx
addq $0x12, %rcx
movswq -0x54(%rbp), %rax
addq %rcx, %rax
movw %ax, -0x54(%rbp)
movb -0x52(%rbp), %al
addb $0x1, %al
movb %al, -0x52(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movswl -0x54(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x6b00
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movzwl 0x18(%rax), %esi
movq -0x38(%rbp), %rdx
addq $0x40, %rdx
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x38(%rbp), %r8
callq 0xfe70
movsbl %al, %eax
cmpl $0x0, %eax
jge 0x6d46
movq -0x38(%rbp), %rdi
callq 0xe930
jmp 0x6d48
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x6ad1
jmp 0x6d5a
movq -0x20(%rbp), %rsi
leaq 0x14673(%rip), %rdx     # 0x1b3d8
movq %rdx, %rdi
callq 0x6ed0
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x6d92
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x6d92
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x60c0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movl $0x5dd, %esi            # imm = 0x5DD
callq 0x7720
movq -0x18(%rbp), %rdi
movl $0x5de, %esi            # imm = 0x5DE
callq 0x7720
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x6942
movl $0x8, %edi
callq 0x8790
addq $0xa8, %rsp
popq %rbx
popq %rbp
retq
nop