// File: /workspace/github_c_makefile_star2_O3/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), %r12
movq %rax, (%r12)
leaq 0x10(%rsp), %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x2060
leaq 0x50(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x20d0
movslq 0x1c(%r14), %rax
movslq 0x1c(%r15), %rcx
subq %rcx, %rax
movq %rax, %rcx
shlq $0x3, %rcx
cmpl $-0x1, %eax
leaq (%rcx,%rcx,2), %rcx
movl $0x18, %edx
cmovgeq %rcx, %rdx
cmpl $0x2, %eax
movq $-0x18, %rax
cmovlq %rdx, %rax
movslq 0x8(%r14), %r12
movslq 0x8(%r15), %rcx
movq %r12, %rdx
subq %rcx, %rdx
addq %rax, %rdx
imulq $0x3c, %rdx, %rax
movslq 0x4(%r14), %r13
movslq 0x4(%r15), %rcx
movq %r13, %rsi
subq %rcx, %rsi
addq %rax, %rsi
movb $0x0, 0x1(%rsp)
movabsq $-0x7777777777777777, %r15 # imm = 0x8888888888888889
js 0x9f77
movq %rsi, %rax
mulq %r15
shrq $0x5, %rdx
imulq $0x3c, %rdx, %rax
movq %rsi, %r14
subq %rax, %r14
movl $0x2b, %ebp
jmp 0x9ffc
movq %rsi, %rbx
negq %rbx
addq $0x294, %rsi            # imm = 0x294
cmpq $0x1a5, %rsi            # imm = 0x1A5
setb %cl
movq %rbx, %rax
mulq %r15
shrq $0x5, %rdx
imulq $0x3c, %rdx, %rax
movq %rbx, %r14
subq %rax, %r14
sete %al
andb %cl, %al
movl $0x2d, %ebp
cmpb $0x1, %al
jne 0x9ff9
xorl %eax, %eax
cmpl $0x0, 0x30(%rsp)
sete %al
movl $0x53, %esi
movl $0x44, %ecx
cmovel %esi, %ecx
xorq $-0x3, %rax
addq %rax, %rdx
leaq 0x51ec(%rip), %rax      # 0xf1c1
movsbl (%rax,%rdx), %edx
leaq 0x51d8(%rip), %rsi      # 0xf1b8
xorl %r14d, %r14d
leaq 0x1(%rsp), %rdi
xorl %eax, %eax
callq 0x21d0
movl 0x14(%rsp), %r13d
movl 0x18(%rsp), %r12d
movq %rbx, %rsi
movslq 0x28(%rsp), %rax
leaq 0x523c(%rip), %rcx      # 0xf244
movslq (%rcx,%rax,4), %r10
addq %rcx, %r10
movl 0x10(%rsp), %ebx
movl 0x1c(%rsp), %ecx
movslq 0x20(%rsp), %rax
leaq 0x523d(%rip), %rdx      # 0xf260
movslq (%rdx,%rax,4), %r8
addq %rdx, %r8
movl $0x76c, %r9d            # imm = 0x76C
addl 0x24(%rsp), %r9d
movq %rsi, %rax
mulq %r15
movq %rdx, %r11
shrq $0x5, %r11
subq $0x8, %rsp
leaq 0x9(%rsp), %r15
leaq 0x5178(%rip), %rsi      # 0xf1ca
movq 0x10(%rsp), %rdi
movq %r10, %rdx
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %r11
pushq %rbp
pushq %rbx
pushq %r13
pushq %r12
callq 0x21d0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop