// File: /workspace/github_c_makefile_star2_O0/arachsys[P]init/syslog.c
// Function: syslog_recv
static void syslog_recv(int fd) {
  char *cursor;
  int length, priority;
  struct iovec block;
  struct msghdr header;
  struct tm date;
  struct ucred id;
  union {
    struct cmsghdr hdr;
    char data[CMSG_SPACE(sizeof(struct ucred))];
  } cmsg;

  block.iov_base = buffer;
  block.iov_len = sizeof(buffer) - 1;
  header.msg_name = NULL;
  header.msg_namelen = 0;
  header.msg_iov = &block;
  header.msg_iovlen = 1;
  header.msg_control = &cmsg;
  header.msg_controllen = sizeof(cmsg);
  header.msg_flags = 0;

  if ((length = recvmsg(fd, &header, 0)) <= 0)
    return;

  id.pid = id.uid = id.gid = 0;
  if (cmsg.hdr.cmsg_level == SOL_SOCKET)
    if (cmsg.hdr.cmsg_type == SCM_CREDENTIALS)
      memcpy(&id, CMSG_DATA(&cmsg.hdr), sizeof(struct ucred));

  for (cursor = buffer; cursor < buffer + length; cursor++)
    if (*cursor == 0 || *cursor == '\n')
      *cursor = 0;
    else if ((*cursor < 32 && *cursor != '\t') || *cursor == 127)
      *cursor = ' ';
  buffer[length] = 0;

  cursor = buffer;
  priority = LOG_DAEMON | LOG_NOTICE;

  while (cursor < buffer + length) {
    cursor += syslog_priority(cursor, &priority);
    cursor += syslog_date(cursor, &date);

    if (*cursor) {
      printf("%u %u %u", id.pid, id.uid, id.gid);
      if (numeric)
        printf(" %u", priority & LOG_FACMASK);
      else
        printf(" %s", syslog_facility(priority));
      printf(" %u %04u-%02u-%02u %02u:%02u:%02u", priority & LOG_PRIMASK,
        date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, date.tm_hour,
        date.tm_min, date.tm_sec);
      if (zone && zone[0])
        printf("%c%02u%02u", date.tm_gmtoff < 0 ? '-' : '+',
          abs((int) date.tm_gmtoff) / 3600,
          abs((int) date.tm_gmtoff) / 60 % 60);
      printf(" %s\n", cursor);
    }
    cursor += strlen(cursor) + 1;
  }
  fflush(stdout);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl %edi, -0x4(%rbp)
leaq 0x2b2b(%rip), %rax      # 0x5360
movq %rax, -0x28(%rbp)
movq $0x10000, -0x20(%rbp)   # imm = 0x10000
movq $0x0, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
leaq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x1, -0x48(%rbp)
leaq -0xc8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x20, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x4(%rbp), %edi
leaq -0x60(%rbp), %rsi
xorl %edx, %edx
callq 0x2140
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jg 0x2895
jmp 0x2b41
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
cmpl $0x1, -0xc0(%rbp)
jne 0x28e1
cmpl $0x2, -0xbc(%rbp)
jne 0x28df
movq -0xb8(%rbp), %rax
movq %rax, -0xa4(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0x28e1
leaq 0x2a78(%rip), %rax      # 0x5360
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x2a65(%rip), %rcx      # 0x5360
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x2961
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x291b
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x2924
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
jmp 0x2951
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jge 0x293c
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0x2948
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7f, %eax
jne 0x294f
movq -0x10(%rbp), %rax
movb $0x20, (%rax)
jmp 0x2951
jmp 0x2953
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x28ec
movslq -0x14(%rbp), %rcx
leaq 0x29f4(%rip), %rax      # 0x5360
movb $0x0, (%rax,%rcx)
leaq 0x29e9(%rip), %rax      # 0x5360
movq %rax, -0x10(%rbp)
movl $0x1d, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rdx
leaq 0x29cf(%rip), %rcx      # 0x5360
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x2b32
movq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x2be0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x2c20
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2b18
movl -0xa4(%rbp), %esi
movl -0xa0(%rbp), %edx
movl -0x9c(%rbp), %ecx
leaq 0x7e4(%rip), %rdi       # 0x31e4
movb $0x0, %al
callq 0x2090
cmpl $0x0, 0x2946(%rip)      # 0x5354
je 0x2a29
movl -0x18(%rbp), %esi
andl $0x3f8, %esi            # imm = 0x3F8
leaq 0x77d(%rip), %rdi       # 0x319d
movb $0x0, %al
callq 0x2090
jmp 0x2a42
movl -0x18(%rbp), %edi
callq 0x2b50
movq %rax, %rsi
leaq 0x76b(%rip), %rdi       # 0x31a6
movb $0x0, %al
callq 0x2090
movl -0x18(%rbp), %esi
andl $0x7, %esi
movl -0x84(%rbp), %edx
addl $0x76c, %edx            # imm = 0x76C
movl -0x88(%rbp), %ecx
addl $0x1, %ecx
movl -0x8c(%rbp), %r8d
movl -0x90(%rbp), %r9d
movl -0x94(%rbp), %r10d
movl -0x98(%rbp), %eax
leaq 0x72b(%rip), %rdi       # 0x31aa
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x2090
cmpq $0x0, 0x28c2(%rip)      # 0x5358
je 0x2b06
movq 0x28b9(%rip), %rax      # 0x5358
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2b06
movq -0x70(%rbp), %rcx
movl $0x2b, %esi
movl $0x2d, %eax
cmpq $0x0, %rcx
cmovll %eax, %esi
movq -0x70(%rbp), %rax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl $0xe10, %ecx            # imm = 0xE10
cltd
idivl %ecx
movl %eax, -0xcc(%rbp)
movq -0x70(%rbp), %rax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl $0x3c, %ecx
cltd
idivl %ecx
movl $0x3c, %ecx
cltd
idivl %ecx
movl %edx, %ecx
movl -0xcc(%rbp), %edx
leaq 0x6cd(%rip), %rdi       # 0x31cc
movb $0x0, %al
callq 0x2090
movq -0x10(%rbp), %rsi
leaq 0x6c6(%rip), %rdi       # 0x31d7
movb $0x0, %al
callq 0x2090
movq -0x10(%rbp), %rdi
callq 0x2070
addq $0x1, %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x2982
movq 0x2487(%rip), %rax      # 0x4fc0
movq (%rax), %rdi
callq 0x2110
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)