// File: /workspace/github_c_makefile_star2_O0/arachsys[P]init/uevent.c
// Function: broadcast
static int broadcast(void) {
  char *action = NULL, *devpath = NULL, *event = NULL, *line = NULL;
  size_t length = 0, linesize = 0, size = 0;
  int sock, socksize = 1 << 21;
  ssize_t count;

  if ((sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT)) < 0)
    err(EXIT_FAILURE, "socket");

  setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &socksize, sizeof(int));
  setsockopt(sock, SOL_SOCKET, SO_SNDBUFFORCE, &socksize, sizeof(int));

  if (connect(sock, (struct sockaddr *) &netlink, sizeof(netlink)) < 0)
    err(EXIT_FAILURE, "connect");

  while ((count = getline(&line, &linesize, stdin)) > 0 || length) {
    if (line && count > 0 && line[count - 1] == '\n')
      count--;

    if (line && count > 0) {
      /* Append property line and null-terminate it. */
      while (size < length + count + 1)
        if (event = realloc(event, size += 4096), event == NULL)
          err(EXIT_FAILURE, "realloc");
      memcpy(event + length, line, count);
      event[length + count] = 0;

      /* Support both KEY VALUE and KEY=VALUE input lines. */
      for (size_t i = length; i < length + count; i++)
        if (event[i] == ' ' || event[i] == '=') {
          event[i] = '=';
          break;
        }

      /* Keep track of ACTION and DEVPATH for constructing header. */
      if (strncmp(event + length, "ACTION=", strlen("ACTION=")) == 0)
        action = event + length + strlen("ACTION=");
      if (strncmp(event + length, "DEVPATH=", strlen("DEVPATH=")) == 0)
        devpath = event + length + strlen("DEVPATH=");

      length += count + 1;
      continue;
    }

    if (action && devpath) {
      /* Make space for the ACTION@DEVPATH header then prepend it. */
      count = 2 + strlen(action) + strlen(devpath);

      while (size < length + count)
        if (event = realloc(event, size += 4096), event == NULL)
          err(EXIT_FAILURE, "realloc");

      memmove(event + count, event, length);
      snprintf(event, count, "%s@%s", action + count, devpath + count);

      /* Attempt to broadcast uevent but tolerate failures. */
      while (send(sock, event, length + count, 0) < 0)
        if (errno != EAGAIN && errno != EINTR)
          break;
    }
    action = devpath = NULL, length = 0;
  }

  free(line);
  close(sock);
  return ferror(stdin) ? EXIT_FAILURE : EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq $0x0, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x200000, -0x40(%rbp)  # imm = 0x200000
movl $0x10, %edi
movl $0x2, %esi
movl $0xf, %edx
callq 0x11e0
movl %eax, -0x3c(%rbp)
cmpl $0x0, %eax
jge 0x1756
movl $0x1, %edi
leaq 0x95d(%rip), %rsi       # 0x20ac
movb $0x0, %al
callq 0x1150
movl -0x3c(%rbp), %edi
movl $0x1, %esi
movl $0x7, %edx
leaq -0x40(%rbp), %rcx
movl $0x4, %r8d
callq 0x10a0
movl -0x3c(%rbp), %edi
movl $0x1, %esi
movl $0x20, %edx
leaq -0x40(%rbp), %rcx
movl $0x4, %r8d
callq 0x10a0
movl -0x3c(%rbp), %edi
leaq 0x2970(%rip), %rsi      # 0x4108
movl $0xc, %edx
callq 0x11d0
cmpl $0x0, %eax
jge 0x17ba
movl $0x1, %edi
leaq 0x933(%rip), %rsi       # 0x20e6
movb $0x0, %al
callq 0x1150
jmp 0x17bc
movq 0x2815(%rip), %rax      # 0x3fd8
movq (%rax), %rdx
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x11b0
movq %rax, %rcx
movq %rcx, -0x48(%rbp)
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x51(%rbp)
jg 0x17f0
cmpq $0x0, -0x28(%rbp)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x17fc
jmp 0x1a94
cmpq $0x0, -0x20(%rbp)
je 0x182b
cmpq $0x0, -0x48(%rbp)
jle 0x182b
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
jne 0x182b
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x197f
cmpq $0x0, -0x48(%rbp)
jle 0x197f
jmp 0x1843
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x48(%rbp), %rcx
addq $0x1, %rcx
cmpq %rcx, %rax
jae 0x1890
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1000, %rsi           # imm = 0x1000
movq %rsi, -0x38(%rbp)
callq 0x1170
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x188e
movl $0x1, %edi
leaq 0x867(%rip), %rsi       # 0x20ee
movb $0x0, %al
callq 0x1150
jmp 0x1843
movq -0x18(%rbp), %rdi
addq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
callq 0x1140
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x48(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x48(%rbp), %rcx
cmpq %rcx, %rax
jae 0x190e
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x18f0
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x18fe
movq -0x18(%rbp), %rax
movq -0x50(%rbp), %rcx
movb $0x3d, (%rax,%rcx)
jmp 0x190e
jmp 0x1900
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x18bd
movq -0x18(%rbp), %rdi
addq -0x28(%rbp), %rdi
leaq 0x7d9(%rip), %rsi       # 0x20f6
movl $0x7, %edx
callq 0x1070
cmpl $0x0, %eax
jne 0x193c
movq -0x18(%rbp), %rax
addq -0x28(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rdi
addq -0x28(%rbp), %rdi
leaq 0x7b3(%rip), %rsi       # 0x20fe
movl $0x8, %edx
callq 0x1070
cmpl $0x0, %eax
jne 0x196a
movq -0x18(%rbp), %rax
addq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x17bc
cmpq $0x0, -0x8(%rbp)
je 0x1a77
cmpq $0x0, -0x10(%rbp)
je 0x1a77
movq -0x8(%rbp), %rdi
callq 0x10b0
addq $0x2, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10b0
movq %rax, %rcx
movq -0x60(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
addq -0x48(%rbp), %rcx
cmpq %rcx, %rax
jae 0x1a06
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x1000, %rsi           # imm = 0x1000
movq %rsi, -0x38(%rbp)
callq 0x1170
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1a04
movl $0x1, %edi
leaq 0x6f1(%rip), %rsi       # 0x20ee
movb $0x0, %al
callq 0x1150
jmp 0x19bd
movq -0x18(%rbp), %rdi
addq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x1190
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x8(%rbp), %rcx
addq -0x48(%rbp), %rcx
movq -0x10(%rbp), %r8
addq -0x48(%rbp), %r8
leaq 0x6cd(%rip), %rdx       # 0x2107
movb $0x0, %al
callq 0x1100
movl -0x3c(%rbp), %edi
movq -0x18(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq -0x48(%rbp), %rdx
xorl %ecx, %ecx
callq 0x10d0
cmpq $0x0, %rax
jge 0x1a75
callq 0x1060
cmpl $0xb, (%rax)
je 0x1a73
callq 0x1060
cmpl $0x4, (%rax)
je 0x1a73
jmp 0x1a75
jmp 0x1a41
jmp 0x1a77
movq $0x0, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movq $0x0, -0x28(%rbp)
jmp 0x17bc
movq -0x20(%rbp), %rdi
callq 0x1030
movl -0x3c(%rbp), %edi
callq 0x1110
movq 0x252c(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
callq 0x1090
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
addq $0x60, %rsp
popq %rbp
retq