// File: /workspace/github_c_makefile_star2_O2/NedFreed[P]msglint/imaildate.c
// Function: n_maildate
void n_maildate(char *buf)
{
    time_t now;
    struct tm local, gmt;
    char tzbuf[ZONESIZE];
    long zminutes;
    char zsign, zdst;

    /* get time */
    now = time(NULL);
#ifdef __APPLE__
    local = *localtime(&now);
    gmt = *gmtime(&now);
#else
    localtime_r(&now, &local);
    gmtime_r(&now, &gmt);
#endif
    
    /* get GMT offset */
    zminutes = local.tm_yday - gmt.tm_yday;
    if (zminutes > 1) {
	zminutes = -24;
    } else if (zminutes < -1) {
	zminutes = 24;
    } else {
	zminutes *= 24;
    }
    zminutes = (zminutes + local.tm_hour - gmt.tm_hour) * 60
	+ local.tm_min - gmt.tm_min;

    /* create timezone */
    *tzbuf = '\0';
    zsign = '+';
    zdst = 'S';
    if (local.tm_isdst) {
	zdst = 'D';
    }
    if (zminutes < 0) {
	zsign = '-';
	zminutes = -zminutes;
	if (zminutes >= 240 && zminutes <= 660 && zminutes % 60 == 0) {
	    sprintf(tzbuf, " (%c%cT)", "AECMPYHB"
		    [(zminutes / 60) - (zdst == 'D' ? 3 : 4)], zdst);
	}
    }

    /* create Internet date */
    sprintf(buf, "%s, %d %s %d %02d:%02d:%02d %c%02ld%02ld%s",
	    dayofweek[local.tm_wday],
	    local.tm_mday,
	    month[local.tm_mon],
	    local.tm_year + 1900,
	    local.tm_hour, local.tm_min, local.tm_sec,
	    zsign, (unsigned long) (zminutes / 60),
	    (unsigned long) (zminutes % 60), tzbuf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, 0x8(%rsp)
xorl %edi, %edi
callq 0x2140
leaq 0x48(%rsp), %r15
movq %rax, (%r15)
leaq 0x10(%rsp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x2060
leaq 0x50(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x20d0
movslq 0x1c(%r14), %rax
movslq 0x1c(%r12), %rcx
subq %rcx, %rax
imulq $0x18, %rax, %rcx
cmpl $-0x1, %eax
pushq $0x18
popq %rdx
cmovgeq %rcx, %rdx
cmpl $0x2, %eax
pushq $-0x18
popq %rax
cmovlq %rdx, %rax
movslq 0x8(%r14), %r13
movslq 0x8(%r12), %rcx
movq %r13, %rdx
subq %rcx, %rdx
addq %rax, %rdx
imulq $0x3c, %rdx, %rax
movslq 0x4(%r14), %rbp
movslq 0x4(%r12), %rcx
movq %rbp, %rsi
subq %rcx, %rsi
addq %rax, %rsi
movb $0x0, 0x1(%rsp)
pushq $0x3c
popq %r12
js 0x9518
movq %rsi, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r14
pushq $0x2b
popq %rbx
jmp 0x9591
movq %rsi, %r15
negq %r15
addq $0x294, %rsi            # imm = 0x294
cmpq $0x1a5, %rsi            # imm = 0x1A5
setb %cl
movq %r15, %rax
xorl %edx, %edx
divq %r12
movq %rdx, %r14
testq %rdx, %rdx
sete %dl
andb %cl, %dl
pushq $0x2d
popq %rbx
cmpb $0x1, %dl
jne 0x958e
xorl %edx, %edx
cmpl $0x0, 0x30(%rsp)
sete %dl
pushq $0x53
popq %rsi
pushq $0x44
popq %rcx
cmovel %esi, %ecx
xorq $-0x3, %rdx
addq %rdx, %rax
leaq 0x5c76(%rip), %rdx      # 0xf1e1
movsbl (%rdx,%rax), %edx
leaq 0x5c62(%rip), %rsi      # 0xf1d8
xorl %r14d, %r14d
leaq 0x1(%rsp), %rdi
xorl %eax, %eax
callq 0x21d0
movl 0x14(%rsp), %ebp
movl 0x18(%rsp), %r13d
movq %r15, %rsi
movslq 0x28(%rsp), %rax
leaq 0x5cc7(%rip), %rcx      # 0xf264
movslq (%rcx,%rax,4), %r10
addq %rcx, %r10
movl 0x10(%rsp), %r15d
movl 0x1c(%rsp), %ecx
movslq 0x20(%rsp), %rax
leaq 0x5cc7(%rip), %rdx      # 0xf280
movslq (%rdx,%rax,4), %r8
addq %rdx, %r8
movl $0x76c, %r9d            # imm = 0x76C
addl 0x24(%rsp), %r9d
movq %rsi, %rax
xorl %edx, %edx
divq %r12
movq %rax, %r11
subq $0x8, %rsp
leaq 0x9(%rsp), %r12
leaq 0x5c04(%rip), %rsi      # 0xf1ea
movq 0x10(%rsp), %rdi
movq %r10, %rdx
xorl %eax, %eax
pushq %r12
pushq %r14
pushq %r11
pushq %rbx
pushq %r15
pushq %rbp
pushq %r13
callq 0x21d0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop